mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Remove redundant ID fields and require filters and update
date labels to 'Tanggal mulai' and 'Tanggal akhir
This commit is contained in:
@@ -327,12 +327,9 @@ const UniformityTable = () => {
|
||||
start_date: filterStartDate,
|
||||
end_date: filterEndDate,
|
||||
location: filterLocation,
|
||||
location_id: Number(filterLocation?.value) || 0,
|
||||
project_flock: filterProjectFlock,
|
||||
project_flock_id: Number(filterProjectFlock?.value) || 0,
|
||||
project_flock_kandang_id: filterProjectFlockKandangId,
|
||||
kandang: filterKandang,
|
||||
kandang_id: Number(filterKandang?.value) || 0,
|
||||
},
|
||||
validationSchema: UniformityTableFilterSchema,
|
||||
enableReinitialize: true,
|
||||
@@ -1202,7 +1199,8 @@ const UniformityTable = () => {
|
||||
<div className='grid grid-cols-1 sm:grid-cols-2 sm:gap-4'>
|
||||
<div>
|
||||
<DateInput
|
||||
label='Tanggal'
|
||||
required
|
||||
label='Tanggal mulai'
|
||||
name='start_date'
|
||||
value={filterFormik.values.start_date}
|
||||
onChange={handleFilterStartDateChange}
|
||||
@@ -1218,7 +1216,8 @@ const UniformityTable = () => {
|
||||
|
||||
<div>
|
||||
<DateInput
|
||||
label=' '
|
||||
required
|
||||
label='Tanggal akhir'
|
||||
name='end_date'
|
||||
value={filterFormik.values.end_date}
|
||||
onChange={handleFilterEndDateChange}
|
||||
@@ -1235,6 +1234,7 @@ const UniformityTable = () => {
|
||||
|
||||
<div>
|
||||
<SelectInput
|
||||
required
|
||||
label='Lokasi'
|
||||
placeholder='Pilih Lokasi...'
|
||||
value={filterFormik.values.location}
|
||||
@@ -1257,6 +1257,7 @@ const UniformityTable = () => {
|
||||
|
||||
<div>
|
||||
<SelectInput
|
||||
required
|
||||
label='Project Flock'
|
||||
placeholder='Pilih Project Flock...'
|
||||
value={filterFormik.values.project_flock}
|
||||
@@ -1280,6 +1281,7 @@ const UniformityTable = () => {
|
||||
|
||||
<div>
|
||||
<SelectInput
|
||||
required
|
||||
label='Kandang'
|
||||
placeholder='Pilih Kandang...'
|
||||
value={filterFormik.values.kandang}
|
||||
|
||||
@@ -5,12 +5,9 @@ export type UniformityTableFilterType = {
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
location: OptionType | null;
|
||||
location_id: number;
|
||||
project_flock: OptionType | null;
|
||||
project_flock_id: number;
|
||||
project_flock_kandang_id: number | undefined;
|
||||
kandang: OptionType | null;
|
||||
kandang_id: number;
|
||||
};
|
||||
|
||||
export const UniformityTableFilterSchema = yup.object({
|
||||
@@ -25,11 +22,6 @@ export const UniformityTableFilterSchema = yup.object({
|
||||
}
|
||||
return !!value;
|
||||
}),
|
||||
location_id: yup
|
||||
.number()
|
||||
.min(1, 'Location wajib diisi!')
|
||||
.required('Location wajib diisi!')
|
||||
.typeError('Location wajib diisi!'),
|
||||
project_flock: yup
|
||||
.mixed<OptionType>()
|
||||
.required('Project Flock wajib dipilih')
|
||||
@@ -39,11 +31,6 @@ export const UniformityTableFilterSchema = yup.object({
|
||||
}
|
||||
return !!value;
|
||||
}),
|
||||
project_flock_id: yup
|
||||
.number()
|
||||
.min(1, 'Project flock wajib diisi!')
|
||||
.required('Project flock wajib diisi!')
|
||||
.typeError('Project flock wajib diisi!'),
|
||||
project_flock_kandang_id: yup.number().optional(),
|
||||
kandang: yup
|
||||
.mixed<OptionType>()
|
||||
@@ -54,11 +41,6 @@ export const UniformityTableFilterSchema = yup.object({
|
||||
}
|
||||
return !!value;
|
||||
}),
|
||||
kandang_id: yup
|
||||
.number()
|
||||
.min(1, 'Kandang wajib diisi!')
|
||||
.required('Kandang wajib diisi!')
|
||||
.typeError('Kandang wajib diisi!'),
|
||||
}) as yup.ObjectSchema<UniformityTableFilterType>;
|
||||
|
||||
export type UniformityTableFilterValues = yup.InferType<
|
||||
|
||||
Reference in New Issue
Block a user