Support single bulk email
This commit is contained in:
parent
abc08eeafd
commit
d4fa06301f
|
|
@ -757,12 +757,22 @@ abstract class InvoiceEntity extends Object
|
|||
}
|
||||
|
||||
if (userCompany.canEditEntity(this)) {
|
||||
if (entityType == EntityType.quote) {
|
||||
actions.add(EntityAction.emailQuote);
|
||||
} else if (entityType == EntityType.credit) {
|
||||
actions.add(EntityAction.emailCredit);
|
||||
} else if (entityType == EntityType.invoice) {
|
||||
actions.add(EntityAction.emailInvoice);
|
||||
if (multiselect) {
|
||||
if (entityType == EntityType.quote) {
|
||||
actions.add(EntityAction.bulkEmailQuote);
|
||||
} else if (entityType == EntityType.credit) {
|
||||
actions.add(EntityAction.bulkEmailCredit);
|
||||
} else if (entityType == EntityType.invoice) {
|
||||
actions.add(EntityAction.bulkEmailInvoice);
|
||||
}
|
||||
} else {
|
||||
if (entityType == EntityType.quote) {
|
||||
actions.add(EntityAction.emailQuote);
|
||||
} else if (entityType == EntityType.credit) {
|
||||
actions.add(EntityAction.emailCredit);
|
||||
} else if (entityType == EntityType.invoice) {
|
||||
actions.add(EntityAction.emailInvoice);
|
||||
}
|
||||
}
|
||||
|
||||
if (isPayable && userCompany.canCreate(EntityType.payment)) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@ class EntityAction extends EnumClass {
|
|||
static const EntityAction emailInvoice = _$emailInvoice;
|
||||
static const EntityAction emailQuote = _$emailQuote;
|
||||
static const EntityAction emailCredit = _$emailCredit;
|
||||
static const EntityAction emailPayment = _$emailPayment;
|
||||
static const EntityAction bulkEmailInvoice = _$bulkEmailInvoice;
|
||||
static const EntityAction bulkEmailQuote = _$bulkEmailQuote;
|
||||
static const EntityAction bulkEmailCredit = _$bulkEmailCredit;
|
||||
static const EntityAction bulkEmailPayment = _$bulkEmailPayment;
|
||||
static const EntityAction markSent = _$markSent;
|
||||
static const EntityAction markPaid = _$markPaid;
|
||||
static const EntityAction newClient = _$newClient;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,12 @@ const EntityAction _$download = const EntityAction._('download');
|
|||
const EntityAction _$emailInvoice = const EntityAction._('emailInvoice');
|
||||
const EntityAction _$emailQuote = const EntityAction._('emailQuote');
|
||||
const EntityAction _$emailCredit = const EntityAction._('emailCredit');
|
||||
const EntityAction _$emailPayment = const EntityAction._('emailPayment');
|
||||
const EntityAction _$bulkEmailInvoice =
|
||||
const EntityAction._('bulkEmailInvoice');
|
||||
const EntityAction _$bulkEmailQuote = const EntityAction._('bulkEmailQuote');
|
||||
const EntityAction _$bulkEmailCredit = const EntityAction._('bulkEmailCredit');
|
||||
const EntityAction _$bulkEmailPayment =
|
||||
const EntityAction._('bulkEmailPayment');
|
||||
const EntityAction _$markSent = const EntityAction._('markSent');
|
||||
const EntityAction _$markPaid = const EntityAction._('markPaid');
|
||||
const EntityAction _$newClient = const EntityAction._('newClient');
|
||||
|
|
@ -103,8 +108,14 @@ EntityAction _$valueOf(String name) {
|
|||
return _$emailQuote;
|
||||
case 'emailCredit':
|
||||
return _$emailCredit;
|
||||
case 'emailPayment':
|
||||
return _$emailPayment;
|
||||
case 'bulkEmailInvoice':
|
||||
return _$bulkEmailInvoice;
|
||||
case 'bulkEmailQuote':
|
||||
return _$bulkEmailQuote;
|
||||
case 'bulkEmailCredit':
|
||||
return _$bulkEmailCredit;
|
||||
case 'bulkEmailPayment':
|
||||
return _$bulkEmailPayment;
|
||||
case 'markSent':
|
||||
return _$markSent;
|
||||
case 'markPaid':
|
||||
|
|
@ -191,7 +202,10 @@ final BuiltSet<EntityAction> _$values =
|
|||
_$emailInvoice,
|
||||
_$emailQuote,
|
||||
_$emailCredit,
|
||||
_$emailPayment,
|
||||
_$bulkEmailInvoice,
|
||||
_$bulkEmailQuote,
|
||||
_$bulkEmailCredit,
|
||||
_$bulkEmailPayment,
|
||||
_$markSent,
|
||||
_$markPaid,
|
||||
_$newClient,
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ abstract class PaymentEntity extends Object
|
|||
}
|
||||
|
||||
if (client != null && client.hasEmailAddress) {
|
||||
actions.add(EntityAction.emailPayment);
|
||||
actions.add(EntityAction.bulkEmailPayment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ Future handleCreditAction(
|
|||
creditIds));
|
||||
break;
|
||||
case EntityAction.emailCredit:
|
||||
case EntityAction.bulkEmailCredit:
|
||||
bool emailValid = true;
|
||||
creditIds.forEach((element) {
|
||||
final client = state.clientState.get(credit.clientId);
|
||||
|
|
@ -469,7 +470,7 @@ Future handleCreditAction(
|
|||
]);
|
||||
return;
|
||||
}
|
||||
if (creditIds.length == 1) {
|
||||
if (action == EntityAction.emailCredit) {
|
||||
store.dispatch(ShowEmailCredit(
|
||||
completer:
|
||||
snackBarCompleter<Null>(context, localization.emailedCredit),
|
||||
|
|
|
|||
|
|
@ -564,6 +564,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
invoiceIds));
|
||||
break;
|
||||
case EntityAction.emailInvoice:
|
||||
case EntityAction.bulkEmailInvoice:
|
||||
bool emailValid = true;
|
||||
invoiceIds.forEach((element) {
|
||||
final client = state.clientState.get(invoice.clientId);
|
||||
|
|
@ -587,7 +588,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
]);
|
||||
return;
|
||||
}
|
||||
if (invoiceIds.length == 1) {
|
||||
if (action == EntityAction.emailInvoice) {
|
||||
store.dispatch(ShowEmailInvoice(
|
||||
completer:
|
||||
snackBarCompleter<Null>(context, localization.emailedInvoice),
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ void handlePaymentAction(
|
|||
));
|
||||
});
|
||||
break;
|
||||
case EntityAction.emailPayment:
|
||||
case EntityAction.bulkEmailPayment:
|
||||
store.dispatch(EmailPaymentRequest(
|
||||
snackBarCompleter<Null>(context, localization.emailedPayment),
|
||||
paymentIds));
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ Middleware<AppState> _emailPayment(PaymentRepository repository) {
|
|||
final action = dynamicAction as EmailPaymentRequest;
|
||||
repository
|
||||
.bulkAction(store.state.credentials, action.paymentIds,
|
||||
EntityAction.emailPayment)
|
||||
EntityAction.bulkEmailPayment)
|
||||
.then((List<PaymentEntity> payments) {
|
||||
store.dispatch(EmailPaymentSuccess());
|
||||
action.completer.complete(null);
|
||||
|
|
|
|||
|
|
@ -470,6 +470,7 @@ Future handleQuoteAction(
|
|||
quoteIds));
|
||||
break;
|
||||
case EntityAction.emailQuote:
|
||||
case EntityAction.bulkEmailQuote:
|
||||
bool emailValid = true;
|
||||
quoteIds.forEach((element) {
|
||||
final client = state.clientState.get(quote.clientId);
|
||||
|
|
@ -493,7 +494,7 @@ Future handleQuoteAction(
|
|||
]);
|
||||
return;
|
||||
}
|
||||
if (quoteIds.length == 1) {
|
||||
if (action == EntityAction.emailQuote) {
|
||||
store.dispatch(ShowEmailQuote(
|
||||
completer:
|
||||
snackBarCompleter<Null>(context, localization.emailedQuote),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'bulk_email_invoice': 'Email Invoice',
|
||||
'bulk_email_quote': 'Email Quote',
|
||||
'bulk_email_credit': 'Email Credit',
|
||||
'from_name': 'From Name',
|
||||
'enabling_may_degrade_performance': 'Enabling may degrade performance',
|
||||
'disabling_may_improve_performance': 'Disabling may improve performance',
|
||||
|
|
@ -62603,6 +62606,18 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['from_name'] ??
|
||||
_localizedValues['en']['from_name'];
|
||||
|
||||
String get bulkEmailInvoice =>
|
||||
_localizedValues[localeCode]['bulk_email_invoice'] ??
|
||||
_localizedValues['en']['bulk_email_invoice'];
|
||||
|
||||
String get bulkEmailQuote =>
|
||||
_localizedValues[localeCode]['bulk_email_quote'] ??
|
||||
_localizedValues['en']['bulk_email_quote'];
|
||||
|
||||
String get bulkEmailCredit =>
|
||||
_localizedValues[localeCode]['bulk_email_credit'] ??
|
||||
_localizedValues['en']['bulk_email_credit'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,10 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
|||
return Icons.public;
|
||||
case EntityAction.markPaid:
|
||||
return Icons.payment;
|
||||
case EntityAction.emailPayment:
|
||||
case EntityAction.bulkEmailPayment:
|
||||
case EntityAction.bulkEmailCredit:
|
||||
case EntityAction.bulkEmailInvoice:
|
||||
case EntityAction.bulkEmailQuote:
|
||||
case EntityAction.emailQuote:
|
||||
case EntityAction.emailInvoice:
|
||||
case EntityAction.emailCredit:
|
||||
|
|
|
|||
Loading…
Reference in New Issue