mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
fix: issue when selecting all phase and employee
This commit is contained in:
@@ -535,14 +535,6 @@ export function DailyChecklistContent() {
|
||||
}
|
||||
};
|
||||
|
||||
const toggleSelectAllAbk = () => {
|
||||
if (tempSelectedEmployees.length === employees.length) {
|
||||
setTempSelectedEmployees([]);
|
||||
} else {
|
||||
setTempSelectedEmployees([...employees]);
|
||||
}
|
||||
};
|
||||
|
||||
const applyAbkSelection = async () => {
|
||||
if (!dailyChecklistId) {
|
||||
toast.error('Checklist belum tersedia');
|
||||
@@ -853,10 +845,34 @@ export function DailyChecklistContent() {
|
||||
);
|
||||
|
||||
const isAllAbkSelected =
|
||||
tempSelectedEmployees.length === employees.length && employees.length > 0;
|
||||
tempSelectedEmployees.length === filteredEmployees.length &&
|
||||
filteredEmployees.length > 0 &&
|
||||
tempSelectedEmployees.every((tempSelectedEmployee) => {
|
||||
return (
|
||||
filteredEmployees.findIndex(
|
||||
(filteredEmployee) => filteredEmployee.id === tempSelectedEmployee.id
|
||||
) >= 0
|
||||
);
|
||||
});
|
||||
const isAllPhasesSelected =
|
||||
tempSelectedPhaseIds.length === availablePhases.length &&
|
||||
availablePhases.length > 0;
|
||||
tempSelectedPhaseIds.length === filteredPhases.length &&
|
||||
filteredPhases.length > 0 &&
|
||||
tempSelectedPhaseIds.every((tempSelectedPhaseId) => {
|
||||
return (
|
||||
filteredPhases.findIndex(
|
||||
(filteredPhase) =>
|
||||
String(filteredPhase.id) === String(tempSelectedPhaseId)
|
||||
) >= 0
|
||||
);
|
||||
});
|
||||
|
||||
const toggleSelectAllAbk = () => {
|
||||
if (isAllAbkSelected) {
|
||||
setTempSelectedEmployees([]);
|
||||
} else {
|
||||
setTempSelectedEmployees([...filteredEmployees]);
|
||||
}
|
||||
};
|
||||
|
||||
// Group activities by PHASE → TIME_TYPE → ACTIVITIES
|
||||
const groupActivitiesByPhase = () => {
|
||||
@@ -1519,14 +1535,14 @@ export function DailyChecklistContent() {
|
||||
setTempSelectedPhaseIds([]);
|
||||
} else {
|
||||
setTempSelectedPhaseIds(
|
||||
availablePhases.map((p) => String(p.id))
|
||||
filteredPhases.map((p) => String(p.id))
|
||||
);
|
||||
}
|
||||
}}
|
||||
className='checkbox-clean'
|
||||
/>
|
||||
<span className='text-sm font-medium text-gray-700 group-hover:text-gray-900'>
|
||||
Pilih Semua ({availablePhases.length} Fase)
|
||||
Pilih Semua ({filteredPhases.length} Fase)
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -1621,7 +1637,7 @@ export function DailyChecklistContent() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{employees.length > 0 && (
|
||||
{filteredEmployees.length > 0 && (
|
||||
<div className='flex items-center gap-3 px-1 py-2'>
|
||||
<label className='flex items-center gap-2 cursor-pointer group'>
|
||||
<input
|
||||
@@ -1631,7 +1647,7 @@ export function DailyChecklistContent() {
|
||||
className='checkbox-clean'
|
||||
/>
|
||||
<span className='text-sm font-medium text-gray-700 group-hover:text-gray-900'>
|
||||
Pilih Semua ({employees.length} ABK)
|
||||
Pilih Semua ({filteredEmployees.length} ABK)
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user