This commit is contained in:
Hillel Coren 2019-12-15 21:23:09 +02:00
parent 51e2995850
commit db390d8495
18 changed files with 217 additions and 0 deletions

View File

@ -234,6 +234,18 @@ class FilterCompanyGatewaysByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterCompanyGatewaysByCustom3 implements PersistUI {
FilterCompanyGatewaysByCustom3(this.value);
final String value;
}
class FilterCompanyGatewaysByCustom4 implements PersistUI {
FilterCompanyGatewaysByCustom4(this.value);
final String value;
}
class FilterCompanyGatewaysByEntity implements PersistUI { class FilterCompanyGatewaysByEntity implements PersistUI {
FilterCompanyGatewaysByEntity({this.entityId, this.entityType}); FilterCompanyGatewaysByEntity({this.entityId, this.entityType});

View File

@ -224,6 +224,18 @@ class FilterDocumentsByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterDocumentsByCustom3 implements PersistUI {
FilterDocumentsByCustom3(this.value);
final String value;
}
class FilterDocumentsByCustom4 implements PersistUI {
FilterDocumentsByCustom4(this.value);
final String value;
}
class FilterDocumentsByEntity implements PersistUI { class FilterDocumentsByEntity implements PersistUI {
FilterDocumentsByEntity({this.entityId, this.entityType}); FilterDocumentsByEntity({this.entityId, this.entityType});

View File

@ -238,6 +238,18 @@ class FilterExpensesByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterExpensesByCustom3 implements PersistUI {
FilterExpensesByCustom3(this.value);
final String value;
}
class FilterExpensesByCustom4 implements PersistUI {
FilterExpensesByCustom4(this.value);
final String value;
}
class FilterExpensesByEntity implements PersistUI { class FilterExpensesByEntity implements PersistUI {
FilterExpensesByEntity({this.entityId, this.entityType}); FilterExpensesByEntity({this.entityId, this.entityType});

View File

@ -50,6 +50,8 @@ final expenseListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterExpenses>(_filterExpenses), TypedReducer<ListUIState, FilterExpenses>(_filterExpenses),
TypedReducer<ListUIState, FilterExpensesByCustom1>(_filterExpensesByCustom1), TypedReducer<ListUIState, FilterExpensesByCustom1>(_filterExpensesByCustom1),
TypedReducer<ListUIState, FilterExpensesByCustom2>(_filterExpensesByCustom2), TypedReducer<ListUIState, FilterExpensesByCustom2>(_filterExpensesByCustom2),
TypedReducer<ListUIState, FilterExpensesByCustom3>(_filterExpensesByCustom3),
TypedReducer<ListUIState, FilterExpensesByCustom4>(_filterExpensesByCustom4),
TypedReducer<ListUIState, FilterExpensesByEntity>(_filterExpensesByClient), TypedReducer<ListUIState, FilterExpensesByEntity>(_filterExpensesByClient),
TypedReducer<ListUIState, StartExpenseMultiselect>(_startListMultiselect), TypedReducer<ListUIState, StartExpenseMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToExpenseMultiselect>(_addToListMultiselect), TypedReducer<ListUIState, AddToExpenseMultiselect>(_addToListMultiselect),
@ -85,6 +87,26 @@ ListUIState _filterExpensesByCustom2(
} }
} }
ListUIState _filterExpensesByCustom3(
ListUIState expenseListState, FilterExpensesByCustom3 action) {
if (expenseListState.custom3Filters.contains(action.value)) {
return expenseListState
.rebuild((b) => b..custom3Filters.remove(action.value));
} else {
return expenseListState.rebuild((b) => b..custom3Filters.add(action.value));
}
}
ListUIState _filterExpensesByCustom4(
ListUIState expenseListState, FilterExpensesByCustom4 action) {
if (expenseListState.custom4Filters.contains(action.value)) {
return expenseListState
.rebuild((b) => b..custom4Filters.remove(action.value));
} else {
return expenseListState.rebuild((b) => b..custom4Filters.add(action.value));
}
}
ListUIState _filterExpensesByState( ListUIState _filterExpensesByState(
ListUIState expenseListState, FilterExpensesByState action) { ListUIState expenseListState, FilterExpensesByState action) {
if (expenseListState.stateFilters.contains(action.state)) { if (expenseListState.stateFilters.contains(action.state)) {

View File

@ -358,6 +358,18 @@ class FilterInvoicesByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterInvoicesByCustom3 implements PersistUI {
FilterInvoicesByCustom3(this.value);
final String value;
}
class FilterInvoicesByCustom4 implements PersistUI {
FilterInvoicesByCustom4(this.value);
final String value;
}
void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices, void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
EntityAction action) async { EntityAction action) async {
assert( assert(

View File

@ -132,6 +132,8 @@ final invoiceListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterInvoices>(_filterInvoices), TypedReducer<ListUIState, FilterInvoices>(_filterInvoices),
TypedReducer<ListUIState, FilterInvoicesByCustom1>(_filterInvoicesByCustom1), TypedReducer<ListUIState, FilterInvoicesByCustom1>(_filterInvoicesByCustom1),
TypedReducer<ListUIState, FilterInvoicesByCustom2>(_filterInvoicesByCustom2), TypedReducer<ListUIState, FilterInvoicesByCustom2>(_filterInvoicesByCustom2),
TypedReducer<ListUIState, FilterInvoicesByCustom3>(_filterInvoicesByCustom3),
TypedReducer<ListUIState, FilterInvoicesByCustom4>(_filterInvoicesByCustom4),
TypedReducer<ListUIState, StartInvoiceMultiselect>(_startListMultiselect), TypedReducer<ListUIState, StartInvoiceMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToInvoiceMultiselect>(_addToListMultiselect), TypedReducer<ListUIState, AddToInvoiceMultiselect>(_addToListMultiselect),
TypedReducer<ListUIState, RemoveFromInvoiceMultiselect>( TypedReducer<ListUIState, RemoveFromInvoiceMultiselect>(
@ -159,6 +161,27 @@ ListUIState _filterInvoicesByCustom2(
} }
} }
ListUIState _filterInvoicesByCustom3(
ListUIState invoiceListState, FilterInvoicesByCustom3 action) {
if (invoiceListState.custom3Filters.contains(action.value)) {
return invoiceListState
.rebuild((b) => b..custom3Filters.remove(action.value));
} else {
return invoiceListState.rebuild((b) => b..custom3Filters.add(action.value));
}
}
ListUIState _filterInvoicesByCustom4(
ListUIState invoiceListState, FilterInvoicesByCustom4 action) {
if (invoiceListState.custom4Filters.contains(action.value)) {
return invoiceListState
.rebuild((b) => b..custom4Filters.remove(action.value));
} else {
return invoiceListState.rebuild((b) => b..custom4Filters.add(action.value));
}
}
ListUIState _filterInvoicesByState( ListUIState _filterInvoicesByState(
ListUIState invoiceListState, FilterInvoicesByState action) { ListUIState invoiceListState, FilterInvoicesByState action) {
if (invoiceListState.stateFilters.contains(action.state)) { if (invoiceListState.stateFilters.contains(action.state)) {

View File

@ -245,6 +245,18 @@ class FilterPaymentsByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterPaymentsByCustom3 implements PersistUI {
FilterPaymentsByCustom3(this.value);
final String value;
}
class FilterPaymentsByCustom4 implements PersistUI {
FilterPaymentsByCustom4(this.value);
final String value;
}
class FilterPaymentsByEntity implements PersistUI { class FilterPaymentsByEntity implements PersistUI {
FilterPaymentsByEntity({this.entityId, this.entityType}); FilterPaymentsByEntity({this.entityId, this.entityType});

View File

@ -49,6 +49,8 @@ final paymentListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterPayments>(_filterPayments), TypedReducer<ListUIState, FilterPayments>(_filterPayments),
TypedReducer<ListUIState, FilterPaymentsByCustom1>(_filterPaymentsByCustom1), TypedReducer<ListUIState, FilterPaymentsByCustom1>(_filterPaymentsByCustom1),
TypedReducer<ListUIState, FilterPaymentsByCustom2>(_filterPaymentsByCustom2), TypedReducer<ListUIState, FilterPaymentsByCustom2>(_filterPaymentsByCustom2),
TypedReducer<ListUIState, FilterPaymentsByCustom3>(_filterPaymentsByCustom3),
TypedReducer<ListUIState, FilterPaymentsByCustom4>(_filterPaymentsByCustom4),
TypedReducer<ListUIState, FilterPaymentsByEntity>(_filterPaymentsByEntity), TypedReducer<ListUIState, FilterPaymentsByEntity>(_filterPaymentsByEntity),
TypedReducer<ListUIState, StartPaymentMultiselect>(_startListMultiselect), TypedReducer<ListUIState, StartPaymentMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToPaymentMultiselect>(_addToListMultiselect), TypedReducer<ListUIState, AddToPaymentMultiselect>(_addToListMultiselect),
@ -84,6 +86,26 @@ ListUIState _filterPaymentsByCustom2(
} }
} }
ListUIState _filterPaymentsByCustom3(
ListUIState paymentListState, FilterPaymentsByCustom3 action) {
if (paymentListState.custom3Filters.contains(action.value)) {
return paymentListState
.rebuild((b) => b..custom3Filters.remove(action.value));
} else {
return paymentListState.rebuild((b) => b..custom3Filters.add(action.value));
}
}
ListUIState _filterPaymentsByCustom4(
ListUIState paymentListState, FilterPaymentsByCustom4 action) {
if (paymentListState.custom4Filters.contains(action.value)) {
return paymentListState
.rebuild((b) => b..custom4Filters.remove(action.value));
} else {
return paymentListState.rebuild((b) => b..custom4Filters.add(action.value));
}
}
ListUIState _filterPaymentsByState( ListUIState _filterPaymentsByState(
ListUIState paymentListState, FilterPaymentsByState action) { ListUIState paymentListState, FilterPaymentsByState action) {
if (paymentListState.stateFilters.contains(action.state)) { if (paymentListState.stateFilters.contains(action.state)) {

View File

@ -269,6 +269,18 @@ class FilterTasksByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterTasksByCustom3 implements PersistUI {
FilterTasksByCustom3(this.value);
final String value;
}
class FilterTasksByCustom4 implements PersistUI {
FilterTasksByCustom4(this.value);
final String value;
}
class FilterTasksByEntity implements PersistUI { class FilterTasksByEntity implements PersistUI {
FilterTasksByEntity({this.entityId, this.entityType}); FilterTasksByEntity({this.entityId, this.entityType});

View File

@ -260,6 +260,18 @@ class FilterVendorsByCustom2 implements PersistUI {
final String value; final String value;
} }
class FilterVendorsByCustom3 implements PersistUI {
FilterVendorsByCustom3(this.value);
final String value;
}
class FilterVendorsByCustom4 implements PersistUI {
FilterVendorsByCustom4(this.value);
final String value;
}
class FilterVendorsByEntity implements PersistUI { class FilterVendorsByEntity implements PersistUI {
FilterVendorsByEntity({this.entityId, this.entityType}); FilterVendorsByEntity({this.entityId, this.entityType});

View File

@ -93,6 +93,8 @@ final vendorListReducer = combineReducers<ListUIState>([
TypedReducer<ListUIState, FilterVendors>(_filterVendors), TypedReducer<ListUIState, FilterVendors>(_filterVendors),
TypedReducer<ListUIState, FilterVendorsByCustom1>(_filterVendorsByCustom1), TypedReducer<ListUIState, FilterVendorsByCustom1>(_filterVendorsByCustom1),
TypedReducer<ListUIState, FilterVendorsByCustom2>(_filterVendorsByCustom2), TypedReducer<ListUIState, FilterVendorsByCustom2>(_filterVendorsByCustom2),
TypedReducer<ListUIState, FilterVendorsByCustom3>(_filterVendorsByCustom3),
TypedReducer<ListUIState, FilterVendorsByCustom4>(_filterVendorsByCustom4),
TypedReducer<ListUIState, FilterVendorsByEntity>(_filterVendorsByClient), TypedReducer<ListUIState, FilterVendorsByEntity>(_filterVendorsByClient),
TypedReducer<ListUIState, StartVendorMultiselect>(_startListMultiselect), TypedReducer<ListUIState, StartVendorMultiselect>(_startListMultiselect),
TypedReducer<ListUIState, AddToVendorMultiselect>(_addToListMultiselect), TypedReducer<ListUIState, AddToVendorMultiselect>(_addToListMultiselect),
@ -128,6 +130,26 @@ ListUIState _filterVendorsByCustom2(
} }
} }
ListUIState _filterVendorsByCustom3(ListUIState vendorListState,
FilterVendorsByCustom3 action) {
if (vendorListState.custom3Filters.contains(action.value)) {
return vendorListState
.rebuild((b) => b..custom3Filters.remove(action.value));
} else {
return vendorListState.rebuild((b) => b..custom3Filters.add(action.value));
}
}
ListUIState _filterVendorsByCustom4(
ListUIState vendorListState, FilterVendorsByCustom4 action) {
if (vendorListState.custom4Filters.contains(action.value)) {
return vendorListState
.rebuild((b) => b..custom4Filters.remove(action.value));
} else {
return vendorListState.rebuild((b) => b..custom4Filters.add(action.value));
}
}
ListUIState _filterVendorsByState( ListUIState _filterVendorsByState(
ListUIState vendorListState, FilterVendorsByState action) { ListUIState vendorListState, FilterVendorsByState action) {
if (vendorListState.stateFilters.contains(action.state)) { if (vendorListState.stateFilters.contains(action.state)) {

View File

@ -87,6 +87,10 @@ class CompanyGatewayScreen extends StatelessWidget {
store.dispatch(FilterCompanyGatewaysByCustom1(value)), store.dispatch(FilterCompanyGatewaysByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterCompanyGatewaysByCustom2(value)), store.dispatch(FilterCompanyGatewaysByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterCompanyGatewaysByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterCompanyGatewaysByCustom4(value)),
onSelectedState: (EntityState state, value) { onSelectedState: (EntityState state, value) {
store.dispatch(FilterCompanyGatewaysByState(state)); store.dispatch(FilterCompanyGatewaysByState(state));
}, },

View File

@ -95,6 +95,10 @@ class DocumentScreen extends StatelessWidget {
store.dispatch(FilterDocumentsByCustom1(value)), store.dispatch(FilterDocumentsByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterDocumentsByCustom2(value)), store.dispatch(FilterDocumentsByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterDocumentsByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterDocumentsByCustom4(value)),
sortFields: [ sortFields: [
DocumentFields.updatedAt, DocumentFields.updatedAt,
], ],

View File

@ -95,10 +95,18 @@ class ExpenseScreen extends StatelessWidget {
excludeBlank: true), excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.expense2, customValues2: company.getCustomFieldValues(CustomFieldType.expense2,
excludeBlank: true), excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.expense3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.expense4,
excludeBlank: true),
onSelectedCustom1: (value) => onSelectedCustom1: (value) =>
store.dispatch(FilterExpensesByCustom1(value)), store.dispatch(FilterExpensesByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterExpensesByCustom2(value)), store.dispatch(FilterExpensesByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterExpensesByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterExpensesByCustom4(value)),
sortFields: [ sortFields: [
ExpenseFields.publicNotes, ExpenseFields.publicNotes,
ExpenseFields.expenseDate, ExpenseFields.expenseDate,

View File

@ -109,10 +109,18 @@ class InvoiceScreen extends StatelessWidget {
excludeBlank: true), excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.invoice2, customValues2: company.getCustomFieldValues(CustomFieldType.invoice2,
excludeBlank: true), excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.invoice3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.invoice4,
excludeBlank: true),
onSelectedCustom1: (value) => onSelectedCustom1: (value) =>
store.dispatch(FilterInvoicesByCustom1(value)), store.dispatch(FilterInvoicesByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterInvoicesByCustom2(value)), store.dispatch(FilterInvoicesByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterInvoicesByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterInvoicesByCustom4(value)),
statuses: [ statuses: [
InvoiceStatusEntity().rebuild( InvoiceStatusEntity().rebuild(
(b) => b (b) => b

View File

@ -90,6 +90,10 @@ class PaymentScreen extends StatelessWidget {
store.dispatch(FilterPaymentsByCustom1(value)), store.dispatch(FilterPaymentsByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterPaymentsByCustom2(value)), store.dispatch(FilterPaymentsByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterPaymentsByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterPaymentsByCustom4(value)),
sortFields: [ sortFields: [
PaymentFields.paymentDate, PaymentFields.paymentDate,
PaymentFields.amount, PaymentFields.amount,

View File

@ -94,10 +94,18 @@ class TaskScreen extends StatelessWidget {
excludeBlank: true), excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.task2, customValues2: company.getCustomFieldValues(CustomFieldType.task2,
excludeBlank: true), excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.task3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.task4,
excludeBlank: true),
onSelectedCustom1: (value) => onSelectedCustom1: (value) =>
store.dispatch(FilterTasksByCustom1(value)), store.dispatch(FilterTasksByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterTasksByCustom2(value)), store.dispatch(FilterTasksByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterTasksByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterTasksByCustom4(value)),
sortFields: [ sortFields: [
TaskFields.description, TaskFields.description,
TaskFields.duration, TaskFields.duration,

View File

@ -91,10 +91,18 @@ class VendorScreen extends StatelessWidget {
excludeBlank: true), excludeBlank: true),
customValues2: company.getCustomFieldValues(CustomFieldType.vendor2, customValues2: company.getCustomFieldValues(CustomFieldType.vendor2,
excludeBlank: true), excludeBlank: true),
customValues3: company.getCustomFieldValues(CustomFieldType.vendor3,
excludeBlank: true),
customValues4: company.getCustomFieldValues(CustomFieldType.vendor4,
excludeBlank: true),
onSelectedCustom1: (value) => onSelectedCustom1: (value) =>
store.dispatch(FilterVendorsByCustom1(value)), store.dispatch(FilterVendorsByCustom1(value)),
onSelectedCustom2: (value) => onSelectedCustom2: (value) =>
store.dispatch(FilterVendorsByCustom2(value)), store.dispatch(FilterVendorsByCustom2(value)),
onSelectedCustom3: (value) =>
store.dispatch(FilterVendorsByCustom3(value)),
onSelectedCustom4: (value) =>
store.dispatch(FilterVendorsByCustom4(value)),
sortFields: [ sortFields: [
VendorFields.name, VendorFields.name,
VendorFields.updatedAt, VendorFields.updatedAt,