mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix: make empty kandang end date required
This commit is contained in:
@@ -181,6 +181,8 @@ export function DailyChecklistContent() {
|
|||||||
const [initialLoading, setInitialLoading] = useState(!!checklistIdFromUrl);
|
const [initialLoading, setInitialLoading] = useState(!!checklistIdFromUrl);
|
||||||
|
|
||||||
const [emptyKandangEndDate, setEmptyKandangEndDate] = useState<string>('');
|
const [emptyKandangEndDate, setEmptyKandangEndDate] = useState<string>('');
|
||||||
|
const [emptyKandangEndDateError, setEmptyKandangEndDateError] =
|
||||||
|
useState<string>('');
|
||||||
|
|
||||||
const [existingDocuments, setExistingDocuments] = useState<Document[]>([]);
|
const [existingDocuments, setExistingDocuments] = useState<Document[]>([]);
|
||||||
const [documents, setDocuments] = useState<File[]>([]);
|
const [documents, setDocuments] = useState<File[]>([]);
|
||||||
@@ -788,6 +790,11 @@ export function DailyChecklistContent() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emptyKandang && !emptyKandangEndDate) {
|
||||||
|
setEmptyKandangEndDateError('Tanggal akhir kandang kosong wajib diisi');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsLoadingDraft(true);
|
setIsLoadingDraft(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -865,6 +872,11 @@ export function DailyChecklistContent() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (emptyKandang && !emptyKandangEndDate) {
|
||||||
|
setEmptyKandangEndDateError('Tanggal akhir kandang kosong wajib diisi');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isKandangEmpty) {
|
if (!isKandangEmpty) {
|
||||||
if (selectedEmployees.length === 0) {
|
if (selectedEmployees.length === 0) {
|
||||||
toast.error('Pilih minimal 1 ABK');
|
toast.error('Pilih minimal 1 ABK');
|
||||||
@@ -1224,11 +1236,20 @@ export function DailyChecklistContent() {
|
|||||||
<div className='mt-1.5'>
|
<div className='mt-1.5'>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
date={emptyKandangEndDate}
|
date={emptyKandangEndDate}
|
||||||
onDateChange={setEmptyKandangEndDate}
|
onDateChange={(val) => {
|
||||||
|
setEmptyKandangEndDate(val);
|
||||||
|
if (val) setEmptyKandangEndDateError('');
|
||||||
|
}}
|
||||||
disabled={!isChecklistStatusDraft}
|
disabled={!isChecklistStatusDraft}
|
||||||
placeholder='Pilih tanggal'
|
placeholder='Pilih tanggal'
|
||||||
formatDisplay={formatDateForDisplay}
|
formatDisplay={formatDateForDisplay}
|
||||||
|
hasError={!!emptyKandangEndDateError}
|
||||||
/>
|
/>
|
||||||
|
{emptyKandangEndDateError && (
|
||||||
|
<p className='text-xs text-red-500 mt-1'>
|
||||||
|
{emptyKandangEndDateError}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user