From de8fda93605c633c0bce0b29b4b46a6369b853b2 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 30 Jan 2026 11:03:17 +0700 Subject: [PATCH 1/4] fix: reset input error when dialog is closed --- .../MasterConfigurationContent.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/figma-make/components/pages/master-data/configuration/MasterConfigurationContent.tsx b/src/figma-make/components/pages/master-data/configuration/MasterConfigurationContent.tsx index 9fa75c33..33ad2608 100644 --- a/src/figma-make/components/pages/master-data/configuration/MasterConfigurationContent.tsx +++ b/src/figma-make/components/pages/master-data/configuration/MasterConfigurationContent.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { Plus, MoreVertical, Pencil, Trash2 } from 'lucide-react'; import { Card, CardContent } from '@/figma-make/components/base/card'; import { Button } from '@/figma-make/components/base/button'; @@ -404,7 +404,22 @@ export function MasterConfigurationContent() { {/* Add/Edit Modal */} - + { + if (!open) { + setIsFormInvalid(false); + setConfigurationForm({ + id: 0, + date: '', + percentage_threshold_bad: '', + percentage_threshold_enough: '', + }); + } + + setShowModal(open); + }} + > From 7956ce5b6f61da9cd07ec3ebd61475d9bc2c8600 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 30 Jan 2026 11:18:39 +0700 Subject: [PATCH 2/4] fix: issue when selecting all phase and employee --- .../daily-checklist/DailyChecklistContent.tsx | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx index 37430354..b99842bd 100644 --- a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx +++ b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx @@ -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' /> - Pilih Semua ({availablePhases.length} Fase) + Pilih Semua ({filteredPhases.length} Fase) @@ -1621,7 +1637,7 @@ export function DailyChecklistContent() { /> - {employees.length > 0 && ( + {filteredEmployees.length > 0 && (
From 99f8e5dcf3671956adb57de2364d6b04fd2bd8d9 Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Fri, 30 Jan 2026 11:45:50 +0700 Subject: [PATCH 3/4] chore: add validation in phase selection and sort activity and employee name --- .../daily-checklist/DailyChecklistContent.tsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx index b99842bd..79049480 100644 --- a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx +++ b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx @@ -127,6 +127,10 @@ export function DailyChecklistContent() { { id: number; name: string }[] >([]); + const sortedSelectedEmployees = selectedEmployees.toSorted((a, b) => + a.name.localeCompare(b.name) + ); + const [dailyChecklistId, setDailyChecklistId] = useState(null); const [checklistStatus, setChecklistStatus] = useState('DRAFT'); // const [isEditMode, setIsEditMode] = useState(false); @@ -486,6 +490,11 @@ export function DailyChecklistContent() { return; } + if (!tempSelectedPhaseIds.length) { + toast.error('Pilih minimal satu fase'); + return; + } + try { // Insert new phase links const setDailyChecklistPhaseRes = @@ -1146,7 +1155,7 @@ export function DailyChecklistContent() { Aktivitas - {selectedEmployees.map((emp) => ( + {sortedSelectedEmployees.map((emp) => ( + a.name.localeCompare(b.name, undefined, { + sensitivity: 'base', + }) + ); + + console.log(activities); + activities.forEach((activity, index) => { const taskId = taskIdsByPhaseActivityId[activity.id]; @@ -1260,7 +1277,7 @@ export function DailyChecklistContent() {

)} - {selectedEmployees.map((emp) => ( + {sortedSelectedEmployees.map((emp) => ( Date: Fri, 30 Jan 2026 11:46:29 +0700 Subject: [PATCH 4/4] chore: sort activity and employee name --- .../detail/DetailDailyChecklistContent.tsx | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/figma-make/components/pages/list-daily-checklist/detail/DetailDailyChecklistContent.tsx b/src/figma-make/components/pages/list-daily-checklist/detail/DetailDailyChecklistContent.tsx index 0b3ece27..d8723df0 100644 --- a/src/figma-make/components/pages/list-daily-checklist/detail/DetailDailyChecklistContent.tsx +++ b/src/figma-make/components/pages/list-daily-checklist/detail/DetailDailyChecklistContent.tsx @@ -275,6 +275,13 @@ export function DetailDailyChecklistContent() { ]) ).values() ); + + uniqueEmployees.sort((a, b) => + a.name.localeCompare(b.name, undefined, { + sensitivity: 'base', + }) + ); + setEmployees(uniqueEmployees); // Group data by Phase → Time Type → Activity @@ -779,11 +786,23 @@ export function DetailDailyChecklistContent() { } // ACTIVITY rows - timeGroup.activities.forEach((activity, index) => { + const activities = timeGroup.activities; + + activities.sort((a, b) => + a.name.localeCompare(b.name, undefined, { + sensitivity: 'base', + }) + ); + + activities.forEach((activity, index) => { const indentClass = hasMultipleTimeTypes ? 'pl-12' : 'pl-8'; + console.log({ + activity, + }); + rows.push( {activity.employees.length > 0 && - activity.employees[0].note ? ( + activity.employees[ + activity.employees.length - 1 + ].note ? (

- {activity.employees[0].note} + { + activity.employees[ + activity.employees.length - 1 + ].note + }

) : (