Choose template to use when emailing multiple invoices at once #472
This commit is contained in:
parent
65b7d1aa49
commit
ce4e01cead
|
|
@ -10,6 +10,8 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/main_app.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
|
@ -677,6 +679,56 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
invoiceIds: invoiceIds,
|
||||
));
|
||||
});
|
||||
|
||||
if (false) {
|
||||
final template = await showDialog<EmailTemplate>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
final settings = getClientSettings(state, client);
|
||||
final templates = {
|
||||
EmailTemplate.invoice: localization.initialEmail,
|
||||
EmailTemplate.reminder1: localization.firstReminder,
|
||||
EmailTemplate.reminder2: localization.secondReminder,
|
||||
EmailTemplate.reminder3: localization.thirdReminder,
|
||||
EmailTemplate.reminder_endless: localization.endlessReminder,
|
||||
if ((settings.emailSubjectCustom1 ?? '').isNotEmpty)
|
||||
EmailTemplate.custom1: localization.firstCustom,
|
||||
if ((settings.emailSubjectCustom2 ?? '').isNotEmpty)
|
||||
EmailTemplate.custom2: localization.secondCustom,
|
||||
if ((settings.emailSubjectCustom3 ?? '').isNotEmpty)
|
||||
EmailTemplate.custom3: localization.thirdCustom,
|
||||
};
|
||||
return SimpleDialog(
|
||||
title: Text(
|
||||
invoiceIds.length == 1
|
||||
? localization.sendEmail
|
||||
: localization.sendCountEmails
|
||||
.replaceFirst(':count', '${invoiceIds.length}'),
|
||||
),
|
||||
children: templates.keys
|
||||
.map((template) => SimpleDialogOption(
|
||||
child: Text(templates[template]),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(template);
|
||||
},
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (template != null) {
|
||||
store.dispatch(BulkEmailInvoicesRequest(
|
||||
completer: snackBarCompleter<Null>(
|
||||
navigatorKey.currentContext,
|
||||
invoiceIds.length == 1
|
||||
? localization.emailedInvoice
|
||||
: localization.emailedInvoices),
|
||||
invoiceIds: invoiceIds,
|
||||
template: template,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EntityAction.cloneToOther:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'send_count_emails': 'Send :count emails',
|
||||
'location': 'Location',
|
||||
'invoice_task_item_description': 'Invoice Task Item Description',
|
||||
'invoice_task_item_description_help':
|
||||
|
|
@ -102521,6 +102522,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['location'] ??
|
||||
_localizedValues['en']['location'];
|
||||
|
||||
String get sendCountEmails =>
|
||||
_localizedValues[localeCode]['send_count_emails'] ??
|
||||
_localizedValues['en']['send_count_emails'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue