SHow unapplied payments
This commit is contained in:
parent
9217d0da3f
commit
414be68cad
|
|
@ -390,6 +390,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 kPaymentStatusUnapplied = '-1';
|
||||||
const String kPaymentStatusPending = '1';
|
const String kPaymentStatusPending = '1';
|
||||||
const String kPaymentStatusCancelled = '2';
|
const String kPaymentStatusCancelled = '2';
|
||||||
const String kPaymentStatusFailed = '3';
|
const String kPaymentStatusFailed = '3';
|
||||||
|
|
@ -398,6 +399,7 @@ const String kPaymentStatusPartiallyRefunded = '5';
|
||||||
const String kPaymentStatusRefunded = '6';
|
const String kPaymentStatusRefunded = '6';
|
||||||
|
|
||||||
const kPaymentStatuses = {
|
const kPaymentStatuses = {
|
||||||
|
kPaymentStatusUnapplied: 'unapplied',
|
||||||
kPaymentStatusPending: 'pending',
|
kPaymentStatusPending: 'pending',
|
||||||
kPaymentStatusCancelled: 'cancelled',
|
kPaymentStatusCancelled: 'cancelled',
|
||||||
kPaymentStatusFailed: 'failed',
|
kPaymentStatusFailed: 'failed',
|
||||||
|
|
@ -502,6 +504,7 @@ class PaymentStatusColors {
|
||||||
kPaymentStatusCompleted: kColorGreen,
|
kPaymentStatusCompleted: kColorGreen,
|
||||||
kPaymentStatusPartiallyRefunded: Colors.purple,
|
kPaymentStatusPartiallyRefunded: Colors.purple,
|
||||||
kPaymentStatusRefunded: convertHexStringToColor('#8D3E3F'),
|
kPaymentStatusRefunded: convertHexStringToColor('#8D3E3F'),
|
||||||
|
kPaymentStatusUnapplied: convertHexStringToColor('#444444'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,14 @@ abstract class PaymentEntity extends Object
|
||||||
|
|
||||||
BuiltList<PaymentableEntity> get credits;
|
BuiltList<PaymentableEntity> get credits;
|
||||||
|
|
||||||
|
String get calculatedStatusId {
|
||||||
|
if (applied < amount) {
|
||||||
|
return kPaymentStatusUnapplied;
|
||||||
|
}
|
||||||
|
|
||||||
|
return statusId;
|
||||||
|
}
|
||||||
|
|
||||||
int compareTo(
|
int compareTo(
|
||||||
{PaymentEntity payment,
|
{PaymentEntity payment,
|
||||||
String sortField,
|
String sortField,
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ class EntityStatusChip extends StatelessWidget {
|
||||||
switch (entity.entityType) {
|
switch (entity.entityType) {
|
||||||
case EntityType.payment:
|
case EntityType.payment:
|
||||||
final payment = entity as PaymentEntity;
|
final payment = entity as PaymentEntity;
|
||||||
label = kPaymentStatuses[payment.statusId];
|
label = kPaymentStatuses[payment.calculatedStatusId];
|
||||||
color = PaymentStatusColors.colors[payment.statusId];
|
color = PaymentStatusColors.colors[payment.calculatedStatusId];
|
||||||
break;
|
break;
|
||||||
case EntityType.invoice:
|
case EntityType.invoice:
|
||||||
final invoice = entity as InvoiceEntity;
|
final invoice = entity as InvoiceEntity;
|
||||||
|
|
|
||||||
|
|
@ -205,10 +205,10 @@ class PaymentListItem extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
localization
|
localization
|
||||||
.lookup('payment_status_${payment.statusId}'),
|
.lookup('payment_status_${payment.calculatedStatusId}'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
PaymentStatusColors.colors[payment.statusId],
|
PaymentStatusColors.colors[payment.calculatedStatusId],
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
'unapplied': 'Unapplied',
|
||||||
'select_label': 'Select Label',
|
'select_label': 'Select Label',
|
||||||
'custom_labels': 'Custom Labels',
|
'custom_labels': 'Custom Labels',
|
||||||
'record_type': 'Record Type',
|
'record_type': 'Record Type',
|
||||||
|
|
@ -39025,6 +39026,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get selectLabel => _localizedValues[localeCode]['select_label'] ?? '';
|
String get selectLabel => _localizedValues[localeCode]['select_label'] ?? '';
|
||||||
|
|
||||||
|
String get unapplied => _localizedValues[localeCode]['unapplied'] ?? '';
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue