Null safety
This commit is contained in:
parent
9de6d6ee53
commit
acc11c91e1
|
|
@ -316,7 +316,7 @@ class FilterByEntity implements PersistUI {
|
||||||
class FilterCompany implements PersistUI {
|
class FilterCompany implements PersistUI {
|
||||||
FilterCompany(this.filter);
|
FilterCompany(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void filterByEntity({
|
void filterByEntity({
|
||||||
|
|
@ -556,8 +556,8 @@ void viewEntityById({
|
||||||
store.dispatch(ToggleViewerLayout(entityType));
|
store.dispatch(ToggleViewerLayout(entityType));
|
||||||
final filterEntity =
|
final filterEntity =
|
||||||
store.state.getEntityMap(entityType)![entityId] as BaseEntity;
|
store.state.getEntityMap(entityType)![entityId] as BaseEntity;
|
||||||
final entityTypes = filterEntity.entityType!.relatedTypes
|
final entityTypes = filterEntity.entityType!.relatedTypes.where(
|
||||||
.where((entityType) => state.company!.isModuleEnabled(entityType));
|
(entityType) => state.company!.isModuleEnabled(entityType));
|
||||||
if (entityTypes.isNotEmpty) {
|
if (entityTypes.isNotEmpty) {
|
||||||
viewEntitiesByType(
|
viewEntitiesByType(
|
||||||
entityType: entityTypes.first, filterEntity: filterEntity);
|
entityType: entityTypes.first, filterEntity: filterEntity);
|
||||||
|
|
@ -1325,14 +1325,17 @@ void editEntity({
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case EntityType.project:
|
case EntityType.project:
|
||||||
store.dispatch(EditProject(project: entity as ProjectEntity, completer: completer));
|
store.dispatch(EditProject(
|
||||||
|
project: entity as ProjectEntity, completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.taxRate:
|
case EntityType.taxRate:
|
||||||
store.dispatch(EditTaxRate(taxRate: entity as TaxRateEntity, completer: completer));
|
store.dispatch(EditTaxRate(
|
||||||
|
taxRate: entity as TaxRateEntity, completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.companyGateway:
|
case EntityType.companyGateway:
|
||||||
store.dispatch(EditCompanyGateway(
|
store.dispatch(EditCompanyGateway(
|
||||||
companyGateway: entity as CompanyGatewayEntity, completer: completer));
|
companyGateway: entity as CompanyGatewayEntity,
|
||||||
|
completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.invoice:
|
case EntityType.invoice:
|
||||||
final invoice = entity as InvoiceEntity;
|
final invoice = entity as InvoiceEntity;
|
||||||
|
|
@ -1372,7 +1375,8 @@ void editEntity({
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case EntityType.product:
|
case EntityType.product:
|
||||||
store.dispatch(EditProduct(product: entity as ProductEntity, completer: completer));
|
store.dispatch(EditProduct(
|
||||||
|
product: entity as ProductEntity, completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.task:
|
case EntityType.task:
|
||||||
if (!state.company!.invoiceTaskLock ||
|
if (!state.company!.invoiceTaskLock ||
|
||||||
|
|
@ -1385,7 +1389,8 @@ void editEntity({
|
||||||
break;
|
break;
|
||||||
case EntityType.expense:
|
case EntityType.expense:
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
EditExpense(expense: entity as ExpenseEntity, completer: completer),
|
EditExpense(
|
||||||
|
expense: entity as ExpenseEntity, completer: completer),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EntityType.payment:
|
case EntityType.payment:
|
||||||
|
|
@ -1402,32 +1407,36 @@ void editEntity({
|
||||||
break;
|
break;
|
||||||
// STARTER: edit - do not remove comment
|
// STARTER: edit - do not remove comment
|
||||||
case EntityType.schedule:
|
case EntityType.schedule:
|
||||||
store
|
store.dispatch(EditSchedule(
|
||||||
.dispatch(EditSchedule(schedule: entity as ScheduleEntity, completer: completer));
|
schedule: entity as ScheduleEntity, completer: completer));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType.transactionRule:
|
case EntityType.transactionRule:
|
||||||
store.dispatch(EditTransactionRule(
|
store.dispatch(EditTransactionRule(
|
||||||
transactionRule: entity as TransactionRuleEntity, completer: completer));
|
transactionRule: entity as TransactionRuleEntity,
|
||||||
|
completer: completer));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType.transaction:
|
case EntityType.transaction:
|
||||||
store.dispatch(
|
store.dispatch(EditTransaction(
|
||||||
EditTransaction(transaction: entity as TransactionEntity, completer: completer));
|
transaction: entity as TransactionEntity,
|
||||||
|
completer: completer));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType.purchaseOrder:
|
case EntityType.purchaseOrder:
|
||||||
store.dispatch(
|
store.dispatch(EditPurchaseOrder(
|
||||||
EditPurchaseOrder(purchaseOrder: entity as InvoiceEntity, completer: completer));
|
purchaseOrder: entity as InvoiceEntity, completer: completer));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType.recurringExpense:
|
case EntityType.recurringExpense:
|
||||||
store.dispatch(EditRecurringExpense(
|
store.dispatch(EditRecurringExpense(
|
||||||
recurringExpense: entity as ExpenseEntity, completer: completer));
|
recurringExpense: entity as ExpenseEntity,
|
||||||
|
completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.subscription:
|
case EntityType.subscription:
|
||||||
store.dispatch(
|
store.dispatch(EditSubscription(
|
||||||
EditSubscription(subscription: entity as SubscriptionEntity, completer: completer));
|
subscription: entity as SubscriptionEntity,
|
||||||
|
completer: completer));
|
||||||
break;
|
break;
|
||||||
case EntityType.taskStatus:
|
case EntityType.taskStatus:
|
||||||
store.dispatch(EditTaskStatus(
|
store.dispatch(EditTaskStatus(
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ class RestoreBankAccountsFailure implements StopSaving {
|
||||||
class FilterBankAccounts implements PersistUI {
|
class FilterBankAccounts implements PersistUI {
|
||||||
FilterBankAccounts(this.filter);
|
FilterBankAccounts(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortBankAccounts implements PersistUI, PersistPrefs {
|
class SortBankAccounts implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -261,8 +261,8 @@ class UpdateBankAccountTab implements PersistUI {
|
||||||
final int? tabIndex;
|
final int? tabIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleBankAccountAction(
|
void handleBankAccountAction(BuildContext? context,
|
||||||
BuildContext? context, List<BaseEntity?> bankAccounts, EntityAction? action) {
|
List<BaseEntity?> bankAccounts, EntityAction? action) {
|
||||||
if (bankAccounts.isEmpty) {
|
if (bankAccounts.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ class RestoreClientFailure implements StopSaving {
|
||||||
class FilterClients implements PersistUI {
|
class FilterClients implements PersistUI {
|
||||||
FilterClients(this.filter);
|
FilterClients(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortClients implements PersistUI, PersistPrefs {
|
class SortClients implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -343,8 +343,8 @@ class FilterClientsByCustom4 implements PersistUI {
|
||||||
final String value;
|
final String value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleClientAction(
|
void handleClientAction(BuildContext? context, List<BaseEntity?> clients,
|
||||||
BuildContext? context, List<BaseEntity?> clients, EntityAction? action) async {
|
EntityAction? action) async {
|
||||||
if (clients.isEmpty) {
|
if (clients.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -385,8 +385,8 @@ void handleClientAction(
|
||||||
case EntityAction.newTask:
|
case EntityAction.newTask:
|
||||||
createEntity(
|
createEntity(
|
||||||
context: context,
|
context: context,
|
||||||
entity:
|
entity: TaskEntity(state: state)
|
||||||
TaskEntity(state: state).rebuild((b) => b..clientId = client!.id));
|
.rebuild((b) => b..clientId = client!.id));
|
||||||
break;
|
break;
|
||||||
case EntityAction.newInvoice:
|
case EntityAction.newInvoice:
|
||||||
createEntity(
|
createEntity(
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ class RestoreCompanyGatewayFailure implements StopSaving {
|
||||||
class FilterCompanyGateways implements PersistUI {
|
class FilterCompanyGateways implements PersistUI {
|
||||||
FilterCompanyGateways(this.filter);
|
FilterCompanyGateways(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortCompanyGateways implements PersistUI, PersistPrefs {
|
class SortCompanyGateways implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ class RestoreCreditsFailure implements StopSaving {
|
||||||
class FilterCredits implements PersistUI {
|
class FilterCredits implements PersistUI {
|
||||||
FilterCredits(this.filter);
|
FilterCredits(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortCredits implements PersistUI, PersistPrefs {
|
class SortCredits implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -417,7 +417,7 @@ class FilterCreditsByStatus implements PersistUI {
|
||||||
class FilterCreditDropdown {
|
class FilterCreditDropdown {
|
||||||
FilterCreditDropdown(this.filter);
|
FilterCreditDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterCreditsByCustom1 implements PersistUI {
|
class FilterCreditsByCustom1 implements PersistUI {
|
||||||
|
|
@ -470,8 +470,8 @@ class SaveCreditDocumentFailure implements StopSaving {
|
||||||
final Object error;
|
final Object error;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future handleCreditAction(
|
Future handleCreditAction(BuildContext context, List<BaseEntity?> credits,
|
||||||
BuildContext context, List<BaseEntity?> credits, EntityAction? action) async {
|
EntityAction? action) async {
|
||||||
final store = StoreProvider.of<AppState>(context);
|
final store = StoreProvider.of<AppState>(context);
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
@ -631,7 +631,8 @@ Future handleCreditAction(
|
||||||
entity: PaymentEntity(state: state, client: client).rebuild((b) => b
|
entity: PaymentEntity(state: state, client: client).rebuild((b) => b
|
||||||
..typeId = kPaymentTypeCredit
|
..typeId = kPaymentTypeCredit
|
||||||
..credits.addAll(credits
|
..credits.addAll(credits
|
||||||
.map((credit) => PaymentableEntity.fromCredit(credit as InvoiceEntity))
|
.map((credit) =>
|
||||||
|
PaymentableEntity.fromCredit(credit as InvoiceEntity))
|
||||||
.toList())),
|
.toList())),
|
||||||
filterEntity: client,
|
filterEntity: client,
|
||||||
);
|
);
|
||||||
|
|
@ -687,8 +688,8 @@ Future handleCreditAction(
|
||||||
final invitation = credit.invitations.first;
|
final invitation = credit.invitations.first;
|
||||||
final url = invitation.downloadLink;
|
final url = invitation.downloadLink;
|
||||||
store.dispatch(StartSaving());
|
store.dispatch(StartSaving());
|
||||||
final http.Response? response =
|
final http.Response? response = await (WebClient()
|
||||||
await (WebClient().get(url, '', rawResponse: true) as FutureOr<Response?>);
|
.get(url, '', rawResponse: true) as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
@ -698,7 +699,8 @@ Future handleCreditAction(
|
||||||
final data = json.encode(
|
final data = json.encode(
|
||||||
{'ids': creditIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
{'ids': creditIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
||||||
final http.Response? response = await (WebClient()
|
final http.Response? response = await (WebClient()
|
||||||
.post(url, state.credentials.token, data: data, rawResponse: true) as FutureOr<Response?>);
|
.post(url, state.credentials.token, data: data, rawResponse: true)
|
||||||
|
as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ final editingItemReducer = combineReducers<int?>([
|
||||||
TypedReducer<int?, EditCreditItem>((index, action) => action.creditItemIndex),
|
TypedReducer<int?, EditCreditItem>((index, action) => action.creditItemIndex),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterCreditDropdown>(filtercreditDropdownReducer),
|
TypedReducer<String, FilterCreditDropdown>(filtercreditDropdownReducer),
|
||||||
]);
|
]);
|
||||||
|
|
@ -62,6 +63,7 @@ String filtercreditDropdownReducer(
|
||||||
String dropdownFilter, FilterCreditDropdown action) {
|
String dropdownFilter, FilterCreditDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<String?> selectedIdReducer = combineReducers([
|
Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ArchiveCreditsSuccess>((completer, action) => ''),
|
TypedReducer<String?, ArchiveCreditsSuccess>((completer, action) => ''),
|
||||||
|
|
@ -73,7 +75,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
(selectedId, action) => action.credit.id),
|
(selectedId, action) => action.credit.id),
|
||||||
TypedReducer<String?, ShowEmailCredit>(
|
TypedReducer<String?, ShowEmailCredit>(
|
||||||
(selectedId, action) => action.credit!.id),
|
(selectedId, action) => action.credit!.id),
|
||||||
TypedReducer<String?, ShowPdfCredit>((selectedId, action) => action.credit!.id),
|
TypedReducer<String?, ShowPdfCredit>(
|
||||||
|
(selectedId, action) => action.credit!.id),
|
||||||
TypedReducer<String?, SelectCompany>(
|
TypedReducer<String?, SelectCompany>(
|
||||||
(selectedId, action) => action.clearSelection ? '' : selectedId),
|
(selectedId, action) => action.clearSelection ? '' : selectedId),
|
||||||
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),
|
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),
|
||||||
|
|
@ -165,14 +168,16 @@ InvoiceEntity _addCreditItems(InvoiceEntity? credit, AddCreditItems action) {
|
||||||
return credit!.rebuild((b) => b..lineItems.addAll(action.creditItems));
|
return credit!.rebuild((b) => b..lineItems.addAll(action.creditItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceEntity? _removeCreditItem(InvoiceEntity? credit, DeleteCreditItem action) {
|
InvoiceEntity? _removeCreditItem(
|
||||||
|
InvoiceEntity? credit, DeleteCreditItem action) {
|
||||||
if (credit!.lineItems.length <= action.index) {
|
if (credit!.lineItems.length <= action.index) {
|
||||||
return credit;
|
return credit;
|
||||||
}
|
}
|
||||||
return credit.rebuild((b) => b..lineItems.removeAt(action.index));
|
return credit.rebuild((b) => b..lineItems.removeAt(action.index));
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceEntity? _updateCreditItem(InvoiceEntity? credit, UpdateCreditItem action) {
|
InvoiceEntity? _updateCreditItem(
|
||||||
|
InvoiceEntity? credit, UpdateCreditItem action) {
|
||||||
if (credit!.lineItems.length <= action.index!) {
|
if (credit!.lineItems.length <= action.index!) {
|
||||||
return credit;
|
return credit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class RestoreDesignsFailure implements StopSaving {
|
||||||
class FilterDesigns implements PersistUI {
|
class FilterDesigns implements PersistUI {
|
||||||
FilterDesigns(this.filter);
|
FilterDesigns(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortDesigns implements PersistUI, PersistPrefs {
|
class SortDesigns implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ class RestoreDocumentFailure implements StopSaving {
|
||||||
class FilterDocuments implements PersistUI {
|
class FilterDocuments implements PersistUI {
|
||||||
FilterDocuments(this.filter);
|
FilterDocuments(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterDocumentsByStatus implements PersistUI {
|
class FilterDocumentsByStatus implements PersistUI {
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ Middleware<AppState> _loadDocumentData(DocumentRepository repository) {
|
||||||
final action = dynamicAction as LoadDocumentData;
|
final action = dynamicAction as LoadDocumentData;
|
||||||
|
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final document = state.documentState.map[action.documentId];
|
final document = state.documentState.map[action.documentId]!;
|
||||||
|
|
||||||
store.dispatch(LoadDocumentRequest());
|
store.dispatch(LoadDocumentRequest());
|
||||||
repository.loadData(store.state.credentials, document).then((bodyBytes) {
|
repository.loadData(store.state.credentials, document).then((bodyBytes) {
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ class RestoreExpenseFailure implements StopSaving {
|
||||||
class FilterExpenses implements PersistUI {
|
class FilterExpenses implements PersistUI {
|
||||||
FilterExpenses(this.filter);
|
FilterExpenses(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortExpenses implements PersistUI, PersistPrefs {
|
class SortExpenses implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -299,7 +299,8 @@ void handleExpenseAction(
|
||||||
}
|
}
|
||||||
if (expense.projectId!.isNotEmpty) {
|
if (expense.projectId!.isNotEmpty) {
|
||||||
if (projectId!.isEmpty &&
|
if (projectId!.isEmpty &&
|
||||||
state.projectState.get(expense.projectId!)!.clientId == client!.id) {
|
state.projectState.get(expense.projectId!)!.clientId ==
|
||||||
|
client!.id) {
|
||||||
projectId = expense.projectId;
|
projectId = expense.projectId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class RestoreExpenseCategoriesFailure implements StopSaving {
|
||||||
class FilterExpenseCategories implements PersistUI {
|
class FilterExpenseCategories implements PersistUI {
|
||||||
FilterExpenseCategories(this.filter);
|
FilterExpenseCategories(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortExpenseCategories implements PersistUI, PersistPrefs {
|
class SortExpenseCategories implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ class RestoreGroupFailure implements StopSaving {
|
||||||
class FilterGroups implements PersistUI {
|
class FilterGroups implements PersistUI {
|
||||||
FilterGroups(this.filter);
|
FilterGroups(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortGroups implements PersistUI, PersistPrefs {
|
class SortGroups implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,7 @@ class RestoreInvoicesFailure implements StopSaving {
|
||||||
class FilterInvoices implements PersistUI {
|
class FilterInvoices implements PersistUI {
|
||||||
FilterInvoices(this.filter);
|
FilterInvoices(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortInvoices implements PersistUI, PersistPrefs {
|
class SortInvoices implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -460,7 +460,7 @@ class FilterInvoicesByStatus implements PersistUI {
|
||||||
class FilterInvoiceDropdown {
|
class FilterInvoiceDropdown {
|
||||||
FilterInvoiceDropdown(this.filter);
|
FilterInvoiceDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterInvoicesByCustom1 implements PersistUI {
|
class FilterInvoicesByCustom1 implements PersistUI {
|
||||||
|
|
@ -782,7 +782,8 @@ void handleInvoiceAction(BuildContext? context, List<BaseEntity?> invoices,
|
||||||
entity: PaymentEntity(state: state, client: client).rebuild((b) => b
|
entity: PaymentEntity(state: state, client: client).rebuild((b) => b
|
||||||
..invoices.addAll(invoices
|
..invoices.addAll(invoices
|
||||||
.where((invoice) => !(invoice as InvoiceEntity).isPaid)
|
.where((invoice) => !(invoice as InvoiceEntity).isPaid)
|
||||||
.map((invoice) => PaymentableEntity.fromInvoice(invoice as InvoiceEntity))
|
.map((invoice) =>
|
||||||
|
PaymentableEntity.fromInvoice(invoice as InvoiceEntity))
|
||||||
.toList())),
|
.toList())),
|
||||||
filterEntity: client,
|
filterEntity: client,
|
||||||
);
|
);
|
||||||
|
|
@ -841,8 +842,8 @@ void handleInvoiceAction(BuildContext? context, List<BaseEntity?> invoices,
|
||||||
final invitation = invoice.invitations.first;
|
final invitation = invoice.invitations.first;
|
||||||
final url = invitation.downloadLink;
|
final url = invitation.downloadLink;
|
||||||
store.dispatch(StartSaving());
|
store.dispatch(StartSaving());
|
||||||
final http.Response? response =
|
final http.Response? response = await (WebClient()
|
||||||
await (WebClient().get(url, '', rawResponse: true) as FutureOr<Response?>);
|
.get(url, '', rawResponse: true) as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
@ -852,7 +853,8 @@ void handleInvoiceAction(BuildContext? context, List<BaseEntity?> invoices,
|
||||||
final data = json.encode(
|
final data = json.encode(
|
||||||
{'ids': invoiceIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
{'ids': invoiceIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
||||||
final http.Response? response = await (WebClient()
|
final http.Response? response = await (WebClient()
|
||||||
.post(url, state.credentials.token, data: data, rawResponse: true) as FutureOr<Response?>);
|
.post(url, state.credentials.token, data: data, rawResponse: true)
|
||||||
|
as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ final editingItemIndexReducer = combineReducers<int?>([
|
||||||
(index, action) => action.invoiceItemIndex),
|
(index, action) => action.invoiceItemIndex),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterInvoiceDropdown>(filterInvoiceDropdownReducer),
|
TypedReducer<String, FilterInvoiceDropdown>(filterInvoiceDropdownReducer),
|
||||||
]);
|
]);
|
||||||
|
|
@ -65,6 +66,7 @@ String filterInvoiceDropdownReducer(
|
||||||
String dropdownFilter, FilterInvoiceDropdown action) {
|
String dropdownFilter, FilterInvoiceDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<String?> selectedIdReducer = combineReducers([
|
Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ArchiveInvoicesSuccess>((completer, action) => ''),
|
TypedReducer<String?, ArchiveInvoicesSuccess>((completer, action) => ''),
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ class EmailPaymentFailure implements StopSaving {
|
||||||
class FilterPayments implements PersistUI {
|
class FilterPayments implements PersistUI {
|
||||||
FilterPayments(this.filter);
|
FilterPayments(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortPayments implements PersistUI, PersistPrefs {
|
class SortPayments implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ class RestorePaymentTermsFailure implements StopSaving {
|
||||||
class FilterPaymentTerms implements PersistUI {
|
class FilterPaymentTerms implements PersistUI {
|
||||||
FilterPaymentTerms(this.filter);
|
FilterPaymentTerms(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortPaymentTerms implements PersistUI, PersistPrefs {
|
class SortPaymentTerms implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -246,8 +246,8 @@ class FilterPaymentTermsByCustom4 implements PersistUI {
|
||||||
final String value;
|
final String value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handlePaymentTermAction(
|
void handlePaymentTermAction(BuildContext? context,
|
||||||
BuildContext? context, List<BaseEntity?> paymentTerms, EntityAction? action) {
|
List<BaseEntity?> paymentTerms, EntityAction? action) {
|
||||||
if (paymentTerms.isEmpty) {
|
if (paymentTerms.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ class SetTaxCategoryProductsFailure implements StopSaving {
|
||||||
class FilterProducts implements PersistUI {
|
class FilterProducts implements PersistUI {
|
||||||
FilterProducts(this.filter);
|
FilterProducts(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortProducts implements PersistUI, PersistPrefs {
|
class SortProducts implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -263,7 +263,7 @@ class FilterProductsByCustom4 implements PersistUI {
|
||||||
class FilterProductDropdown {
|
class FilterProductDropdown {
|
||||||
FilterProductDropdown(this.filter);
|
FilterProductDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleProductAction(
|
void handleProductAction(
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ final int? Function(int, dynamic) tabIndexReducer = combineReducers<int?>([
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterProductDropdown>(filterProductDropdownReducer),
|
TypedReducer<String, FilterProductDropdown>(filterProductDropdownReducer),
|
||||||
]);
|
]);
|
||||||
|
|
@ -49,6 +50,7 @@ String filterProductDropdownReducer(
|
||||||
String dropdownFilter, FilterProductDropdown action) {
|
String dropdownFilter, FilterProductDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
final editingReducer = combineReducers<ProductEntity?>([
|
final editingReducer = combineReducers<ProductEntity?>([
|
||||||
TypedReducer<ProductEntity?, SaveProductSuccess>(_updateEditing),
|
TypedReducer<ProductEntity?, SaveProductSuccess>(_updateEditing),
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ class RestoreProjectFailure implements StopSaving {
|
||||||
class FilterProjects implements PersistUI {
|
class FilterProjects implements PersistUI {
|
||||||
FilterProjects(this.filter);
|
FilterProjects(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortProjects implements PersistUI, PersistPrefs {
|
class SortProjects implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -301,8 +301,8 @@ void handleProjectAction(
|
||||||
|
|
||||||
final items = <InvoiceItemEntity>[];
|
final items = <InvoiceItemEntity>[];
|
||||||
projects.forEach((project) {
|
projects.forEach((project) {
|
||||||
items.addAll(
|
items.addAll(convertProjectToInvoiceItem(
|
||||||
convertProjectToInvoiceItem(project: project as ProjectEntity?, context: context));
|
project: project as ProjectEntity?, context: context));
|
||||||
});
|
});
|
||||||
createEntity(
|
createEntity(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -503,7 +503,7 @@ class DeletePurchaseOrderItem implements PersistUI {
|
||||||
class FilterPurchaseOrders implements PersistUI {
|
class FilterPurchaseOrders implements PersistUI {
|
||||||
FilterPurchaseOrders(this.filter);
|
FilterPurchaseOrders(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortPurchaseOrders implements PersistUI, PersistPrefs {
|
class SortPurchaseOrders implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -527,7 +527,7 @@ class FilterPurchaseOrdersByStatus implements PersistUI {
|
||||||
class FilterPurchaseOrderDropdown {
|
class FilterPurchaseOrderDropdown {
|
||||||
FilterPurchaseOrderDropdown(this.filter);
|
FilterPurchaseOrderDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterPurchaseOrdersByCustom1 implements PersistUI {
|
class FilterPurchaseOrdersByCustom1 implements PersistUI {
|
||||||
|
|
@ -620,8 +620,8 @@ void handlePurchaseOrderAction(BuildContext? context,
|
||||||
final invitation = purchaseOrder!.invitations.first;
|
final invitation = purchaseOrder!.invitations.first;
|
||||||
final url = invitation.downloadLink;
|
final url = invitation.downloadLink;
|
||||||
store.dispatch(StartSaving());
|
store.dispatch(StartSaving());
|
||||||
final http.Response? response =
|
final http.Response? response = await (WebClient()
|
||||||
await (WebClient().get(url, '', rawResponse: true) as FutureOr<Response?>);
|
.get(url, '', rawResponse: true) as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
@ -633,7 +633,8 @@ void handlePurchaseOrderAction(BuildContext? context,
|
||||||
'action': EntityAction.bulkPrint.toApiParam()
|
'action': EntityAction.bulkPrint.toApiParam()
|
||||||
});
|
});
|
||||||
final http.Response? response = await (WebClient()
|
final http.Response? response = await (WebClient()
|
||||||
.post(url, state.credentials.token, data: data, rawResponse: true) as FutureOr<Response?>);
|
.post(url, state.credentials.token, data: data, rawResponse: true)
|
||||||
|
as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
@ -728,7 +729,8 @@ void handlePurchaseOrderAction(BuildContext? context,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
editEntity(
|
editEntity(
|
||||||
entity: state.vendorState.get(purchaseOrder!.vendorId)!);
|
entity:
|
||||||
|
state.vendorState.get(purchaseOrder!.vendorId)!);
|
||||||
},
|
},
|
||||||
child: Text(localization.editVendor.toUpperCase()))
|
child: Text(localization.editVendor.toUpperCase()))
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ EntityUIState purchaseOrderUIReducer(
|
||||||
final forceSelectedReducer = combineReducers<bool?>([
|
final forceSelectedReducer = combineReducers<bool?>([
|
||||||
TypedReducer<bool?, ViewPurchaseOrder>((completer, action) => true),
|
TypedReducer<bool?, ViewPurchaseOrder>((completer, action) => true),
|
||||||
TypedReducer<bool?, ViewPurchaseOrderList>((completer, action) => false),
|
TypedReducer<bool?, ViewPurchaseOrderList>((completer, action) => false),
|
||||||
TypedReducer<bool?, FilterPurchaseOrdersByState>((completer, action) => false),
|
TypedReducer<bool?, FilterPurchaseOrdersByState>(
|
||||||
|
(completer, action) => false),
|
||||||
TypedReducer<bool?, FilterPurchaseOrdersByStatus>(
|
TypedReducer<bool?, FilterPurchaseOrdersByStatus>(
|
||||||
(completer, action) => false),
|
(completer, action) => false),
|
||||||
TypedReducer<bool?, FilterPurchaseOrders>((completer, action) => false),
|
TypedReducer<bool?, FilterPurchaseOrders>((completer, action) => false),
|
||||||
|
|
@ -58,9 +59,11 @@ final historyActivityIdReducer = combineReducers<String?>([
|
||||||
final editingItemReducer = combineReducers<int?>([
|
final editingItemReducer = combineReducers<int?>([
|
||||||
TypedReducer<int?, EditPurchaseOrder>(
|
TypedReducer<int?, EditPurchaseOrder>(
|
||||||
(index, action) => action.purchaseOrderItemIndex),
|
(index, action) => action.purchaseOrderItemIndex),
|
||||||
TypedReducer<int?, EditPurchaseOrderItem>((index, action) => action.itemIndex),
|
TypedReducer<int?, EditPurchaseOrderItem>(
|
||||||
|
(index, action) => action.itemIndex),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterPurchaseOrderDropdown>(
|
TypedReducer<String, FilterPurchaseOrderDropdown>(
|
||||||
filterpurchaseOrderDropdownReducer),
|
filterpurchaseOrderDropdownReducer),
|
||||||
|
|
@ -70,9 +73,11 @@ String filterpurchaseOrderDropdownReducer(
|
||||||
String dropdownFilter, FilterPurchaseOrderDropdown action) {
|
String dropdownFilter, FilterPurchaseOrderDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<String?> selectedIdReducer = combineReducers([
|
Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ArchivePurchaseOrdersSuccess>((completer, action) => ''),
|
TypedReducer<String?, ArchivePurchaseOrdersSuccess>(
|
||||||
|
(completer, action) => ''),
|
||||||
TypedReducer<String?, DeletePurchaseOrdersSuccess>((completer, action) => ''),
|
TypedReducer<String?, DeletePurchaseOrdersSuccess>((completer, action) => ''),
|
||||||
TypedReducer<String?, PreviewEntity>((selectedId, action) =>
|
TypedReducer<String?, PreviewEntity>((selectedId, action) =>
|
||||||
action.entityType == EntityType.purchaseOrder
|
action.entityType == EntityType.purchaseOrder
|
||||||
|
|
@ -91,7 +96,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),
|
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),
|
||||||
TypedReducer<String?, SortPurchaseOrders>((selectedId, action) => ''),
|
TypedReducer<String?, SortPurchaseOrders>((selectedId, action) => ''),
|
||||||
TypedReducer<String?, FilterPurchaseOrders>((selectedId, action) => ''),
|
TypedReducer<String?, FilterPurchaseOrders>((selectedId, action) => ''),
|
||||||
TypedReducer<String?, FilterPurchaseOrdersByState>((selectedId, action) => ''),
|
TypedReducer<String?, FilterPurchaseOrdersByState>(
|
||||||
|
(selectedId, action) => ''),
|
||||||
TypedReducer<String?, FilterPurchaseOrdersByStatus>(
|
TypedReducer<String?, FilterPurchaseOrdersByStatus>(
|
||||||
(selectedId, action) => ''),
|
(selectedId, action) => ''),
|
||||||
TypedReducer<String?, FilterPurchaseOrdersByCustom1>(
|
TypedReducer<String?, FilterPurchaseOrdersByCustom1>(
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ class RestoreQuotesFailure implements StopSaving {
|
||||||
class FilterQuotes implements PersistUI {
|
class FilterQuotes implements PersistUI {
|
||||||
FilterQuotes(this.filter);
|
FilterQuotes(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortQuotes implements PersistUI, PersistPrefs {
|
class SortQuotes implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -403,7 +403,7 @@ class FilterQuotesByStatus implements PersistUI {
|
||||||
class FilterQuoteDropdown {
|
class FilterQuoteDropdown {
|
||||||
FilterQuoteDropdown(this.filter);
|
FilterQuoteDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterQuotesByCustom1 implements PersistUI {
|
class FilterQuotesByCustom1 implements PersistUI {
|
||||||
|
|
@ -513,8 +513,8 @@ class SaveQuoteDocumentFailure implements StopSaving {
|
||||||
final Object error;
|
final Object error;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future handleQuoteAction(
|
Future handleQuoteAction(BuildContext context, List<BaseEntity?> quotes,
|
||||||
BuildContext context, List<BaseEntity?> quotes, EntityAction? action) async {
|
EntityAction? action) async {
|
||||||
final store = StoreProvider.of<AppState>(context);
|
final store = StoreProvider.of<AppState>(context);
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
@ -561,7 +561,8 @@ Future handleQuoteAction(
|
||||||
ApproveQuotes(snackBarCompleter<Null>(context, message), quoteIds));
|
ApproveQuotes(snackBarCompleter<Null>(context, message), quoteIds));
|
||||||
break;
|
break;
|
||||||
case EntityAction.viewInvoice:
|
case EntityAction.viewInvoice:
|
||||||
viewEntityById(entityId: quote!.invoiceId, entityType: EntityType.invoice);
|
viewEntityById(
|
||||||
|
entityId: quote!.invoiceId, entityType: EntityType.invoice);
|
||||||
break;
|
break;
|
||||||
case EntityAction.markSent:
|
case EntityAction.markSent:
|
||||||
store.dispatch(MarkSentQuotesRequest(
|
store.dispatch(MarkSentQuotesRequest(
|
||||||
|
|
@ -740,8 +741,8 @@ Future handleQuoteAction(
|
||||||
final invitation = quote!.invitations.first;
|
final invitation = quote!.invitations.first;
|
||||||
final url = invitation.downloadLink;
|
final url = invitation.downloadLink;
|
||||||
store.dispatch(StartSaving());
|
store.dispatch(StartSaving());
|
||||||
final http.Response? response =
|
final http.Response? response = await (WebClient()
|
||||||
await (WebClient().get(url, '', rawResponse: true) as FutureOr<Response?>);
|
.get(url, '', rawResponse: true) as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
@ -751,7 +752,8 @@ Future handleQuoteAction(
|
||||||
final data = json.encode(
|
final data = json.encode(
|
||||||
{'ids': quoteIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
{'ids': quoteIds, 'action': EntityAction.bulkPrint.toApiParam()});
|
||||||
final http.Response? response = await (WebClient()
|
final http.Response? response = await (WebClient()
|
||||||
.post(url, state.credentials.token, data: data, rawResponse: true) as FutureOr<Response?>);
|
.post(url, state.credentials.token, data: data, rawResponse: true)
|
||||||
|
as FutureOr<Response?>);
|
||||||
store.dispatch(StopSaving());
|
store.dispatch(StopSaving());
|
||||||
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
await Printing.layoutPdf(onLayout: (_) => response!.bodyBytes);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ final editingItemReducer = combineReducers<int?>([
|
||||||
TypedReducer<int?, EditQuoteItem>((index, action) => action.quoteItemIndex),
|
TypedReducer<int?, EditQuoteItem>((index, action) => action.quoteItemIndex),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterQuoteDropdown>(filterquoteDropdownReducer),
|
TypedReducer<String, FilterQuoteDropdown>(filterquoteDropdownReducer),
|
||||||
]);
|
]);
|
||||||
|
|
@ -64,6 +65,7 @@ String filterquoteDropdownReducer(
|
||||||
String dropdownFilter, FilterQuoteDropdown action) {
|
String dropdownFilter, FilterQuoteDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<String?> selectedIdReducer = combineReducers([
|
Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ArchiveQuotesSuccess>((completer, action) => ''),
|
TypedReducer<String?, ArchiveQuotesSuccess>((completer, action) => ''),
|
||||||
|
|
@ -73,7 +75,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ViewQuote>((selectedId, action) => action.quoteId),
|
TypedReducer<String?, ViewQuote>((selectedId, action) => action.quoteId),
|
||||||
TypedReducer<String?, AddQuoteSuccess>(
|
TypedReducer<String?, AddQuoteSuccess>(
|
||||||
(selectedId, action) => action.quote.id),
|
(selectedId, action) => action.quote.id),
|
||||||
TypedReducer<String?, ShowEmailQuote>((selectedId, action) => action.quote!.id),
|
TypedReducer<String?, ShowEmailQuote>(
|
||||||
|
(selectedId, action) => action.quote!.id),
|
||||||
TypedReducer<String?, ShowPdfQuote>((selectedId, action) => action.quote!.id),
|
TypedReducer<String?, ShowPdfQuote>((selectedId, action) => action.quote!.id),
|
||||||
TypedReducer<String?, SelectCompany>(
|
TypedReducer<String?, SelectCompany>(
|
||||||
(selectedId, action) => action.clearSelection ? '' : selectedId),
|
(selectedId, action) => action.clearSelection ? '' : selectedId),
|
||||||
|
|
@ -293,7 +296,8 @@ ListUIState _addToListMultiselect(
|
||||||
|
|
||||||
ListUIState _removeFromListMultiselect(
|
ListUIState _removeFromListMultiselect(
|
||||||
ListUIState quoteListState, RemoveFromQuoteMultiselect action) {
|
ListUIState quoteListState, RemoveFromQuoteMultiselect action) {
|
||||||
return quoteListState.rebuild((b) => b..selectedIds.remove(action.entity!.id));
|
return quoteListState
|
||||||
|
.rebuild((b) => b..selectedIds.remove(action.entity!.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
ListUIState _clearListMultiselect(
|
ListUIState _clearListMultiselect(
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ class RestoreRecurringExpensesFailure implements StopSaving {
|
||||||
class FilterRecurringExpenses implements PersistUI {
|
class FilterRecurringExpenses implements PersistUI {
|
||||||
FilterRecurringExpenses(this.filter);
|
FilterRecurringExpenses(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortRecurringExpenses implements PersistUI, PersistPrefs {
|
class SortRecurringExpenses implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -364,8 +364,9 @@ void handleRecurringExpenseAction(BuildContext? context,
|
||||||
final store = StoreProvider.of<AppState>(context!);
|
final store = StoreProvider.of<AppState>(context!);
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final recurringExpense = recurringExpenses.first as ExpenseEntity?;
|
final recurringExpense = recurringExpenses.first as ExpenseEntity?;
|
||||||
final recurringExpenseIds =
|
final recurringExpenseIds = recurringExpenses
|
||||||
recurringExpenses.map((recurringExpense) => recurringExpense!.id).toList();
|
.map((recurringExpense) => recurringExpense!.id)
|
||||||
|
.toList();
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case EntityAction.edit:
|
case EntityAction.edit:
|
||||||
|
|
|
||||||
|
|
@ -323,12 +323,15 @@ class UpdatePricesRecurringInvoicesFailure implements StopSaving {
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncreasePricesRecurringInvoicesRequest implements StartSaving {
|
class IncreasePricesRecurringInvoicesRequest implements StartSaving {
|
||||||
IncreasePricesRecurringInvoicesRequest(
|
IncreasePricesRecurringInvoicesRequest({
|
||||||
{this.completer, this.recurringInvoiceIds, this.percentageIncrease});
|
this.completer,
|
||||||
|
required this.recurringInvoiceIds,
|
||||||
|
required this.percentageIncrease,
|
||||||
|
});
|
||||||
|
|
||||||
final Completer? completer;
|
final Completer? completer;
|
||||||
final double? percentageIncrease;
|
final double percentageIncrease;
|
||||||
final List<String>? recurringInvoiceIds;
|
final List<String> recurringInvoiceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncreasePricesRecurringInvoicesSuccess
|
class IncreasePricesRecurringInvoicesSuccess
|
||||||
|
|
@ -385,7 +388,7 @@ class RestoreRecurringInvoicesFailure implements StopSaving {
|
||||||
class FilterRecurringInvoices implements PersistUI {
|
class FilterRecurringInvoices implements PersistUI {
|
||||||
FilterRecurringInvoices(this.filter);
|
FilterRecurringInvoices(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortRecurringInvoices implements PersistUI, PersistPrefs {
|
class SortRecurringInvoices implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -409,7 +412,7 @@ class FilterRecurringInvoicesByStatus implements PersistUI {
|
||||||
class FilterRecurringInvoiceDropdown {
|
class FilterRecurringInvoiceDropdown {
|
||||||
FilterRecurringInvoiceDropdown(this.filter);
|
FilterRecurringInvoiceDropdown(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterRecurringInvoicesByCustom1 implements PersistUI {
|
class FilterRecurringInvoicesByCustom1 implements PersistUI {
|
||||||
|
|
@ -513,8 +516,9 @@ void handleRecurringInvoiceAction(BuildContext? context,
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final recurringInvoice = recurringInvoices.first as InvoiceEntity;
|
final recurringInvoice = recurringInvoices.first as InvoiceEntity;
|
||||||
final recurringInvoiceIds =
|
final recurringInvoiceIds = recurringInvoices
|
||||||
recurringInvoices.map((recurringInvoice) => recurringInvoice!.id).toList();
|
.map((recurringInvoice) => recurringInvoice!.id)
|
||||||
|
.toList();
|
||||||
final client = state.clientState.get(recurringInvoice.clientId);
|
final client = state.clientState.get(recurringInvoice.clientId);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
@ -563,7 +567,7 @@ void handleRecurringInvoiceAction(BuildContext? context,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (amount != 0) {
|
if (amount != null && amount != 0) {
|
||||||
store.dispatch(IncreasePricesRecurringInvoicesRequest(
|
store.dispatch(IncreasePricesRecurringInvoicesRequest(
|
||||||
completer: snackBarCompleter<Null>(
|
completer: snackBarCompleter<Null>(
|
||||||
navigatorKey.currentContext!, localization!.updatedPrices),
|
navigatorKey.currentContext!, localization!.updatedPrices),
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ final editingItemIndexReducer = combineReducers<int?>([
|
||||||
(index, action) => action.itemIndex),
|
(index, action) => action.itemIndex),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> dropdownFilterReducer = combineReducers([
|
Reducer<String> dropdownFilterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterRecurringInvoiceDropdown>(
|
TypedReducer<String, FilterRecurringInvoiceDropdown>(
|
||||||
filterRecurringInvoiceDropdownReducer),
|
filterRecurringInvoiceDropdownReducer),
|
||||||
|
|
@ -73,6 +74,7 @@ String filterRecurringInvoiceDropdownReducer(
|
||||||
String dropdownFilter, FilterRecurringInvoiceDropdown action) {
|
String dropdownFilter, FilterRecurringInvoiceDropdown action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<String?> selectedIdReducer = combineReducers([
|
Reducer<String?> selectedIdReducer = combineReducers([
|
||||||
TypedReducer<String?, ArchiveRecurringInvoicesSuccess>(
|
TypedReducer<String?, ArchiveRecurringInvoicesSuccess>(
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ class RestoreSchedulesFailure implements StopSaving {
|
||||||
class FilterSchedules implements PersistUI {
|
class FilterSchedules implements PersistUI {
|
||||||
FilterSchedules(this.filter);
|
FilterSchedules(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortSchedules implements PersistUI, PersistPrefs {
|
class SortSchedules implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ class ConnecGmailUserFailure implements StopSaving {
|
||||||
class FilterSettings implements PersistUI {
|
class FilterSettings implements PersistUI {
|
||||||
FilterSettings(this.filter);
|
FilterSettings(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ToggleShowNewSettings {}
|
class ToggleShowNewSettings {}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class RestoreSubscriptionsFailure implements StopSaving {
|
||||||
class FilterSubscriptions implements PersistUI {
|
class FilterSubscriptions implements PersistUI {
|
||||||
FilterSubscriptions(this.filter);
|
FilterSubscriptions(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortSubscriptions implements PersistUI, PersistPrefs {
|
class SortSubscriptions implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -271,8 +271,8 @@ class UpdateSubscriptionTab implements PersistUI {
|
||||||
final int? tabIndex;
|
final int? tabIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSubscriptionAction(
|
void handleSubscriptionAction(BuildContext? context,
|
||||||
BuildContext? context, List<BaseEntity?> subscriptions, EntityAction? action) {
|
List<BaseEntity?> subscriptions, EntityAction? action) {
|
||||||
if (subscriptions.isEmpty) {
|
if (subscriptions.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ class SortTasksFailure implements StopSaving {
|
||||||
class FilterTasks implements PersistUI {
|
class FilterTasks implements PersistUI {
|
||||||
FilterTasks(this.filter);
|
FilterTasks(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTasks implements PersistUI, PersistPrefs {
|
class SortTasks implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ InvoiceItemEntity convertTaskToInvoiceItem({
|
||||||
final date = formatDate(time.startDate!.toIso8601String(), context,
|
final date = formatDate(time.startDate!.toIso8601String(), context,
|
||||||
showTime: false);
|
showTime: false);
|
||||||
if (dates.containsKey(date)) {
|
if (dates.containsKey(date)) {
|
||||||
dates[date] += hours;
|
dates[date] = dates[date]! + hours;
|
||||||
} else {
|
} else {
|
||||||
dates[date] = hours;
|
dates[date] = hours;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ class RestoreTaskStatusesFailure implements StopSaving {
|
||||||
class FilterTaskStatuses implements PersistUI {
|
class FilterTaskStatuses implements PersistUI {
|
||||||
FilterTaskStatuses(this.filter);
|
FilterTaskStatuses(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTaskStatuses implements PersistUI, PersistPrefs {
|
class SortTaskStatuses implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -265,8 +265,8 @@ class ClearTaskStatusMultiselect {
|
||||||
ClearTaskStatusMultiselect();
|
ClearTaskStatusMultiselect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTaskStatusAction(
|
void handleTaskStatusAction(BuildContext? context,
|
||||||
BuildContext? context, List<BaseEntity?> taskStatuses, EntityAction? action) {
|
List<BaseEntity?> taskStatuses, EntityAction? action) {
|
||||||
if (taskStatuses.isEmpty) {
|
if (taskStatuses.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ class RestoreTaxRateFailure implements StopSaving {
|
||||||
class FilterTaxRates implements PersistUI {
|
class FilterTaxRates implements PersistUI {
|
||||||
FilterTaxRates(this.filter);
|
FilterTaxRates(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTaxRates implements PersistUI, PersistPrefs {
|
class SortTaxRates implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ class RestoreTokensFailure implements StopSaving {
|
||||||
class FilterTokens implements PersistUI {
|
class FilterTokens implements PersistUI {
|
||||||
FilterTokens(this.filter);
|
FilterTokens(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTokens implements PersistUI, PersistPrefs {
|
class SortTokens implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ class ConvertTransactionsFailure implements StopSaving {
|
||||||
class FilterTransactions implements PersistUI {
|
class FilterTransactions implements PersistUI {
|
||||||
FilterTransactions(this.filter);
|
FilterTransactions(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTransactions implements PersistUI, PersistPrefs {
|
class SortTransactions implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -412,8 +412,8 @@ class UpdateTransactionTab implements PersistUI {
|
||||||
final int? tabIndex;
|
final int? tabIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTransactionAction(
|
void handleTransactionAction(BuildContext? context,
|
||||||
BuildContext? context, List<BaseEntity?> transactions, EntityAction? action) {
|
List<BaseEntity?> transactions, EntityAction? action) {
|
||||||
if (transactions.isEmpty) {
|
if (transactions.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ class RestoreTransactionRulesFailure implements StopSaving {
|
||||||
class FilterTransactionRules implements PersistUI {
|
class FilterTransactionRules implements PersistUI {
|
||||||
FilterTransactionRules(this.filter);
|
FilterTransactionRules(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortTransactionRules implements PersistUI, PersistPrefs {
|
class SortTransactionRules implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -292,7 +292,8 @@ void handleTransactionRuleAction(BuildContext? context,
|
||||||
break;
|
break;
|
||||||
case EntityAction.delete:
|
case EntityAction.delete:
|
||||||
store.dispatch(DeleteTransactionRulesRequest(
|
store.dispatch(DeleteTransactionRulesRequest(
|
||||||
snackBarCompleter<Null>(context, localization!.deletedTransactionRule),
|
snackBarCompleter<Null>(
|
||||||
|
context, localization!.deletedTransactionRule),
|
||||||
transactionRuleIds));
|
transactionRuleIds));
|
||||||
break;
|
break;
|
||||||
case EntityAction.toggleMultiselect:
|
case EntityAction.toggleMultiselect:
|
||||||
|
|
|
||||||
|
|
@ -245,11 +245,13 @@ Reducer<bool> historyVisibleReducer = combineReducers([
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/*
|
||||||
Reducer<String> filterReducer = combineReducers([
|
Reducer<String> filterReducer = combineReducers([
|
||||||
TypedReducer<String, FilterCompany>((filter, action) {
|
TypedReducer<String, FilterCompany>((filter, action) {
|
||||||
return action.filter;
|
return action.filter;
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
*/
|
||||||
|
|
||||||
Reducer<bool> hideDesktopWarningReducer = combineReducers([
|
Reducer<bool> hideDesktopWarningReducer = combineReducers([
|
||||||
TypedReducer<bool, DismissNativeWarningPermanently>((filter, action) {
|
TypedReducer<bool, DismissNativeWarningPermanently>((filter, action) {
|
||||||
|
|
@ -513,8 +515,8 @@ Reducer<int> selectedCompanyIndexReducer = combineReducers([
|
||||||
CompanyPrefState companyPrefReducer(CompanyPrefState? state, dynamic action) {
|
CompanyPrefState companyPrefReducer(CompanyPrefState? state, dynamic action) {
|
||||||
state ??= CompanyPrefState();
|
state ??= CompanyPrefState();
|
||||||
|
|
||||||
return state.rebuild(
|
return state.rebuild((b) =>
|
||||||
(b) => b..historyList.replace(historyReducer(state!.historyList, action)));
|
b..historyList.replace(historyReducer(state!.historyList, action)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
Reducer<BuiltList<HistoryRecord>> historyReducer = combineReducers([
|
||||||
|
|
@ -907,8 +909,7 @@ BuiltList<HistoryRecord> _addToHistory(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final old =
|
final old = list.firstWhereOrNull((item) => item.matchesRecord(record));
|
||||||
list.firstWhereOrNull((item) => item.matchesRecord(record));
|
|
||||||
|
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
return list.rebuild((b) => b
|
return list.rebuild((b) => b
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,48 @@
|
||||||
// Package imports:
|
// Package imports:
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/bank_account/bank_account_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
import 'package:invoiceninja_flutter/redux/client/client_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/client/client_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/company_gateway/company_gateway_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/credit/credit_actions.dart';
|
import 'package:invoiceninja_flutter/redux/credit/credit_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/credit/credit_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/design/design_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/document/document_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/expense/expense_actions.dart';
|
import 'package:invoiceninja_flutter/redux/expense/expense_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/expense/expense_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/expense_category/expense_category_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/group/group_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
|
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/invoice/invoice_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
|
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/payment/payment_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/payment_term/payment_term_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/product/product_actions.dart';
|
import 'package:invoiceninja_flutter/redux/product/product_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/product/product_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
|
import 'package:invoiceninja_flutter/redux/project/project_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/project/project_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/purchase_order/purchase_order_actions.dart';
|
import 'package:invoiceninja_flutter/redux/purchase_order/purchase_order_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/purchase_order/purchase_order_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/quote/quote_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/recurring_expense/recurring_expense_actions.dart';
|
import 'package:invoiceninja_flutter/redux/recurring_expense/recurring_expense_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/recurring_expense/recurring_expense_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/recurring_invoice/recurring_invoice_actions.dart';
|
import 'package:invoiceninja_flutter/redux/recurring_invoice/recurring_invoice_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/recurring_invoice/recurring_invoice_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/schedule/schedule_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/subscription/subscription_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/task/task_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/task_status/task_status_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/tax_rate/tax_rate_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/token/token_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/transaction/transaction_actions.dart';
|
import 'package:invoiceninja_flutter/redux/transaction/transaction_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/transaction/transaction_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/transaction_rule/transaction_rule_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/user/user_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/vendor/vendor_actions.dart';
|
import 'package:invoiceninja_flutter/redux/vendor/vendor_actions.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/vendor/vendor_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/webhook/webhook_state.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
|
|
@ -80,50 +109,79 @@ UIState uiReducer(UIState state, dynamic action) {
|
||||||
..currentRoute = currentRoute
|
..currentRoute = currentRoute
|
||||||
..previewStack.replace(previewStackReducer(state.previewStack, action))
|
..previewStack.replace(previewStackReducer(state.previewStack, action))
|
||||||
..filterStack.replace(filterStackReducer(state.filterStack, action))
|
..filterStack.replace(filterStackReducer(state.filterStack, action))
|
||||||
..productUIState.replace(productUIReducer(state.productUIState, action) as ProductUIState)
|
..productUIState.replace(
|
||||||
..clientUIState.replace(clientUIReducer(state.clientUIState, action) as ClientUIState)
|
productUIReducer(state.productUIState, action) as ProductUIState)
|
||||||
..invoiceUIState.replace(invoiceUIReducer(state.invoiceUIState, action) as InvoiceUIState)
|
..clientUIState
|
||||||
|
.replace(clientUIReducer(state.clientUIState, action) as ClientUIState)
|
||||||
|
..invoiceUIState.replace(
|
||||||
|
invoiceUIReducer(state.invoiceUIState, action) as InvoiceUIState)
|
||||||
..dashboardUIState
|
..dashboardUIState
|
||||||
.replace(dashboardUIReducer(state.dashboardUIState, action))
|
.replace(dashboardUIReducer(state.dashboardUIState, action))
|
||||||
..reportsUIState.replace(reportsUIReducer(state.reportsUIState, action))
|
..reportsUIState.replace(reportsUIReducer(state.reportsUIState, action))
|
||||||
// STARTER: reducer - do not remove comment
|
// STARTER: reducer - do not remove comment
|
||||||
..scheduleUIState.replace(scheduleUIReducer(state.scheduleUIState, action) as ScheduleUIState)
|
..scheduleUIState.replace(
|
||||||
..transactionRuleUIState
|
scheduleUIReducer(state.scheduleUIState, action) as ScheduleUIState)
|
||||||
.replace(transactionRuleUIReducer(state.transactionRuleUIState, action) as TransactionRuleUIState)
|
..transactionRuleUIState.replace(
|
||||||
..transactionUIState
|
transactionRuleUIReducer(state.transactionRuleUIState, action)
|
||||||
.replace(transactionUIReducer(state.transactionUIState, action) as TransactionUIState)
|
as TransactionRuleUIState)
|
||||||
..bankAccountUIState
|
..transactionUIState.replace(
|
||||||
.replace(bankAccountUIReducer(state.bankAccountUIState, action) as BankAccountUIState)
|
transactionUIReducer(state.transactionUIState, action)
|
||||||
..purchaseOrderUIState
|
as TransactionUIState)
|
||||||
.replace(purchaseOrderUIReducer(state.purchaseOrderUIState, action) as PurchaseOrderUIState)
|
..bankAccountUIState.replace(
|
||||||
|
bankAccountUIReducer(state.bankAccountUIState, action)
|
||||||
|
as BankAccountUIState)
|
||||||
|
..purchaseOrderUIState.replace(
|
||||||
|
purchaseOrderUIReducer(state.purchaseOrderUIState, action)
|
||||||
|
as PurchaseOrderUIState)
|
||||||
..recurringExpenseUIState.replace(
|
..recurringExpenseUIState.replace(
|
||||||
recurringExpenseUIReducer(state.recurringExpenseUIState, action) as RecurringExpenseUIState)
|
recurringExpenseUIReducer(state.recurringExpenseUIState, action)
|
||||||
..subscriptionUIState
|
as RecurringExpenseUIState)
|
||||||
.replace(subscriptionUIReducer(state.subscriptionUIState, action) as SubscriptionUIState)
|
..subscriptionUIState.replace(
|
||||||
..taskStatusUIState
|
subscriptionUIReducer(state.subscriptionUIState, action)
|
||||||
.replace(taskStatusUIReducer(state.taskStatusUIState, action) as TaskStatusUIState)
|
as SubscriptionUIState)
|
||||||
..expenseCategoryUIState
|
..taskStatusUIState.replace(
|
||||||
.replace(expenseCategoryUIReducer(state.expenseCategoryUIState, action) as ExpenseCategoryUIState)
|
taskStatusUIReducer(state.taskStatusUIState, action)
|
||||||
|
as TaskStatusUIState)
|
||||||
|
..expenseCategoryUIState.replace(
|
||||||
|
expenseCategoryUIReducer(state.expenseCategoryUIState, action)
|
||||||
|
as ExpenseCategoryUIState)
|
||||||
..recurringInvoiceUIState.replace(
|
..recurringInvoiceUIState.replace(
|
||||||
recurringInvoiceUIReducer(state.recurringInvoiceUIState, action) as RecurringInvoiceUIState)
|
recurringInvoiceUIReducer(state.recurringInvoiceUIState, action)
|
||||||
..webhookUIState.replace(webhookUIReducer(state.webhookUIState, action) as WebhookUIState)
|
as RecurringInvoiceUIState)
|
||||||
..tokenUIState.replace(tokenUIReducer(state.tokenUIState, action) as TokenUIState)
|
..webhookUIState.replace(
|
||||||
..paymentTermUIState
|
webhookUIReducer(state.webhookUIState, action) as WebhookUIState)
|
||||||
.replace(paymentTermUIReducer(state.paymentTermUIState, action) as PaymentTermUIState)
|
..tokenUIState
|
||||||
..designUIState.replace(designUIReducer(state.designUIState, action) as DesignUIState)
|
.replace(tokenUIReducer(state.tokenUIState, action) as TokenUIState)
|
||||||
..creditUIState.replace(creditUIReducer(state.creditUIState, action) as CreditUIState)
|
..paymentTermUIState.replace(
|
||||||
..userUIState.replace(userUIReducer(state.userUIState, action) as UserUIState)
|
paymentTermUIReducer(state.paymentTermUIState, action)
|
||||||
..taxRateUIState.replace(taxRateUIReducer(state.taxRateUIState, action) as TaxRateUIState)
|
as PaymentTermUIState)
|
||||||
..companyGatewayUIState
|
..designUIState
|
||||||
.replace(companyGatewayUIReducer(state.companyGatewayUIState, action) as CompanyGatewayUIState)
|
.replace(designUIReducer(state.designUIState, action) as DesignUIState)
|
||||||
..groupUIState.replace(groupUIReducer(state.groupUIState, action) as GroupUIState)
|
..creditUIState
|
||||||
..documentUIState.replace(documentUIReducer(state.documentUIState, action) as DocumentUIState)
|
.replace(creditUIReducer(state.creditUIState, action) as CreditUIState)
|
||||||
..expenseUIState.replace(expenseUIReducer(state.expenseUIState, action) as ExpenseUIState)
|
..userUIState
|
||||||
..vendorUIState.replace(vendorUIReducer(state.vendorUIState, action) as VendorUIState)
|
.replace(userUIReducer(state.userUIState, action) as UserUIState)
|
||||||
..taskUIState.replace(taskUIReducer(state.taskUIState, action) as TaskUIState)
|
..taxRateUIState.replace(
|
||||||
..projectUIState.replace(projectUIReducer(state.projectUIState, action) as ProjectUIState)
|
taxRateUIReducer(state.taxRateUIState, action) as TaxRateUIState)
|
||||||
..paymentUIState.replace(paymentUIReducer(state.paymentUIState, action) as PaymentUIState)
|
..companyGatewayUIState.replace(
|
||||||
..quoteUIState.replace(quoteUIReducer(state.quoteUIState, action) as QuoteUIState)
|
companyGatewayUIReducer(state.companyGatewayUIState, action)
|
||||||
|
as CompanyGatewayUIState)
|
||||||
|
..groupUIState
|
||||||
|
.replace(groupUIReducer(state.groupUIState, action) as GroupUIState)
|
||||||
|
..documentUIState.replace(
|
||||||
|
documentUIReducer(state.documentUIState, action) as DocumentUIState)
|
||||||
|
..expenseUIState.replace(
|
||||||
|
expenseUIReducer(state.expenseUIState, action) as ExpenseUIState)
|
||||||
|
..vendorUIState
|
||||||
|
.replace(vendorUIReducer(state.vendorUIState, action) as VendorUIState)
|
||||||
|
..taskUIState
|
||||||
|
.replace(taskUIReducer(state.taskUIState, action) as TaskUIState)
|
||||||
|
..projectUIState.replace(
|
||||||
|
projectUIReducer(state.projectUIState, action) as ProjectUIState)
|
||||||
|
..paymentUIState.replace(
|
||||||
|
paymentUIReducer(state.paymentUIState, action) as PaymentUIState)
|
||||||
|
..quoteUIState
|
||||||
|
.replace(quoteUIReducer(state.quoteUIState, action) as QuoteUIState)
|
||||||
..settingsUIState
|
..settingsUIState
|
||||||
.replace(settingsUIReducer(state.settingsUIState, action)));
|
.replace(settingsUIReducer(state.settingsUIState, action)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ class ResendInviteFailure implements StopSaving {
|
||||||
class FilterUsers {
|
class FilterUsers {
|
||||||
FilterUsers(this.filter);
|
FilterUsers(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortUsers implements PersistUI, PersistPrefs {
|
class SortUsers implements PersistUI, PersistPrefs {
|
||||||
|
|
@ -409,8 +409,8 @@ void handleUserAction(
|
||||||
case EntityAction.newTask:
|
case EntityAction.newTask:
|
||||||
createEntity(
|
createEntity(
|
||||||
context: context,
|
context: context,
|
||||||
entity:
|
entity: TaskEntity(state: state)
|
||||||
TaskEntity(state: state).rebuild((b) => b.assignedUserId = user!.id),
|
.rebuild((b) => b.assignedUserId = user!.id),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EntityAction.newVendor:
|
case EntityAction.newVendor:
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ class DeleteVendorContact implements PersistUI {
|
||||||
class FilterVendors implements PersistUI {
|
class FilterVendors implements PersistUI {
|
||||||
FilterVendors(this.filter);
|
FilterVendors(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortVendors implements PersistUI, PersistPrefs {
|
class SortVendors implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ class RestoreWebhooksFailure implements StopSaving {
|
||||||
class FilterWebhooks implements PersistUI {
|
class FilterWebhooks implements PersistUI {
|
||||||
FilterWebhooks(this.filter);
|
FilterWebhooks(this.filter);
|
||||||
|
|
||||||
final String filter;
|
final String? filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortWebhooks implements PersistUI, PersistPrefs {
|
class SortWebhooks implements PersistUI, PersistPrefs {
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
||||||
vendorId: invoice.vendorId,
|
vendorId: invoice.vendorId,
|
||||||
vendorState: state.vendorState,
|
vendorState: state.vendorState,
|
||||||
onSelected: (vendor) {
|
onSelected: (vendor) {
|
||||||
viewModel.onVendorChanged!(context, invoice, vendor as VendorEntity);
|
viewModel.onVendorChanged!(
|
||||||
|
context, invoice, vendor as VendorEntity);
|
||||||
},
|
},
|
||||||
onAddPressed: (completer) =>
|
onAddPressed: (completer) =>
|
||||||
viewModel.onAddVendorPressed!(context, completer),
|
viewModel.onAddVendorPressed!(context, completer),
|
||||||
|
|
@ -180,8 +181,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
||||||
: ClientPicker(
|
: ClientPicker(
|
||||||
clientId: invoice.clientId,
|
clientId: invoice.clientId,
|
||||||
clientState: state.clientState,
|
clientState: state.clientState,
|
||||||
onSelected: (client) =>
|
onSelected: (client) => viewModel.onClientChanged!(
|
||||||
viewModel.onClientChanged!(context, invoice, client as ClientEntity?),
|
context, invoice, client as ClientEntity?),
|
||||||
onAddPressed: (completer) =>
|
onAddPressed: (completer) =>
|
||||||
viewModel.onAddClientPressed!(context, completer),
|
viewModel.onAddClientPressed!(context, completer),
|
||||||
)
|
)
|
||||||
|
|
@ -198,7 +199,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
||||||
validator: (String val) => val.trim().isEmpty &&
|
validator: (String val) => val.trim().isEmpty &&
|
||||||
invoice.isOld &&
|
invoice.isOld &&
|
||||||
originalInvoice!.number.isNotEmpty
|
originalInvoice!.number.isNotEmpty
|
||||||
? AppLocalization.of(context)!.pleaseEnterAnInvoiceNumber
|
? AppLocalization.of(context)!
|
||||||
|
.pleaseEnterAnInvoiceNumber
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
UserPicker(
|
UserPicker(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue