Archive/delete
This commit is contained in:
parent
e2b83bbd83
commit
847bec3a75
|
|
@ -260,7 +260,7 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -456,7 +456,7 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
@ -553,7 +553,7 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -656,7 +656,7 @@ class _$ContactEntitySerializer implements StructuredSerializer<ContactEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class _$CompanyGatewayEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ class _$CompanyGatewayEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -587,7 +587,7 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class _$CreditEntitySerializer implements StructuredSerializer<CreditEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ class _$CreditEntitySerializer implements StructuredSerializer<CreditEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class _$DocumentEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ class _$DocumentEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ abstract class BaseEntity implements SelectableEntity {
|
|||
int get updatedAt;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'archived_at')
|
||||
@BuiltValueField(wireName: 'deleted_at')
|
||||
int get archivedAt;
|
||||
|
||||
@nullable
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ class _$ExpenseEntitySerializer implements StructuredSerializer<ExpenseEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ class _$ExpenseEntitySerializer implements StructuredSerializer<ExpenseEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
@ -477,7 +477,7 @@ class _$ExpenseCategoryEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ class _$ExpenseCategoryEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class _$GatewayTokenEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ class _$GatewayTokenEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ class _$GroupEntitySerializer implements StructuredSerializer<GroupEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -527,7 +527,7 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
@ -780,7 +780,7 @@ class _$InvitationEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -855,7 +855,7 @@ class _$InvitationEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ class _$PaymentEntitySerializer implements StructuredSerializer<PaymentEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ class _$PaymentEntitySerializer implements StructuredSerializer<PaymentEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -324,7 +324,7 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -263,7 +263,7 @@ class _$ProjectEntitySerializer implements StructuredSerializer<ProjectEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ class _$QuoteEntitySerializer implements StructuredSerializer<QuoteEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -512,7 +512,7 @@ class _$QuoteEntitySerializer implements StructuredSerializer<QuoteEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
@ -584,7 +584,7 @@ class _$InvitationEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -659,7 +659,7 @@ class _$InvitationEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ class _$TaskEntitySerializer implements StructuredSerializer<TaskEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ class _$TaskEntitySerializer implements StructuredSerializer<TaskEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -263,7 +263,7 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
@ -413,7 +413,7 @@ class _$VendorContactEntitySerializer
|
|||
}
|
||||
if (object.archivedAt != null) {
|
||||
result
|
||||
..add('archived_at')
|
||||
..add('deleted_at')
|
||||
..add(serializers.serialize(object.archivedAt,
|
||||
specifiedType: const FullType(int)));
|
||||
}
|
||||
|
|
@ -488,7 +488,7 @@ class _$VendorContactEntitySerializer
|
|||
result.updatedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
case 'archived_at':
|
||||
case 'deleted_at':
|
||||
result.archivedAt = serializers.deserialize(value,
|
||||
specifiedType: const FullType(int)) as int;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -176,46 +176,46 @@ class SaveClientFailure implements StopSaving {
|
|||
final Object error;
|
||||
}
|
||||
|
||||
class ArchiveClientRequest implements StartSaving {
|
||||
ArchiveClientRequest(this.completer, this.clientIds);
|
||||
class ArchiveClientsRequest implements StartSaving {
|
||||
ArchiveClientsRequest(this.completer, this.clientIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> clientIds;
|
||||
}
|
||||
|
||||
class ArchiveClientSuccess implements StopSaving, PersistData {
|
||||
ArchiveClientSuccess(this.clients);
|
||||
class ArchiveClientsSuccess implements StopSaving, PersistData {
|
||||
ArchiveClientsSuccess(this.clients);
|
||||
|
||||
final List<ClientEntity> clients;
|
||||
}
|
||||
|
||||
class ArchiveClientFailure implements StopSaving {
|
||||
ArchiveClientFailure(this.clients);
|
||||
class ArchiveClientsFailure implements StopSaving {
|
||||
ArchiveClientsFailure(this.clients);
|
||||
|
||||
final List<ClientEntity> clients;
|
||||
}
|
||||
|
||||
class DeleteClientRequest implements StartSaving {
|
||||
DeleteClientRequest(this.completer, this.clientIds);
|
||||
class DeleteClientsRequest implements StartSaving {
|
||||
DeleteClientsRequest(this.completer, this.clientIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> clientIds;
|
||||
}
|
||||
|
||||
class DeleteClientSuccess implements StopSaving, PersistData {
|
||||
DeleteClientSuccess(this.clients);
|
||||
class DeleteClientsSuccess implements StopSaving, PersistData {
|
||||
DeleteClientsSuccess(this.clients);
|
||||
|
||||
final List<ClientEntity> clients;
|
||||
}
|
||||
|
||||
class DeleteClientFailure implements StopSaving {
|
||||
DeleteClientFailure(this.clients);
|
||||
class DeleteClientsFailure implements StopSaving {
|
||||
DeleteClientsFailure(this.clients);
|
||||
|
||||
final List<ClientEntity> clients;
|
||||
}
|
||||
|
||||
class RestoreClientRequest implements StartSaving {
|
||||
RestoreClientRequest(this.completer, this.clientIds);
|
||||
class RestoreClientsRequest implements StartSaving {
|
||||
RestoreClientsRequest(this.completer, this.clientIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> clientIds;
|
||||
|
|
@ -373,17 +373,17 @@ void handleClientAction(
|
|||
.rebuild((b) => b.clientId = client.id));
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestoreClientRequest(
|
||||
store.dispatch(RestoreClientsRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredClient),
|
||||
clientIds));
|
||||
break;
|
||||
case EntityAction.archive:
|
||||
store.dispatch(ArchiveClientRequest(
|
||||
store.dispatch(ArchiveClientsRequest(
|
||||
snackBarCompleter<Null>(context, localization.archivedClient),
|
||||
clientIds));
|
||||
break;
|
||||
case EntityAction.delete:
|
||||
store.dispatch(DeleteClientRequest(
|
||||
store.dispatch(DeleteClientsRequest(
|
||||
snackBarCompleter<Null>(context, localization.deletedClient),
|
||||
clientIds));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ List<Middleware<AppState>> createStoreClientsMiddleware([
|
|||
TypedMiddleware<AppState, LoadClients>(loadClients),
|
||||
TypedMiddleware<AppState, LoadClient>(loadClient),
|
||||
TypedMiddleware<AppState, SaveClientRequest>(saveClient),
|
||||
TypedMiddleware<AppState, ArchiveClientRequest>(archiveClient),
|
||||
TypedMiddleware<AppState, DeleteClientRequest>(deleteClient),
|
||||
TypedMiddleware<AppState, RestoreClientRequest>(restoreClient),
|
||||
TypedMiddleware<AppState, ArchiveClientsRequest>(archiveClient),
|
||||
TypedMiddleware<AppState, DeleteClientsRequest>(deleteClient),
|
||||
TypedMiddleware<AppState, RestoreClientsRequest>(restoreClient),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -104,20 +104,20 @@ Middleware<AppState> _viewClientList() {
|
|||
|
||||
Middleware<AppState> _archiveClient(ClientRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchiveClientRequest;
|
||||
final action = dynamicAction as ArchiveClientsRequest;
|
||||
final prevClients =
|
||||
action.clientIds.map((id) => store.state.clientState.map[id]).toList();
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.clientIds, EntityAction.archive)
|
||||
.then((List<ClientEntity> clients) {
|
||||
store.dispatch(ArchiveClientSuccess(clients));
|
||||
store.dispatch(ArchiveClientsSuccess(clients));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(ArchiveClientFailure(prevClients));
|
||||
store.dispatch(ArchiveClientsFailure(prevClients));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -129,20 +129,20 @@ Middleware<AppState> _archiveClient(ClientRepository repository) {
|
|||
|
||||
Middleware<AppState> _deleteClient(ClientRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DeleteClientRequest;
|
||||
final action = dynamicAction as DeleteClientsRequest;
|
||||
final prevClients =
|
||||
action.clientIds.map((id) => store.state.clientState.map[id]).toList();
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.clientIds, EntityAction.delete)
|
||||
.then((List<ClientEntity> clients) {
|
||||
store.dispatch(DeleteClientSuccess(clients));
|
||||
store.dispatch(DeleteClientsSuccess(clients));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(DeleteClientFailure(prevClients));
|
||||
store.dispatch(DeleteClientsFailure(prevClients));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ Middleware<AppState> _deleteClient(ClientRepository repository) {
|
|||
|
||||
Middleware<AppState> _restoreClient(ClientRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as RestoreClientRequest;
|
||||
final action = dynamicAction as RestoreClientsRequest;
|
||||
final prevClients =
|
||||
action.clientIds.map((id) => store.state.clientState.map[id]).toList();
|
||||
repository
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ final editingReducer = combineReducers<ClientEntity>([
|
|||
TypedReducer<ClientEntity, RestoreClientSuccess>((clients, action) {
|
||||
return action.clients[0];
|
||||
}),
|
||||
TypedReducer<ClientEntity, ArchiveClientSuccess>((clients, action) {
|
||||
TypedReducer<ClientEntity, ArchiveClientsSuccess>((clients, action) {
|
||||
return action.clients[0];
|
||||
}),
|
||||
TypedReducer<ClientEntity, DeleteClientSuccess>((clients, action) {
|
||||
TypedReducer<ClientEntity, DeleteClientsSuccess>((clients, action) {
|
||||
return action.clients[0];
|
||||
}),
|
||||
TypedReducer<ClientEntity, EditClient>((client, action) {
|
||||
|
|
@ -211,19 +211,19 @@ final clientsReducer = combineReducers<ClientState>([
|
|||
TypedReducer<ClientState, AddClientSuccess>(_addClient),
|
||||
TypedReducer<ClientState, LoadClientsSuccess>(_setLoadedClients),
|
||||
TypedReducer<ClientState, LoadClientSuccess>(_setLoadedClient),
|
||||
TypedReducer<ClientState, ArchiveClientRequest>(_archiveClientRequest),
|
||||
TypedReducer<ClientState, ArchiveClientSuccess>(_archiveClientSuccess),
|
||||
TypedReducer<ClientState, ArchiveClientFailure>(_archiveClientFailure),
|
||||
TypedReducer<ClientState, DeleteClientRequest>(_deleteClientRequest),
|
||||
TypedReducer<ClientState, DeleteClientSuccess>(_deleteClientSuccess),
|
||||
TypedReducer<ClientState, DeleteClientFailure>(_deleteClientFailure),
|
||||
TypedReducer<ClientState, RestoreClientRequest>(_restoreClientRequest),
|
||||
TypedReducer<ClientState, ArchiveClientsRequest>(_archiveClientRequest),
|
||||
TypedReducer<ClientState, ArchiveClientsSuccess>(_archiveClientSuccess),
|
||||
TypedReducer<ClientState, ArchiveClientsFailure>(_archiveClientFailure),
|
||||
TypedReducer<ClientState, DeleteClientsRequest>(_deleteClientRequest),
|
||||
TypedReducer<ClientState, DeleteClientsSuccess>(_deleteClientSuccess),
|
||||
TypedReducer<ClientState, DeleteClientsFailure>(_deleteClientFailure),
|
||||
TypedReducer<ClientState, RestoreClientsRequest>(_restoreClientRequest),
|
||||
TypedReducer<ClientState, RestoreClientSuccess>(_restoreClientSuccess),
|
||||
TypedReducer<ClientState, RestoreClientFailure>(_restoreClientFailure),
|
||||
]);
|
||||
|
||||
ClientState _archiveClientRequest(
|
||||
ClientState clientState, ArchiveClientRequest action) {
|
||||
ClientState clientState, ArchiveClientsRequest action) {
|
||||
final clients = action.clientIds.map((id) => clientState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < clients.length; i++) {
|
||||
|
|
@ -238,7 +238,7 @@ ClientState _archiveClientRequest(
|
|||
}
|
||||
|
||||
ClientState _archiveClientSuccess(
|
||||
ClientState clientState, ArchiveClientSuccess action) {
|
||||
ClientState clientState, ArchiveClientsSuccess action) {
|
||||
return clientState.rebuild((b) {
|
||||
for (final client in action.clients) {
|
||||
b.map[client.id] = client;
|
||||
|
|
@ -247,7 +247,7 @@ ClientState _archiveClientSuccess(
|
|||
}
|
||||
|
||||
ClientState _archiveClientFailure(
|
||||
ClientState clientState, ArchiveClientFailure action) {
|
||||
ClientState clientState, ArchiveClientsFailure action) {
|
||||
return clientState.rebuild((b) {
|
||||
for (final client in action.clients) {
|
||||
b.map[client.id] = client;
|
||||
|
|
@ -256,7 +256,7 @@ ClientState _archiveClientFailure(
|
|||
}
|
||||
|
||||
ClientState _deleteClientRequest(
|
||||
ClientState clientState, DeleteClientRequest action) {
|
||||
ClientState clientState, DeleteClientsRequest action) {
|
||||
final clients = action.clientIds.map((id) => clientState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < clients.length; i++) {
|
||||
|
|
@ -272,7 +272,7 @@ ClientState _deleteClientRequest(
|
|||
}
|
||||
|
||||
ClientState _deleteClientSuccess(
|
||||
ClientState clientState, DeleteClientSuccess action) {
|
||||
ClientState clientState, DeleteClientsSuccess action) {
|
||||
return clientState.rebuild((b) {
|
||||
for (final client in action.clients) {
|
||||
b.map[client.id] = client;
|
||||
|
|
@ -281,7 +281,7 @@ ClientState _deleteClientSuccess(
|
|||
}
|
||||
|
||||
ClientState _deleteClientFailure(
|
||||
ClientState clientState, DeleteClientFailure action) {
|
||||
ClientState clientState, DeleteClientsFailure action) {
|
||||
return clientState.rebuild((b) {
|
||||
for (final client in action.clients) {
|
||||
b.map[client.id] = client;
|
||||
|
|
@ -290,7 +290,7 @@ ClientState _deleteClientFailure(
|
|||
}
|
||||
|
||||
ClientState _restoreClientRequest(
|
||||
ClientState clientState, RestoreClientRequest action) {
|
||||
ClientState clientState, RestoreClientsRequest action) {
|
||||
final clients = action.clientIds.map((id) => clientState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < clients.length; i++) {
|
||||
|
|
|
|||
|
|
@ -252,59 +252,59 @@ class MarkInvoicesPaidFailure implements StopSaving {
|
|||
final dynamic error;
|
||||
}
|
||||
|
||||
class ArchiveInvoiceRequest implements StartSaving {
|
||||
ArchiveInvoiceRequest(this.completer, this.invoiceIds);
|
||||
class ArchiveInvoicesRequest implements StartSaving {
|
||||
ArchiveInvoicesRequest(this.completer, this.invoiceIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> invoiceIds;
|
||||
}
|
||||
|
||||
class ArchiveInvoiceSuccess implements StopSaving, PersistData {
|
||||
ArchiveInvoiceSuccess(this.invoices);
|
||||
class ArchiveInvoicesSuccess implements StopSaving, PersistData {
|
||||
ArchiveInvoicesSuccess(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class ArchiveInvoiceFailure implements StopSaving {
|
||||
ArchiveInvoiceFailure(this.invoices);
|
||||
class ArchiveInvoicesFailure implements StopSaving {
|
||||
ArchiveInvoicesFailure(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class DeleteInvoiceRequest implements StartSaving {
|
||||
DeleteInvoiceRequest(this.completer, this.invoiceIds);
|
||||
class DeleteInvoicesRequest implements StartSaving {
|
||||
DeleteInvoicesRequest(this.completer, this.invoiceIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> invoiceIds;
|
||||
}
|
||||
|
||||
class DeleteInvoiceSuccess implements StopSaving, PersistData {
|
||||
DeleteInvoiceSuccess(this.invoices);
|
||||
class DeleteInvoicesSuccess implements StopSaving, PersistData {
|
||||
DeleteInvoicesSuccess(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class DeleteInvoiceFailure implements StopSaving {
|
||||
DeleteInvoiceFailure(this.invoices);
|
||||
class DeleteInvoicesFailure implements StopSaving {
|
||||
DeleteInvoicesFailure(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class RestoreInvoiceRequest implements StartSaving {
|
||||
RestoreInvoiceRequest(this.completer, this.invoiceIds);
|
||||
class RestoreInvoicesRequest implements StartSaving {
|
||||
RestoreInvoicesRequest(this.completer, this.invoiceIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> invoiceIds;
|
||||
}
|
||||
|
||||
class RestoreInvoiceSuccess implements StopSaving, PersistData {
|
||||
RestoreInvoiceSuccess(this.invoices);
|
||||
class RestoreInvoicesSuccess implements StopSaving, PersistData {
|
||||
RestoreInvoicesSuccess(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
||||
class RestoreInvoiceFailure implements StopSaving {
|
||||
RestoreInvoiceFailure(this.invoices);
|
||||
class RestoreInvoicesFailure implements StopSaving {
|
||||
RestoreInvoicesFailure(this.invoices);
|
||||
|
||||
final List<InvoiceEntity> invoices;
|
||||
}
|
||||
|
|
@ -436,17 +436,17 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
.toList())));
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestoreInvoiceRequest(
|
||||
store.dispatch(RestoreInvoicesRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredInvoice),
|
||||
invoiceIds));
|
||||
break;
|
||||
case EntityAction.archive:
|
||||
store.dispatch(ArchiveInvoiceRequest(
|
||||
store.dispatch(ArchiveInvoicesRequest(
|
||||
snackBarCompleter<Null>(context, localization.archivedInvoice),
|
||||
invoiceIds));
|
||||
break;
|
||||
case EntityAction.delete:
|
||||
store.dispatch(DeleteInvoiceRequest(
|
||||
store.dispatch(DeleteInvoicesRequest(
|
||||
snackBarCompleter<Null>(context, localization.deletedInvoice),
|
||||
invoiceIds));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ List<Middleware<AppState>> createStoreInvoicesMiddleware([
|
|||
TypedMiddleware<AppState, LoadInvoices>(loadInvoices),
|
||||
TypedMiddleware<AppState, LoadInvoice>(loadInvoice),
|
||||
TypedMiddleware<AppState, SaveInvoiceRequest>(saveInvoice),
|
||||
TypedMiddleware<AppState, ArchiveInvoiceRequest>(archiveInvoice),
|
||||
TypedMiddleware<AppState, DeleteInvoiceRequest>(deleteInvoice),
|
||||
TypedMiddleware<AppState, RestoreInvoiceRequest>(restoreInvoice),
|
||||
TypedMiddleware<AppState, ArchiveInvoicesRequest>(archiveInvoice),
|
||||
TypedMiddleware<AppState, DeleteInvoicesRequest>(deleteInvoice),
|
||||
TypedMiddleware<AppState, RestoreInvoicesRequest>(restoreInvoice),
|
||||
TypedMiddleware<AppState, EmailInvoiceRequest>(emailInvoice),
|
||||
TypedMiddleware<AppState, MarkInvoicesSentRequest>(markInvoiceSent),
|
||||
TypedMiddleware<AppState, MarkInvoicesPaidRequest>(markInvoicePaid),
|
||||
|
|
@ -138,7 +138,7 @@ Middleware<AppState> _showEmailInvoice() {
|
|||
|
||||
Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchiveInvoiceRequest;
|
||||
final action = dynamicAction as ArchiveInvoicesRequest;
|
||||
final prevInvoices = action.invoiceIds
|
||||
.map((id) => store.state.invoiceState.map[id])
|
||||
.toList();
|
||||
|
|
@ -146,13 +146,13 @@ Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.archive)
|
||||
.then((List<InvoiceEntity> invoices) {
|
||||
store.dispatch(ArchiveInvoiceSuccess(invoices));
|
||||
store.dispatch(ArchiveInvoicesSuccess(invoices));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(ArchiveInvoiceFailure(prevInvoices));
|
||||
store.dispatch(ArchiveInvoicesFailure(prevInvoices));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ Middleware<AppState> _archiveInvoice(InvoiceRepository repository) {
|
|||
|
||||
Middleware<AppState> _deleteInvoice(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DeleteInvoiceRequest;
|
||||
final action = dynamicAction as DeleteInvoicesRequest;
|
||||
final prevInvoices = action.invoiceIds
|
||||
.map((id) => store.state.invoiceState.map[id])
|
||||
.toList();
|
||||
|
|
@ -172,14 +172,14 @@ Middleware<AppState> _deleteInvoice(InvoiceRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.delete)
|
||||
.then((List<InvoiceEntity> invoices) {
|
||||
store.dispatch(DeleteInvoiceSuccess(invoices));
|
||||
store.dispatch(DeleteInvoicesSuccess(invoices));
|
||||
store.dispatch(LoadClient(clientId: invoices.first.clientId));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(DeleteInvoiceFailure(prevInvoices));
|
||||
store.dispatch(DeleteInvoicesFailure(prevInvoices));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ Middleware<AppState> _deleteInvoice(InvoiceRepository repository) {
|
|||
|
||||
Middleware<AppState> _restoreInvoice(InvoiceRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as RestoreInvoiceRequest;
|
||||
final action = dynamicAction as RestoreInvoicesRequest;
|
||||
final prevInvoices = action.invoiceIds
|
||||
.map((id) => store.state.invoiceState.map[id])
|
||||
.toList();
|
||||
|
|
@ -199,14 +199,14 @@ Middleware<AppState> _restoreInvoice(InvoiceRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.restore)
|
||||
.then((List<InvoiceEntity> invoices) {
|
||||
store.dispatch(RestoreInvoiceSuccess(invoices));
|
||||
store.dispatch(RestoreInvoicesSuccess(invoices));
|
||||
store.dispatch(LoadClient(clientId: invoices.first.clientId));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(RestoreInvoiceFailure(prevInvoices));
|
||||
store.dispatch(RestoreInvoicesFailure(prevInvoices));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ final editingReducer = combineReducers<InvoiceEntity>([
|
|||
.where((contact) => contact.sendInvoice)
|
||||
.map((contact) => InvitationEntity(contactId: contact.id))));
|
||||
}),
|
||||
TypedReducer<InvoiceEntity, RestoreInvoiceSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, ArchiveInvoiceSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, DeleteInvoiceSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, RestoreInvoicesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, ArchiveInvoicesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, DeleteInvoicesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, AddInvoiceItem>(_addInvoiceItem),
|
||||
TypedReducer<InvoiceEntity, AddInvoiceItems>(_addInvoiceItems),
|
||||
TypedReducer<InvoiceEntity, DeleteInvoiceItem>(_removeInvoiceItem),
|
||||
|
|
@ -252,15 +252,15 @@ final invoicesReducer = combineReducers<InvoiceState>([
|
|||
TypedReducer<InvoiceState, LoadInvoiceSuccess>(_updateInvoice),
|
||||
TypedReducer<InvoiceState, MarkInvoicesSentSuccess>(_markInvoicesSentSuccess),
|
||||
TypedReducer<InvoiceState, MarkInvoicesPaidSuccess>(_markInvoicesPaidSuccess),
|
||||
TypedReducer<InvoiceState, ArchiveInvoiceRequest>(_archiveInvoiceRequest),
|
||||
TypedReducer<InvoiceState, ArchiveInvoiceSuccess>(_archiveInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, ArchiveInvoiceFailure>(_archiveInvoiceFailure),
|
||||
TypedReducer<InvoiceState, DeleteInvoiceRequest>(_deleteInvoiceRequest),
|
||||
TypedReducer<InvoiceState, DeleteInvoiceSuccess>(_deleteInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, DeleteInvoiceFailure>(_deleteInvoiceFailure),
|
||||
TypedReducer<InvoiceState, RestoreInvoiceRequest>(_restoreInvoiceRequest),
|
||||
TypedReducer<InvoiceState, RestoreInvoiceSuccess>(_restoreInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, RestoreInvoiceFailure>(_restoreInvoiceFailure),
|
||||
TypedReducer<InvoiceState, ArchiveInvoicesRequest>(_archiveInvoiceRequest),
|
||||
TypedReducer<InvoiceState, ArchiveInvoicesSuccess>(_archiveInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, ArchiveInvoicesFailure>(_archiveInvoiceFailure),
|
||||
TypedReducer<InvoiceState, DeleteInvoicesRequest>(_deleteInvoiceRequest),
|
||||
TypedReducer<InvoiceState, DeleteInvoicesSuccess>(_deleteInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, DeleteInvoicesFailure>(_deleteInvoiceFailure),
|
||||
TypedReducer<InvoiceState, RestoreInvoicesRequest>(_restoreInvoiceRequest),
|
||||
TypedReducer<InvoiceState, RestoreInvoicesSuccess>(_restoreInvoiceSuccess),
|
||||
TypedReducer<InvoiceState, RestoreInvoicesFailure>(_restoreInvoiceFailure),
|
||||
TypedReducer<InvoiceState, ConvertQuoteSuccess>(_convertQuoteSuccess),
|
||||
]);
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ InvoiceState _markInvoicesPaidSuccess(
|
|||
}
|
||||
|
||||
InvoiceState _archiveInvoiceRequest(
|
||||
InvoiceState invoiceState, ArchiveInvoiceRequest action) {
|
||||
InvoiceState invoiceState, ArchiveInvoicesRequest action) {
|
||||
final invoices = action.invoiceIds.map((id) => invoiceState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < invoices.length; i++) {
|
||||
|
|
@ -299,7 +299,7 @@ InvoiceState _archiveInvoiceRequest(
|
|||
}
|
||||
|
||||
InvoiceState _archiveInvoiceSuccess(
|
||||
InvoiceState invoiceState, ArchiveInvoiceSuccess action) {
|
||||
InvoiceState invoiceState, ArchiveInvoicesSuccess action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
@ -308,7 +308,7 @@ InvoiceState _archiveInvoiceSuccess(
|
|||
}
|
||||
|
||||
InvoiceState _archiveInvoiceFailure(
|
||||
InvoiceState invoiceState, ArchiveInvoiceFailure action) {
|
||||
InvoiceState invoiceState, ArchiveInvoicesFailure action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
@ -317,7 +317,7 @@ InvoiceState _archiveInvoiceFailure(
|
|||
}
|
||||
|
||||
InvoiceState _deleteInvoiceRequest(
|
||||
InvoiceState invoiceState, DeleteInvoiceRequest action) {
|
||||
InvoiceState invoiceState, DeleteInvoicesRequest action) {
|
||||
final invoices = action.invoiceIds.map((id) => invoiceState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < invoices.length; i++) {
|
||||
|
|
@ -333,7 +333,7 @@ InvoiceState _deleteInvoiceRequest(
|
|||
}
|
||||
|
||||
InvoiceState _deleteInvoiceSuccess(
|
||||
InvoiceState invoiceState, DeleteInvoiceSuccess action) {
|
||||
InvoiceState invoiceState, DeleteInvoicesSuccess action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
@ -342,7 +342,7 @@ InvoiceState _deleteInvoiceSuccess(
|
|||
}
|
||||
|
||||
InvoiceState _deleteInvoiceFailure(
|
||||
InvoiceState invoiceState, DeleteInvoiceFailure action) {
|
||||
InvoiceState invoiceState, DeleteInvoicesFailure action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
@ -351,7 +351,7 @@ InvoiceState _deleteInvoiceFailure(
|
|||
}
|
||||
|
||||
InvoiceState _restoreInvoiceRequest(
|
||||
InvoiceState invoiceState, RestoreInvoiceRequest action) {
|
||||
InvoiceState invoiceState, RestoreInvoicesRequest action) {
|
||||
final invoices = action.invoiceIds.map((id) => invoiceState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < invoices.length; i++) {
|
||||
|
|
@ -367,7 +367,7 @@ InvoiceState _restoreInvoiceRequest(
|
|||
}
|
||||
|
||||
InvoiceState _restoreInvoiceSuccess(
|
||||
InvoiceState invoiceState, RestoreInvoiceSuccess action) {
|
||||
InvoiceState invoiceState, RestoreInvoicesSuccess action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
@ -376,7 +376,7 @@ InvoiceState _restoreInvoiceSuccess(
|
|||
}
|
||||
|
||||
InvoiceState _restoreInvoiceFailure(
|
||||
InvoiceState invoiceState, RestoreInvoiceFailure action) {
|
||||
InvoiceState invoiceState, RestoreInvoicesFailure action) {
|
||||
return invoiceState.rebuild((b) {
|
||||
for (final invoice in action.invoices) {
|
||||
b.map[invoice.id] = invoice;
|
||||
|
|
|
|||
|
|
@ -143,59 +143,59 @@ class SavePaymentFailure implements StopSaving {
|
|||
final Object error;
|
||||
}
|
||||
|
||||
class ArchivePaymentRequest implements StartSaving {
|
||||
ArchivePaymentRequest(this.completer, this.paymentIds);
|
||||
class ArchivePaymentsRequest implements StartSaving {
|
||||
ArchivePaymentsRequest(this.completer, this.paymentIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> paymentIds;
|
||||
}
|
||||
|
||||
class ArchivePaymentSuccess implements StopSaving, PersistData {
|
||||
ArchivePaymentSuccess(this.payments);
|
||||
class ArchivePaymentsSuccess implements StopSaving, PersistData {
|
||||
ArchivePaymentsSuccess(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
||||
class ArchivePaymentFailure implements StopSaving {
|
||||
ArchivePaymentFailure(this.payments);
|
||||
class ArchivePaymentsFailure implements StopSaving {
|
||||
ArchivePaymentsFailure(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
||||
class DeletePaymentRequest implements StartSaving {
|
||||
DeletePaymentRequest(this.completer, this.paymentIds);
|
||||
class DeletePaymentsRequest implements StartSaving {
|
||||
DeletePaymentsRequest(this.completer, this.paymentIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> paymentIds;
|
||||
}
|
||||
|
||||
class DeletePaymentSuccess implements StopSaving, PersistData {
|
||||
DeletePaymentSuccess(this.payments);
|
||||
class DeletePaymentsSuccess implements StopSaving, PersistData {
|
||||
DeletePaymentsSuccess(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
||||
class DeletePaymentFailure implements StopSaving {
|
||||
DeletePaymentFailure(this.payments);
|
||||
class DeletePaymentsFailure implements StopSaving {
|
||||
DeletePaymentsFailure(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
||||
class RestorePaymentRequest implements StartSaving {
|
||||
RestorePaymentRequest(this.completer, this.paymentIds);
|
||||
class RestorePaymentsRequest implements StartSaving {
|
||||
RestorePaymentsRequest(this.completer, this.paymentIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> paymentIds;
|
||||
}
|
||||
|
||||
class RestorePaymentSuccess implements StopSaving, PersistData {
|
||||
RestorePaymentSuccess(this.payments);
|
||||
class RestorePaymentsSuccess implements StopSaving, PersistData {
|
||||
RestorePaymentsSuccess(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
||||
class RestorePaymentFailure implements StopSaving {
|
||||
RestorePaymentFailure(this.payments);
|
||||
class RestorePaymentsFailure implements StopSaving {
|
||||
RestorePaymentsFailure(this.payments);
|
||||
|
||||
final List<PaymentEntity> payments;
|
||||
}
|
||||
|
|
@ -295,17 +295,17 @@ void handlePaymentAction(
|
|||
payment));
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestorePaymentRequest(
|
||||
store.dispatch(RestorePaymentsRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredPayment),
|
||||
paymentIds));
|
||||
break;
|
||||
case EntityAction.archive:
|
||||
store.dispatch(ArchivePaymentRequest(
|
||||
store.dispatch(ArchivePaymentsRequest(
|
||||
snackBarCompleter<Null>(context, localization.archivedPayment),
|
||||
paymentIds));
|
||||
break;
|
||||
case EntityAction.delete:
|
||||
store.dispatch(DeletePaymentRequest(
|
||||
store.dispatch(DeletePaymentsRequest(
|
||||
snackBarCompleter<Null>(context, localization.deletedPayment),
|
||||
paymentIds));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ List<Middleware<AppState>> createStorePaymentsMiddleware([
|
|||
TypedMiddleware<AppState, LoadPayments>(loadPayments),
|
||||
//TypedMiddleware<AppState, LoadPayment>(loadPayment),
|
||||
TypedMiddleware<AppState, SavePaymentRequest>(savePayment),
|
||||
TypedMiddleware<AppState, ArchivePaymentRequest>(archivePayment),
|
||||
TypedMiddleware<AppState, DeletePaymentRequest>(deletePayment),
|
||||
TypedMiddleware<AppState, RestorePaymentRequest>(restorePayment),
|
||||
TypedMiddleware<AppState, ArchivePaymentsRequest>(archivePayment),
|
||||
TypedMiddleware<AppState, DeletePaymentsRequest>(deletePayment),
|
||||
TypedMiddleware<AppState, RestorePaymentsRequest>(restorePayment),
|
||||
TypedMiddleware<AppState, EmailPaymentRequest>(emailPayment),
|
||||
];
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ Middleware<AppState> _viewPaymentList() {
|
|||
|
||||
Middleware<AppState> _archivePayment(PaymentRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchivePaymentRequest;
|
||||
final action = dynamicAction as ArchivePaymentsRequest;
|
||||
final prevPayments = action.paymentIds
|
||||
.map((id) => store.state.paymentState.map[id])
|
||||
.toList();
|
||||
|
|
@ -112,13 +112,13 @@ Middleware<AppState> _archivePayment(PaymentRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.paymentIds, EntityAction.archive)
|
||||
.then((List<PaymentEntity> payments) {
|
||||
store.dispatch(ArchivePaymentSuccess(payments));
|
||||
store.dispatch(ArchivePaymentsSuccess(payments));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(ArchivePaymentFailure(prevPayments));
|
||||
store.dispatch(ArchivePaymentsFailure(prevPayments));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ Middleware<AppState> _archivePayment(PaymentRepository repository) {
|
|||
|
||||
Middleware<AppState> _deletePayment(PaymentRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DeletePaymentRequest;
|
||||
final action = dynamicAction as DeletePaymentsRequest;
|
||||
final prevPayments = action.paymentIds
|
||||
.map((id) => store.state.paymentState.map[id])
|
||||
.toList();
|
||||
|
|
@ -138,14 +138,14 @@ Middleware<AppState> _deletePayment(PaymentRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.paymentIds, EntityAction.delete)
|
||||
.then((List<PaymentEntity> payments) {
|
||||
store.dispatch(DeletePaymentSuccess(payments));
|
||||
store.dispatch(DeletePaymentsSuccess(payments));
|
||||
store.dispatch(LoadInvoice(invoiceId: payments.first.invoiceId));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(DeletePaymentFailure(prevPayments));
|
||||
store.dispatch(DeletePaymentsFailure(prevPayments));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ Middleware<AppState> _deletePayment(PaymentRepository repository) {
|
|||
|
||||
Middleware<AppState> _restorePayment(PaymentRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as RestorePaymentRequest;
|
||||
final action = dynamicAction as RestorePaymentsRequest;
|
||||
final prevPayments = action.paymentIds
|
||||
.map((id) => store.state.paymentState.map[id])
|
||||
.toList();
|
||||
|
|
@ -165,14 +165,14 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.paymentIds, EntityAction.restore)
|
||||
.then((List<PaymentEntity> payments) {
|
||||
store.dispatch(RestorePaymentSuccess(payments));
|
||||
store.dispatch(RestorePaymentsSuccess(payments));
|
||||
store.dispatch(LoadInvoice(invoiceId: payments.first.invoiceId));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(RestorePaymentFailure(prevPayments));
|
||||
store.dispatch(RestorePaymentsFailure(prevPayments));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ Reducer<String> selectedIdReducer = combineReducers([
|
|||
final editingReducer = combineReducers<PaymentEntity>([
|
||||
TypedReducer<PaymentEntity, SavePaymentSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, AddPaymentSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, RestorePaymentSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, ArchivePaymentSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, DeletePaymentSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, RestorePaymentsSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, ArchivePaymentsSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, DeletePaymentsSuccess>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, EditPayment>(_updateEditing),
|
||||
TypedReducer<PaymentEntity, UpdatePayment>((payment, action) {
|
||||
return action.payment.rebuild((b) => b..isChanged = true);
|
||||
|
|
@ -157,19 +157,19 @@ final paymentsReducer = combineReducers<PaymentState>([
|
|||
TypedReducer<PaymentState, AddPaymentSuccess>(_addPayment),
|
||||
TypedReducer<PaymentState, LoadPaymentsSuccess>(_setLoadedPayments),
|
||||
TypedReducer<PaymentState, LoadPaymentSuccess>(_setLoadedPayment),
|
||||
TypedReducer<PaymentState, ArchivePaymentRequest>(_archivePaymentRequest),
|
||||
TypedReducer<PaymentState, ArchivePaymentSuccess>(_archivePaymentSuccess),
|
||||
TypedReducer<PaymentState, ArchivePaymentFailure>(_archivePaymentFailure),
|
||||
TypedReducer<PaymentState, DeletePaymentRequest>(_deletePaymentRequest),
|
||||
TypedReducer<PaymentState, DeletePaymentSuccess>(_deletePaymentSuccess),
|
||||
TypedReducer<PaymentState, DeletePaymentFailure>(_deletePaymentFailure),
|
||||
TypedReducer<PaymentState, RestorePaymentRequest>(_restorePaymentRequest),
|
||||
TypedReducer<PaymentState, RestorePaymentSuccess>(_restorePaymentSuccess),
|
||||
TypedReducer<PaymentState, RestorePaymentFailure>(_restorePaymentFailure),
|
||||
TypedReducer<PaymentState, ArchivePaymentsRequest>(_archivePaymentRequest),
|
||||
TypedReducer<PaymentState, ArchivePaymentsSuccess>(_archivePaymentSuccess),
|
||||
TypedReducer<PaymentState, ArchivePaymentsFailure>(_archivePaymentFailure),
|
||||
TypedReducer<PaymentState, DeletePaymentsRequest>(_deletePaymentRequest),
|
||||
TypedReducer<PaymentState, DeletePaymentsSuccess>(_deletePaymentSuccess),
|
||||
TypedReducer<PaymentState, DeletePaymentsFailure>(_deletePaymentFailure),
|
||||
TypedReducer<PaymentState, RestorePaymentsRequest>(_restorePaymentRequest),
|
||||
TypedReducer<PaymentState, RestorePaymentsSuccess>(_restorePaymentSuccess),
|
||||
TypedReducer<PaymentState, RestorePaymentsFailure>(_restorePaymentFailure),
|
||||
]);
|
||||
|
||||
PaymentState _archivePaymentRequest(
|
||||
PaymentState paymentState, ArchivePaymentRequest action) {
|
||||
PaymentState paymentState, ArchivePaymentsRequest action) {
|
||||
final payments = action.paymentIds.map((id) => paymentState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < payments.length; i++) {
|
||||
|
|
@ -184,7 +184,7 @@ PaymentState _archivePaymentRequest(
|
|||
}
|
||||
|
||||
PaymentState _archivePaymentSuccess(
|
||||
PaymentState paymentState, ArchivePaymentSuccess action) {
|
||||
PaymentState paymentState, ArchivePaymentsSuccess action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
@ -193,7 +193,7 @@ PaymentState _archivePaymentSuccess(
|
|||
}
|
||||
|
||||
PaymentState _archivePaymentFailure(
|
||||
PaymentState paymentState, ArchivePaymentFailure action) {
|
||||
PaymentState paymentState, ArchivePaymentsFailure action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
@ -202,7 +202,7 @@ PaymentState _archivePaymentFailure(
|
|||
}
|
||||
|
||||
PaymentState _deletePaymentRequest(
|
||||
PaymentState paymentState, DeletePaymentRequest action) {
|
||||
PaymentState paymentState, DeletePaymentsRequest action) {
|
||||
final payments = action.paymentIds.map((id) => paymentState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < payments.length; i++) {
|
||||
|
|
@ -218,7 +218,7 @@ PaymentState _deletePaymentRequest(
|
|||
}
|
||||
|
||||
PaymentState _deletePaymentSuccess(
|
||||
PaymentState paymentState, DeletePaymentSuccess action) {
|
||||
PaymentState paymentState, DeletePaymentsSuccess action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
@ -227,7 +227,7 @@ PaymentState _deletePaymentSuccess(
|
|||
}
|
||||
|
||||
PaymentState _deletePaymentFailure(
|
||||
PaymentState paymentState, DeletePaymentFailure action) {
|
||||
PaymentState paymentState, DeletePaymentsFailure action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
@ -236,7 +236,7 @@ PaymentState _deletePaymentFailure(
|
|||
}
|
||||
|
||||
PaymentState _restorePaymentRequest(
|
||||
PaymentState paymentState, RestorePaymentRequest action) {
|
||||
PaymentState paymentState, RestorePaymentsRequest action) {
|
||||
final payments = action.paymentIds.map((id) => paymentState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < payments.length; i++) {
|
||||
|
|
@ -252,7 +252,7 @@ PaymentState _restorePaymentRequest(
|
|||
}
|
||||
|
||||
PaymentState _restorePaymentSuccess(
|
||||
PaymentState paymentState, RestorePaymentSuccess action) {
|
||||
PaymentState paymentState, RestorePaymentsSuccess action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
@ -261,7 +261,7 @@ PaymentState _restorePaymentSuccess(
|
|||
}
|
||||
|
||||
PaymentState _restorePaymentFailure(
|
||||
PaymentState paymentState, RestorePaymentFailure action) {
|
||||
PaymentState paymentState, RestorePaymentsFailure action) {
|
||||
return paymentState.rebuild((b) {
|
||||
for (final payment in action.payments) {
|
||||
b.map[payment.id] = payment;
|
||||
|
|
|
|||
|
|
@ -105,59 +105,59 @@ class SaveProductFailure implements StopSaving {
|
|||
final Object error;
|
||||
}
|
||||
|
||||
class ArchiveProductRequest implements StartSaving {
|
||||
ArchiveProductRequest(this.completer, this.productIds);
|
||||
class ArchiveProductsRequest implements StartSaving {
|
||||
ArchiveProductsRequest(this.completer, this.productIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> productIds;
|
||||
}
|
||||
|
||||
class ArchiveProductSuccess implements StopSaving, PersistData {
|
||||
ArchiveProductSuccess(this.products);
|
||||
class ArchiveProductsSuccess implements StopSaving, PersistData {
|
||||
ArchiveProductsSuccess(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
||||
class ArchiveProductFailure implements StopSaving {
|
||||
ArchiveProductFailure(this.products);
|
||||
class ArchiveProductsFailure implements StopSaving {
|
||||
ArchiveProductsFailure(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
||||
class DeleteProductRequest implements StartSaving {
|
||||
DeleteProductRequest(this.completer, this.productIds);
|
||||
class DeleteProductsRequest implements StartSaving {
|
||||
DeleteProductsRequest(this.completer, this.productIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> productIds;
|
||||
}
|
||||
|
||||
class DeleteProductSuccess implements StopSaving, PersistData {
|
||||
DeleteProductSuccess(this.products);
|
||||
class DeleteProductsSuccess implements StopSaving, PersistData {
|
||||
DeleteProductsSuccess(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
||||
class DeleteProductFailure implements StopSaving {
|
||||
DeleteProductFailure(this.products);
|
||||
class DeleteProductsFailure implements StopSaving {
|
||||
DeleteProductsFailure(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
||||
class RestoreProductRequest implements StartSaving {
|
||||
RestoreProductRequest(this.completer, this.productIds);
|
||||
class RestoreProductsRequest implements StartSaving {
|
||||
RestoreProductsRequest(this.completer, this.productIds);
|
||||
|
||||
final Completer completer;
|
||||
final List<String> productIds;
|
||||
}
|
||||
|
||||
class RestoreProductSuccess implements StopSaving, PersistData {
|
||||
RestoreProductSuccess(this.products);
|
||||
class RestoreProductsSuccess implements StopSaving, PersistData {
|
||||
RestoreProductsSuccess(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
||||
class RestoreProductFailure implements StopSaving {
|
||||
RestoreProductFailure(this.products);
|
||||
class RestoreProductsFailure implements StopSaving {
|
||||
RestoreProductsFailure(this.products);
|
||||
|
||||
final List<ProductEntity> products;
|
||||
}
|
||||
|
|
@ -239,17 +239,17 @@ void handleProductAction(
|
|||
createEntity(context: context, entity: (product as ProductEntity).clone);
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestoreProductRequest(
|
||||
store.dispatch(RestoreProductsRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredProduct),
|
||||
productIds));
|
||||
break;
|
||||
case EntityAction.archive:
|
||||
store.dispatch(ArchiveProductRequest(
|
||||
store.dispatch(ArchiveProductsRequest(
|
||||
snackBarCompleter<Null>(context, localization.archivedProduct),
|
||||
productIds));
|
||||
break;
|
||||
case EntityAction.delete:
|
||||
store.dispatch(DeleteProductRequest(
|
||||
store.dispatch(DeleteProductsRequest(
|
||||
snackBarCompleter<Null>(context, localization.deletedProduct),
|
||||
productIds));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ List<Middleware<AppState>> createStoreProductsMiddleware([
|
|||
TypedMiddleware<AppState, EditProduct>(editProduct),
|
||||
TypedMiddleware<AppState, LoadProducts>(loadProducts),
|
||||
TypedMiddleware<AppState, SaveProductRequest>(saveProduct),
|
||||
TypedMiddleware<AppState, ArchiveProductRequest>(archiveProduct),
|
||||
TypedMiddleware<AppState, DeleteProductRequest>(deleteProduct),
|
||||
TypedMiddleware<AppState, RestoreProductRequest>(restoreProduct),
|
||||
TypedMiddleware<AppState, ArchiveProductsRequest>(archiveProduct),
|
||||
TypedMiddleware<AppState, DeleteProductsRequest>(deleteProduct),
|
||||
TypedMiddleware<AppState, RestoreProductsRequest>(restoreProduct),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ Middleware<AppState> _viewProductList() {
|
|||
|
||||
Middleware<AppState> _archiveProduct(ProductRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchiveProductRequest;
|
||||
final action = dynamicAction as ArchiveProductsRequest;
|
||||
final prevProducts = action.productIds
|
||||
.map((id) => store.state.productState.map[id])
|
||||
.toList();
|
||||
|
|
@ -109,13 +109,13 @@ Middleware<AppState> _archiveProduct(ProductRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.productIds, EntityAction.archive)
|
||||
.then((List<ProductEntity> products) {
|
||||
store.dispatch(ArchiveProductSuccess(products));
|
||||
store.dispatch(ArchiveProductsSuccess(products));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((dynamic error) {
|
||||
print(error);
|
||||
store.dispatch(ArchiveProductFailure(prevProducts));
|
||||
store.dispatch(ArchiveProductsFailure(prevProducts));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ Middleware<AppState> _archiveProduct(ProductRepository repository) {
|
|||
|
||||
Middleware<AppState> _deleteProduct(ProductRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DeleteProductRequest;
|
||||
final action = dynamicAction as DeleteProductsRequest;
|
||||
final prevProducts = action.productIds
|
||||
.map((id) => store.state.productState.map[id])
|
||||
.toList();
|
||||
|
|
@ -135,13 +135,13 @@ Middleware<AppState> _deleteProduct(ProductRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.productIds, EntityAction.delete)
|
||||
.then((List<ProductEntity> products) {
|
||||
store.dispatch(DeleteProductSuccess(products));
|
||||
store.dispatch(DeleteProductsSuccess(products));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(DeleteProductFailure(prevProducts));
|
||||
store.dispatch(DeleteProductsFailure(prevProducts));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ Middleware<AppState> _deleteProduct(ProductRepository repository) {
|
|||
|
||||
Middleware<AppState> _restoreProduct(ProductRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as RestoreProductRequest;
|
||||
final action = dynamicAction as RestoreProductsRequest;
|
||||
final prevProducts = action.productIds
|
||||
.map((id) => store.state.productState.map[id])
|
||||
.toList();
|
||||
|
|
@ -161,13 +161,13 @@ Middleware<AppState> _restoreProduct(ProductRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.productIds, EntityAction.restore)
|
||||
.then((List<ProductEntity> products) {
|
||||
store.dispatch(RestoreProductSuccess(products));
|
||||
store.dispatch(RestoreProductsSuccess(products));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(RestoreProductFailure(prevProducts));
|
||||
store.dispatch(RestoreProductsFailure(prevProducts));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ final editingReducer = combineReducers<ProductEntity>([
|
|||
TypedReducer<ProductEntity, UpdateProduct>((product, action) {
|
||||
return action.product.rebuild((b) => b..isChanged = true);
|
||||
}),
|
||||
TypedReducer<ProductEntity, RestoreProductSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, ArchiveProductSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, DeleteProductSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, RestoreProductsSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, ArchiveProductsSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, DeleteProductsSuccess>(_updateEditing),
|
||||
TypedReducer<ProductEntity, SelectCompany>(_clearEditing),
|
||||
TypedReducer<ProductEntity, DiscardChanges>(_clearEditing),
|
||||
]);
|
||||
|
|
@ -157,19 +157,19 @@ final productsReducer = combineReducers<ProductState>([
|
|||
TypedReducer<ProductState, SaveProductSuccess>(_updateProduct),
|
||||
TypedReducer<ProductState, AddProductSuccess>(_addProduct),
|
||||
TypedReducer<ProductState, LoadProductsSuccess>(_setLoadedProducts),
|
||||
TypedReducer<ProductState, ArchiveProductRequest>(_archiveProductRequest),
|
||||
TypedReducer<ProductState, ArchiveProductSuccess>(_archiveProductSuccess),
|
||||
TypedReducer<ProductState, ArchiveProductFailure>(_archiveProductFailure),
|
||||
TypedReducer<ProductState, DeleteProductRequest>(_deleteProductRequest),
|
||||
TypedReducer<ProductState, DeleteProductSuccess>(_deleteProductSuccess),
|
||||
TypedReducer<ProductState, DeleteProductFailure>(_deleteProductFailure),
|
||||
TypedReducer<ProductState, RestoreProductRequest>(_restoreProductRequest),
|
||||
TypedReducer<ProductState, RestoreProductSuccess>(_restoreProductSuccess),
|
||||
TypedReducer<ProductState, RestoreProductFailure>(_restoreProductFailure),
|
||||
TypedReducer<ProductState, ArchiveProductsRequest>(_archiveProductRequest),
|
||||
TypedReducer<ProductState, ArchiveProductsSuccess>(_archiveProductSuccess),
|
||||
TypedReducer<ProductState, ArchiveProductsFailure>(_archiveProductFailure),
|
||||
TypedReducer<ProductState, DeleteProductsRequest>(_deleteProductRequest),
|
||||
TypedReducer<ProductState, DeleteProductsSuccess>(_deleteProductSuccess),
|
||||
TypedReducer<ProductState, DeleteProductsFailure>(_deleteProductFailure),
|
||||
TypedReducer<ProductState, RestoreProductsRequest>(_restoreProductRequest),
|
||||
TypedReducer<ProductState, RestoreProductsSuccess>(_restoreProductSuccess),
|
||||
TypedReducer<ProductState, RestoreProductsFailure>(_restoreProductFailure),
|
||||
]);
|
||||
|
||||
ProductState _archiveProductRequest(
|
||||
ProductState productState, ArchiveProductRequest action) {
|
||||
ProductState productState, ArchiveProductsRequest action) {
|
||||
final products = action.productIds.map((id) => productState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < products.length; i++) {
|
||||
|
|
@ -184,7 +184,7 @@ ProductState _archiveProductRequest(
|
|||
}
|
||||
|
||||
ProductState _archiveProductSuccess(
|
||||
ProductState productState, ArchiveProductSuccess action) {
|
||||
ProductState productState, ArchiveProductsSuccess action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
@ -193,7 +193,7 @@ ProductState _archiveProductSuccess(
|
|||
}
|
||||
|
||||
ProductState _archiveProductFailure(
|
||||
ProductState productState, ArchiveProductFailure action) {
|
||||
ProductState productState, ArchiveProductsFailure action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
@ -202,7 +202,7 @@ ProductState _archiveProductFailure(
|
|||
}
|
||||
|
||||
ProductState _deleteProductRequest(
|
||||
ProductState productState, DeleteProductRequest action) {
|
||||
ProductState productState, DeleteProductsRequest action) {
|
||||
final products = action.productIds.map((id) => productState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < products.length; i++) {
|
||||
|
|
@ -218,7 +218,7 @@ ProductState _deleteProductRequest(
|
|||
}
|
||||
|
||||
ProductState _deleteProductSuccess(
|
||||
ProductState productState, DeleteProductSuccess action) {
|
||||
ProductState productState, DeleteProductsSuccess action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
@ -227,7 +227,7 @@ ProductState _deleteProductSuccess(
|
|||
}
|
||||
|
||||
ProductState _deleteProductFailure(
|
||||
ProductState productState, DeleteProductFailure action) {
|
||||
ProductState productState, DeleteProductsFailure action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
@ -236,7 +236,7 @@ ProductState _deleteProductFailure(
|
|||
}
|
||||
|
||||
ProductState _restoreProductRequest(
|
||||
ProductState productState, RestoreProductRequest action) {
|
||||
ProductState productState, RestoreProductsRequest action) {
|
||||
final products = action.productIds.map((id) => productState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < products.length; i++) {
|
||||
|
|
@ -252,7 +252,7 @@ ProductState _restoreProductRequest(
|
|||
}
|
||||
|
||||
ProductState _restoreProductSuccess(
|
||||
ProductState productState, RestoreProductSuccess action) {
|
||||
ProductState productState, RestoreProductsSuccess action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
@ -261,7 +261,7 @@ ProductState _restoreProductSuccess(
|
|||
}
|
||||
|
||||
ProductState _restoreProductFailure(
|
||||
ProductState productState, RestoreProductFailure action) {
|
||||
ProductState productState, RestoreProductsFailure action) {
|
||||
return productState.rebuild((b) {
|
||||
for (final product in action.products) {
|
||||
b.map[product.id] = product;
|
||||
|
|
|
|||
|
|
@ -236,62 +236,62 @@ class MarkSentQuoteFailure implements StopSaving {
|
|||
final InvoiceEntity quote;
|
||||
}
|
||||
|
||||
class ArchiveQuoteRequest implements StartSaving {
|
||||
ArchiveQuoteRequest(this.completer, this.quoteIds);
|
||||
class ArchiveQuotesRequest implements StartSaving {
|
||||
ArchiveQuotesRequest(this.completer, this.quoteIds);
|
||||
|
||||
final Completer completer;
|
||||
|
||||
final List<String> quoteIds;
|
||||
}
|
||||
|
||||
class ArchiveQuoteSuccess implements StopSaving, PersistData {
|
||||
ArchiveQuoteSuccess(this.quotes);
|
||||
class ArchiveQuotesSuccess implements StopSaving, PersistData {
|
||||
ArchiveQuotesSuccess(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
||||
class ArchiveQuoteFailure implements StopSaving {
|
||||
ArchiveQuoteFailure(this.quotes);
|
||||
class ArchiveQuotesFailure implements StopSaving {
|
||||
ArchiveQuotesFailure(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
||||
class DeleteQuoteRequest implements StartSaving {
|
||||
DeleteQuoteRequest(this.completer, this.quoteIds);
|
||||
class DeleteQuotesRequest implements StartSaving {
|
||||
DeleteQuotesRequest(this.completer, this.quoteIds);
|
||||
|
||||
final Completer completer;
|
||||
|
||||
final List<String> quoteIds;
|
||||
}
|
||||
|
||||
class DeleteQuoteSuccess implements StopSaving, PersistData {
|
||||
DeleteQuoteSuccess(this.quotes);
|
||||
class DeleteQuotesSuccess implements StopSaving, PersistData {
|
||||
DeleteQuotesSuccess(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
||||
class DeleteQuoteFailure implements StopSaving {
|
||||
DeleteQuoteFailure(this.quotes);
|
||||
class DeleteQuotesFailure implements StopSaving {
|
||||
DeleteQuotesFailure(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
||||
class RestoreQuoteRequest implements StartSaving {
|
||||
RestoreQuoteRequest(this.completer, this.quoteIds);
|
||||
class RestoreQuotesRequest implements StartSaving {
|
||||
RestoreQuotesRequest(this.completer, this.quoteIds);
|
||||
|
||||
final Completer completer;
|
||||
|
||||
final List<String> quoteIds;
|
||||
}
|
||||
|
||||
class RestoreQuoteSuccess implements StopSaving, PersistData {
|
||||
RestoreQuoteSuccess(this.quotes);
|
||||
class RestoreQuotesSuccess implements StopSaving, PersistData {
|
||||
RestoreQuotesSuccess(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
||||
class RestoreQuoteFailure implements StopSaving {
|
||||
RestoreQuoteFailure(this.quotes);
|
||||
class RestoreQuotesFailure implements StopSaving {
|
||||
RestoreQuotesFailure(this.quotes);
|
||||
|
||||
final List<InvoiceEntity> quotes;
|
||||
}
|
||||
|
|
@ -443,17 +443,17 @@ Future handleQuoteAction(
|
|||
createEntity(context: context, entity: quote.clone);
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestoreQuoteRequest(
|
||||
store.dispatch(RestoreQuotesRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredQuote),
|
||||
quoteIds));
|
||||
break;
|
||||
case EntityAction.archive:
|
||||
store.dispatch(ArchiveQuoteRequest(
|
||||
store.dispatch(ArchiveQuotesRequest(
|
||||
snackBarCompleter<Null>(context, localization.archivedQuote),
|
||||
quoteIds));
|
||||
break;
|
||||
case EntityAction.delete:
|
||||
store.dispatch(DeleteQuoteRequest(
|
||||
store.dispatch(DeleteQuotesRequest(
|
||||
snackBarCompleter<Null>(context, localization.deletedQuote),
|
||||
quoteIds));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ List<Middleware<AppState>> createStoreQuotesMiddleware([
|
|||
TypedMiddleware<AppState, LoadQuotes>(loadQuotes),
|
||||
TypedMiddleware<AppState, LoadQuote>(loadQuote),
|
||||
TypedMiddleware<AppState, SaveQuoteRequest>(saveQuote),
|
||||
TypedMiddleware<AppState, ArchiveQuoteRequest>(archiveQuote),
|
||||
TypedMiddleware<AppState, DeleteQuoteRequest>(deleteQuote),
|
||||
TypedMiddleware<AppState, RestoreQuoteRequest>(restoreQuote),
|
||||
TypedMiddleware<AppState, ArchiveQuotesRequest>(archiveQuote),
|
||||
TypedMiddleware<AppState, DeleteQuotesRequest>(deleteQuote),
|
||||
TypedMiddleware<AppState, RestoreQuotesRequest>(restoreQuote),
|
||||
TypedMiddleware<AppState, EmailQuoteRequest>(emailQuote),
|
||||
TypedMiddleware<AppState, MarkSentQuoteRequest>(markSentQuote),
|
||||
];
|
||||
|
|
@ -134,20 +134,20 @@ Middleware<AppState> _showEmailQuote() {
|
|||
|
||||
Middleware<AppState> _archiveQuote(QuoteRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as ArchiveQuoteRequest;
|
||||
final action = dynamicAction as ArchiveQuotesRequest;
|
||||
final prevQuotes =
|
||||
action.quoteIds.map((id) => store.state.quoteState.map[id]).toList();
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.quoteIds, EntityAction.archive)
|
||||
.then((List<InvoiceEntity> quotes) {
|
||||
store.dispatch(ArchiveQuoteSuccess(quotes));
|
||||
store.dispatch(ArchiveQuotesSuccess(quotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(ArchiveQuoteFailure(prevQuotes));
|
||||
store.dispatch(ArchiveQuotesFailure(prevQuotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ Middleware<AppState> _archiveQuote(QuoteRepository repository) {
|
|||
|
||||
Middleware<AppState> _deleteQuote(QuoteRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DeleteQuoteRequest;
|
||||
final action = dynamicAction as DeleteQuotesRequest;
|
||||
final prevQuotes =
|
||||
action.quoteIds.map((id) => store.state.quoteState.map[id]).toList();
|
||||
|
||||
|
|
@ -167,13 +167,13 @@ Middleware<AppState> _deleteQuote(QuoteRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.quoteIds, EntityAction.delete)
|
||||
.then((List<InvoiceEntity> quotes) {
|
||||
store.dispatch(DeleteQuoteSuccess(quotes));
|
||||
store.dispatch(DeleteQuotesSuccess(quotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(DeleteQuoteFailure(prevQuotes));
|
||||
store.dispatch(DeleteQuotesFailure(prevQuotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ Middleware<AppState> _deleteQuote(QuoteRepository repository) {
|
|||
|
||||
Middleware<AppState> _restoreQuote(QuoteRepository repository) {
|
||||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as RestoreQuoteRequest;
|
||||
final action = dynamicAction as RestoreQuotesRequest;
|
||||
final prevQuotes =
|
||||
action.quoteIds.map((id) => store.state.quoteState.map[id]).toList();
|
||||
|
||||
|
|
@ -193,13 +193,13 @@ Middleware<AppState> _restoreQuote(QuoteRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.quoteIds, EntityAction.restore)
|
||||
.then((List<InvoiceEntity> quotes) {
|
||||
store.dispatch(RestoreQuoteSuccess(quotes));
|
||||
store.dispatch(RestoreQuotesSuccess(quotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
}
|
||||
}).catchError((Object error) {
|
||||
print(error);
|
||||
store.dispatch(RestoreQuoteFailure(prevQuotes));
|
||||
store.dispatch(RestoreQuotesFailure(prevQuotes));
|
||||
if (action.completer != null) {
|
||||
action.completer.completeError(error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ final editingReducer = combineReducers<InvoiceEntity>([
|
|||
..invitations.addAll(client.contacts
|
||||
.map((contact) => InvitationEntity(contactId: contact.id))));
|
||||
}),
|
||||
TypedReducer<InvoiceEntity, RestoreQuoteSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, ArchiveQuoteSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, DeleteQuoteSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, RestoreQuotesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, ArchiveQuotesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, DeleteQuotesSuccess>(_updateEditing),
|
||||
TypedReducer<InvoiceEntity, AddQuoteItem>(_addQuoteItem),
|
||||
TypedReducer<InvoiceEntity, AddQuoteItems>(_addQuoteItems),
|
||||
TypedReducer<InvoiceEntity, DeleteQuoteItem>(_removeQuoteItem),
|
||||
|
|
@ -235,15 +235,15 @@ final quotesReducer = combineReducers<QuoteState>([
|
|||
TypedReducer<QuoteState, LoadQuotesSuccess>(_setLoadedQuotes),
|
||||
TypedReducer<QuoteState, LoadQuoteSuccess>(_updateQuote),
|
||||
TypedReducer<QuoteState, MarkSentQuoteSuccess>(_markSentQuoteSuccess),
|
||||
TypedReducer<QuoteState, ArchiveQuoteRequest>(_archiveQuoteRequest),
|
||||
TypedReducer<QuoteState, ArchiveQuoteSuccess>(_archiveQuoteSuccess),
|
||||
TypedReducer<QuoteState, ArchiveQuoteFailure>(_archiveQuoteFailure),
|
||||
TypedReducer<QuoteState, DeleteQuoteRequest>(_deleteQuoteRequest),
|
||||
TypedReducer<QuoteState, DeleteQuoteSuccess>(_deleteQuoteSuccess),
|
||||
TypedReducer<QuoteState, DeleteQuoteFailure>(_deleteQuoteFailure),
|
||||
TypedReducer<QuoteState, RestoreQuoteRequest>(_restoreQuoteRequest),
|
||||
TypedReducer<QuoteState, RestoreQuoteSuccess>(_restoreQuoteSuccess),
|
||||
TypedReducer<QuoteState, RestoreQuoteFailure>(_restoreQuoteFailure),
|
||||
TypedReducer<QuoteState, ArchiveQuotesRequest>(_archiveQuoteRequest),
|
||||
TypedReducer<QuoteState, ArchiveQuotesSuccess>(_archiveQuoteSuccess),
|
||||
TypedReducer<QuoteState, ArchiveQuotesFailure>(_archiveQuoteFailure),
|
||||
TypedReducer<QuoteState, DeleteQuotesRequest>(_deleteQuoteRequest),
|
||||
TypedReducer<QuoteState, DeleteQuotesSuccess>(_deleteQuoteSuccess),
|
||||
TypedReducer<QuoteState, DeleteQuotesFailure>(_deleteQuoteFailure),
|
||||
TypedReducer<QuoteState, RestoreQuotesRequest>(_restoreQuoteRequest),
|
||||
TypedReducer<QuoteState, RestoreQuotesSuccess>(_restoreQuoteSuccess),
|
||||
TypedReducer<QuoteState, RestoreQuotesFailure>(_restoreQuoteFailure),
|
||||
TypedReducer<QuoteState, ConvertQuoteSuccess>(_convertQuoteSuccess),
|
||||
]);
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ QuoteState _markSentQuoteSuccess(
|
|||
}
|
||||
|
||||
QuoteState _archiveQuoteRequest(
|
||||
QuoteState quoteState, ArchiveQuoteRequest action) {
|
||||
QuoteState quoteState, ArchiveQuotesRequest action) {
|
||||
final quotes = action.quoteIds.map((id) => quoteState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < quotes.length; i++) {
|
||||
|
|
@ -268,7 +268,7 @@ QuoteState _archiveQuoteRequest(
|
|||
}
|
||||
|
||||
QuoteState _archiveQuoteSuccess(
|
||||
QuoteState quoteState, ArchiveQuoteSuccess action) {
|
||||
QuoteState quoteState, ArchiveQuotesSuccess action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
@ -277,7 +277,7 @@ QuoteState _archiveQuoteSuccess(
|
|||
}
|
||||
|
||||
QuoteState _archiveQuoteFailure(
|
||||
QuoteState quoteState, ArchiveQuoteFailure action) {
|
||||
QuoteState quoteState, ArchiveQuotesFailure action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
@ -286,7 +286,7 @@ QuoteState _archiveQuoteFailure(
|
|||
}
|
||||
|
||||
QuoteState _deleteQuoteRequest(
|
||||
QuoteState quoteState, DeleteQuoteRequest action) {
|
||||
QuoteState quoteState, DeleteQuotesRequest action) {
|
||||
final quotes = action.quoteIds.map((id) => quoteState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < quotes.length; i++) {
|
||||
|
|
@ -302,7 +302,7 @@ QuoteState _deleteQuoteRequest(
|
|||
}
|
||||
|
||||
QuoteState _deleteQuoteSuccess(
|
||||
QuoteState quoteState, DeleteQuoteSuccess action) {
|
||||
QuoteState quoteState, DeleteQuotesSuccess action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
@ -311,7 +311,7 @@ QuoteState _deleteQuoteSuccess(
|
|||
}
|
||||
|
||||
QuoteState _deleteQuoteFailure(
|
||||
QuoteState quoteState, DeleteQuoteFailure action) {
|
||||
QuoteState quoteState, DeleteQuotesFailure action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
@ -320,7 +320,7 @@ QuoteState _deleteQuoteFailure(
|
|||
}
|
||||
|
||||
QuoteState _restoreQuoteRequest(
|
||||
QuoteState quoteState, RestoreQuoteRequest action) {
|
||||
QuoteState quoteState, RestoreQuotesRequest action) {
|
||||
final quotes = action.quoteIds.map((id) => quoteState.map[id]).toList();
|
||||
|
||||
for (int i = 0; i < quotes.length; i++) {
|
||||
|
|
@ -336,7 +336,7 @@ QuoteState _restoreQuoteRequest(
|
|||
}
|
||||
|
||||
QuoteState _restoreQuoteSuccess(
|
||||
QuoteState quoteState, RestoreQuoteSuccess action) {
|
||||
QuoteState quoteState, RestoreQuotesSuccess action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
@ -345,7 +345,7 @@ QuoteState _restoreQuoteSuccess(
|
|||
}
|
||||
|
||||
QuoteState _restoreQuoteFailure(
|
||||
QuoteState quoteState, RestoreQuoteFailure action) {
|
||||
QuoteState quoteState, RestoreQuotesFailure action) {
|
||||
return quoteState.rebuild((b) {
|
||||
for (final quote in action.quotes) {
|
||||
b.map[quote.id] = quote;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ class EntityStateTitle extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
print('## Build');
|
||||
print('## Archivd At: ${entity.archivedAt}');
|
||||
print('## isDeleted: ${entity.isDeleted}');
|
||||
|
||||
final state = entity.entityState;
|
||||
|
||||
if (state == kEntityStateActive) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue