From 23e8487a9702733fc8651bef9c37cfcbcdf4cb84 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Thu, 15 Jan 2026 15:21:16 +0700 Subject: [PATCH] refactor(FE): Show zero values in RecordingForm --- .../recording/form/RecordingForm.tsx | 50 ++++++------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/src/components/pages/production/recording/form/RecordingForm.tsx b/src/components/pages/production/recording/form/RecordingForm.tsx index c418c5b2..46fba9af 100644 --- a/src/components/pages/production/recording/form/RecordingForm.tsx +++ b/src/components/pages/production/recording/form/RecordingForm.tsx @@ -1640,15 +1640,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { FCR - {initialValues.fcr_value && - initialValues.fcr_value > 0 + {initialValues.fcr_value != null ? formatNumber(initialValues.fcr_value) : '-'} - {initialValues.project_flock?.fcr?.fcr_std && - initialValues.project_flock?.fcr?.fcr_std > 0 + {initialValues.project_flock?.fcr?.fcr_std != null ? formatNumber( initialValues.project_flock?.fcr?.fcr_std ) @@ -1659,17 +1657,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Feed Intake (KG) - {initialValues.feed_intake && - initialValues.feed_intake > 0 + {initialValues.feed_intake != null ? formatNumber(initialValues.feed_intake) : '-'} {initialValues.project_flock?.production_standart - ?.feed_intake_std && - initialValues.project_flock?.production_standart - ?.feed_intake_std > 0 + ?.feed_intake_std != null ? formatNumber( initialValues.project_flock?.production_standart ?.feed_intake_std @@ -1696,8 +1691,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Deplesi Kumulatif - {initialValues.cum_depletion_rate && - initialValues.cum_depletion_rate > 0 + {initialValues.cum_depletion_rate != null ? `${initialValues.cum_depletion_rate.toFixed(2)}%` : '-'} @@ -1706,8 +1700,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Total Depletion - {initialValues.total_depletion_qty && - initialValues.total_depletion_qty > 0 + {initialValues.total_depletion_qty != null ? formatNumber(initialValues.total_depletion_qty) : '-'} @@ -1716,8 +1709,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Total Ayam - {initialValues.project_flock?.total_chick_qty && - initialValues.project_flock?.total_chick_qty > 0 + {initialValues.project_flock?.total_chick_qty != null ? formatNumber( initialValues.project_flock?.total_chick_qty ) @@ -1759,17 +1751,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Egg Mass - {initialValues.egg_mass && - initialValues.egg_mass > 0 + {initialValues.egg_mass != null ? formatNumber(initialValues.egg_mass) : '-'} {initialValues.project_flock?.production_standart - ?.egg_mass_std && - initialValues.project_flock?.production_standart - ?.egg_mass_std > 0 + ?.egg_mass_std != null ? formatNumber( initialValues.project_flock ?.production_standart?.egg_mass_std @@ -1783,17 +1772,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { - {initialValues.egg_weight && - initialValues.egg_weight > 0 + {initialValues.egg_weight != null ? formatNumber(initialValues.egg_weight) : '-'} {initialValues.project_flock?.production_standart - ?.egg_weight_std && - initialValues.project_flock?.production_standart - ?.egg_weight_std > 0 + ?.egg_weight_std != null ? formatNumber( initialValues.project_flock ?.production_standart?.egg_weight_std @@ -1805,17 +1791,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Hen Day - {initialValues.hen_day && - initialValues.hen_day > 0 + {initialValues.hen_day != null ? formatNumber(initialValues.hen_day) : '-'} {initialValues.project_flock?.production_standart - ?.hen_day_std !== undefined && - initialValues.project_flock?.production_standart - ?.hen_day_std > 0 + ?.hen_day_std != null ? `${initialValues.project_flock?.production_standart?.hen_day_std}%` : '-'} @@ -1824,17 +1807,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => { Hen House - {initialValues.hen_house && - initialValues.hen_house > 0 + {initialValues.hen_house != null ? formatNumber(initialValues.hen_house) : '-'} {initialValues.project_flock?.production_standart - ?.hen_house_std !== undefined && - initialValues.project_flock?.production_standart - ?.hen_house_std > 0 + ?.hen_house_std != null ? `${initialValues.project_flock?.production_standart?.hen_house_std}%` : '-'}