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,
|
start_date: filterStartDate,
|
||||||
end_date: filterEndDate,
|
end_date: filterEndDate,
|
||||||
location: filterLocation,
|
location: filterLocation,
|
||||||
location_id: Number(filterLocation?.value) || 0,
|
|
||||||
project_flock: filterProjectFlock,
|
project_flock: filterProjectFlock,
|
||||||
project_flock_id: Number(filterProjectFlock?.value) || 0,
|
|
||||||
project_flock_kandang_id: filterProjectFlockKandangId,
|
project_flock_kandang_id: filterProjectFlockKandangId,
|
||||||
kandang: filterKandang,
|
kandang: filterKandang,
|
||||||
kandang_id: Number(filterKandang?.value) || 0,
|
|
||||||
},
|
},
|
||||||
validationSchema: UniformityTableFilterSchema,
|
validationSchema: UniformityTableFilterSchema,
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
@@ -1202,7 +1199,8 @@ const UniformityTable = () => {
|
|||||||
<div className='grid grid-cols-1 sm:grid-cols-2 sm:gap-4'>
|
<div className='grid grid-cols-1 sm:grid-cols-2 sm:gap-4'>
|
||||||
<div>
|
<div>
|
||||||
<DateInput
|
<DateInput
|
||||||
label='Tanggal'
|
required
|
||||||
|
label='Tanggal mulai'
|
||||||
name='start_date'
|
name='start_date'
|
||||||
value={filterFormik.values.start_date}
|
value={filterFormik.values.start_date}
|
||||||
onChange={handleFilterStartDateChange}
|
onChange={handleFilterStartDateChange}
|
||||||
@@ -1218,7 +1216,8 @@ const UniformityTable = () => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<DateInput
|
<DateInput
|
||||||
label=' '
|
required
|
||||||
|
label='Tanggal akhir'
|
||||||
name='end_date'
|
name='end_date'
|
||||||
value={filterFormik.values.end_date}
|
value={filterFormik.values.end_date}
|
||||||
onChange={handleFilterEndDateChange}
|
onChange={handleFilterEndDateChange}
|
||||||
@@ -1235,6 +1234,7 @@ const UniformityTable = () => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<SelectInput
|
<SelectInput
|
||||||
|
required
|
||||||
label='Lokasi'
|
label='Lokasi'
|
||||||
placeholder='Pilih Lokasi...'
|
placeholder='Pilih Lokasi...'
|
||||||
value={filterFormik.values.location}
|
value={filterFormik.values.location}
|
||||||
@@ -1257,6 +1257,7 @@ const UniformityTable = () => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<SelectInput
|
<SelectInput
|
||||||
|
required
|
||||||
label='Project Flock'
|
label='Project Flock'
|
||||||
placeholder='Pilih Project Flock...'
|
placeholder='Pilih Project Flock...'
|
||||||
value={filterFormik.values.project_flock}
|
value={filterFormik.values.project_flock}
|
||||||
@@ -1280,6 +1281,7 @@ const UniformityTable = () => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<SelectInput
|
<SelectInput
|
||||||
|
required
|
||||||
label='Kandang'
|
label='Kandang'
|
||||||
placeholder='Pilih Kandang...'
|
placeholder='Pilih Kandang...'
|
||||||
value={filterFormik.values.kandang}
|
value={filterFormik.values.kandang}
|
||||||
|
|||||||
@@ -5,12 +5,9 @@ export type UniformityTableFilterType = {
|
|||||||
start_date: string;
|
start_date: string;
|
||||||
end_date: string;
|
end_date: string;
|
||||||
location: OptionType | null;
|
location: OptionType | null;
|
||||||
location_id: number;
|
|
||||||
project_flock: OptionType | null;
|
project_flock: OptionType | null;
|
||||||
project_flock_id: number;
|
|
||||||
project_flock_kandang_id: number | undefined;
|
project_flock_kandang_id: number | undefined;
|
||||||
kandang: OptionType | null;
|
kandang: OptionType | null;
|
||||||
kandang_id: number;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UniformityTableFilterSchema = yup.object({
|
export const UniformityTableFilterSchema = yup.object({
|
||||||
@@ -25,11 +22,6 @@ export const UniformityTableFilterSchema = yup.object({
|
|||||||
}
|
}
|
||||||
return !!value;
|
return !!value;
|
||||||
}),
|
}),
|
||||||
location_id: yup
|
|
||||||
.number()
|
|
||||||
.min(1, 'Location wajib diisi!')
|
|
||||||
.required('Location wajib diisi!')
|
|
||||||
.typeError('Location wajib diisi!'),
|
|
||||||
project_flock: yup
|
project_flock: yup
|
||||||
.mixed<OptionType>()
|
.mixed<OptionType>()
|
||||||
.required('Project Flock wajib dipilih')
|
.required('Project Flock wajib dipilih')
|
||||||
@@ -39,11 +31,6 @@ export const UniformityTableFilterSchema = yup.object({
|
|||||||
}
|
}
|
||||||
return !!value;
|
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(),
|
project_flock_kandang_id: yup.number().optional(),
|
||||||
kandang: yup
|
kandang: yup
|
||||||
.mixed<OptionType>()
|
.mixed<OptionType>()
|
||||||
@@ -54,11 +41,6 @@ export const UniformityTableFilterSchema = yup.object({
|
|||||||
}
|
}
|
||||||
return !!value;
|
return !!value;
|
||||||
}),
|
}),
|
||||||
kandang_id: yup
|
|
||||||
.number()
|
|
||||||
.min(1, 'Kandang wajib diisi!')
|
|
||||||
.required('Kandang wajib diisi!')
|
|
||||||
.typeError('Kandang wajib diisi!'),
|
|
||||||
}) as yup.ObjectSchema<UniformityTableFilterType>;
|
}) as yup.ObjectSchema<UniformityTableFilterType>;
|
||||||
|
|
||||||
export type UniformityTableFilterValues = yup.InferType<
|
export type UniformityTableFilterValues = yup.InferType<
|
||||||
|
|||||||
Reference in New Issue
Block a user