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