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
|
@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 company = store.state.company;
|
||||||
final client = widget.client;
|
final client = widget.client;
|
||||||
|
|
||||||
List<Widget> _buildDetailsList() {
|
List<Widget> _buildDetailsList() {
|
||||||
|
|
@ -53,6 +55,31 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
||||||
final contacts = client.contacts;
|
final contacts = client.contacts;
|
||||||
|
|
||||||
contacts.forEach((contact) {
|
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(
|
listTiles.add(AppListTile(
|
||||||
buttonRow: PortalLinks(
|
buttonRow: PortalLinks(
|
||||||
viewLink: contact.silentLink,
|
viewLink: contact.silentLink,
|
||||||
|
|
@ -63,7 +90,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
||||||
title: contact.fullName.isEmpty
|
title: contact.fullName.isEmpty
|
||||||
? localization.blankContact
|
? localization.blankContact
|
||||||
: contact.fullName,
|
: contact.fullName,
|
||||||
subtitle: contact.email,
|
subtitle: subtitleParts.join('\n'),
|
||||||
copyValue: contact.email,
|
copyValue: contact.email,
|
||||||
onLongPress: () => setState(() {
|
onLongPress: () => setState(() {
|
||||||
if ((contact.email ?? '').isEmpty) {
|
if ((contact.email ?? '').isEmpty) {
|
||||||
|
|
|
||||||
|
|
@ -363,19 +363,27 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
|
||||||
icon: Icons.phone, text: contact.phone),
|
icon: Icons.phone, text: contact.phone),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (contact.customValue1.isNotEmpty)
|
if (company.hasCustomField(
|
||||||
|
CustomFieldType.contact1) &&
|
||||||
|
contact.customValue1.isNotEmpty)
|
||||||
Text(company.formatCustomFieldValue(
|
Text(company.formatCustomFieldValue(
|
||||||
CustomFieldType.contact1,
|
CustomFieldType.contact1,
|
||||||
contact.customValue1)),
|
contact.customValue1)),
|
||||||
if (contact.customValue2.isNotEmpty)
|
if (company.hasCustomField(
|
||||||
|
CustomFieldType.contact2) &&
|
||||||
|
contact.customValue2.isNotEmpty)
|
||||||
Text(company.formatCustomFieldValue(
|
Text(company.formatCustomFieldValue(
|
||||||
CustomFieldType.contact2,
|
CustomFieldType.contact2,
|
||||||
contact.customValue2)),
|
contact.customValue2)),
|
||||||
if (contact.customValue3.isNotEmpty)
|
if (company.hasCustomField(
|
||||||
|
CustomFieldType.contact3) &&
|
||||||
|
contact.customValue3.isNotEmpty)
|
||||||
Text(company.formatCustomFieldValue(
|
Text(company.formatCustomFieldValue(
|
||||||
CustomFieldType.contact3,
|
CustomFieldType.contact3,
|
||||||
contact.customValue3)),
|
contact.customValue3)),
|
||||||
if (contact.customValue4.isNotEmpty)
|
if (company.hasCustomField(
|
||||||
|
CustomFieldType.contact4) &&
|
||||||
|
contact.customValue4.isNotEmpty)
|
||||||
Text(company.formatCustomFieldValue(
|
Text(company.formatCustomFieldValue(
|
||||||
CustomFieldType.contact4,
|
CustomFieldType.contact4,
|
||||||
contact.customValue4)),
|
contact.customValue4)),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue