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