From 49b53bb36d40583ab771aa83bbb64a3cced38db4 Mon Sep 17 00:00:00 2001 From: Makombe Kennedy Date: Sat, 14 Dec 2024 09:42:37 +0300 Subject: [PATCH] O3-4273-Fix Stock reports params to show location name and not the UUID (#245) --- .../create-stock-report.component.tsx | 25 ++++++++------ translations/en.json | 33 +++++++++++-------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/stock-reports/generate-report/create-stock-report.component.tsx b/src/stock-reports/generate-report/create-stock-report.component.tsx index 4195294e..af87e3f7 100644 --- a/src/stock-reports/generate-report/create-stock-report.component.tsx +++ b/src/stock-reports/generate-report/create-stock-report.component.tsx @@ -94,6 +94,7 @@ const CreateReport: React.FC = ({ model }) => { const handleReportNameChange = (name: string) => { setSelectedReportName(name); }; + useEffect(() => { let hasResetParameters = false; if (selectedReportName) { @@ -176,7 +177,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.Fullfillment, (report.fullFillment ?? ['All']).join(','), (report.fullFillment ?? ['All']).join(', '), - t('editFullfillmentReport', 'stockmanagement.report.edit.fullfillment'), + t('fulfillment', 'Fulfillment'), newLine, ); } @@ -212,14 +213,14 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.InventoryGroupBy, report.inventoryGroupBy ?? 'LocationStockItemBatchNo', report.inventoryGroupByName?.trim() ?? 'Stock Item Batch Number', - t('displayInventoryReport', 'stockmanagement.report.edit.inventorygroupby'), + t('inventoryGroupBy', 'Inventory group by'), newLine, ); } if (displayLocation) { parameters += getReportParameter( ReportParameter.Location, - report.location, + report.locationUuid, report.location?.trim() ?? '', t('location', 'Location'), newLine, @@ -239,7 +240,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.MaxReorderLevelRatio, (report.maxReorderLevelRatio ?? 0).toString(), (report.maxReorderLevelRatio ?? 0).toString() + '%', - t('displayMaxReorderReport', 'stockmanagement.report.edit.maxreorderlevelratio'), + t('maxReorderLevelRatio', 'Max reorder level ratio'), newLine, ); } @@ -248,7 +249,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.StockSource, report.stockSourceUuid ?? '', report.stockSource?.trim() ?? 'All Sources', - t('displayStockReport', 'stockmanagement.report.edit.stocksource'), + t('stockSource', 'Stock source'), newLine, ); } @@ -257,7 +258,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.StockSourceDestination, report.stockSourceDestinationUuid ?? '', report.stockSourceDestination?.trim() ?? 'All Destinations', - t('displayStockDestinationReport', 'stockmanagement.report.edit.stocksourcedestination'), + t('stockSourceDestination', 'Stock source destination'), newLine, ); } @@ -266,7 +267,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.MostLeastMoving, report.mostLeastMoving ?? 'MostMoving', report.mostLeastMovingName?.trim() ?? 'Most Moving', - t('displayMostLeastMovingReport', 'stockmanagement.report.edit.mostleastmoving'), + t('mostMoving', 'Most moving'), newLine, ); } @@ -284,7 +285,7 @@ const CreateReport: React.FC = ({ model }) => { ReportParameter.Date, report.date ? JSON.stringify(report.date).replaceAll('"', '') : '', formatDisplayDate(report.date) ?? '', - t('displayReportDate', 'stockmanagement.report.edit.date'), + t('date', 'Date'), newLine, ); } @@ -472,11 +473,15 @@ const CreateReport: React.FC = ({ model }) => { )} {displayLocation && (