Prevent sending empty download documents request
This commit is contained in:
parent
41794a2594
commit
8f0f86a6dc
|
|
@ -515,6 +515,10 @@ void handleClientAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -524,6 +528,7 @@ void handleClientAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case EntityAction.merge:
|
||||
showDialog<void>(
|
||||
|
|
|
|||
|
|
@ -674,6 +674,10 @@ Future handleCreditAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -683,6 +687,7 @@ Future handleCreditAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in credit_actions');
|
||||
|
|
|
|||
|
|
@ -382,6 +382,10 @@ void handleExpenseAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -391,6 +395,7 @@ void handleExpenseAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in expense_actions');
|
||||
|
|
|
|||
|
|
@ -781,6 +781,10 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -790,6 +794,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in invoice_actions');
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/product/product_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
import '../document/document_actions.dart';
|
||||
|
|
@ -353,6 +354,10 @@ void handleProductAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -362,6 +367,7 @@ void handleProductAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in product_actions');
|
||||
|
|
|
|||
|
|
@ -372,6 +372,10 @@ void handleProjectAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -381,6 +385,7 @@ void handleProjectAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## Error: action $action not handled in project_actions');
|
||||
|
|
|
|||
|
|
@ -717,6 +717,10 @@ Future handleQuoteAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -726,6 +730,7 @@ Future handleQuoteAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in quote_actions');
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class ViewRecurringExpenseList implements PersistUI {
|
||||
|
|
@ -442,6 +443,10 @@ void handleRecurringExpenseAction(BuildContext context,
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -451,6 +456,7 @@ void handleRecurringExpenseAction(BuildContext context,
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in recurring_expense_actions');
|
||||
|
|
|
|||
|
|
@ -599,6 +599,10 @@ void handleRecurringInvoiceAction(BuildContext context,
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -608,6 +612,7 @@ void handleRecurringInvoiceAction(BuildContext context,
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case EntityAction.sendNow:
|
||||
store.dispatch(SendNowRecurringInvoicesRequest(
|
||||
|
|
|
|||
|
|
@ -527,6 +527,10 @@ void handleTaskAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -536,6 +540,7 @@ void handleTaskAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in task_actions');
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_actions_dialog.dart';
|
||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
|
|
@ -379,6 +380,10 @@ void handleVendorAction(
|
|||
documentIds.add(document.id);
|
||||
}
|
||||
}
|
||||
if (documentIds.isEmpty) {
|
||||
showMessageDialog(
|
||||
context: context, message: localization.noDocumentsToDownload);
|
||||
} else {
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
|
|
@ -388,6 +393,7 @@ void handleVendorAction(
|
|||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('## ERROR: unhandled action $action in vendor_actions');
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'no_documents_to_download': 'There are no documents in the selected records to download',
|
||||
'pixels': 'Pixels',
|
||||
'logo_size': 'Logo Size',
|
||||
'postal_city': 'Postal/City',
|
||||
|
|
@ -94004,6 +94005,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['pixels'] ??
|
||||
_localizedValues['en']['pixels'];
|
||||
|
||||
String get noDocumentsToDownload =>
|
||||
_localizedValues[localeCode]['no_documents_to_download'] ??
|
||||
_localizedValues['en']['no_documents_to_download'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue