From 99fc3f8cae97e4eecd756995560e5900117479f1 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Wed, 21 Jan 2026 13:45:12 +0700 Subject: [PATCH] refactor(FE): Standardize unit labels and number formatting --- .../recording/form/RecordingForm.tsx | 73 ++++++++----------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index 10558973..5120bab2 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -156,39 +156,39 @@ const productionStandardColumns: ColumnDef[] = [ }, { accessorKey: 'egg_production_standard_detail.target_hen_house_production', - header: 'Target Hen House (%)', + header: 'Target Hen House (btr)', cell: (props) => - `${ + formatNumber( (props.row.original.egg_production_standard_detail ?.target_hen_house_production as number) || 0 - }%`, + ), }, { accessorKey: 'egg_production_standard_detail.target_egg_weight', - header: 'Target Egg Weight (gram)', + header: 'Target Egg Weight (g)', cell: (props) => - formatNumber( + `${ (props.row.original.egg_production_standard_detail ?.target_egg_weight as number) || 0 - ), + } g`, }, { accessorKey: 'egg_production_standard_detail.target_egg_mass', - header: 'Target Egg Mass (gram)', + header: 'Target Egg Mass (kg)', cell: (props) => - formatNumber( + `${ (props.row.original.egg_production_standard_detail ?.target_egg_mass as number) || 0 - ), + } kg`, }, { accessorKey: 'egg_production_standard_detail.standard_fcr', - header: 'Standard FCR', + header: 'Standard FCR (g)', cell: (props) => - formatNumber( + `${ (props.row.original.egg_production_standard_detail ?.standard_fcr as number) || 0 - ), + } g`, }, ]; @@ -2107,38 +2107,33 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { - FCR + FCR (g) {initialValues.fcr_value != null - ? formatNumber(initialValues.fcr_value) + ? `${formatNumber(initialValues.fcr_value)} g` : '-'} {initialValues.project_flock?.fcr?.fcr_std != null - ? formatNumber( - initialValues.project_flock?.fcr?.fcr_std - ) + ? `${formatNumber(initialValues.project_flock?.fcr?.fcr_std)} g` : '-'} - Feed Intake (KG) + Feed Intake (g) {initialValues.feed_intake != null - ? formatNumber(initialValues.feed_intake) + ? `${formatNumber(initialValues.feed_intake)} g` : '-'} {initialValues.project_flock?.production_standart ?.feed_intake_std != null - ? formatNumber( - initialValues.project_flock?.production_standart - ?.feed_intake_std - ) + ? `${formatNumber(initialValues.project_flock?.production_standart?.feed_intake_std)} g` : '-'} @@ -2218,51 +2213,43 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { - Egg Mass + Egg Mass (kg) {initialValues.egg_mass != null - ? formatNumber(initialValues.egg_mass) + ? `${formatNumber(initialValues.egg_mass)} kg` : '-'} {initialValues.project_flock?.production_standart ?.egg_mass_std != null - ? formatNumber( - initialValues.project_flock - ?.production_standart?.egg_mass_std - ) + ? `${formatNumber(initialValues.project_flock?.production_standart?.egg_mass_std)} kg` : '-'} - - Egg Weight (KG) - + Egg Weight (g) {initialValues.egg_weight != null - ? formatNumber(initialValues.egg_weight) + ? `${formatNumber(initialValues.egg_weight)} g` : '-'} {initialValues.project_flock?.production_standart ?.egg_weight_std != null - ? formatNumber( - initialValues.project_flock - ?.production_standart?.egg_weight_std - ) + ? `${formatNumber(initialValues.project_flock?.production_standart?.egg_weight_std)} g` : '-'} - Hen Day + Hen Day (%) {initialValues.hen_day != null - ? formatNumber(initialValues.hen_day) + ? `${formatNumber(initialValues.hen_day)}%` : '-'} @@ -2274,18 +2261,20 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { - Hen House + + Hen House (btr) + {initialValues.hen_house != null - ? formatNumber(initialValues.hen_house) + ? `${formatNumber(initialValues.hen_house)} btr` : '-'} {initialValues.project_flock?.production_standart ?.hen_house_std != null - ? `${initialValues.project_flock?.production_standart?.hen_house_std}%` + ? `${formatNumber(initialValues.project_flock?.production_standart?.hen_house_std)} btr` : '-'}