feat(FE-170,174): update validation messages and labels for egg product fields in RecordingForm

This commit is contained in:
rstubryan
2025-11-05 13:13:46 +07:00
parent 4454eac8af
commit fac9d5fa42
2 changed files with 61 additions and 83 deletions
@@ -109,9 +109,9 @@ const DepletionObjectSchema: Yup.ObjectSchema<DepletionSchema> = Yup.object({
const EggObjectSchema: Yup.ObjectSchema<EggSchema> = Yup.object({ const EggObjectSchema: Yup.ObjectSchema<EggSchema> = Yup.object({
product_warehouse_id: Yup.number() product_warehouse_id: Yup.number()
.required('Produk telur wajib diisi!') .required('Kondisi telur wajib diisi!')
.min(1, 'Produk telur wajib diisi!') .min(1, 'Kondisi telur wajib diisi!')
.typeError('Produk telur harus berupa angka!'), .typeError('Kondisi telur harus berupa angka!'),
qty: Yup.number() qty: Yup.number()
.required('Jumlah telur wajib diisi!') .required('Jumlah telur wajib diisi!')
.min(1, 'Jumlah telur tidak boleh 0!') .min(1, 'Jumlah telur tidak boleh 0!')
@@ -1179,14 +1179,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
body: 'flex flex-col gap-6', body: 'flex flex-col gap-6',
}} }}
> >
<div <div className={'grid grid-cols-3 gap-4'}>
className={
type === 'detail'
? 'flex flex-col gap-6'
: 'grid grid-cols-3 gap-4'
}
>
{(type as 'add' | 'edit' | 'detail') === 'detail' ? null : (
<> <>
<SelectInput <SelectInput
key={`location-select-${selectedLocation?.value || 'default'}`} key={`location-select-${selectedLocation?.value || 'default'}`}
@@ -1244,21 +1237,6 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
} }
/> />
</> </>
)}
{(type as 'add' | 'edit' | 'detail') === 'detail' &&
formik.values.project_flock_kandang && (
<div className='form-control'>
<label className='label'>
<span className='label-text font-semibold'>
Project Flock - Kandang
</span>
</label>
<div className='input input-bordered bg-gray-50'>
{formik.values.project_flock_kandang.label}
</div>
</div>
)}
</div> </div>
</Card> </Card>
@@ -1970,7 +1948,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
</th> </th>
)} )}
<th> <th>
Produk Telur Kondisi Telur
<span <span
className='tooltip tooltip-error tooltip-bottom z-[9999]' className='tooltip tooltip-error tooltip-bottom z-[9999]'
data-tip='required' data-tip='required'
@@ -2037,7 +2015,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
); );
}} }}
options={depletionProducts} options={depletionProducts}
placeholder='Pilih Produk Telur' placeholder='Pilih Kondisi Telur'
isLoading={isLoadingEggProducts} isLoading={isLoadingEggProducts}
isError={ isError={
isRepeaterInputError( isRepeaterInputError(