diff --git a/lib/colors.dart b/lib/colors.dart index af5a17565..74a507f89 100644 --- a/lib/colors.dart +++ b/lib/colors.dart @@ -16,6 +16,7 @@ class InvoiceStatusColors { kInvoiceStatusPastDue: _colorTheme.colorDanger, kInvoiceStatusCancelled: _colorTheme.colorLightGray, kInvoiceStatusReversed: _colorTheme.colorLightGray, + kInvoiceStatusViewed: _colorTheme.colorWarning, }; } } @@ -63,6 +64,7 @@ class QuoteStatusColors { kQuoteStatusApproved: _colorTheme.colorPrimary, kQuoteStatusConverted: _colorTheme.colorSuccess, kQuoteStatusExpired: _colorTheme.colorDanger, + kQuoteStatusViewed: _colorTheme.colorWarning, }; } } diff --git a/lib/constants.dart b/lib/constants.dart index 718e44d18..45de0bb48 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -169,6 +169,7 @@ const kInvoiceStatuses = { kInvoiceStatusPaid: 'paid', kInvoiceStatusCancelled: 'cancelled', kInvoiceStatusReversed: 'reversed', + kInvoiceStatusViewed: 'viewed', }; const String kRecurringInvoiceStatusDraft = '1'; @@ -185,6 +186,7 @@ const kRecurringInvoiceStatuses = { kRecurringInvoiceStatusPending: 'pending', }; +const String kQuoteStatusViewed = '-2'; const String kQuoteStatusExpired = '-1'; const String kQuoteStatusDraft = '1'; const String kQuoteStatusSent = '2'; @@ -197,6 +199,7 @@ const kQuoteStatuses = { kQuoteStatusSent: 'sent', kQuoteStatusApproved: 'approved', kQuoteStatusConverted: 'converted', + kQuoteStatusViewed: 'viewed', }; const String kCreditStatusDraft = '1'; diff --git a/lib/data/models/invoice_model.dart b/lib/data/models/invoice_model.dart index 522629cc5..f4c410627 100644 --- a/lib/data/models/invoice_model.dart +++ b/lib/data/models/invoice_model.dart @@ -686,18 +686,10 @@ abstract class InvoiceEntity extends Object } for (final status in statuses) { - if (status.id == statusId) { - return true; - } - - if (status.id == kInvoiceStatusPastDue && isPastDue) { + if (status.id == statusId || status.id == calculatedStatusId) { return true; } else if (status.id == kInvoiceStatusUnpaid && isUnpaid && isSent) { 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; } + if (isViewed) { + return isInvoice ? kInvoiceStatusViewed : kQuoteStatusViewed; + } + /* if (subEntityType == EntityType.quote && (invoiceId ?? '').isNotEmpty) { return kQuoteStatusApproved; diff --git a/lib/ui/invoice/view/invoice_view_contacts.dart b/lib/ui/invoice/view/invoice_view_contacts.dart index 00258ca53..74b8f2375 100644 --- a/lib/ui/invoice/view/invoice_view_contacts.dart +++ b/lib/ui/invoice/view/invoice_view_contacts.dart @@ -76,13 +76,11 @@ class _InvitationListTile extends StatelessWidget { return ListTile( contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16), - title: Text(contact.fullNameWithEmail.isEmpty - ? client.displayName - : contact.fullNameWithEmail), + title: Text(contact.fullNameOrEmail), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 8), + SizedBox(height: 4), if (invitation.sentDate.isNotEmpty) Padding( padding: const EdgeInsets.only(bottom: 4), @@ -107,7 +105,7 @@ class _InvitationListTile extends StatelessWidget { formatDate(invitation.viewedDate, context, showTime: true), ), ), - SizedBox(height: 4), + SizedBox(height: 8), Row( children: [ Expanded( diff --git a/lib/ui/quote/quote_screen.dart b/lib/ui/quote/quote_screen.dart index 035db4cf4..658978f4d 100644 --- a/lib/ui/quote/quote_screen.dart +++ b/lib/ui/quote/quote_screen.dart @@ -96,6 +96,11 @@ class QuoteScreen extends StatelessWidget { ..id = kQuoteStatusSent ..name = localization.sent, ), + InvoiceStatusEntity().rebuild( + (b) => b + ..id = kQuoteStatusViewed + ..name = localization.viewed, + ), InvoiceStatusEntity().rebuild( (b) => b ..id = kQuoteStatusApproved