Quotes
This commit is contained in:
parent
8156456e0a
commit
c30914a27e
|
|
@ -328,8 +328,7 @@ abstract class InvoiceEntity extends Object
|
||||||
|
|
||||||
BuiltList<InvitationEntity> get invitations;
|
BuiltList<InvitationEntity> get invitations;
|
||||||
|
|
||||||
bool get isApproved =>
|
bool get isApproved => statusId == kQuoteStatusApproved;
|
||||||
statusId == kQuoteStatusApproved || (invoiceId ?? '').isNotEmpty;
|
|
||||||
|
|
||||||
bool get hasClient => '${clientId ?? ''}'.isNotEmpty;
|
bool get hasClient => '${clientId ?? ''}'.isNotEmpty;
|
||||||
|
|
||||||
|
|
@ -472,7 +471,7 @@ abstract class InvoiceEntity extends Object
|
||||||
actions.add(EntityAction.sendEmail);
|
actions.add(EntityAction.sendEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userCompany.canCreate(EntityType.payment) && isUnpaid) {
|
if (!isQuote && userCompany.canCreate(EntityType.payment) && isUnpaid) {
|
||||||
actions.add(EntityAction.newPayment);
|
actions.add(EntityAction.newPayment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,9 +479,13 @@ abstract class InvoiceEntity extends Object
|
||||||
actions.add(EntityAction.markSent);
|
actions.add(EntityAction.markSent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPaid) {
|
if (!isQuote && !isPaid) {
|
||||||
actions.add(EntityAction.markPaid);
|
actions.add(EntityAction.markPaid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isQuote && !isApproved) {
|
||||||
|
actions.add(EntityAction.convert);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invitations.isNotEmpty && !multiselect) {
|
if (invitations.isNotEmpty && !multiselect) {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class EntityAction extends EnumClass {
|
||||||
static const EntityAction cloneToInvoice = _$cloneToInvoice;
|
static const EntityAction cloneToInvoice = _$cloneToInvoice;
|
||||||
static const EntityAction cloneToQuote = _$cloneToQuote;
|
static const EntityAction cloneToQuote = _$cloneToQuote;
|
||||||
static const EntityAction convert = _$convert;
|
static const EntityAction convert = _$convert;
|
||||||
|
static const EntityAction approve = _$approve;
|
||||||
static const EntityAction download = _$download;
|
static const EntityAction download = _$download;
|
||||||
static const EntityAction sendEmail = _$sendEmail;
|
static const EntityAction sendEmail = _$sendEmail;
|
||||||
static const EntityAction markSent = _$markSent;
|
static const EntityAction markSent = _$markSent;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ 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 _$convert = const EntityAction._('convert');
|
const EntityAction _$convert = const EntityAction._('convert');
|
||||||
|
const EntityAction _$approve = const EntityAction._('approve');
|
||||||
const EntityAction _$download = const EntityAction._('download');
|
const EntityAction _$download = const EntityAction._('download');
|
||||||
const EntityAction _$sendEmail = const EntityAction._('sendEmail');
|
const EntityAction _$sendEmail = const EntityAction._('sendEmail');
|
||||||
const EntityAction _$markSent = const EntityAction._('markSent');
|
const EntityAction _$markSent = const EntityAction._('markSent');
|
||||||
|
|
@ -63,6 +64,8 @@ EntityAction _$valueOf(String name) {
|
||||||
return _$cloneToQuote;
|
return _$cloneToQuote;
|
||||||
case 'convert':
|
case 'convert':
|
||||||
return _$convert;
|
return _$convert;
|
||||||
|
case 'approve':
|
||||||
|
return _$approve;
|
||||||
case 'download':
|
case 'download':
|
||||||
return _$download;
|
return _$download;
|
||||||
case 'sendEmail':
|
case 'sendEmail':
|
||||||
|
|
@ -126,6 +129,7 @@ final BuiltSet<EntityAction> _$values =
|
||||||
_$cloneToInvoice,
|
_$cloneToInvoice,
|
||||||
_$cloneToQuote,
|
_$cloneToQuote,
|
||||||
_$convert,
|
_$convert,
|
||||||
|
_$approve,
|
||||||
_$download,
|
_$download,
|
||||||
_$sendEmail,
|
_$sendEmail,
|
||||||
_$markSent,
|
_$markSent,
|
||||||
|
|
|
||||||
|
|
@ -413,14 +413,9 @@ Future handleQuoteAction(
|
||||||
entityType: EntityType.invoice);
|
entityType: EntityType.invoice);
|
||||||
break;
|
break;
|
||||||
case EntityAction.convert:
|
case EntityAction.convert:
|
||||||
final Completer<InvoiceEntity> completer = Completer<InvoiceEntity>();
|
store.dispatch(ConvertQuotes(
|
||||||
store.dispatch(ConvertQuotes(completer, quoteIds));
|
snackBarCompleter<Null>(context, localization.convertedQuote),
|
||||||
completer.future.then((InvoiceEntity invoice) {
|
quoteIds));
|
||||||
viewEntityById(
|
|
||||||
context: context,
|
|
||||||
entityType: EntityType.invoice,
|
|
||||||
entityId: invoice.id);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case EntityAction.markSent:
|
case EntityAction.markSent:
|
||||||
store.dispatch(MarkSentQuotesRequest(
|
store.dispatch(MarkSentQuotesRequest(
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ Middleware<AppState> _convertQuote(QuoteRepository repository) {
|
||||||
store.state.credentials, action.quoteIds, EntityAction.convert)
|
store.state.credentials, action.quoteIds, EntityAction.convert)
|
||||||
.then((quotes) {
|
.then((quotes) {
|
||||||
store.dispatch(ConvertQuoteSuccess(quotes: quotes));
|
store.dispatch(ConvertQuoteSuccess(quotes: quotes));
|
||||||
action.completer.complete(quotes);
|
action.completer.complete(null);
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
print(error);
|
print(error);
|
||||||
store.dispatch(ConvertQuoteFailure(error));
|
store.dispatch(ConvertQuoteFailure(error));
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
'converted_quote': 'Successfully converted quote',
|
||||||
'credit_design': 'Credit Design',
|
'credit_design': 'Credit Design',
|
||||||
'includes': 'Includes',
|
'includes': 'Includes',
|
||||||
'header': 'Header',
|
'header': 'Header',
|
||||||
|
|
@ -32847,6 +32848,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
String get partialPaymentEmail =>
|
String get partialPaymentEmail =>
|
||||||
_localizedValues[localeCode]['partial_payment_email'];
|
_localizedValues[localeCode]['partial_payment_email'];
|
||||||
|
|
||||||
|
String get convertedQuote => _localizedValues[localeCode]['converted_quote'];
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
return _localizedValues[localeCode][lookupKey] ??
|
return _localizedValues[localeCode][lookupKey] ??
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
||||||
case EntityAction.restore:
|
case EntityAction.restore:
|
||||||
return Icons.restore;
|
return Icons.restore;
|
||||||
case EntityAction.convert:
|
case EntityAction.convert:
|
||||||
return Icons.check_box;
|
return Icons.content_copy;
|
||||||
|
case EntityAction.approve:
|
||||||
|
return Icons.check_circle_outline;
|
||||||
case EntityAction.viewInvoice:
|
case EntityAction.viewInvoice:
|
||||||
return Icons.insert_drive_file;
|
return Icons.insert_drive_file;
|
||||||
case EntityAction.newInvoice:
|
case EntityAction.newInvoice:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue