Recurring invoices
This commit is contained in:
parent
b7d835b51b
commit
66173066bd
|
|
@ -715,23 +715,30 @@ abstract class InvoiceEntity extends Object
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (invitations.isNotEmpty && !multiselect) {
|
||||
actions.add(EntityAction.clientPortal);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (actions.isNotEmpty) {
|
||||
actions.add(null);
|
||||
}
|
||||
|
||||
if (userCompany.canCreate(EntityType.invoice) && !multiselect) {
|
||||
actions.add(EntityAction.cloneToInvoice);
|
||||
if (!multiselect) {
|
||||
if (userCompany.canCreate(EntityType.invoice)) {
|
||||
actions.add(EntityAction.cloneToInvoice);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.quote)) {
|
||||
actions.add(EntityAction.cloneToQuote);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.credit)) {
|
||||
actions.add(EntityAction.cloneToCredit);
|
||||
}
|
||||
if (userCompany.canCreate(EntityType.recurringInvoice)) {
|
||||
actions.add(EntityAction.cloneToRecurring);
|
||||
}
|
||||
actions.add(null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class EntityAction extends EnumClass {
|
|||
static const EntityAction cloneToCredit = _$cloneToCredit;
|
||||
static const EntityAction cloneToInvoice = _$cloneToInvoice;
|
||||
static const EntityAction cloneToQuote = _$cloneToQuote;
|
||||
static const EntityAction cloneToRecurring = _$cloneToRecurring;
|
||||
static const EntityAction convert = _$convert;
|
||||
static const EntityAction approve = _$approve;
|
||||
static const EntityAction apply = _$apply;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ const EntityAction _$clone = const EntityAction._('clone');
|
|||
const EntityAction _$cloneToCredit = const EntityAction._('cloneToCredit');
|
||||
const EntityAction _$cloneToInvoice = const EntityAction._('cloneToInvoice');
|
||||
const EntityAction _$cloneToQuote = const EntityAction._('cloneToQuote');
|
||||
const EntityAction _$cloneToRecurring =
|
||||
const EntityAction._('cloneToRecurring');
|
||||
const EntityAction _$convert = const EntityAction._('convert');
|
||||
const EntityAction _$approve = const EntityAction._('approve');
|
||||
const EntityAction _$apply = const EntityAction._('apply');
|
||||
|
|
@ -71,6 +73,8 @@ EntityAction _$valueOf(String name) {
|
|||
return _$cloneToInvoice;
|
||||
case 'cloneToQuote':
|
||||
return _$cloneToQuote;
|
||||
case 'cloneToRecurring':
|
||||
return _$cloneToRecurring;
|
||||
case 'convert':
|
||||
return _$convert;
|
||||
case 'approve':
|
||||
|
|
@ -153,6 +157,7 @@ final BuiltSet<EntityAction> _$values =
|
|||
_$cloneToCredit,
|
||||
_$cloneToInvoice,
|
||||
_$cloneToQuote,
|
||||
_$cloneToRecurring,
|
||||
_$convert,
|
||||
_$approve,
|
||||
_$apply,
|
||||
|
|
|
|||
|
|
@ -483,6 +483,12 @@ Future handleCreditAction(
|
|||
case EntityAction.cloneToCredit:
|
||||
createEntity(context: context, entity: credit.clone);
|
||||
break;
|
||||
case EntityAction.cloneToRecurring:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: credit.clone
|
||||
.rebuild((b) => b..entityType = EntityType.recurringInvoice));
|
||||
break;
|
||||
case EntityAction.newPayment:
|
||||
createEntity(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -582,6 +582,12 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
|
|||
entity:
|
||||
invoice.clone.rebuild((b) => b..entityType = EntityType.credit));
|
||||
break;
|
||||
case EntityAction.cloneToRecurring:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: invoice.clone
|
||||
.rebuild((b) => b..entityType = EntityType.recurringInvoice));
|
||||
break;
|
||||
case EntityAction.newPayment:
|
||||
createEntity(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -506,6 +506,12 @@ Future handleQuoteAction(
|
|||
entity:
|
||||
quote.clone.rebuild((b) => b..entityType = EntityType.credit));
|
||||
break;
|
||||
case EntityAction.cloneToRecurring:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: quote.clone
|
||||
.rebuild((b) => b..entityType = EntityType.recurringInvoice));
|
||||
break;
|
||||
case EntityAction.restore:
|
||||
store.dispatch(RestoreQuotesRequest(
|
||||
snackBarCompleter<Null>(context, localization.restoredQuote),
|
||||
|
|
|
|||
|
|
@ -433,6 +433,9 @@ void handleRecurringInvoiceAction(BuildContext context,
|
|||
forceSafariVC: false, forceWebView: false);
|
||||
}
|
||||
break;
|
||||
case EntityAction.cloneToRecurring:
|
||||
createEntity(context: context, entity: recurringInvoice.clone);
|
||||
break;
|
||||
case EntityAction.cloneToInvoice:
|
||||
createEntity(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'clone_to_recurring': 'Clone to Recurring',
|
||||
'crypto': 'Crypto',
|
||||
'paypal': 'PayPal',
|
||||
'alipay': 'Alipay',
|
||||
|
|
@ -4637,6 +4638,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
String get crypto => _localizedValues[localeCode]['crypto'] ?? '';
|
||||
|
||||
String get cloneToRecurring =>
|
||||
_localizedValues[localeCode]['clone_to_recurring'] ?? '';
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
|||
case EntityAction.cloneToInvoice:
|
||||
case EntityAction.cloneToQuote:
|
||||
case EntityAction.cloneToCredit:
|
||||
case EntityAction.cloneToRecurring:
|
||||
return Icons.control_point_duplicate;
|
||||
case EntityAction.markSent:
|
||||
return Icons.public;
|
||||
|
|
|
|||
Loading…
Reference in New Issue