From 3647f1a1eadfe7ca3c2b3bb4b8b623978af3807a Mon Sep 17 00:00:00 2001 From: ValdiANS Date: Tue, 19 May 2026 12:11:24 +0700 Subject: [PATCH] fix: make empty kandang end date required --- .../daily-checklist/DailyChecklistContent.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx index ee0b781f..80c13f01 100644 --- a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx +++ b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx @@ -181,6 +181,8 @@ export function DailyChecklistContent() { const [initialLoading, setInitialLoading] = useState(!!checklistIdFromUrl); const [emptyKandangEndDate, setEmptyKandangEndDate] = useState(''); + const [emptyKandangEndDateError, setEmptyKandangEndDateError] = + useState(''); const [existingDocuments, setExistingDocuments] = useState([]); const [documents, setDocuments] = useState([]); @@ -788,6 +790,11 @@ export function DailyChecklistContent() { return; } + if (emptyKandang && !emptyKandangEndDate) { + setEmptyKandangEndDateError('Tanggal akhir kandang kosong wajib diisi'); + return; + } + setIsLoadingDraft(true); try { @@ -865,6 +872,11 @@ export function DailyChecklistContent() { return; } + if (emptyKandang && !emptyKandangEndDate) { + setEmptyKandangEndDateError('Tanggal akhir kandang kosong wajib diisi'); + return; + } + if (!isKandangEmpty) { if (selectedEmployees.length === 0) { toast.error('Pilih minimal 1 ABK'); @@ -1224,11 +1236,20 @@ export function DailyChecklistContent() {
{ + setEmptyKandangEndDate(val); + if (val) setEmptyKandangEndDateError(''); + }} disabled={!isChecklistStatusDraft} placeholder='Pilih tanggal' formatDisplay={formatDateForDisplay} + hasError={!!emptyKandangEndDateError} /> + {emptyKandangEndDateError && ( +

+ {emptyKandangEndDateError} +

+ )}