Data table fixes
This commit is contained in:
parent
67470e561c
commit
4fc8789cf2
|
|
@ -36,6 +36,7 @@ class CreditFields {
|
|||
static const String balance = 'balance_due';
|
||||
static const String clientId = 'client_id';
|
||||
static const String client = 'client';
|
||||
static const String status = 'status';
|
||||
static const String statusId = 'status_id';
|
||||
static const String creditNumber = 'credit_number';
|
||||
static const String discount = 'discount';
|
||||
|
|
|
|||
|
|
@ -365,17 +365,23 @@ abstract class InvoiceEntity extends Object
|
|||
|
||||
switch (sortField) {
|
||||
case InvoiceFields.invoiceNumber:
|
||||
case QuoteFields.quoteNumber:
|
||||
case CreditFields.creditNumber:
|
||||
response = (invoiceA.number ?? '')
|
||||
.toLowerCase()
|
||||
.compareTo((invoiceB.number ?? '').toLowerCase());
|
||||
break;
|
||||
case InvoiceFields.amount:
|
||||
case QuoteFields.amount:
|
||||
case CreditFields.amount:
|
||||
response = invoiceA.amount.compareTo(invoiceB.amount);
|
||||
break;
|
||||
case InvoiceFields.updatedAt:
|
||||
response = invoiceA.updatedAt.compareTo(invoiceB.updatedAt);
|
||||
break;
|
||||
case InvoiceFields.invoiceDate:
|
||||
case QuoteFields.date:
|
||||
case CreditFields.date:
|
||||
response = invoiceA.date.compareTo(invoiceB.date);
|
||||
break;
|
||||
case InvoiceFields.balance:
|
||||
|
|
|
|||
|
|
@ -32,10 +32,11 @@ abstract class QuoteItemResponse
|
|||
}
|
||||
|
||||
class QuoteFields {
|
||||
static const String amount = 'quote_total';
|
||||
static const String amount = 'quote_amount';
|
||||
static const String balance = 'balance_due';
|
||||
static const String clientId = 'client_id';
|
||||
static const String client = 'client';
|
||||
static const String status = 'status';
|
||||
static const String statusId = 'status_id';
|
||||
static const String quoteNumber = 'quote_number';
|
||||
static const String discount = 'discount';
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ Middleware<AppState> _markInvoicePaid(InvoiceRepository repository) {
|
|||
.bulkAction(
|
||||
store.state.credentials, action.invoiceIds, EntityAction.markPaid)
|
||||
.then((invoices) {
|
||||
store.dispatch(MarkInvoicesSentSuccess(invoices));
|
||||
store.dispatch(MarkInvoicesPaidSuccess(invoices));
|
||||
final Completer<Null> completer = Completer<Null>();
|
||||
completer.future.then((_) {
|
||||
store.dispatch(LoadPayments(force: true));
|
||||
|
|
|
|||
|
|
@ -5,14 +5,17 @@ import 'package:invoiceninja_flutter/data/models/credit_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
|
||||
class CreditPresenter extends EntityPresenter {
|
||||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||
return [
|
||||
CreditFields.creditNumber,
|
||||
CreditFields.client,
|
||||
CreditFields.date,
|
||||
CreditFields.amount,
|
||||
CreditFields.status,
|
||||
CreditFields.date,
|
||||
CreditFields.balance,
|
||||
EntityFields.state,
|
||||
];
|
||||
|
|
@ -20,10 +23,13 @@ class CreditPresenter extends EntityPresenter {
|
|||
|
||||
@override
|
||||
Widget getField({String field, BuildContext context}) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final state = StoreProvider.of<AppState>(context).state;
|
||||
final credit = entity as InvoiceEntity;
|
||||
|
||||
switch (field) {
|
||||
case CreditFields.status:
|
||||
return Text(localization.lookup(kQuoteStatuses[credit.statusId]));
|
||||
case CreditFields.creditNumber:
|
||||
return Text(credit.number);
|
||||
case CreditFields.client:
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
class InvoicePresenter extends EntityPresenter {
|
||||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||
return [
|
||||
InvoiceFields.status,
|
||||
InvoiceFields.invoiceNumber,
|
||||
InvoiceFields.client,
|
||||
InvoiceFields.invoiceDate,
|
||||
InvoiceFields.amount,
|
||||
InvoiceFields.balance,
|
||||
InvoiceFields.status,
|
||||
InvoiceFields.invoiceDate,
|
||||
InvoiceFields.dueDate,
|
||||
EntityFields.state,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ class PaymentPresenter extends EntityPresenter {
|
|||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||
return [
|
||||
PaymentFields.paymentNumber,
|
||||
PaymentFields.client,
|
||||
PaymentFields.amount,
|
||||
PaymentFields.paymentStatus,
|
||||
PaymentFields.invoiceNumber,
|
||||
PaymentFields.client,
|
||||
PaymentFields.transactionReference,
|
||||
PaymentFields.amount,
|
||||
PaymentFields.paymentDate,
|
||||
PaymentFields.transactionReference,
|
||||
PaymentFields.paymentStatus,
|
||||
EntityFields.state,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -5,15 +5,17 @@ import 'package:invoiceninja_flutter/data/models/quote_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
|
||||
class QuotePresenter extends EntityPresenter {
|
||||
static List<String> getTableFields(UserCompanyEntity userCompany) {
|
||||
return [
|
||||
QuoteFields.quoteNumber,
|
||||
QuoteFields.client,
|
||||
QuoteFields.date,
|
||||
QuoteFields.amount,
|
||||
QuoteFields.balance,
|
||||
QuoteFields.status,
|
||||
QuoteFields.date,
|
||||
QuoteFields.validUntil,
|
||||
EntityFields.state,
|
||||
];
|
||||
|
|
@ -21,10 +23,17 @@ class QuotePresenter extends EntityPresenter {
|
|||
|
||||
@override
|
||||
Widget getField({String field, BuildContext context}) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final state = StoreProvider.of<AppState>(context).state;
|
||||
final quote = entity as InvoiceEntity;
|
||||
|
||||
switch (field) {
|
||||
case QuoteFields.status:
|
||||
return Text(
|
||||
quote.isPastDue
|
||||
? localization.expired
|
||||
: localization.lookup(kQuoteStatuses[quote.statusId]),
|
||||
);
|
||||
case QuoteFields.quoteNumber:
|
||||
return Text(quote.number);
|
||||
case QuoteFields.client:
|
||||
|
|
@ -35,8 +44,6 @@ class QuotePresenter extends EntityPresenter {
|
|||
return Text(formatDate(quote.date, context));
|
||||
case QuoteFields.amount:
|
||||
return Text(formatNumber(quote.amount, context));
|
||||
case QuoteFields.balance:
|
||||
return Text(formatNumber(quote.balance, context));
|
||||
case QuoteFields.validUntil:
|
||||
return Text(formatDate(quote.dueDate, context));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'credit_amount': 'Credit Amount',
|
||||
'quote_amount': 'Quote Amount',
|
||||
'hosted': 'Hosted',
|
||||
'selfhosted': 'Self-Hosted',
|
||||
'exclusive': 'Exclusive',
|
||||
|
|
@ -36507,6 +36508,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
String get creditAmount =>
|
||||
_localizedValues[localeCode]['credit_amount'] ?? '';
|
||||
|
||||
String get quoteAmount =>
|
||||
_localizedValues[localeCode]['quote_amount'] ?? '';
|
||||
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
|
|
|
|||
Loading…
Reference in New Issue