Show custom fields in full width view
This commit is contained in:
parent
a61ed749ac
commit
6a8f17a3e4
|
|
@ -607,6 +607,20 @@ abstract class CompanyEntity extends Object
|
|||
}
|
||||
}
|
||||
|
||||
String formatCustomFieldValue(String field, String value) {
|
||||
final context = navigatorKey.currentContext;
|
||||
final type = getCustomFieldType(field);
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
if (type == kFieldTypeDate) {
|
||||
value = formatDate(value, context);
|
||||
} else if (type == kFieldTypeSwitch) {
|
||||
value = value == kSwitchValueYes ? localization.yes : localization.no;
|
||||
}
|
||||
|
||||
return getCustomFieldLabel(field) + ': $value';
|
||||
}
|
||||
|
||||
List<String> getCustomFieldValues(String field, {bool excludeBlank = false}) {
|
||||
final values = customFields[field];
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter_redux/flutter_redux.dart';
|
|||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/company_gateway_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/company_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/gateway_token_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/copy_to_clipboard.dart';
|
||||
|
|
@ -63,6 +64,7 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
|
|||
final localization = AppLocalization.of(context);
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final state = store.state;
|
||||
final company = state.company;
|
||||
final client = state.clientState.get(state.uiState.filterEntityId);
|
||||
final documents = client.documents;
|
||||
final viewModel = widget.viewModel;
|
||||
|
|
@ -197,6 +199,18 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
|
|||
if ((client.settings.defaultTaskRate ?? 0) != 0)
|
||||
Text(
|
||||
'${localization.taskRate}: ${client.settings.defaultTaskRate}'),
|
||||
if (client.customValue1.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.client1, client.customValue1)),
|
||||
if (client.customValue2.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.client2, client.customValue2)),
|
||||
if (client.customValue3.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.client3, client.customValue3)),
|
||||
if (client.customValue4.isNotEmpty)
|
||||
Text(company.formatCustomFieldValue(
|
||||
CustomFieldType.client4, client.customValue4)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue