Show 'System' invoice history

This commit is contained in:
Hillel Coren 2023-11-08 11:27:34 +02:00
parent 4281c7a5a2
commit 39d06df0f4
1 changed files with 7 additions and 2 deletions

View File

@ -38,6 +38,7 @@ class _InvoiceViewHistoryState extends State<InvoiceViewHistory> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final viewModel = widget.viewModel; final viewModel = widget.viewModel;
final invoice = viewModel.invoice!; final invoice = viewModel.invoice!;
final localization = AppLocalization.of(context)!;
// TODO remove this null check, it shouldn't be needed // TODO remove this null check, it shouldn't be needed
if (invoice.isStale) { if (invoice.isStale) {
@ -56,7 +57,7 @@ class _InvoiceViewHistoryState extends State<InvoiceViewHistory> {
activityList.sort((a, b) => b.updatedAt.compareTo(a.updatedAt)); activityList.sort((a, b) => b.updatedAt.compareTo(a.updatedAt));
if (activityList.isEmpty) { if (activityList.isEmpty) {
return HelpText(AppLocalization.of(context)!.noHistory); return HelpText(localization.noHistory);
} }
return ScrollableListViewBuilder( return ScrollableListViewBuilder(
@ -71,7 +72,7 @@ class _InvoiceViewHistoryState extends State<InvoiceViewHistory> {
final contact = client.getContact(activity.contactId); final contact = client.getContact(activity.contactId);
final user = state.userState.get(activity.userId); final user = state.userState.get(activity.userId);
String? personName; String personName = '';
if (contact.isOld) { if (contact.isOld) {
personName = contact.fullNameOrEmail; personName = contact.fullNameOrEmail;
} else if (user.isOld) { } else if (user.isOld) {
@ -83,6 +84,10 @@ class _InvoiceViewHistoryState extends State<InvoiceViewHistory> {
personName = client.name; personName = client.name;
} }
if (personName.isEmpty) {
personName = localization.system;
}
return ListTile( return ListTile(
title: Text( title: Text(
formatNumber(history.amount, context, clientId: invoice.clientId)! + formatNumber(history.amount, context, clientId: invoice.clientId)! +