mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
fix: remove empty kandang date
This commit is contained in:
@@ -103,7 +103,6 @@ export function DailyChecklistContent() {
|
||||
searchParams.get('category') || ''
|
||||
);
|
||||
const [emptyKandang, setEmptyKandang] = useState(false);
|
||||
const [emptyKandangEndDate, setEmptyKandangEndDate] = useState('');
|
||||
|
||||
const isKandangEmpty = selectedCategory === 'empty_kandang';
|
||||
|
||||
@@ -239,7 +238,6 @@ export function DailyChecklistContent() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!emptyKandang) {
|
||||
setEmptyKandangEndDate('');
|
||||
setSelectedCategory('');
|
||||
return;
|
||||
}
|
||||
@@ -314,16 +312,6 @@ export function DailyChecklistContent() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (emptyKandang && !emptyKandangEndDate) {
|
||||
setDailyChecklistId(null);
|
||||
setChecklistStatus('DRAFT');
|
||||
setSelectedPhaseIds([]);
|
||||
setActivitiesByPhase({});
|
||||
setTaskIdsByPhaseActivityId({});
|
||||
setAssignments({});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const checklist = await DailyChecklistApi.create({
|
||||
date,
|
||||
@@ -331,7 +319,6 @@ export function DailyChecklistContent() {
|
||||
category: emptyKandang ? 'empty_kandang' : selectedCategory,
|
||||
status: 'DRAFT',
|
||||
empty_kandang: emptyKandang,
|
||||
empty_kandang_end_date: emptyKandang ? emptyKandangEndDate : '',
|
||||
});
|
||||
|
||||
if (isResponseError(checklist)) {
|
||||
@@ -388,7 +375,7 @@ export function DailyChecklistContent() {
|
||||
};
|
||||
|
||||
checkAndLoadChecklist();
|
||||
}, [date, kandangId, selectedCategory, emptyKandang, emptyKandangEndDate]);
|
||||
}, [date, kandangId, selectedCategory, emptyKandang]);
|
||||
|
||||
// Load activities and tasks when phases change
|
||||
useEffect(() => {
|
||||
@@ -1176,24 +1163,6 @@ export function DailyChecklistContent() {
|
||||
/>
|
||||
<span>Kandang Kosong</span>
|
||||
</label>
|
||||
|
||||
{emptyKandang && (
|
||||
<div className='w-full md:max-w-md'>
|
||||
<Label htmlFor='empty_kandang_end_date'>
|
||||
Tanggal Akhir Kandang Kosong{' '}
|
||||
<span className='text-red-500'>*</span>
|
||||
</Label>
|
||||
<div className='mt-1.5'>
|
||||
<DatePicker
|
||||
date={emptyKandangEndDate}
|
||||
onDateChange={setEmptyKandangEndDate}
|
||||
disabled={!isChecklistStatusDraft}
|
||||
placeholder='Pilih tanggal akhir kandang kosong'
|
||||
formatDisplay={formatDateForDisplay}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ export type BaseDailyChecklist = {
|
||||
category: string;
|
||||
date: string;
|
||||
empty_kandang?: boolean;
|
||||
empty_kandang_end_date?: string | null;
|
||||
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
||||
total_phase: number;
|
||||
total_activity: number;
|
||||
@@ -60,7 +59,6 @@ export type CreateDailyChecklistPayload = {
|
||||
category: string;
|
||||
status: string;
|
||||
empty_kandang: boolean;
|
||||
empty_kandang_end_date: string;
|
||||
};
|
||||
|
||||
export type PerformanceOverviewItem = {
|
||||
|
||||
Reference in New Issue
Block a user