Show custom client/vendor contact fields on details tab
This commit is contained in:
parent
98effef307
commit
b8860e5161
|
|
@ -46,6 +46,8 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final company = store.state.company;
|
||||
final client = widget.client;
|
||||
|
||||
List<Widget> _buildDetailsList() {
|
||||
|
|
@ -53,6 +55,31 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
final contacts = client.contacts;
|
||||
|
||||
contacts.forEach((contact) {
|
||||
final subtitleParts = <String>[];
|
||||
if (contact.email.isNotEmpty) {
|
||||
subtitleParts.add(contact.email);
|
||||
}
|
||||
if (company.hasCustomField(CustomFieldType.contact1) &&
|
||||
contact.customValue1.isNotEmpty) {
|
||||
subtitleParts.add(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact1, contact.customValue1));
|
||||
}
|
||||
if (company.hasCustomField(CustomFieldType.contact2) &&
|
||||
contact.customValue2.isNotEmpty) {
|
||||
subtitleParts.add(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact2, contact.customValue2));
|
||||
}
|
||||
if (company.hasCustomField(CustomFieldType.contact3) &&
|
||||
contact.customValue3.isNotEmpty) {
|
||||
subtitleParts.add(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact3, contact.customValue3));
|
||||
}
|
||||
if (company.hasCustomField(CustomFieldType.contact4) &&
|
||||
contact.customValue4.isNotEmpty) {
|
||||
subtitleParts.add(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact4, contact.customValue4));
|
||||
}
|
||||
|
||||
listTiles.add(AppListTile(
|
||||
buttonRow: PortalLinks(
|
||||
viewLink: contact.silentLink,
|
||||
|
|
@ -63,7 +90,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
title: contact.fullName.isEmpty
|
||||
? localization.blankContact
|
||||
: contact.fullName,
|
||||
subtitle: contact.email,
|
||||
subtitle: subtitleParts.join('\n'),
|
||||
copyValue: contact.email,
|
||||
onLongPress: () => setState(() {
|
||||
if ((contact.email ?? '').isEmpty) {
|
||||
|
|
|
|||
|
|
@ -363,19 +363,27 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
|
|||
icon: Icons.phone, text: contact.phone),
|
||||
),
|
||||
),
|
||||
if (contact.customValue1.isNotEmpty)
|
||||
if (company.hasCustomField(
|
||||
CustomFieldType.contact1) &&
|
||||
contact.customValue1.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact1,
|
||||
contact.customValue1)),
|
||||
if (contact.customValue2.isNotEmpty)
|
||||
if (company.hasCustomField(
|
||||
CustomFieldType.contact2) &&
|
||||
contact.customValue2.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact2,
|
||||
contact.customValue2)),
|
||||
if (contact.customValue3.isNotEmpty)
|
||||
if (company.hasCustomField(
|
||||
CustomFieldType.contact3) &&
|
||||
contact.customValue3.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact3,
|
||||
contact.customValue3)),
|
||||
if (contact.customValue4.isNotEmpty)
|
||||
if (company.hasCustomField(
|
||||
CustomFieldType.contact4) &&
|
||||
contact.customValue4.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.contact4,
|
||||
contact.customValue4)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue