refactor(FE-318): Add egg weight column and separate inputs

This commit is contained in:
rstubryan
2025-12-08 20:08:35 +07:00
parent b464432581
commit 5deca5739f
@@ -2599,6 +2599,15 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
<span className='text-error'>*</span> <span className='text-error'>*</span>
</span> </span>
</th> </th>
<th>
Berat (gram)
<span
className='tooltip tooltip-error tooltip-bottom '
data-tip='required'
>
<span className='text-error'>*</span>
</span>
</th>
{(type as 'add' | 'edit' | 'detail') !== 'detail' && ( {(type as 'add' | 'edit' | 'detail') !== 'detail' && (
<th>Action</th> <th>Action</th>
)} )}
@@ -2674,58 +2683,55 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
/> />
</td> </td>
<td> <td>
<div className='flex flex-col gap-1'> <NumberInput
<NumberInput required
required name={`eggs.${idx}.qty`}
name={`eggs.${idx}.qty`} value={egg.qty ?? ''}
value={egg.qty ?? ''} onChange={handleEggQtyChangeWrapper(idx)}
onChange={handleEggQtyChangeWrapper(idx)} onBlur={formik.handleBlur}
onBlur={formik.handleBlur} decimalScale={0}
decimalScale={0} allowNegative={false}
allowNegative={false} thousandSeparator=','
thousandSeparator=',' decimalSeparator='.'
decimalSeparator='.' isError={
isError={ isRepeaterInputError('eggs', 'qty', idx).isError
isRepeaterInputError('eggs', 'qty', idx) }
.isError errorMessage={
} isRepeaterInputError('eggs', 'qty', idx)
errorMessage={ .errorMessage
isRepeaterInputError('eggs', 'qty', idx) }
.errorMessage readOnly={type === 'detail'}
} className={{
readOnly={type === 'detail'} wrapper: 'w-full min-w-24',
className={{ }}
wrapper: 'w-full min-w-24', placeholder='Masukkan jumlah telur'
}} />
placeholder='Masukkan jumlah telur' </td>
/> <td>
</div> <NumberInput
<div className='flex flex-col gap-1'> required
<NumberInput name={`eggs.${idx}.weight`}
required value={egg.weight ?? ''}
name={`eggs.${idx}.weight`} onChange={handleEggWeightChangeWrapper(idx)}
value={egg.weight ?? ''} onBlur={formik.handleBlur}
onChange={handleEggWeightChangeWrapper(idx)} decimalScale={0}
onBlur={formik.handleBlur} allowNegative={false}
decimalScale={0} thousandSeparator=','
allowNegative={false} decimalSeparator='.'
thousandSeparator=',' isError={
decimalSeparator='.' isRepeaterInputError('eggs', 'weight', idx)
isError={ .isError
isRepeaterInputError('eggs', 'weight', idx) }
.isError errorMessage={
} isRepeaterInputError('eggs', 'weight', idx)
errorMessage={ .errorMessage
isRepeaterInputError('eggs', 'weight', idx) }
.errorMessage readOnly={type === 'detail'}
} className={{
readOnly={type === 'detail'} wrapper: 'w-full min-w-24',
className={{ }}
wrapper: 'w-full min-w-24', placeholder='Masukkan berat telur (gram)...'
}} />
placeholder='Masukkan berat telur (gram)...'
/>
</div>
</td> </td>
{(type as 'add' | 'edit' | 'detail') !== 'detail' && ( {(type as 'add' | 'edit' | 'detail') !== 'detail' && (
<td> <td>
@@ -2908,7 +2914,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
> >
Submit Submit
</Button> </Button>
{isLayingCategory && ( {/*{isLayingCategory && (
<Tooltip <Tooltip
content={ content={
hasConsumableEggs hasConsumableEggs
@@ -2979,7 +2985,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
Next Step: Grading Next Step: Grading
</Button> </Button>
</Tooltip> </Tooltip>
)} )}*/}
</div> </div>
)} )}
</div> </div>