Invoice status 'Viewed' does not work #312
This commit is contained in:
parent
ed50b921b8
commit
05e93d6fdc
|
|
@ -16,6 +16,7 @@ class InvoiceStatusColors {
|
||||||
kInvoiceStatusPastDue: _colorTheme.colorDanger,
|
kInvoiceStatusPastDue: _colorTheme.colorDanger,
|
||||||
kInvoiceStatusCancelled: _colorTheme.colorLightGray,
|
kInvoiceStatusCancelled: _colorTheme.colorLightGray,
|
||||||
kInvoiceStatusReversed: _colorTheme.colorLightGray,
|
kInvoiceStatusReversed: _colorTheme.colorLightGray,
|
||||||
|
kInvoiceStatusViewed: _colorTheme.colorWarning,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,6 +64,7 @@ class QuoteStatusColors {
|
||||||
kQuoteStatusApproved: _colorTheme.colorPrimary,
|
kQuoteStatusApproved: _colorTheme.colorPrimary,
|
||||||
kQuoteStatusConverted: _colorTheme.colorSuccess,
|
kQuoteStatusConverted: _colorTheme.colorSuccess,
|
||||||
kQuoteStatusExpired: _colorTheme.colorDanger,
|
kQuoteStatusExpired: _colorTheme.colorDanger,
|
||||||
|
kQuoteStatusViewed: _colorTheme.colorWarning,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ const kInvoiceStatuses = {
|
||||||
kInvoiceStatusPaid: 'paid',
|
kInvoiceStatusPaid: 'paid',
|
||||||
kInvoiceStatusCancelled: 'cancelled',
|
kInvoiceStatusCancelled: 'cancelled',
|
||||||
kInvoiceStatusReversed: 'reversed',
|
kInvoiceStatusReversed: 'reversed',
|
||||||
|
kInvoiceStatusViewed: 'viewed',
|
||||||
};
|
};
|
||||||
|
|
||||||
const String kRecurringInvoiceStatusDraft = '1';
|
const String kRecurringInvoiceStatusDraft = '1';
|
||||||
|
|
@ -185,6 +186,7 @@ const kRecurringInvoiceStatuses = {
|
||||||
kRecurringInvoiceStatusPending: 'pending',
|
kRecurringInvoiceStatusPending: 'pending',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const String kQuoteStatusViewed = '-2';
|
||||||
const String kQuoteStatusExpired = '-1';
|
const String kQuoteStatusExpired = '-1';
|
||||||
const String kQuoteStatusDraft = '1';
|
const String kQuoteStatusDraft = '1';
|
||||||
const String kQuoteStatusSent = '2';
|
const String kQuoteStatusSent = '2';
|
||||||
|
|
@ -197,6 +199,7 @@ const kQuoteStatuses = {
|
||||||
kQuoteStatusSent: 'sent',
|
kQuoteStatusSent: 'sent',
|
||||||
kQuoteStatusApproved: 'approved',
|
kQuoteStatusApproved: 'approved',
|
||||||
kQuoteStatusConverted: 'converted',
|
kQuoteStatusConverted: 'converted',
|
||||||
|
kQuoteStatusViewed: 'viewed',
|
||||||
};
|
};
|
||||||
|
|
||||||
const String kCreditStatusDraft = '1';
|
const String kCreditStatusDraft = '1';
|
||||||
|
|
|
||||||
|
|
@ -686,18 +686,10 @@ abstract class InvoiceEntity extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final status in statuses) {
|
for (final status in statuses) {
|
||||||
if (status.id == statusId) {
|
if (status.id == statusId || status.id == calculatedStatusId) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status.id == kInvoiceStatusPastDue && isPastDue) {
|
|
||||||
return true;
|
return true;
|
||||||
} else if (status.id == kInvoiceStatusUnpaid && isUnpaid && isSent) {
|
} else if (status.id == kInvoiceStatusUnpaid && isUnpaid && isSent) {
|
||||||
return true;
|
return true;
|
||||||
} else if (status.id == kInvoiceStatusViewed && isViewed) {
|
|
||||||
return true;
|
|
||||||
} else if (status.id == kRecurringInvoiceStatusPending && isPending) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -969,6 +961,10 @@ abstract class InvoiceEntity extends Object
|
||||||
return kRecurringInvoiceStatusPending;
|
return kRecurringInvoiceStatusPending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isViewed) {
|
||||||
|
return isInvoice ? kInvoiceStatusViewed : kQuoteStatusViewed;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (subEntityType == EntityType.quote && (invoiceId ?? '').isNotEmpty) {
|
if (subEntityType == EntityType.quote && (invoiceId ?? '').isNotEmpty) {
|
||||||
return kQuoteStatusApproved;
|
return kQuoteStatusApproved;
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,11 @@ class _InvitationListTile extends StatelessWidget {
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||||
title: Text(contact.fullNameWithEmail.isEmpty
|
title: Text(contact.fullNameOrEmail),
|
||||||
? client.displayName
|
|
||||||
: contact.fullNameWithEmail),
|
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 4),
|
||||||
if (invitation.sentDate.isNotEmpty)
|
if (invitation.sentDate.isNotEmpty)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 4),
|
padding: const EdgeInsets.only(bottom: 4),
|
||||||
|
|
@ -107,7 +105,7 @@ class _InvitationListTile extends StatelessWidget {
|
||||||
formatDate(invitation.viewedDate, context, showTime: true),
|
formatDate(invitation.viewedDate, context, showTime: true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,11 @@ class QuoteScreen extends StatelessWidget {
|
||||||
..id = kQuoteStatusSent
|
..id = kQuoteStatusSent
|
||||||
..name = localization.sent,
|
..name = localization.sent,
|
||||||
),
|
),
|
||||||
|
InvoiceStatusEntity().rebuild(
|
||||||
|
(b) => b
|
||||||
|
..id = kQuoteStatusViewed
|
||||||
|
..name = localization.viewed,
|
||||||
|
),
|
||||||
InvoiceStatusEntity().rebuild(
|
InvoiceStatusEntity().rebuild(
|
||||||
(b) => b
|
(b) => b
|
||||||
..id = kQuoteStatusApproved
|
..id = kQuoteStatusApproved
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue