mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'fix/daily-checklist' into 'development'
[FIX/FE] Daily Checklist See merge request mbugroup/lti-web-client!479
This commit is contained in:
@@ -233,8 +233,12 @@ export function DailyChecklistContent() {
|
|||||||
setEmptyKandang(isEmptyKandang);
|
setEmptyKandang(isEmptyKandang);
|
||||||
setSelectedCategory(isEmptyKandang ? 'empty_kandang' : data.category);
|
setSelectedCategory(isEmptyKandang ? 'empty_kandang' : data.category);
|
||||||
|
|
||||||
if (isEmptyKandang && data.empty_kandang_end_date) {
|
if (
|
||||||
const rawEnd = data.empty_kandang_end_date;
|
isEmptyKandang &&
|
||||||
|
data.empty_kandang &&
|
||||||
|
data.empty_kandang.end_date
|
||||||
|
) {
|
||||||
|
const rawEnd = data.empty_kandang.end_date;
|
||||||
setEmptyKandangEndDate(
|
setEmptyKandangEndDate(
|
||||||
rawEnd.length > 10 ? rawEnd.slice(0, 10) : rawEnd
|
rawEnd.length > 10 ? rawEnd.slice(0, 10) : rawEnd
|
||||||
);
|
);
|
||||||
|
|||||||
+19
@@ -60,6 +60,7 @@ interface ChecklistHeader {
|
|||||||
progress_percent: number;
|
progress_percent: number;
|
||||||
total_phases: number;
|
total_phases: number;
|
||||||
total_activities: number;
|
total_activities: number;
|
||||||
|
empty_kandang_end_date?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PhaseGroup {
|
interface PhaseGroup {
|
||||||
@@ -179,6 +180,9 @@ export function DetailDailyChecklistContent() {
|
|||||||
|
|
||||||
setDocuments(rawDetailChecklist?.document_urls || []);
|
setDocuments(rawDetailChecklist?.document_urls || []);
|
||||||
|
|
||||||
|
const emptyKandangEndDate =
|
||||||
|
rawDetailChecklist?.empty_kandang?.end_date ?? null;
|
||||||
|
|
||||||
const checklistData = {
|
const checklistData = {
|
||||||
id: rawDetailChecklist?.id,
|
id: rawDetailChecklist?.id,
|
||||||
date: rawDetailChecklist?.date,
|
date: rawDetailChecklist?.date,
|
||||||
@@ -205,6 +209,7 @@ export function DetailDailyChecklistContent() {
|
|||||||
progress_percent: 0,
|
progress_percent: 0,
|
||||||
total_phases: 0,
|
total_phases: 0,
|
||||||
total_activities: 0,
|
total_activities: 0,
|
||||||
|
empty_kandang_end_date: emptyKandangEndDate,
|
||||||
});
|
});
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
@@ -272,6 +277,7 @@ export function DetailDailyChecklistContent() {
|
|||||||
progress_percent: 0,
|
progress_percent: 0,
|
||||||
total_phases: new Set(tasks.map((t) => t.phase_id)).size,
|
total_phases: new Set(tasks.map((t) => t.phase_id)).size,
|
||||||
total_activities: tasks.length,
|
total_activities: tasks.length,
|
||||||
|
empty_kandang_end_date: emptyKandangEndDate,
|
||||||
});
|
});
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
@@ -322,6 +328,7 @@ export function DetailDailyChecklistContent() {
|
|||||||
progress_percent: progressPercent,
|
progress_percent: progressPercent,
|
||||||
total_phases: uniquePhases.size,
|
total_phases: uniquePhases.size,
|
||||||
total_activities: uniqueActivities.size,
|
total_activities: uniqueActivities.size,
|
||||||
|
empty_kandang_end_date: emptyKandangEndDate,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching checklist detail:', error);
|
console.error('Error fetching checklist detail:', error);
|
||||||
@@ -777,6 +784,18 @@ export function DetailDailyChecklistContent() {
|
|||||||
{CATEGORY_LABELS[header.category] || header.category}
|
{CATEGORY_LABELS[header.category] || header.category}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{header.category === 'empty_kandang' && (
|
||||||
|
<div>
|
||||||
|
<Label className='text-xs text-gray-500'>
|
||||||
|
Tanggal Selesai Kandang Kosong
|
||||||
|
</Label>
|
||||||
|
<p className='text-sm font-medium text-gray-900 mt-1'>
|
||||||
|
{header.empty_kandang_end_date
|
||||||
|
? formatDate(header.empty_kandang_end_date)
|
||||||
|
: '-'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div>
|
<div>
|
||||||
<Label className='text-xs text-gray-500'>Status</Label>
|
<Label className='text-xs text-gray-500'>Status</Label>
|
||||||
<div className='mt-1'>{getStatusBadge(header.status)}</div>
|
<div className='mt-1'>{getStatusBadge(header.status)}</div>
|
||||||
|
|||||||
+5
-2
@@ -12,8 +12,11 @@ export type BaseDailyChecklist = {
|
|||||||
status: string;
|
status: string;
|
||||||
category: string;
|
category: string;
|
||||||
date: string;
|
date: string;
|
||||||
empty_kandang?: boolean;
|
empty_kandang?: {
|
||||||
empty_kandang_end_date?: string | null;
|
id: boolean;
|
||||||
|
start_date: string;
|
||||||
|
end_date: string;
|
||||||
|
};
|
||||||
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
||||||
total_phase: number;
|
total_phase: number;
|
||||||
total_activity: number;
|
total_activity: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user