Show if a payment is partially applied
This commit is contained in:
parent
3c3cac569a
commit
872f599600
|
|
@ -81,6 +81,7 @@ class PaymentStatusColors {
|
||||||
kPaymentStatusPartiallyRefunded: _colorTheme.colorPrimary,
|
kPaymentStatusPartiallyRefunded: _colorTheme.colorPrimary,
|
||||||
kPaymentStatusRefunded: _colorTheme.colorLightGray,
|
kPaymentStatusRefunded: _colorTheme.colorLightGray,
|
||||||
kPaymentStatusUnapplied: _colorTheme.colorDarkGray,
|
kPaymentStatusUnapplied: _colorTheme.colorDarkGray,
|
||||||
|
kPaymentStatusPartiallyUnapplied: _colorTheme.colorDarkGray,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,7 @@ const String kPermissionCreateAll = 'create_all';
|
||||||
const String kPermissionViewAll = 'view_all';
|
const String kPermissionViewAll = 'view_all';
|
||||||
const String kPermissionEditAll = 'edit_all';
|
const String kPermissionEditAll = 'edit_all';
|
||||||
|
|
||||||
|
const String kPaymentStatusPartiallyUnapplied = '-2';
|
||||||
const String kPaymentStatusUnapplied = '-1';
|
const String kPaymentStatusUnapplied = '-1';
|
||||||
const String kPaymentStatusPending = '1';
|
const String kPaymentStatusPending = '1';
|
||||||
const String kPaymentStatusCancelled = '2';
|
const String kPaymentStatusCancelled = '2';
|
||||||
|
|
@ -412,6 +413,7 @@ const String kPaymentStatusPartiallyRefunded = '5';
|
||||||
const String kPaymentStatusRefunded = '6';
|
const String kPaymentStatusRefunded = '6';
|
||||||
|
|
||||||
const kPaymentStatuses = {
|
const kPaymentStatuses = {
|
||||||
|
kPaymentStatusPartiallyUnapplied: 'partially_unapplied',
|
||||||
kPaymentStatusUnapplied: 'unapplied',
|
kPaymentStatusUnapplied: 'unapplied',
|
||||||
kPaymentStatusPending: 'pending',
|
kPaymentStatusPending: 'pending',
|
||||||
kPaymentStatusCancelled: 'cancelled',
|
kPaymentStatusCancelled: 'cancelled',
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,9 @@ abstract class PaymentEntity extends Object
|
||||||
|
|
||||||
String get calculatedStatusId {
|
String get calculatedStatusId {
|
||||||
if (applied < amount) {
|
if (applied < amount) {
|
||||||
return kPaymentStatusUnapplied;
|
return applied == 0
|
||||||
|
? kPaymentStatusUnapplied
|
||||||
|
: kPaymentStatusPartiallyUnapplied;
|
||||||
}
|
}
|
||||||
|
|
||||||
return statusId;
|
return statusId;
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class EntityStatusChip extends StatelessWidget {
|
||||||
|
|
||||||
switch (entity.entityType) {
|
switch (entity.entityType) {
|
||||||
case EntityType.payment:
|
case EntityType.payment:
|
||||||
|
print('## PAYMENT');
|
||||||
final payment = entity as PaymentEntity;
|
final payment = entity as PaymentEntity;
|
||||||
label = kPaymentStatuses[payment.calculatedStatusId];
|
label = kPaymentStatuses[payment.calculatedStatusId];
|
||||||
color = PaymentStatusColors(state.prefState.colorThemeModel)
|
color = PaymentStatusColors(state.prefState.colorThemeModel)
|
||||||
|
|
@ -91,8 +92,9 @@ class EntityStatusChip extends StatelessWidget {
|
||||||
return SizedBox();
|
return SizedBox();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
print('## label: $label');
|
||||||
label = localization.lookup(label) ?? '';
|
label = localization.lookup(label) ?? '';
|
||||||
|
|
||||||
if (label.isEmpty) {
|
if (label.isEmpty) {
|
||||||
label = localization.logged;
|
label = localization.logged;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
'partially_unapplied': 'Partially Unapplied',
|
||||||
'select_a_gmail_user': 'Please select a user authenticated with Gmail',
|
'select_a_gmail_user': 'Please select a user authenticated with Gmail',
|
||||||
'list_long_press': 'List Long Press',
|
'list_long_press': 'List Long Press',
|
||||||
'show_actions': 'Show Actions',
|
'show_actions': 'Show Actions',
|
||||||
|
|
@ -1400,6 +1401,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
'payment_status_5': 'Partially Refunded',
|
'payment_status_5': 'Partially Refunded',
|
||||||
'payment_status_6': 'Refunded',
|
'payment_status_6': 'Refunded',
|
||||||
'payment_status_-1': 'Unapplied',
|
'payment_status_-1': 'Unapplied',
|
||||||
|
'payment_status_-2': 'Partially Unapplied',
|
||||||
'net': 'Net',
|
'net': 'Net',
|
||||||
'client_portal': 'Client Portal',
|
'client_portal': 'Client Portal',
|
||||||
'show_tasks': 'Show tasks',
|
'show_tasks': 'Show tasks',
|
||||||
|
|
@ -53956,6 +53958,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
String get selectAGmailUser =>
|
String get selectAGmailUser =>
|
||||||
_localizedValues[localeCode]['select_a_gmail_user'] ?? '';
|
_localizedValues[localeCode]['select_a_gmail_user'] ?? '';
|
||||||
|
|
||||||
|
String get partiallyUnapplied =>
|
||||||
|
_localizedValues[localeCode]['partiallyUnapplied'] ?? '';
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue