diff --git a/src/figma-make/components/pages/dashboard/Dashboard.tsx b/src/figma-make/components/pages/dashboard/Dashboard.tsx index f6d12d79..8953ccf6 100644 --- a/src/figma-make/components/pages/dashboard/Dashboard.tsx +++ b/src/figma-make/components/pages/dashboard/Dashboard.tsx @@ -83,10 +83,7 @@ export function Dashboard() { dateFrom && dateTo ? `${DailyChecklistApi.basePath}/summary?date_from=${dateFrom}&date_to=${dateTo}&kandang_id=${kandangFilter === 'ALL' ? '' : kandangFilter}&category=${categoryFilter === 'ALL' ? '' : categoryFilter}` : '', - httpClientFetcher, - { - keepPreviousData: true, - } + httpClientFetcher ); const { options: kandangOptions, isLoadingOptions: isLoadingKandangs } = @@ -311,14 +308,14 @@ export function Dashboard() { {chartData?.map((entry, index) => ( ))} @@ -370,7 +367,7 @@ export function Dashboard() { {employeePerformance?.map((emp, index) => ( = 100 || + Number(configurationForm.percentage_threshold_bad) >= 100 + ) { + setIsFormInvalid(true); + toast.error('Persentase threshold tidak boleh lebih dari 100'); + return; + } + + if ( + Number(configurationForm.percentage_threshold_enough) <= + Number(configurationForm.percentage_threshold_bad) + 1 + ) { + setIsFormInvalid(true); + toast.error( + 'Persentase threshold "kurang" harus lebih kecil dari persentase threshold "cukup"' + ); + return; + } + setLoading(true); try { @@ -443,14 +464,18 @@ export function MasterConfigurationContent() { type='number' id='percentageThresholdBad' value={configurationForm.percentage_threshold_bad} - onChange={(e) => + onChange={(e) => { + setIsFormInvalid(false); + setConfigurationForm({ ...configurationForm, percentage_threshold_bad: e.target.value, - }) - } + }); + }} placeholder='Kurang' - className='w-20' + className={cn('w-20', { + 'border-red-500': isFormInvalid, + })} disabled={loading} max={100} /> @@ -476,14 +501,17 @@ export function MasterConfigurationContent() { type='number' id='percentageThresholdEnough' value={configurationForm.percentage_threshold_enough} - onChange={(e) => + onChange={(e) => { + setIsFormInvalid(false); setConfigurationForm({ ...configurationForm, percentage_threshold_enough: e.target.value, - }) - } + }); + }} placeholder='Cukup' - className='w-20' + className={cn('w-20', { + 'border-red-500': isFormInvalid, + })} disabled={loading} min={Number(configurationForm.percentage_threshold_bad) + 1} max={100} diff --git a/src/figma-make/components/pages/reports/DailyChecklistReportsContent.tsx b/src/figma-make/components/pages/reports/DailyChecklistReportsContent.tsx index 61558d4f..f1c32198 100644 --- a/src/figma-make/components/pages/reports/DailyChecklistReportsContent.tsx +++ b/src/figma-make/components/pages/reports/DailyChecklistReportsContent.tsx @@ -292,7 +292,7 @@ export function DailyChecklistReportsContent() { }; const phaseChangeHandler = (value: string) => { - updateFilter('phase_id', value); + updateFilter('phase_id', value === 'ALL' ? '' : value); }; const employeeChangeHandler = (value: string) => {