Working on reversing invoices
This commit is contained in:
parent
0e03178b06
commit
a9560b27f1
|
|
@ -961,11 +961,9 @@ abstract class InvoiceEntity extends Object
|
|||
actions.add(EntityAction.cancel);
|
||||
}
|
||||
|
||||
/*
|
||||
if (userCompany.canCreate(EntityType.credit)) {
|
||||
actions.add(EntityAction.reverse);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,25 +304,6 @@ class MarkInvoicesPaidFailure implements StopSaving {
|
|||
final dynamic error;
|
||||
}
|
||||
|
||||
class ReverseInvoicesRequest implements StartSaving {
|
||||
ReverseInvoicesRequest(this.completer, this.invoiceIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> invoiceIds;
|
||||
}
|
||||
|
||||
class ReverseInvoicesSuccess implements StopSaving {
|
||||
ReverseInvoicesSuccess(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class ReverseInvoicesFailure implements StopSaving {
|
||||
ReverseInvoicesFailure(this.error);
|
||||
|
||||
final Object error;
|
||||
}
|
||||
|
||||
class CancelInvoicesRequest implements StartSaving {
|
||||
CancelInvoicesRequest(this.completer, this.invoiceIds);
|
||||
|
||||
|
|
@ -549,13 +530,6 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
invoiceIds));
|
||||
break;
|
||||
case EntityAction.reverse:
|
||||
store.dispatch(ReverseInvoicesRequest(
|
||||
snackBarCompleter<Null>(
|
||||
context,
|
||||
invoiceIds.length == 1
|
||||
? localization.reversedInvoice
|
||||
: localization.reversedInvoices),
|
||||
invoiceIds));
|
||||
break;
|
||||
case EntityAction.cancel:
|
||||
store.dispatch(CancelInvoicesRequest(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ List<Middleware<AppState>> createStoreInvoicesMiddleware([
|
|||
final bulkEmailInvoices = _bulkEmailInvoices(repository);
|
||||
final markInvoiceSent = _markInvoiceSent(repository);
|
||||
final markInvoicePaid = _markInvoicePaid(repository);
|
||||
final reverseInvoices = _reverseInvoices(repository);
|
||||
final cancelInvoices = _cancelInvoices(repository);
|
||||
final downloadInvoices = _downloadInvoices(repository);
|
||||
final saveDocument = _saveDocument(repository);
|
||||
|
|
@ -59,7 +58,6 @@ List<Middleware<AppState>> createStoreInvoicesMiddleware([
|
|||
TypedMiddleware<AppState, BulkEmailInvoicesRequest>(bulkEmailInvoices),
|
||||
TypedMiddleware<AppState, MarkInvoicesSentRequest>(markInvoiceSent),
|
||||
TypedMiddleware<AppState, MarkInvoicesPaidRequest>(markInvoicePaid),
|
||||
TypedMiddleware<AppState, ReverseInvoicesRequest>(reverseInvoices),
|
||||
TypedMiddleware<AppState, CancelInvoicesRequest>(cancelInvoices),
|
||||
TypedMiddleware<AppState, DownloadInvoicesRequest>(downloadInvoices),
|
||||
TypedMiddleware<AppState, SaveInvoiceDocumentRequest>(saveDocument),
|
||||
|
|
@ -173,30 +171,6 @@ Middleware<AppState> _cancelInvoices(InvoiceRepository repository) {
|
|||
};
|
||||
}
|
||||
|
||||
Middleware<AppState> _reverseInvoices(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ReverseInvoicesRequest;
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.reverse)
|
||||
.then((List<InvoiceEntity> invoices) {
|
||||
store.dispatch(ReverseInvoicesSuccess(invoices));
|
||||
store.dispatch(RefreshData());
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(ReverseInvoicesFailure(error));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
});
|
||||
|
||||
next(action);
|
||||
};
|
||||
}
|
||||
|
||||
Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchiveInvoicesRequest;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,6 @@ final invoicesReducer = combineReducers<InvoiceState>([
|
|||
TypedReducer<InvoiceState, LoadInvoiceSuccess>(_updateInvoice),
|
||||
TypedReducer<InvoiceState, MarkInvoicesSentSuccess>(_markInvoicesSentSuccess),
|
||||
TypedReducer<InvoiceState, MarkInvoicesPaidSuccess>(_markInvoicesPaidSuccess),
|
||||
TypedReducer<InvoiceState, ReverseInvoicesSuccess>(_reverseInvoicesSuccess),
|
||||
TypedReducer<InvoiceState, CancelInvoicesSuccess>(_cancelInvoicesSuccess),
|
||||
TypedReducer<InvoiceState, EmailInvoiceSuccess>(_emailInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, ArchiveInvoicesSuccess>(_archiveInvoiceSuccess),
|
||||
|
|
@ -338,15 +337,6 @@ InvoiceState _markInvoicesPaidSuccess(
|
|||
});
|
||||
}
|
||||
|
||||
InvoiceState _reverseInvoicesSuccess(
|
||||
InvoiceState invoiceState, ReverseInvoicesSuccess action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
InvoiceState _cancelInvoicesSuccess(
|
||||
InvoiceState invoiceState, CancelInvoicesSuccess action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
|
||||
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
|
||||
//#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
|
||||
//auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);
|
||||
|
||||
#include <flutter/dart_project.h>
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue