mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 07:15:44 +00:00
Merge branch 'fix/daily-checklist' into 'development'
[FIX/FE] Daily Checklist See merge request mbugroup/lti-web-client!227
This commit is contained in:
@@ -83,10 +83,7 @@ export function Dashboard() {
|
|||||||
dateFrom && dateTo
|
dateFrom && dateTo
|
||||||
? `${DailyChecklistApi.basePath}/summary?date_from=${dateFrom}&date_to=${dateTo}&kandang_id=${kandangFilter === 'ALL' ? '' : kandangFilter}&category=${categoryFilter === 'ALL' ? '' : categoryFilter}`
|
? `${DailyChecklistApi.basePath}/summary?date_from=${dateFrom}&date_to=${dateTo}&kandang_id=${kandangFilter === 'ALL' ? '' : kandangFilter}&category=${categoryFilter === 'ALL' ? '' : categoryFilter}`
|
||||||
: '',
|
: '',
|
||||||
httpClientFetcher,
|
httpClientFetcher
|
||||||
{
|
|
||||||
keepPreviousData: true,
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const { options: kandangOptions, isLoadingOptions: isLoadingKandangs } =
|
const { options: kandangOptions, isLoadingOptions: isLoadingKandangs } =
|
||||||
@@ -311,14 +308,14 @@ export function Dashboard() {
|
|||||||
<Bar
|
<Bar
|
||||||
dataKey='remaining'
|
dataKey='remaining'
|
||||||
stackId='a'
|
stackId='a'
|
||||||
fill='#E5E7EB'
|
fill='#878c96'
|
||||||
radius={[4, 4, 0, 0]}
|
radius={[4, 4, 0, 0]}
|
||||||
>
|
>
|
||||||
{chartData?.map((entry, index) => (
|
{chartData?.map((entry, index) => (
|
||||||
<Cell
|
<Cell
|
||||||
key={`cell-remaining-${index}`}
|
key={`cell-remaining-${index}`}
|
||||||
fill={`${entry.color}33`}
|
fill={`${entry.color}70`}
|
||||||
opacity={0.3}
|
opacity={0.7}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Bar>
|
</Bar>
|
||||||
@@ -370,7 +367,7 @@ export function Dashboard() {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{employeePerformance?.map((emp, index) => (
|
{employeePerformance?.map((emp, index) => (
|
||||||
<tr
|
<tr
|
||||||
key={emp.employee_id}
|
key={index}
|
||||||
className={
|
className={
|
||||||
index % 2 === 0 ? 'bg-white' : 'bg-gray-50/50'
|
index % 2 === 0 ? 'bg-white' : 'bg-gray-50/50'
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-8
@@ -69,6 +69,7 @@ export function MasterConfigurationContent() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [isFormInvalid, setIsFormInvalid] = useState(false);
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||||
const [configurationToDelete, setConfigurationToDelete] = useState<
|
const [configurationToDelete, setConfigurationToDelete] = useState<
|
||||||
@@ -173,6 +174,26 @@ export function MasterConfigurationContent() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
Number(configurationForm.percentage_threshold_enough) >= 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);
|
setLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -443,14 +464,18 @@ export function MasterConfigurationContent() {
|
|||||||
type='number'
|
type='number'
|
||||||
id='percentageThresholdBad'
|
id='percentageThresholdBad'
|
||||||
value={configurationForm.percentage_threshold_bad}
|
value={configurationForm.percentage_threshold_bad}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
|
setIsFormInvalid(false);
|
||||||
|
|
||||||
setConfigurationForm({
|
setConfigurationForm({
|
||||||
...configurationForm,
|
...configurationForm,
|
||||||
percentage_threshold_bad: e.target.value,
|
percentage_threshold_bad: e.target.value,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
placeholder='Kurang'
|
placeholder='Kurang'
|
||||||
className='w-20'
|
className={cn('w-20', {
|
||||||
|
'border-red-500': isFormInvalid,
|
||||||
|
})}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
max={100}
|
max={100}
|
||||||
/>
|
/>
|
||||||
@@ -476,14 +501,17 @@ export function MasterConfigurationContent() {
|
|||||||
type='number'
|
type='number'
|
||||||
id='percentageThresholdEnough'
|
id='percentageThresholdEnough'
|
||||||
value={configurationForm.percentage_threshold_enough}
|
value={configurationForm.percentage_threshold_enough}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
|
setIsFormInvalid(false);
|
||||||
setConfigurationForm({
|
setConfigurationForm({
|
||||||
...configurationForm,
|
...configurationForm,
|
||||||
percentage_threshold_enough: e.target.value,
|
percentage_threshold_enough: e.target.value,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
placeholder='Cukup'
|
placeholder='Cukup'
|
||||||
className='w-20'
|
className={cn('w-20', {
|
||||||
|
'border-red-500': isFormInvalid,
|
||||||
|
})}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
min={Number(configurationForm.percentage_threshold_bad) + 1}
|
min={Number(configurationForm.percentage_threshold_bad) + 1}
|
||||||
max={100}
|
max={100}
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ export function DailyChecklistReportsContent() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const phaseChangeHandler = (value: string) => {
|
const phaseChangeHandler = (value: string) => {
|
||||||
updateFilter('phase_id', value);
|
updateFilter('phase_id', value === 'ALL' ? '' : value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const employeeChangeHandler = (value: string) => {
|
const employeeChangeHandler = (value: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user