Merge branch 'develop' of github.com:invoiceninja/flutter-mobile into develop
This commit is contained in:
commit
086b750b21
|
|
@ -9,6 +9,7 @@ import 'package:invoiceninja_flutter/data/models/gateway_token_model.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
|
|
||||||
part 'client_model.g.dart';
|
part 'client_model.g.dart';
|
||||||
|
|
@ -323,7 +324,12 @@ abstract class ClientEntity extends Object
|
||||||
bool get hasEmailAddress =>
|
bool get hasEmailAddress =>
|
||||||
contacts.where((contact) => contact.email?.isNotEmpty).isNotEmpty;
|
contacts.where((contact) => contact.email?.isNotEmpty).isNotEmpty;
|
||||||
|
|
||||||
int compareTo(ClientEntity client, String sortField, bool sortAscending) {
|
int compareTo(
|
||||||
|
ClientEntity client,
|
||||||
|
String sortField,
|
||||||
|
bool sortAscending,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
StaticState staticState) {
|
||||||
int response = 0;
|
int response = 0;
|
||||||
final ClientEntity clientA = sortAscending ? this : client;
|
final ClientEntity clientA = sortAscending ? this : client;
|
||||||
final ClientEntity clientB = sortAscending ? client : this;
|
final ClientEntity clientB = sortAscending ? client : this;
|
||||||
|
|
@ -356,9 +362,91 @@ abstract class ClientEntity extends Object
|
||||||
case ClientFields.idNumber:
|
case ClientFields.idNumber:
|
||||||
response = clientA.idNumber.compareTo(clientB.idNumber);
|
response = clientA.idNumber.compareTo(clientB.idNumber);
|
||||||
break;
|
break;
|
||||||
|
case ClientFields.website:
|
||||||
|
response = clientA.website
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.website.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.address1:
|
||||||
|
response = clientA.address1
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.address1.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.address2:
|
||||||
|
response = clientA.address2
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.address2.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.phone:
|
||||||
|
response = clientA.phone
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.phone.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.publicNotes:
|
||||||
|
response = clientA.publicNotes
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.publicNotes.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.privateNotes:
|
||||||
|
response = clientA.privateNotes
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.privateNotes.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.vatNumber:
|
||||||
|
response = clientA.vatNumber
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(clientB.vatNumber.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.assignedToId:
|
||||||
|
case EntityFields.assignedTo:
|
||||||
|
final userA = userMap[clientA.assignedUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[clientB.assignedUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.createdById:
|
||||||
|
case EntityFields.createdBy:
|
||||||
|
final userA = userMap[clientA.createdUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[clientB.createdUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.country:
|
||||||
|
final countryA = staticState.countryMap[clientA.countryId] ?? CountryEntity();
|
||||||
|
final countryB = staticState.countryMap[clientB.countryId] ?? CountryEntity();
|
||||||
|
response = countryA.name.toLowerCase()
|
||||||
|
.compareTo(countryB.name.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.currency:
|
||||||
|
final currencyA = staticState.currencyMap[clientA.currencyId] ?? CurrencyEntity();
|
||||||
|
final currencyB = staticState.currencyMap[clientB.currencyId] ?? CurrencyEntity();
|
||||||
|
response = currencyA.name.toLowerCase()
|
||||||
|
.compareTo(currencyB.name.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.state:
|
||||||
|
case ClientFields.state:
|
||||||
|
final stateA = EntityState.valueOf(clientA.entityState) ?? EntityState.active;
|
||||||
|
final stateB = EntityState.valueOf(clientB.entityState) ?? EntityState.active;
|
||||||
|
response = stateA.name.toLowerCase()
|
||||||
|
.compareTo(stateB.name.toLowerCase());
|
||||||
|
break;
|
||||||
|
case ClientFields.language:
|
||||||
|
final languageA = staticState.languageMap[clientA.languageId] ?? LanguageEntity();
|
||||||
|
final languageB = staticState.languageMap[clientB.languageId] ?? LanguageEntity();
|
||||||
|
response = languageA.name.toLowerCase()
|
||||||
|
.compareTo(languageB.name.toLowerCase());
|
||||||
|
break;
|
||||||
case ClientFields.createdAt:
|
case ClientFields.createdAt:
|
||||||
response = clientA.createdAt.compareTo(clientB.createdAt);
|
response = clientA.createdAt.compareTo(clientB.createdAt);
|
||||||
break;
|
break;
|
||||||
|
case ClientFields.archivedAt:
|
||||||
|
response = clientA.archivedAt.compareTo(clientB.archivedAt);
|
||||||
|
break;
|
||||||
|
case ClientFields.lastLoginAt:
|
||||||
|
response = clientA.lastLogin.compareTo(clientB.lastLogin);
|
||||||
|
break;
|
||||||
case ClientFields.custom1:
|
case ClientFields.custom1:
|
||||||
response = clientA.customValue1
|
response = clientA.customValue1
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import 'package:invoiceninja_flutter/data/models/mixins/invoice_mixin.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/quote_model.dart';
|
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/redux/static/static_state.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
|
|
||||||
part 'invoice_model.g.dart';
|
part 'invoice_model.g.dart';
|
||||||
|
|
@ -376,7 +377,9 @@ abstract class InvoiceEntity extends Object
|
||||||
{InvoiceEntity invoice,
|
{InvoiceEntity invoice,
|
||||||
String sortField,
|
String sortField,
|
||||||
bool sortAscending,
|
bool sortAscending,
|
||||||
BuiltMap<String, ClientEntity> clientMap}) {
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap}) {
|
||||||
int response = 0;
|
int response = 0;
|
||||||
final InvoiceEntity invoiceA = sortAscending ? this : invoice;
|
final InvoiceEntity invoiceA = sortAscending ? this : invoice;
|
||||||
final InvoiceEntity invoiceB = sortAscending ? invoice : this;
|
final InvoiceEntity invoiceB = sortAscending ? invoice : this;
|
||||||
|
|
@ -394,9 +397,15 @@ abstract class InvoiceEntity extends Object
|
||||||
case CreditFields.amount:
|
case CreditFields.amount:
|
||||||
response = invoiceA.amount.compareTo(invoiceB.amount);
|
response = invoiceA.amount.compareTo(invoiceB.amount);
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.createdAt:
|
||||||
|
response = invoiceA.createdAt.compareTo(invoiceB.createdAt);
|
||||||
|
break;
|
||||||
case EntityFields.updatedAt:
|
case EntityFields.updatedAt:
|
||||||
response = invoiceA.updatedAt.compareTo(invoiceB.updatedAt);
|
response = invoiceA.updatedAt.compareTo(invoiceB.updatedAt);
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.archivedAt:
|
||||||
|
response = invoiceA.archivedAt.compareTo(invoiceB.archivedAt);
|
||||||
|
break;
|
||||||
case InvoiceFields.invoiceDate:
|
case InvoiceFields.invoiceDate:
|
||||||
case QuoteFields.date:
|
case QuoteFields.date:
|
||||||
case CreditFields.date:
|
case CreditFields.date:
|
||||||
|
|
@ -405,13 +414,58 @@ abstract class InvoiceEntity extends Object
|
||||||
case InvoiceFields.balance:
|
case InvoiceFields.balance:
|
||||||
response = invoiceA.balance.compareTo(invoiceB.balance);
|
response = invoiceA.balance.compareTo(invoiceB.balance);
|
||||||
break;
|
break;
|
||||||
|
case InvoiceFields.discount:
|
||||||
|
response = invoiceA.discount.compareTo(invoiceB.discount);
|
||||||
|
break;
|
||||||
|
case InvoiceFields.documents:
|
||||||
|
response = invoiceA.documents.length.compareTo(invoiceB.documents.length);
|
||||||
|
break;
|
||||||
|
case InvoiceFields.poNumber:
|
||||||
|
response = invoiceA.poNumber.compareTo(invoiceB.poNumber);
|
||||||
|
break;
|
||||||
case InvoiceFields.statusId:
|
case InvoiceFields.statusId:
|
||||||
response = invoiceA.statusId.compareTo(invoiceB.statusId);
|
response = invoiceA.statusId.compareTo(invoiceB.statusId);
|
||||||
break;
|
break;
|
||||||
|
case InvoiceFields.status:
|
||||||
|
response = (staticState.invoiceStatusMap[invoiceA.statusId]?.name ?? '')
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(
|
||||||
|
staticState.invoiceStatusMap[invoiceB.statusId]?.name ?? '');
|
||||||
|
break;
|
||||||
|
case EntityFields.state:
|
||||||
|
final stateA = EntityState.valueOf(invoiceA.entityState) ?? EntityState.active;
|
||||||
|
final stateB = EntityState.valueOf(invoiceB.entityState) ?? EntityState.active;
|
||||||
|
response = stateA.name.toLowerCase()
|
||||||
|
.compareTo(stateB.name.toLowerCase());
|
||||||
|
break;
|
||||||
case InvoiceFields.dueDate:
|
case InvoiceFields.dueDate:
|
||||||
case QuoteFields.validUntil:
|
case QuoteFields.validUntil:
|
||||||
response = invoiceA.dueDate.compareTo(invoiceB.dueDate);
|
response = invoiceA.dueDate.compareTo(invoiceB.dueDate);
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.assignedTo:
|
||||||
|
final userA = userMap[invoiceA.assignedUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[invoiceB.assignedUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.createdBy:
|
||||||
|
final userA = userMap[invoiceA.createdUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[invoiceB.createdUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case InvoiceFields.publicNotes:
|
||||||
|
response = invoiceA.publicNotes
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(invoiceB.publicNotes.toLowerCase());
|
||||||
|
break;
|
||||||
|
case InvoiceFields.privateNotes:
|
||||||
|
response = invoiceA.privateNotes
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(invoiceB.privateNotes.toLowerCase());
|
||||||
|
break;
|
||||||
case InvoiceFields.customValue1:
|
case InvoiceFields.customValue1:
|
||||||
response = invoiceA.customValue1
|
response = invoiceA.customValue1
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ class PaymentFields {
|
||||||
static const String privateNotes = 'private_notes';
|
static const String privateNotes = 'private_notes';
|
||||||
static const String exchangeRate = 'exchange_rate';
|
static const String exchangeRate = 'exchange_rate';
|
||||||
static const String exchangeCurrencyId = 'exchange_currency_id';
|
static const String exchangeCurrencyId = 'exchange_currency_id';
|
||||||
static const String paymentStatusId = 'payment_status_id';
|
|
||||||
static const String paymentStatus = 'payment_status';
|
static const String paymentStatus = 'payment_status';
|
||||||
static const String customValue1 = 'custom1';
|
static const String customValue1 = 'custom1';
|
||||||
static const String customValue2 = 'custom2';
|
static const String customValue2 = 'custom2';
|
||||||
|
|
@ -190,7 +189,8 @@ abstract class PaymentEntity extends Object
|
||||||
String sortField,
|
String sortField,
|
||||||
bool sortAscending,
|
bool sortAscending,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap}) {
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
BuiltMap<String, UserEntity> userMap}) {
|
||||||
int response = 0;
|
int response = 0;
|
||||||
final PaymentEntity paymentA = sortAscending ? this : payment;
|
final PaymentEntity paymentA = sortAscending ? this : payment;
|
||||||
final PaymentEntity paymentB = sortAscending ? payment : this;
|
final PaymentEntity paymentB = sortAscending ? payment : this;
|
||||||
|
|
@ -199,6 +199,12 @@ abstract class PaymentEntity extends Object
|
||||||
case PaymentFields.amount:
|
case PaymentFields.amount:
|
||||||
response = paymentA.amount.compareTo(paymentB.amount);
|
response = paymentA.amount.compareTo(paymentB.amount);
|
||||||
break;
|
break;
|
||||||
|
case PaymentFields.exchangeRate:
|
||||||
|
response = paymentA.exchangeRate.compareTo(paymentB.exchangeRate);
|
||||||
|
break;
|
||||||
|
case PaymentFields.refunded:
|
||||||
|
response = paymentA.refunded.compareTo(paymentB.refunded);
|
||||||
|
break;
|
||||||
case PaymentFields.paymentNumber:
|
case PaymentFields.paymentNumber:
|
||||||
response = paymentA.number
|
response = paymentA.number
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
@ -211,9 +217,20 @@ abstract class PaymentEntity extends Object
|
||||||
case PaymentFields.paymentDate:
|
case PaymentFields.paymentDate:
|
||||||
response = paymentA.date.compareTo(paymentB.date);
|
response = paymentA.date.compareTo(paymentB.date);
|
||||||
break;
|
break;
|
||||||
|
case PaymentFields.privateNotes:
|
||||||
|
response = paymentA.privateNotes
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(paymentB.date.toLowerCase());
|
||||||
|
break;
|
||||||
case EntityFields.updatedAt:
|
case EntityFields.updatedAt:
|
||||||
response = paymentA.updatedAt.compareTo(paymentB.updatedAt);
|
response = paymentA.updatedAt.compareTo(paymentB.updatedAt);
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.createdAt:
|
||||||
|
response = paymentA.createdAt.compareTo(paymentB.createdAt);
|
||||||
|
break;
|
||||||
|
case EntityFields.archivedAt:
|
||||||
|
response = paymentA.archivedAt.compareTo(paymentB.archivedAt);
|
||||||
|
break;
|
||||||
case PaymentFields.paymentStatus:
|
case PaymentFields.paymentStatus:
|
||||||
response = paymentA.statusId.compareTo(paymentB.statusId);
|
response = paymentA.statusId.compareTo(paymentB.statusId);
|
||||||
break;
|
break;
|
||||||
|
|
@ -251,6 +268,26 @@ abstract class PaymentEntity extends Object
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.compareTo(clientB.displayName.toLowerCase());
|
.compareTo(clientB.displayName.toLowerCase());
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.assignedTo:
|
||||||
|
final userA = userMap[paymentA.assignedUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[paymentB.assignedUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.createdBy:
|
||||||
|
final userA = userMap[paymentA.createdUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[paymentB.createdUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.state:
|
||||||
|
final stateA = EntityState.valueOf(paymentA.entityState) ?? EntityState.active;
|
||||||
|
final stateB = EntityState.valueOf(paymentB.entityState) ?? EntityState.active;
|
||||||
|
response = stateA.name.toLowerCase()
|
||||||
|
.compareTo(stateB.name.toLowerCase());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('## ERROR: sort by payment.$sortField is not implemented');
|
print('## ERROR: sort by payment.$sortField is not implemented');
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,12 @@ abstract class ProductEntity extends Object
|
||||||
@override
|
@override
|
||||||
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
||||||
|
|
||||||
int compareTo(ProductEntity product,
|
int compareTo(
|
||||||
[String sortField, bool sortAscending = true]) {
|
ProductEntity product, [
|
||||||
|
String sortField,
|
||||||
|
bool sortAscending = true,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
]) {
|
||||||
int response = 0;
|
int response = 0;
|
||||||
final ProductEntity productA = sortAscending ? this : product;
|
final ProductEntity productA = sortAscending ? this : product;
|
||||||
final ProductEntity productB = sortAscending ? product : this;
|
final ProductEntity productB = sortAscending ? product : this;
|
||||||
|
|
@ -192,11 +196,37 @@ abstract class ProductEntity extends Object
|
||||||
case ProductFields.updatedAt:
|
case ProductFields.updatedAt:
|
||||||
response = productA.updatedAt.compareTo(productB.updatedAt);
|
response = productA.updatedAt.compareTo(productB.updatedAt);
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.createdAt:
|
||||||
|
response = productA.createdAt.compareTo(productB.createdAt);
|
||||||
|
break;
|
||||||
|
case ProductFields.archivedAt:
|
||||||
|
response = productA.archivedAt.compareTo(productB.archivedAt);
|
||||||
|
break;
|
||||||
case ProductFields.notes:
|
case ProductFields.notes:
|
||||||
response = productA.notes
|
response = productA.notes
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.compareTo(productB.notes.toLowerCase());
|
.compareTo(productB.notes.toLowerCase());
|
||||||
break;
|
break;
|
||||||
|
case EntityFields.assignedTo:
|
||||||
|
final userA = userMap[productA.assignedUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[productB.assignedUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.createdBy:
|
||||||
|
final userA = userMap[productA.createdUserId] ?? UserEntity();
|
||||||
|
final userB = userMap[productB.createdUserId] ?? UserEntity();
|
||||||
|
response = userA.listDisplayName
|
||||||
|
.toLowerCase()
|
||||||
|
.compareTo(userB.listDisplayName.toLowerCase());
|
||||||
|
break;
|
||||||
|
case EntityFields.state:
|
||||||
|
final stateA = EntityState.valueOf(productA.entityState) ?? EntityState.active;
|
||||||
|
final stateB = EntityState.valueOf(productB.entityState) ?? EntityState.active;
|
||||||
|
response = stateA.name.toLowerCase()
|
||||||
|
.compareTo(stateB.name.toLowerCase());
|
||||||
|
break;
|
||||||
case ProductFields.customValue1:
|
case ProductFields.customValue1:
|
||||||
response = productA.customValue1
|
response = productA.customValue1
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,50 @@
|
||||||
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
import 'package:invoiceninja_flutter/data/models/group_model.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
|
||||||
import 'package:memoize/memoize.dart';
|
import 'package:memoize/memoize.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||||
|
|
||||||
var memoizedDropdownClientList = memo2(
|
var memoizedDropdownClientList = memo4(
|
||||||
(BuiltMap<String, ClientEntity> clientMap, BuiltList<String> clientList) =>
|
(BuiltMap<String, ClientEntity> clientMap, BuiltList<String> clientList,
|
||||||
dropdownClientsSelector(clientMap, clientList));
|
BuiltMap<String, UserEntity> userMap, StaticState staticState) =>
|
||||||
|
dropdownClientsSelector(clientMap, clientList, userMap, staticState));
|
||||||
|
|
||||||
List<String> dropdownClientsSelector(
|
List<String> dropdownClientsSelector(
|
||||||
BuiltMap<String, ClientEntity> clientMap, BuiltList<String> clientList) {
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
BuiltList<String> clientList,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
StaticState staticState) {
|
||||||
final list =
|
final list =
|
||||||
clientList.where((clientId) => clientMap[clientId].isActive).toList();
|
clientList.where((clientId) => clientMap[clientId].isActive).toList();
|
||||||
|
|
||||||
list.sort((clientAId, clientBId) {
|
list.sort((clientAId, clientBId) {
|
||||||
final clientA = clientMap[clientAId];
|
final clientA = clientMap[clientAId];
|
||||||
final clientB = clientMap[clientBId];
|
final clientB = clientMap[clientBId];
|
||||||
return clientA.compareTo(clientB, ClientFields.name, true);
|
return clientA.compareTo(
|
||||||
|
clientB, ClientFields.name, true, userMap, staticState);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredClientList = memo4((BuiltMap<String, ClientEntity>
|
var memoizedFilteredClientList = memo6(
|
||||||
clientMap,
|
(BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> clientList,
|
BuiltList<String> clientList,
|
||||||
BuiltMap<String, GroupEntity> groupMap,
|
BuiltMap<String, GroupEntity> groupMap,
|
||||||
ListUIState clientListState) =>
|
ListUIState clientListState,
|
||||||
filteredClientsSelector(clientMap, clientList, groupMap, clientListState));
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
StaticState staticState) =>
|
||||||
|
filteredClientsSelector(clientMap, clientList, groupMap,
|
||||||
|
clientListState, userMap, staticState));
|
||||||
|
|
||||||
List<String> filteredClientsSelector(
|
List<String> filteredClientsSelector(
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> clientList,
|
BuiltList<String> clientList,
|
||||||
BuiltMap<String, GroupEntity> groupMap,
|
BuiltMap<String, GroupEntity> groupMap,
|
||||||
ListUIState clientListState) {
|
ListUIState clientListState,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
StaticState staticState) {
|
||||||
final list = clientList.where((clientId) {
|
final list = clientList.where((clientId) {
|
||||||
final client = clientMap[clientId];
|
final client = clientMap[clientId];
|
||||||
final group = groupMap[client.groupId] ?? GroupEntity(id: client.groupId);
|
final group = groupMap[client.groupId] ?? GroupEntity(id: client.groupId);
|
||||||
|
|
@ -78,8 +89,8 @@ List<String> filteredClientsSelector(
|
||||||
list.sort((clientAId, clientBId) {
|
list.sort((clientAId, clientBId) {
|
||||||
final clientA = clientMap[clientAId];
|
final clientA = clientMap[clientAId];
|
||||||
final clientB = clientMap[clientBId];
|
final clientB = clientMap[clientBId];
|
||||||
return clientA.compareTo(
|
return clientA.compareTo(clientB, clientListState.sortField,
|
||||||
clientB, clientListState.sortField, clientListState.sortAscending);
|
clientListState.sortAscending, userMap, staticState);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,26 @@
|
||||||
|
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
|
||||||
import 'package:memoize/memoize.dart';
|
import 'package:memoize/memoize.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||||
|
|
||||||
var memoizedDropdownCreditList = memo4(
|
var memoizedDropdownCreditList = memo6(
|
||||||
(BuiltMap<String, InvoiceEntity> creditMap,
|
(BuiltMap<String, InvoiceEntity> creditMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> creditList,
|
BuiltList<String> creditList,
|
||||||
String clientId) =>
|
String clientId,
|
||||||
dropdownCreditSelector(creditMap, clientMap, creditList, clientId));
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
|
dropdownCreditSelector(
|
||||||
|
creditMap, clientMap, creditList, clientId, staticState, userMap));
|
||||||
|
|
||||||
List<String> dropdownCreditSelector(
|
List<String> dropdownCreditSelector(
|
||||||
BuiltMap<String, InvoiceEntity> creditMap,
|
BuiltMap<String, InvoiceEntity> creditMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> creditList,
|
BuiltList<String> creditList,
|
||||||
String clientId) {
|
String clientId,
|
||||||
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list = creditList.where((creditId) {
|
final list = creditList.where((creditId) {
|
||||||
final credit = creditMap[creditId];
|
final credit = creditMap[creditId];
|
||||||
if (clientId != null &&
|
if (clientId != null &&
|
||||||
|
|
@ -33,11 +39,12 @@ List<String> dropdownCreditSelector(
|
||||||
final creditA = creditMap[creditAId];
|
final creditA = creditMap[creditAId];
|
||||||
final creditB = creditMap[creditBId];
|
final creditB = creditMap[creditBId];
|
||||||
return creditA.compareTo(
|
return creditA.compareTo(
|
||||||
invoice: creditB,
|
invoice: creditB,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
sortAscending: true,
|
sortAscending: true,
|
||||||
sortField: ClientFields.name,
|
sortField: ClientFields.name,
|
||||||
);
|
staticState: staticState,
|
||||||
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -48,18 +55,23 @@ ClientEntity creditClientSelector(
|
||||||
return clientMap[credit.clientId];
|
return clientMap[credit.clientId];
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredCreditList = memo4((BuiltMap<String, InvoiceEntity>
|
var memoizedFilteredCreditList = memo6(
|
||||||
creditMap,
|
(BuiltMap<String, InvoiceEntity> creditMap,
|
||||||
BuiltList<String> creditList,
|
BuiltList<String> creditList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
ListUIState creditListState) =>
|
ListUIState creditListState,
|
||||||
filteredCreditsSelector(creditMap, creditList, clientMap, creditListState));
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
|
filteredCreditsSelector(creditMap, creditList, clientMap,
|
||||||
|
creditListState, staticState, userMap));
|
||||||
|
|
||||||
List<String> filteredCreditsSelector(
|
List<String> filteredCreditsSelector(
|
||||||
BuiltMap<String, InvoiceEntity> creditMap,
|
BuiltMap<String, InvoiceEntity> creditMap,
|
||||||
BuiltList<String> creditList,
|
BuiltList<String> creditList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
ListUIState creditListState) {
|
ListUIState creditListState,
|
||||||
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list = creditList.where((creditId) {
|
final list = creditList.where((creditId) {
|
||||||
final credit = creditMap[creditId];
|
final credit = creditMap[creditId];
|
||||||
final client =
|
final client =
|
||||||
|
|
@ -102,11 +114,12 @@ List<String> filteredCreditsSelector(
|
||||||
|
|
||||||
list.sort((creditAId, creditBId) {
|
list.sort((creditAId, creditBId) {
|
||||||
return creditMap[creditAId].compareTo(
|
return creditMap[creditAId].compareTo(
|
||||||
invoice: creditMap[creditBId],
|
invoice: creditMap[creditBId],
|
||||||
sortField: creditListState.sortField,
|
sortField: creditListState.sortField,
|
||||||
sortAscending: creditListState.sortAscending,
|
sortAscending: creditListState.sortAscending,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
);
|
staticState: staticState,
|
||||||
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,26 @@
|
||||||
|
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
|
||||||
import 'package:memoize/memoize.dart';
|
import 'package:memoize/memoize.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||||
|
|
||||||
var memoizedDropdownInvoiceList = memo4(
|
var memoizedDropdownInvoiceList = memo6(
|
||||||
(BuiltMap<String, InvoiceEntity> invoiceMap,
|
(BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> invoiceList,
|
BuiltList<String> invoiceList,
|
||||||
String clientId) =>
|
String clientId,
|
||||||
dropdownInvoiceSelector(invoiceMap, clientMap, invoiceList, clientId));
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
|
dropdownInvoiceSelector(invoiceMap, clientMap, invoiceList, clientId,
|
||||||
|
staticState, userMap));
|
||||||
|
|
||||||
List<String> dropdownInvoiceSelector(
|
List<String> dropdownInvoiceSelector(
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltList<String> invoiceList,
|
BuiltList<String> invoiceList,
|
||||||
String clientId) {
|
String clientId,
|
||||||
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list = invoiceList.where((invoiceId) {
|
final list = invoiceList.where((invoiceId) {
|
||||||
final invoice = invoiceMap[invoiceId];
|
final invoice = invoiceMap[invoiceId];
|
||||||
if (clientId != null &&
|
if (clientId != null &&
|
||||||
|
|
@ -35,33 +41,36 @@ List<String> dropdownInvoiceSelector(
|
||||||
final invoiceA = invoiceMap[invoiceAId];
|
final invoiceA = invoiceMap[invoiceAId];
|
||||||
final invoiceB = invoiceMap[invoiceBId];
|
final invoiceB = invoiceMap[invoiceBId];
|
||||||
return invoiceA.compareTo(
|
return invoiceA.compareTo(
|
||||||
invoice: invoiceB,
|
invoice: invoiceB,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
sortAscending: false,
|
sortAscending: false,
|
||||||
sortField: InvoiceFields.invoiceNumber,
|
sortField: InvoiceFields.invoiceNumber,
|
||||||
);
|
staticState: staticState,
|
||||||
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredInvoiceList = memo5((
|
var memoizedFilteredInvoiceList = memo7(
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
(BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltList<String> invoiceList,
|
BuiltList<String> invoiceList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltMap<String, PaymentEntity> paymentMap,
|
BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
ListUIState invoiceListState,
|
ListUIState invoiceListState,
|
||||||
) =>
|
StaticState staticState,
|
||||||
filteredInvoicesSelector(
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
invoiceMap, invoiceList, clientMap, paymentMap, invoiceListState));
|
filteredInvoicesSelector(invoiceMap, invoiceList, clientMap, paymentMap,
|
||||||
|
invoiceListState, staticState, userMap));
|
||||||
|
|
||||||
List<String> filteredInvoicesSelector(
|
List<String> filteredInvoicesSelector(
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltList<String> invoiceList,
|
BuiltList<String> invoiceList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
BuiltMap<String, PaymentEntity> paymentMap,
|
BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
ListUIState invoiceListState,
|
ListUIState invoiceListState,
|
||||||
) {
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final Map<String, List<String>> invoicePaymentMap = {};
|
final Map<String, List<String>> invoicePaymentMap = {};
|
||||||
|
|
||||||
if (invoiceListState.filterEntityType == EntityType.payment) {
|
if (invoiceListState.filterEntityType == EntityType.payment) {
|
||||||
|
|
@ -128,11 +137,12 @@ List<String> filteredInvoicesSelector(
|
||||||
|
|
||||||
list.sort((invoiceAId, invoiceBId) {
|
list.sort((invoiceAId, invoiceBId) {
|
||||||
return invoiceMap[invoiceAId].compareTo(
|
return invoiceMap[invoiceAId].compareTo(
|
||||||
invoice: invoiceMap[invoiceBId],
|
invoice: invoiceMap[invoiceBId],
|
||||||
sortField: invoiceListState.sortField,
|
sortField: invoiceListState.sortField,
|
||||||
sortAscending: invoiceListState.sortAscending,
|
sortAscending: invoiceListState.sortAscending,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
);
|
staticState: staticState,
|
||||||
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,22 @@ List<PaymentEntity> paymentsByInvoiceSelector(String invoiceId,
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedDropdownPaymentList = memo4((BuiltMap<String, PaymentEntity>
|
var memoizedDropdownPaymentList = memo5((
|
||||||
paymentMap,
|
BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
BuiltList<String> paymentList,
|
BuiltList<String> paymentList,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap) =>
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
dropdownPaymentsSelector(paymentMap, paymentList, invoiceMap, clientMap));
|
BuiltMap<String, UserEntity> userMap,
|
||||||
|
) =>
|
||||||
|
dropdownPaymentsSelector(
|
||||||
|
paymentMap, paymentList, invoiceMap, clientMap, userMap));
|
||||||
|
|
||||||
List<String> dropdownPaymentsSelector(
|
List<String> dropdownPaymentsSelector(
|
||||||
BuiltMap<String, PaymentEntity> paymentMap,
|
BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
BuiltList<String> paymentList,
|
BuiltList<String> paymentList,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
) {
|
) {
|
||||||
final list =
|
final list =
|
||||||
paymentList.where((paymentId) => paymentMap[paymentId].isActive).toList();
|
paymentList.where((paymentId) => paymentMap[paymentId].isActive).toList();
|
||||||
|
|
@ -39,31 +43,33 @@ List<String> dropdownPaymentsSelector(
|
||||||
final paymentB = paymentMap[paymentBId];
|
final paymentB = paymentMap[paymentBId];
|
||||||
|
|
||||||
return paymentA.compareTo(
|
return paymentA.compareTo(
|
||||||
payment: paymentB,
|
payment: paymentB,
|
||||||
sortAscending: true,
|
sortAscending: true,
|
||||||
sortField: PaymentFields.paymentDate,
|
sortField: PaymentFields.paymentDate,
|
||||||
invoiceMap: invoiceMap,
|
invoiceMap: invoiceMap,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
);
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredPaymentList = memo5(
|
var memoizedFilteredPaymentList = memo6(
|
||||||
(BuiltMap<String, PaymentEntity> paymentMap,
|
(BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
BuiltList<String> paymentList,
|
BuiltList<String> paymentList,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
ListUIState paymentListState) =>
|
ListUIState paymentListState) =>
|
||||||
filteredPaymentsSelector(
|
filteredPaymentsSelector(paymentMap, paymentList, invoiceMap, clientMap,
|
||||||
paymentMap, paymentList, invoiceMap, clientMap, paymentListState));
|
userMap, paymentListState));
|
||||||
|
|
||||||
List<String> filteredPaymentsSelector(
|
List<String> filteredPaymentsSelector(
|
||||||
BuiltMap<String, PaymentEntity> paymentMap,
|
BuiltMap<String, PaymentEntity> paymentMap,
|
||||||
BuiltList<String> paymentList,
|
BuiltList<String> paymentList,
|
||||||
BuiltMap<String, InvoiceEntity> invoiceMap,
|
BuiltMap<String, InvoiceEntity> invoiceMap,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
|
BuiltMap<String, UserEntity> userMap,
|
||||||
ListUIState paymentListState) {
|
ListUIState paymentListState) {
|
||||||
final list = paymentList.where((paymentId) {
|
final list = paymentList.where((paymentId) {
|
||||||
final payment = paymentMap[paymentId];
|
final payment = paymentMap[paymentId];
|
||||||
|
|
@ -101,12 +107,12 @@ List<String> filteredPaymentsSelector(
|
||||||
final paymentA = paymentMap[paymentAId];
|
final paymentA = paymentMap[paymentAId];
|
||||||
final paymentB = paymentMap[paymentBId];
|
final paymentB = paymentMap[paymentBId];
|
||||||
return paymentA.compareTo(
|
return paymentA.compareTo(
|
||||||
payment: paymentB,
|
payment: paymentB,
|
||||||
sortAscending: paymentListState.sortAscending,
|
sortAscending: paymentListState.sortAscending,
|
||||||
sortField: paymentListState.sortField,
|
sortField: paymentListState.sortField,
|
||||||
invoiceMap: invoiceMap,
|
invoiceMap: invoiceMap,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
);
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -29,20 +29,23 @@ InvoiceItemEntity convertProductToInvoiceItem({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedDropdownProductList = memo2(
|
var memoizedDropdownProductList = memo3(
|
||||||
(BuiltMap<String, ProductEntity> productMap,
|
(BuiltMap<String, ProductEntity> productMap, BuiltList<String> productList,
|
||||||
BuiltList<String> productList) =>
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
dropdownProductsSelector(productMap, productList));
|
dropdownProductsSelector(productMap, productList, userMap));
|
||||||
|
|
||||||
List<String> dropdownProductsSelector(
|
List<String> dropdownProductsSelector(
|
||||||
BuiltMap<String, ProductEntity> productMap, BuiltList<String> productList) {
|
BuiltMap<String, ProductEntity> productMap,
|
||||||
|
BuiltList<String> productList,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list =
|
final list =
|
||||||
productList.where((productId) => productMap[productId].isActive).toList();
|
productList.where((productId) => productMap[productId].isActive).toList();
|
||||||
|
|
||||||
list.sort((productAId, productBId) {
|
list.sort((productAId, productBId) {
|
||||||
final productA = productMap[productAId];
|
final productA = productMap[productAId];
|
||||||
final productB = productMap[productBId];
|
final productB = productMap[productBId];
|
||||||
return productA.compareTo(productB, ProductFields.productKey, true);
|
return productA.compareTo(
|
||||||
|
productB, ProductFields.productKey, true, userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -63,15 +66,19 @@ List<String> productList(BuiltMap<String, ProductEntity> productMap) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredProductList = memo3(
|
var memoizedFilteredProductList = memo4(
|
||||||
(BuiltMap<String, ProductEntity> productMap, BuiltList<String> productList,
|
(BuiltMap<String, ProductEntity> productMap,
|
||||||
ListUIState productListState) =>
|
BuiltList<String> productList,
|
||||||
filteredProductsSelector(productMap, productList, productListState));
|
ListUIState productListState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
|
filteredProductsSelector(
|
||||||
|
productMap, productList, productListState, userMap));
|
||||||
|
|
||||||
List<String> filteredProductsSelector(
|
List<String> filteredProductsSelector(
|
||||||
BuiltMap<String, ProductEntity> productMap,
|
BuiltMap<String, ProductEntity> productMap,
|
||||||
BuiltList<String> productList,
|
BuiltList<String> productList,
|
||||||
ListUIState productListState) {
|
ListUIState productListState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list = productList.where((productId) {
|
final list = productList.where((productId) {
|
||||||
final product = productMap[productId];
|
final product = productMap[productId];
|
||||||
if (!product.matchesStates(productListState.stateFilters)) {
|
if (!product.matchesStates(productListState.stateFilters)) {
|
||||||
|
|
@ -94,8 +101,8 @@ List<String> filteredProductsSelector(
|
||||||
list.sort((productAId, productBId) {
|
list.sort((productAId, productBId) {
|
||||||
final productA = productMap[productAId];
|
final productA = productMap[productAId];
|
||||||
final productB = productMap[productBId];
|
final productB = productMap[productBId];
|
||||||
return productA.compareTo(
|
return productA.compareTo(productB, productListState.sortField,
|
||||||
productB, productListState.sortField, productListState.sortAscending);
|
productListState.sortAscending, userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:invoiceninja_flutter/redux/static/static_state.dart';
|
||||||
import 'package:memoize/memoize.dart';
|
import 'package:memoize/memoize.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
|
@ -8,17 +9,22 @@ ClientEntity quoteClientSelector(
|
||||||
return clientMap[quote.clientId];
|
return clientMap[quote.clientId];
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoizedFilteredQuoteList = memo4((BuiltMap<String, InvoiceEntity> quoteMap,
|
var memoizedFilteredQuoteList = memo6((BuiltMap<String, InvoiceEntity> quoteMap,
|
||||||
BuiltList<String> quoteList,
|
BuiltList<String> quoteList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
ListUIState quoteListState) =>
|
ListUIState quoteListState,
|
||||||
filteredQuotesSelector(quoteMap, quoteList, clientMap, quoteListState));
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) =>
|
||||||
|
filteredQuotesSelector(
|
||||||
|
quoteMap, quoteList, clientMap, quoteListState, staticState, userMap));
|
||||||
|
|
||||||
List<String> filteredQuotesSelector(
|
List<String> filteredQuotesSelector(
|
||||||
BuiltMap<String, InvoiceEntity> quoteMap,
|
BuiltMap<String, InvoiceEntity> quoteMap,
|
||||||
BuiltList<String> quoteList,
|
BuiltList<String> quoteList,
|
||||||
BuiltMap<String, ClientEntity> clientMap,
|
BuiltMap<String, ClientEntity> clientMap,
|
||||||
ListUIState quoteListState) {
|
ListUIState quoteListState,
|
||||||
|
StaticState staticState,
|
||||||
|
BuiltMap<String, UserEntity> userMap) {
|
||||||
final list = quoteList.where((quoteId) {
|
final list = quoteList.where((quoteId) {
|
||||||
final quote = quoteMap[quoteId];
|
final quote = quoteMap[quoteId];
|
||||||
final client =
|
final client =
|
||||||
|
|
@ -61,11 +67,12 @@ List<String> filteredQuotesSelector(
|
||||||
|
|
||||||
list.sort((quoteAId, quoteBId) {
|
list.sort((quoteAId, quoteBId) {
|
||||||
return quoteMap[quoteAId].compareTo(
|
return quoteMap[quoteAId].compareTo(
|
||||||
invoice: quoteMap[quoteBId],
|
invoice: quoteMap[quoteBId],
|
||||||
sortField: quoteListState.sortField,
|
sortField: quoteListState.sortField,
|
||||||
sortAscending: quoteListState.sortAscending,
|
sortAscending: quoteListState.sortAscending,
|
||||||
clientMap: clientMap,
|
clientMap: clientMap,
|
||||||
);
|
staticState: staticState,
|
||||||
|
userMap: userMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/client/client_selectors.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/client/client_state.dart';
|
import 'package:invoiceninja_flutter/redux/client/client_state.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||||
|
|
@ -25,6 +27,8 @@ class ClientPicker extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
final store = StoreProvider.of<AppState>(context);
|
||||||
|
final state = store.state;
|
||||||
|
|
||||||
return EntityDropdown(
|
return EntityDropdown(
|
||||||
key: ValueKey('__client_${clientId}__'),
|
key: ValueKey('__client_${clientId}__'),
|
||||||
|
|
@ -32,7 +36,8 @@ class ClientPicker extends StatelessWidget {
|
||||||
labelText: localization.client,
|
labelText: localization.client,
|
||||||
entityId: clientId,
|
entityId: clientId,
|
||||||
autofocus: autofocus,
|
autofocus: autofocus,
|
||||||
entityList: memoizedDropdownClientList(clientState.map, clientState.list),
|
entityList: memoizedDropdownClientList(clientState.map, clientState.list,
|
||||||
|
state.userState.map, state.staticState),
|
||||||
entityMap: clientState.map,
|
entityMap: clientState.map,
|
||||||
validator: (String val) => val.trim().isEmpty
|
validator: (String val) => val.trim().isEmpty
|
||||||
? AppLocalization.of(context).pleaseSelectAClient
|
? AppLocalization.of(context).pleaseSelectAClient
|
||||||
|
|
|
||||||
|
|
@ -128,8 +128,13 @@ class ClientListVM {
|
||||||
|
|
||||||
return ClientListVM(
|
return ClientListVM(
|
||||||
state: state,
|
state: state,
|
||||||
clientList: memoizedFilteredClientList(state.clientState.map,
|
clientList: memoizedFilteredClientList(
|
||||||
state.clientState.list, state.groupState.map, state.clientListState),
|
state.clientState.map,
|
||||||
|
state.clientState.list,
|
||||||
|
state.groupState.map,
|
||||||
|
state.clientListState,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
isLoaded: state.clientState.isLoaded,
|
isLoaded: state.clientState.isLoaded,
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,13 @@ class ClientScreenVM {
|
||||||
|
|
||||||
return ClientScreenVM(
|
return ClientScreenVM(
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
clientList: memoizedFilteredClientList(state.clientState.map,
|
clientList: memoizedFilteredClientList(
|
||||||
state.clientState.list, state.groupState.map, state.clientListState),
|
state.clientState.map,
|
||||||
|
state.clientState.list,
|
||||||
|
state.groupState.map,
|
||||||
|
state.clientListState,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.clientListState.isInMultiselect(),
|
isInMultiselect: state.clientListState.isInMultiselect(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -145,8 +145,13 @@ class CreditListVM extends EntityListVM {
|
||||||
state: state,
|
state: state,
|
||||||
user: state.user,
|
user: state.user,
|
||||||
listState: state.creditListState,
|
listState: state.creditListState,
|
||||||
invoiceList: memoizedFilteredCreditList(state.creditState.map,
|
invoiceList: memoizedFilteredCreditList(
|
||||||
state.creditState.list, state.clientState.map, state.creditListState),
|
state.creditState.map,
|
||||||
|
state.creditState.list,
|
||||||
|
state.clientState.map,
|
||||||
|
state.creditListState,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
invoiceMap: state.creditState.map,
|
invoiceMap: state.creditState.map,
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,13 @@ class CreditScreenVM {
|
||||||
|
|
||||||
return CreditScreenVM(
|
return CreditScreenVM(
|
||||||
creditMap: state.creditState.map,
|
creditMap: state.creditState.map,
|
||||||
creditList: memoizedFilteredCreditList(state.creditState.map,
|
creditList: memoizedFilteredCreditList(
|
||||||
state.creditState.list, state.clientState.map, state.creditListState),
|
state.creditState.map,
|
||||||
|
state.creditState.list,
|
||||||
|
state.clientState.map,
|
||||||
|
state.creditListState,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.creditListState.isInMultiselect(),
|
isInMultiselect: state.creditListState.isInMultiselect(),
|
||||||
onEntityAction: (BuildContext context, List<BaseEntity> credits,
|
onEntityAction: (BuildContext context, List<BaseEntity> credits,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
import 'package:invoiceninja_flutter/ui/app/entity_dropdown.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/custom_field.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/custom_field.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
||||||
|
|
@ -84,6 +86,8 @@ class ExpenseEditDetailsState extends State<ExpenseEditDetails> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
final store = StoreProvider.of<AppState>(context);
|
||||||
|
final state = store.state;
|
||||||
final viewModel = widget.viewModel;
|
final viewModel = widget.viewModel;
|
||||||
final expense = viewModel.expense;
|
final expense = viewModel.expense;
|
||||||
final company = viewModel.company;
|
final company = viewModel.company;
|
||||||
|
|
@ -121,7 +125,10 @@ class ExpenseEditDetailsState extends State<ExpenseEditDetails> {
|
||||||
labelText: localization.client,
|
labelText: localization.client,
|
||||||
entityId: expense.clientId,
|
entityId: expense.clientId,
|
||||||
entityList: memoizedDropdownClientList(
|
entityList: memoizedDropdownClientList(
|
||||||
clientState.map, clientState.list),
|
clientState.map,
|
||||||
|
clientState.list,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
onSelected: (client) {
|
onSelected: (client) {
|
||||||
final currencyId =
|
final currencyId =
|
||||||
(client as ClientEntity)?.settings?.currencyId ??
|
(client as ClientEntity)?.settings?.currencyId ??
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
final invoice = viewModel.invoice;
|
final invoice = viewModel.invoice;
|
||||||
final lineItems = invoice.lineItems.toList();
|
final lineItems = invoice.lineItems.toList();
|
||||||
final productState = state.productState;
|
final productState = state.productState;
|
||||||
final productIds =
|
final productIds = memoizedDropdownProductList(
|
||||||
memoizedDropdownProductList(productState.map, productState.list);
|
productState.map, productState.list, state.userState.map);
|
||||||
|
|
||||||
if (lineItems.where((item) => item.isEmpty).isEmpty) {
|
if (lineItems.where((item) => item.isEmpty).isEmpty) {
|
||||||
lineItems.add(InvoiceItemEntity());
|
lineItems.add(InvoiceItemEntity());
|
||||||
|
|
@ -150,7 +150,7 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
return productIds
|
return productIds
|
||||||
.where((productId) => productState.map[productId]
|
.where((productId) => productState.map[productId]
|
||||||
.matchesFilter(pattern))
|
.matchesFilter(pattern))
|
||||||
.toList();
|
.toList();
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
itemBuilder: (context, productId) {
|
itemBuilder: (context, productId) {
|
||||||
|
|
|
||||||
|
|
@ -182,12 +182,13 @@ class InvoiceListVM extends EntityListVM {
|
||||||
user: state.user,
|
user: state.user,
|
||||||
listState: state.invoiceListState,
|
listState: state.invoiceListState,
|
||||||
invoiceList: memoizedFilteredInvoiceList(
|
invoiceList: memoizedFilteredInvoiceList(
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.invoiceState.list,
|
state.invoiceState.list,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
state.paymentState.map,
|
state.paymentState.map,
|
||||||
state.invoiceListState,
|
state.invoiceListState,
|
||||||
),
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
invoiceMap: state.invoiceState.map,
|
invoiceMap: state.invoiceState.map,
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,13 @@ class InvoiceScreenVM {
|
||||||
return InvoiceScreenVM(
|
return InvoiceScreenVM(
|
||||||
invoiceMap: state.invoiceState.map,
|
invoiceMap: state.invoiceState.map,
|
||||||
invoiceList: memoizedFilteredInvoiceList(
|
invoiceList: memoizedFilteredInvoiceList(
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.invoiceState.list,
|
state.invoiceState.list,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
state.paymentState.map,
|
state.paymentState.map,
|
||||||
state.invoiceListState,
|
state.invoiceListState,
|
||||||
),
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.invoiceListState.isInMultiselect(),
|
isInMultiselect: state.invoiceListState.isInMultiselect(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,10 @@ class _PaymentEditState extends State<PaymentEdit> {
|
||||||
..invoices.clear()));
|
..invoices.clear()));
|
||||||
},
|
},
|
||||||
entityList: memoizedDropdownClientList(
|
entityList: memoizedDropdownClientList(
|
||||||
state.clientState.map, state.clientState.list),
|
state.clientState.map,
|
||||||
|
state.clientState.list,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
),
|
),
|
||||||
if (payment.isForInvoice != true &&
|
if (payment.isForInvoice != true &&
|
||||||
payment.isForCredit != true)
|
payment.isForCredit != true)
|
||||||
|
|
@ -359,7 +362,9 @@ class _PaymentableEditorState extends State<PaymentableEditor> {
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
state.invoiceState.list,
|
state.invoiceState.list,
|
||||||
payment.clientId),
|
payment.clientId,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
final invoice = selected as InvoiceEntity;
|
final invoice = selected as InvoiceEntity;
|
||||||
_amountController.text = formatNumber(invoice.balance, context,
|
_amountController.text = formatNumber(invoice.balance, context,
|
||||||
|
|
@ -380,7 +385,9 @@ class _PaymentableEditorState extends State<PaymentableEditor> {
|
||||||
state.creditState.map,
|
state.creditState.map,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
state.creditState.list,
|
state.creditState.list,
|
||||||
payment.clientId),
|
payment.clientId,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
final credit = selected as InvoiceEntity;
|
final credit = selected as InvoiceEntity;
|
||||||
_amountController.text = formatNumber(credit.balance, context,
|
_amountController.text = formatNumber(credit.balance, context,
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@ class PaymentListVM {
|
||||||
state.paymentState.list,
|
state.paymentState.list,
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
|
state.userState.map,
|
||||||
state.paymentListState),
|
state.paymentListState),
|
||||||
paymentMap: state.paymentState.map,
|
paymentMap: state.paymentState.map,
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ class PaymentPresenter extends EntityPresenter {
|
||||||
PaymentFields.paymentNumber,
|
PaymentFields.paymentNumber,
|
||||||
PaymentFields.client,
|
PaymentFields.client,
|
||||||
PaymentFields.amount,
|
PaymentFields.amount,
|
||||||
PaymentFields.paymentStatus,
|
|
||||||
PaymentFields.invoiceNumber,
|
PaymentFields.invoiceNumber,
|
||||||
PaymentFields.paymentDate,
|
PaymentFields.paymentDate,
|
||||||
PaymentFields.transactionReference,
|
PaymentFields.transactionReference,
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class PaymentScreenVM {
|
||||||
state.paymentState.list,
|
state.paymentState.list,
|
||||||
state.invoiceState.map,
|
state.invoiceState.map,
|
||||||
state.clientState.map,
|
state.clientState.map,
|
||||||
|
state.userState.map,
|
||||||
state.paymentListState),
|
state.paymentListState),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.paymentListState.isInMultiselect(),
|
isInMultiselect: state.paymentListState.isInMultiselect(),
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class ProductListVM {
|
||||||
return ProductListVM(
|
return ProductListVM(
|
||||||
state: state,
|
state: state,
|
||||||
productList: memoizedFilteredProductList(state.productState.map,
|
productList: memoizedFilteredProductList(state.productState.map,
|
||||||
state.productState.list, state.productListState),
|
state.productState.list, state.productListState, state.userState.map),
|
||||||
productMap: state.productState.map,
|
productMap: state.productState.map,
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
isLoaded: state.productState.isLoaded,
|
isLoaded: state.productState.isLoaded,
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class ProductScreenVM {
|
||||||
return ProductScreenVM(
|
return ProductScreenVM(
|
||||||
productMap: state.productState.map,
|
productMap: state.productState.map,
|
||||||
productList: memoizedFilteredProductList(state.productState.map,
|
productList: memoizedFilteredProductList(state.productState.map,
|
||||||
state.productState.list, state.productListState),
|
state.productState.list, state.productListState, state.userState.map),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.productListState.isInMultiselect(),
|
isInMultiselect: state.productListState.isInMultiselect(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,10 @@ class _ProjectEditState extends State<ProjectEdit> {
|
||||||
labelText: localization.client,
|
labelText: localization.client,
|
||||||
entityId: project.clientId,
|
entityId: project.clientId,
|
||||||
entityList: memoizedDropdownClientList(
|
entityList: memoizedDropdownClientList(
|
||||||
state.clientState.map, state.clientState.list),
|
state.clientState.map,
|
||||||
|
state.clientState.list,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
validator: (String val) => val.trim().isEmpty
|
validator: (String val) => val.trim().isEmpty
|
||||||
? localization.pleaseSelectAClient
|
? localization.pleaseSelectAClient
|
||||||
: null,
|
: null,
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,13 @@ class QuoteListVM extends EntityListVM {
|
||||||
state: state,
|
state: state,
|
||||||
user: state.user,
|
user: state.user,
|
||||||
listState: state.quoteListState,
|
listState: state.quoteListState,
|
||||||
invoiceList: memoizedFilteredQuoteList(state.quoteState.map,
|
invoiceList: memoizedFilteredQuoteList(
|
||||||
state.quoteState.list, state.clientState.map, state.quoteListState),
|
state.quoteState.map,
|
||||||
|
state.quoteState.list,
|
||||||
|
state.clientState.map,
|
||||||
|
state.quoteListState,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
invoiceMap: state.quoteState.map,
|
invoiceMap: state.quoteState.map,
|
||||||
clientMap: state.clientState.map,
|
clientMap: state.clientState.map,
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,13 @@ class QuoteScreenVM {
|
||||||
|
|
||||||
return QuoteScreenVM(
|
return QuoteScreenVM(
|
||||||
quoteMap: state.quoteState.map,
|
quoteMap: state.quoteState.map,
|
||||||
quoteList: memoizedFilteredQuoteList(state.quoteState.map,
|
quoteList: memoizedFilteredQuoteList(
|
||||||
state.quoteState.list, state.clientState.map, state.quoteListState),
|
state.quoteState.map,
|
||||||
|
state.quoteState.list,
|
||||||
|
state.clientState.map,
|
||||||
|
state.quoteListState,
|
||||||
|
state.staticState,
|
||||||
|
state.userState.map),
|
||||||
userCompany: state.userCompany,
|
userCompany: state.userCompany,
|
||||||
isInMultiselect: state.quoteListState.isInMultiselect(),
|
isInMultiselect: state.quoteListState.isInMultiselect(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,10 @@ class _TaskEditDetailsState extends State<TaskEditDetails> {
|
||||||
labelText: localization.client,
|
labelText: localization.client,
|
||||||
entityId: task.clientId,
|
entityId: task.clientId,
|
||||||
entityList: memoizedDropdownClientList(
|
entityList: memoizedDropdownClientList(
|
||||||
state.clientState.map, state.clientState.list),
|
state.clientState.map,
|
||||||
|
state.clientState.list,
|
||||||
|
state.userState.map,
|
||||||
|
state.staticState),
|
||||||
onSelected: (client) {
|
onSelected: (client) {
|
||||||
viewModel.onChanged(task.rebuild((b) => b
|
viewModel.onChanged(task.rebuild((b) => b
|
||||||
..clientId = client?.id
|
..clientId = client?.id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue