Clients
This commit is contained in:
parent
2408124f6d
commit
d030524329
|
|
@ -180,12 +180,10 @@ abstract class ClientEntity extends Object with BaseEntity implements Built<Clie
|
|||
ClientEntity clientA = sortAscending ? this : client;
|
||||
ClientEntity clientB = sortAscending ? client: this;
|
||||
|
||||
/*
|
||||
switch (sortField) {
|
||||
case ClientFields.cost:
|
||||
response = clientA.cost.compareTo(clientB.cost);
|
||||
case ClientFields.balance:
|
||||
response = clientA.balance.compareTo(clientB.balance);
|
||||
}
|
||||
*/
|
||||
|
||||
if (response == 0) {
|
||||
return clientA.name.compareTo(clientB.name);
|
||||
|
|
@ -199,7 +197,7 @@ abstract class ClientEntity extends Object with BaseEntity implements Built<Clie
|
|||
return true;
|
||||
}
|
||||
|
||||
return name.contains(search);
|
||||
return displayName.contains(search);
|
||||
}
|
||||
|
||||
ClientEntity._();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
|
||||
var contacts = client.contacts;
|
||||
contacts.forEach((contact) {
|
||||
if (contact.email.isNotEmpty) {
|
||||
if ((contact.email ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.email,
|
||||
title: contact.fullName() + '\n' + contact.email,
|
||||
|
|
@ -63,7 +63,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
));
|
||||
}
|
||||
|
||||
if (contact.phone.isNotEmpty) {
|
||||
if ((contact.phone ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.phone,
|
||||
title: contact.fullName() + '\n' + contact.phone,
|
||||
|
|
@ -78,7 +78,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
}
|
||||
});
|
||||
|
||||
if (client.website.isNotEmpty) {
|
||||
if ((client.website ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.link,
|
||||
title: client.website,
|
||||
|
|
@ -89,7 +89,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
));
|
||||
}
|
||||
|
||||
if (client.workPhone.isNotEmpty) {
|
||||
if ((client.workPhone ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.phone,
|
||||
title: client.workPhone,
|
||||
|
|
@ -104,7 +104,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
|
||||
listTiles.add(Divider());
|
||||
|
||||
if (client.vatNumber.isNotEmpty) {
|
||||
if ((client.vatNumber ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.location_city,
|
||||
title: client.vatNumber,
|
||||
|
|
@ -112,7 +112,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
));
|
||||
}
|
||||
|
||||
if (client.idNumber.isNotEmpty) {
|
||||
if ((client.idNumber ?? '').isNotEmpty) {
|
||||
listTiles.add(AppListTile(
|
||||
icon: Icons.business,
|
||||
title: client.idNumber,
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ String formatURL(String url) {
|
|||
String formatAddress({dynamic object, bool isShipping = false, String delimiter = '\n'}) {
|
||||
var str = '';
|
||||
|
||||
String address1 = isShipping ? object.shippingAddress1 : object.address1;
|
||||
String address2 = isShipping ? object.shippingAddress2 : object.address2;
|
||||
String city = isShipping ? object.city : object.city;
|
||||
String state = isShipping ? object.state : object.state;
|
||||
String postalCode = isShipping ? object.postalCode : object.postalCode;
|
||||
String address1 = (isShipping ? object.shippingAddress1 : object.address1) ?? '';
|
||||
String address2 = (isShipping ? object.shippingAddress2 : object.address2) ?? '';
|
||||
String city = (isShipping ? object.city : object.city) ?? '';
|
||||
String state = (isShipping ? object.state : object.state) ?? '';
|
||||
String postalCode = (isShipping ? object.postalCode : object.postalCode) ?? '';
|
||||
|
||||
if (address1.isNotEmpty) {
|
||||
str += address1 + delimiter;
|
||||
|
|
|
|||
Loading…
Reference in New Issue