refactor(FE): Refactor array formatting and improve code readability

This commit is contained in:
rstubryan
2026-02-25 10:41:34 +07:00
parent f701ab0d91
commit dae9a24a7c
2 changed files with 11 additions and 4 deletions
@@ -687,7 +687,11 @@ const UniformityTable = () => {
const response = await UniformityApi.getAllFetcher(url); const response = await UniformityApi.getAllFetcher(url);
return isResponseSuccess(response) ? response.data : null; return isResponseSuccess(response) ? response.data : null;
}, [filterProjectFlockKandangId, tableFilterState.start_date, tableFilterState.end_date]); }, [
filterProjectFlockKandangId,
tableFilterState.start_date,
tableFilterState.end_date,
]);
const handleExportExcel = useCallback(async () => { const handleExportExcel = useCallback(async () => {
setIsExcelExportLoading(true); setIsExcelExportLoading(true);
@@ -1241,7 +1245,9 @@ const UniformityTable = () => {
placeholder='Tanggal Mulai' placeholder='Tanggal Mulai'
value={filterFormik.values.start_date} value={filterFormik.values.start_date}
errorMessage={filterFormik.errors.start_date} errorMessage={filterFormik.errors.start_date}
onChange={(e) => filterFormik.setFieldValue('start_date', e.target.value)} onChange={(e) =>
filterFormik.setFieldValue('start_date', e.target.value)
}
isError={ isError={
filterFormik.touched.start_date && filterFormik.touched.start_date &&
Boolean(filterFormik.errors.start_date) Boolean(filterFormik.errors.start_date)
@@ -1253,7 +1259,9 @@ const UniformityTable = () => {
placeholder='Tanggal Akhir' placeholder='Tanggal Akhir'
value={filterFormik.values.end_date} value={filterFormik.values.end_date}
errorMessage={filterFormik.errors.end_date} errorMessage={filterFormik.errors.end_date}
onChange={(e) => filterFormik.setFieldValue('end_date', e.target.value)} onChange={(e) =>
filterFormik.setFieldValue('end_date', e.target.value)
}
isError={ isError={
filterFormik.touched.end_date && filterFormik.touched.end_date &&
Boolean(filterFormik.errors.end_date) Boolean(filterFormik.errors.end_date)
@@ -234,7 +234,6 @@ const HppPerKandangTab = ({ tabId }: HppPerKandangTabProps) => {
); );
}, [formik.values.show_unrecorded, showUnrecordedOptions]); }, [formik.values.show_unrecorded, showUnrecordedOptions]);
// ===== DATA FETCHING ===== // ===== DATA FETCHING =====
const { data: hppPerKandang, isLoading } = useSWR( const { data: hppPerKandang, isLoading } = useSWR(
isSubmitted isSubmitted