mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: add validation in phase selection and sort activity and employee name
This commit is contained in:
@@ -127,6 +127,10 @@ export function DailyChecklistContent() {
|
|||||||
{ id: number; name: string }[]
|
{ id: number; name: string }[]
|
||||||
>([]);
|
>([]);
|
||||||
|
|
||||||
|
const sortedSelectedEmployees = selectedEmployees.toSorted((a, b) =>
|
||||||
|
a.name.localeCompare(b.name)
|
||||||
|
);
|
||||||
|
|
||||||
const [dailyChecklistId, setDailyChecklistId] = useState<string | null>(null);
|
const [dailyChecklistId, setDailyChecklistId] = useState<string | null>(null);
|
||||||
const [checklistStatus, setChecklistStatus] = useState<string>('DRAFT');
|
const [checklistStatus, setChecklistStatus] = useState<string>('DRAFT');
|
||||||
// const [isEditMode, setIsEditMode] = useState(false);
|
// const [isEditMode, setIsEditMode] = useState(false);
|
||||||
@@ -486,6 +490,11 @@ export function DailyChecklistContent() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tempSelectedPhaseIds.length) {
|
||||||
|
toast.error('Pilih minimal satu fase');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Insert new phase links
|
// Insert new phase links
|
||||||
const setDailyChecklistPhaseRes =
|
const setDailyChecklistPhaseRes =
|
||||||
@@ -1146,7 +1155,7 @@ export function DailyChecklistContent() {
|
|||||||
<th className='text-left py-3 px-4 text-sm font-semibold text-gray-700 border-r border-gray-200 min-w-[200px]'>
|
<th className='text-left py-3 px-4 text-sm font-semibold text-gray-700 border-r border-gray-200 min-w-[200px]'>
|
||||||
Aktivitas
|
Aktivitas
|
||||||
</th>
|
</th>
|
||||||
{selectedEmployees.map((emp) => (
|
{sortedSelectedEmployees.map((emp) => (
|
||||||
<th
|
<th
|
||||||
key={emp.id}
|
key={emp.id}
|
||||||
className='text-center py-3 px-4 text-sm font-semibold text-gray-700 border-r border-gray-200 min-w-[100px]'
|
className='text-center py-3 px-4 text-sm font-semibold text-gray-700 border-r border-gray-200 min-w-[100px]'
|
||||||
@@ -1232,6 +1241,14 @@ export function DailyChecklistContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ACTIVITY rows (Child rows with checkboxes)
|
// ACTIVITY rows (Child rows with checkboxes)
|
||||||
|
activities.sort((a, b) =>
|
||||||
|
a.name.localeCompare(b.name, undefined, {
|
||||||
|
sensitivity: 'base',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(activities);
|
||||||
|
|
||||||
activities.forEach((activity, index) => {
|
activities.forEach((activity, index) => {
|
||||||
const taskId =
|
const taskId =
|
||||||
taskIdsByPhaseActivityId[activity.id];
|
taskIdsByPhaseActivityId[activity.id];
|
||||||
@@ -1260,7 +1277,7 @@ export function DailyChecklistContent() {
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
{selectedEmployees.map((emp) => (
|
{sortedSelectedEmployees.map((emp) => (
|
||||||
<td
|
<td
|
||||||
key={emp.id}
|
key={emp.id}
|
||||||
className='text-center py-3 px-4 border-r border-gray-200'
|
className='text-center py-3 px-4 border-r border-gray-200'
|
||||||
|
|||||||
Reference in New Issue
Block a user