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