diff --git a/lib/data/models/product_model.dart b/lib/data/models/product_model.dart index df4b86309..4cddd13bd 100644 --- a/lib/data/models/product_model.dart +++ b/lib/data/models/product_model.dart @@ -65,6 +65,8 @@ class ProductFields { static const String taxName2 = 'tax_name2'; static const String taxRate3 = 'tax_rate3'; static const String taxName3 = 'tax_name3'; + static const String stockQuantity = 'stock_quantity'; + static const String notificationThreshold = 'notification_threshold'; } abstract class ProductEntity extends Object diff --git a/lib/ui/app/presenters/entity_presenter.dart b/lib/ui/app/presenters/entity_presenter.dart index a67798b33..d393192dd 100644 --- a/lib/ui/app/presenters/entity_presenter.dart +++ b/lib/ui/app/presenters/entity_presenter.dart @@ -149,6 +149,8 @@ class EntityPresenter { 'age_group_60', 'age_group_90', 'age_group_120', + 'stock_quantity', + 'notification_threshold', ].contains(field); return value; diff --git a/lib/ui/product/product_presenter.dart b/lib/ui/product/product_presenter.dart index 06abc84fb..b753757b7 100644 --- a/lib/ui/product/product_presenter.dart +++ b/lib/ui/product/product_presenter.dart @@ -34,6 +34,8 @@ class ProductPresenter extends EntityPresenter { ProductFields.taxName1, ProductFields.taxName2, ProductFields.taxName3, + ProductFields.stockQuantity, + ProductFields.notificationThreshold, ]; } @@ -91,6 +93,13 @@ class ProductPresenter extends EntityPresenter { case ProductFields.taxRate3: return Text(formatNumber(product.taxRate3, context, formatNumberType: FormatNumberType.percent)); + case ProductFields.stockQuantity: + return Text(formatNumber(product.stockQuantity.toDouble(), context, + formatNumberType: FormatNumberType.int)); + case ProductFields.notificationThreshold: + return Text(formatNumber( + product.stockNotificationThreshold.toDouble(), context, + formatNumberType: FormatNumberType.int)); } return super.getField(field: field, context: context); diff --git a/lib/ui/product/view/product_view_overview.dart b/lib/ui/product/view/product_view_overview.dart index c3c9bd839..b159b68e2 100644 --- a/lib/ui/product/view/product_view_overview.dart +++ b/lib/ui/product/view/product_view_overview.dart @@ -82,6 +82,18 @@ class _ProductOverviewState extends State { value: product.customValue4); } + if (company.trackInventory) { + fields[localization.stockQuantity] = formatNumber( + product.stockQuantity.toDouble(), context, + formatNumberType: FormatNumberType.int); + + if (product.stockNotificationThreshold != 0) { + fields[localization.notificationThreshold] = formatNumber( + product.stockNotificationThreshold.toDouble(), context, + formatNumberType: FormatNumberType.int); + } + } + return ScrollableListView( children: [ EntityHeader( diff --git a/lib/ui/reports/product_report.dart b/lib/ui/reports/product_report.dart index 27c19e082..eff183c15 100644 --- a/lib/ui/reports/product_report.dart +++ b/lib/ui/reports/product_report.dart @@ -26,6 +26,8 @@ enum ProductReportFields { product2, product3, product4, + stock_quantity, + notification_threshold } var memoizedProductReport = memo6(( @@ -142,6 +144,12 @@ ReportResult productReport( company: userCompany.company, ); break; + case ProductReportFields.stock_quantity: + value = product.stockQuantity; + break; + case ProductReportFields.notification_threshold: + value = product.stockNotificationThreshold; + break; } if (!ReportResult.matchField(