Add download option
This commit is contained in:
parent
cacc025a05
commit
be645931e0
|
|
@ -783,9 +783,9 @@ abstract class InvoiceEntity extends Object
|
|||
|
||||
if (invitations.isNotEmpty) {
|
||||
if (multiselect) {
|
||||
actions.add(EntityAction.download);
|
||||
actions.add(EntityAction.bulkDownload);
|
||||
} else {
|
||||
actions.add(EntityAction.viewPdf);
|
||||
actions.addAll([EntityAction.viewPdf, EntityAction.download]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class EntityAction extends EnumClass {
|
|||
static const EntityAction approve = _$approve;
|
||||
static const EntityAction apply = _$apply;
|
||||
static const EntityAction download = _$download;
|
||||
static const EntityAction bulkDownload = _$bulkDownload;
|
||||
static const EntityAction emailInvoice = _$emailInvoice;
|
||||
static const EntityAction emailQuote = _$emailQuote;
|
||||
static const EntityAction emailCredit = _$emailCredit;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ const EntityAction _$convertToInvoice =
|
|||
const EntityAction _$approve = const EntityAction._('approve');
|
||||
const EntityAction _$apply = const EntityAction._('apply');
|
||||
const EntityAction _$download = const EntityAction._('download');
|
||||
const EntityAction _$bulkDownload = const EntityAction._('bulkDownload');
|
||||
const EntityAction _$emailInvoice = const EntityAction._('emailInvoice');
|
||||
const EntityAction _$emailQuote = const EntityAction._('emailQuote');
|
||||
const EntityAction _$emailCredit = const EntityAction._('emailCredit');
|
||||
|
|
@ -102,6 +103,8 @@ EntityAction _$valueOf(String name) {
|
|||
return _$apply;
|
||||
case 'download':
|
||||
return _$download;
|
||||
case 'bulkDownload':
|
||||
return _$bulkDownload;
|
||||
case 'emailInvoice':
|
||||
return _$emailInvoice;
|
||||
case 'emailQuote':
|
||||
|
|
@ -201,6 +204,7 @@ final BuiltSet<EntityAction> _$values =
|
|||
_$approve,
|
||||
_$apply,
|
||||
_$download,
|
||||
_$bulkDownload,
|
||||
_$emailInvoice,
|
||||
_$emailQuote,
|
||||
_$emailCredit,
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ Future handleCreditAction(
|
|||
filterEntity: state.clientState.map[credit.clientId],
|
||||
);
|
||||
break;
|
||||
case EntityAction.download:
|
||||
case EntityAction.bulkDownload:
|
||||
store.dispatch(DownloadCreditsRequest(
|
||||
snackBarCompleter<Null>(context, localization.exportedData),
|
||||
creditIds));
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@ Middleware<AppState> _downloadCredits(CreditRepository repository) {
|
|||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DownloadCreditsRequest;
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.creditIds, EntityAction.download)
|
||||
.bulkAction(store.state.credentials, action.creditIds,
|
||||
EntityAction.bulkDownload)
|
||||
.then((invoices) {
|
||||
store.dispatch(DownloadCreditsSuccess());
|
||||
if (action.completer != null) {
|
||||
|
|
|
|||
|
|
@ -654,6 +654,9 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
);
|
||||
break;
|
||||
case EntityAction.download:
|
||||
launch(invoice.invitationDownloadLink);
|
||||
break;
|
||||
case EntityAction.bulkDownload:
|
||||
store.dispatch(DownloadInvoicesRequest(
|
||||
snackBarCompleter<Null>(context, localization.exportedData),
|
||||
invoiceIds));
|
||||
|
|
|
|||
|
|
@ -325,8 +325,8 @@ Middleware<AppState> _downloadInvoices(InvoiceRepository repository) {
|
|||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DownloadInvoicesRequest;
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.download)
|
||||
.bulkAction(store.state.credentials, action.invoiceIds,
|
||||
EntityAction.bulkDownload)
|
||||
.then((invoices) {
|
||||
store.dispatch(DownloadInvoicesSuccess());
|
||||
if (action.completer != null) {
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ Future handleQuoteAction(
|
|||
..entityType = EntityType.recurringInvoice
|
||||
..designId = designId));
|
||||
break;
|
||||
case EntityAction.download:
|
||||
case EntityAction.bulkDownload:
|
||||
store.dispatch(DownloadQuotesRequest(
|
||||
snackBarCompleter<Null>(context, localization.exportedData),
|
||||
quoteIds));
|
||||
|
|
|
|||
|
|
@ -339,8 +339,8 @@ Middleware<AppState> _downloadQuotes(QuoteRepository repository) {
|
|||
return (Store<AppState> store, dynamic dynamicAction, NextDispatcher next) {
|
||||
final action = dynamicAction as DownloadQuotesRequest;
|
||||
repository
|
||||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.download)
|
||||
.bulkAction(store.state.credentials, action.invoiceIds,
|
||||
EntityAction.bulkDownload)
|
||||
.then((invoices) {
|
||||
store.dispatch(DownloadQuotesSuccess());
|
||||
if (action.completer != null) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'bulk_download': 'Download',
|
||||
'persist_data_help':
|
||||
'Save data locally to enable the app to start faster, disabling may improve performance in large accounts',
|
||||
'persist_ui': 'Persist UI',
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
|||
return Icons.edit;
|
||||
case EntityAction.viewStatement:
|
||||
case EntityAction.viewPdf:
|
||||
case EntityAction.download:
|
||||
case EntityAction.bulkDownload:
|
||||
return Icons.picture_as_pdf;
|
||||
case EntityAction.download:
|
||||
return Icons.download;
|
||||
case EntityAction.clientPortal:
|
||||
return Icons.cloud_circle;
|
||||
case EntityAction.clone:
|
||||
|
|
|
|||
Loading…
Reference in New Issue