refactor(FE): Show zero values in RecordingForm

This commit is contained in:
rstubryan
2026-01-15 15:21:16 +07:00
parent ac84841b05
commit 23e8487a97
@@ -1640,15 +1640,13 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
<td className='py-3 font-medium'>FCR</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.fcr_value &&
initialValues.fcr_value > 0
{initialValues.fcr_value != null
? formatNumber(initialValues.fcr_value)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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) => {
<td className='py-3 font-medium'>Feed Intake (KG)</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.feed_intake &&
initialValues.feed_intake > 0
{initialValues.feed_intake != null
? formatNumber(initialValues.feed_intake)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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) => {
<td className='py-2 font-medium'>Deplesi Kumulatif</td>
<td className='text-right py-2'>
<span className='font-semibold'>
{initialValues.cum_depletion_rate &&
initialValues.cum_depletion_rate > 0
{initialValues.cum_depletion_rate != null
? `${initialValues.cum_depletion_rate.toFixed(2)}%`
: '-'}
</span>
@@ -1706,8 +1700,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
<tr>
<td className='py-2 font-medium'>Total Depletion</td>
<td className='text-right py-2 font-semibold'>
{initialValues.total_depletion_qty &&
initialValues.total_depletion_qty > 0
{initialValues.total_depletion_qty != null
? formatNumber(initialValues.total_depletion_qty)
: '-'}
</td>
@@ -1716,8 +1709,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
<tr className='border-t border-gray-200'>
<td className='py-2 text-gray-600'>Total Ayam</td>
<td className='text-right py-2 font-semibold'>
{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) => {
<td className='py-3 font-medium'>Egg Mass</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.egg_mass &&
initialValues.egg_mass > 0
{initialValues.egg_mass != null
? formatNumber(initialValues.egg_mass)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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) => {
</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.egg_weight &&
initialValues.egg_weight > 0
{initialValues.egg_weight != null
? formatNumber(initialValues.egg_weight)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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) => {
<td className='py-3 font-medium'>Hen Day</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.hen_day &&
initialValues.hen_day > 0
{initialValues.hen_day != null
? formatNumber(initialValues.hen_day)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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}%`
: '-'}
</td>
@@ -1824,17 +1807,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
<td className='py-3 font-medium'>Hen House</td>
<td className='text-center py-3'>
<span className='font-semibold'>
{initialValues.hen_house &&
initialValues.hen_house > 0
{initialValues.hen_house != null
? formatNumber(initialValues.hen_house)
: '-'}
</span>
</td>
<td className='text-center py-3 text-gray-600'>
{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}%`
: '-'}
</td>