mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +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);
|
||||
setSelectedCategory(isEmptyKandang ? 'empty_kandang' : data.category);
|
||||
|
||||
if (isEmptyKandang && data.empty_kandang_end_date) {
|
||||
const rawEnd = data.empty_kandang_end_date;
|
||||
if (
|
||||
isEmptyKandang &&
|
||||
data.empty_kandang &&
|
||||
data.empty_kandang.end_date
|
||||
) {
|
||||
const rawEnd = data.empty_kandang.end_date;
|
||||
setEmptyKandangEndDate(
|
||||
rawEnd.length > 10 ? rawEnd.slice(0, 10) : rawEnd
|
||||
);
|
||||
|
||||
+19
@@ -60,6 +60,7 @@ interface ChecklistHeader {
|
||||
progress_percent: number;
|
||||
total_phases: number;
|
||||
total_activities: number;
|
||||
empty_kandang_end_date?: string | null;
|
||||
}
|
||||
|
||||
interface PhaseGroup {
|
||||
@@ -179,6 +180,9 @@ export function DetailDailyChecklistContent() {
|
||||
|
||||
setDocuments(rawDetailChecklist?.document_urls || []);
|
||||
|
||||
const emptyKandangEndDate =
|
||||
rawDetailChecklist?.empty_kandang?.end_date ?? null;
|
||||
|
||||
const checklistData = {
|
||||
id: rawDetailChecklist?.id,
|
||||
date: rawDetailChecklist?.date,
|
||||
@@ -205,6 +209,7 @@ export function DetailDailyChecklistContent() {
|
||||
progress_percent: 0,
|
||||
total_phases: 0,
|
||||
total_activities: 0,
|
||||
empty_kandang_end_date: emptyKandangEndDate,
|
||||
});
|
||||
setLoading(false);
|
||||
return;
|
||||
@@ -272,6 +277,7 @@ export function DetailDailyChecklistContent() {
|
||||
progress_percent: 0,
|
||||
total_phases: new Set(tasks.map((t) => t.phase_id)).size,
|
||||
total_activities: tasks.length,
|
||||
empty_kandang_end_date: emptyKandangEndDate,
|
||||
});
|
||||
setLoading(false);
|
||||
return;
|
||||
@@ -322,6 +328,7 @@ export function DetailDailyChecklistContent() {
|
||||
progress_percent: progressPercent,
|
||||
total_phases: uniquePhases.size,
|
||||
total_activities: uniqueActivities.size,
|
||||
empty_kandang_end_date: emptyKandangEndDate,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error fetching checklist detail:', error);
|
||||
@@ -777,6 +784,18 @@ export function DetailDailyChecklistContent() {
|
||||
{CATEGORY_LABELS[header.category] || header.category}
|
||||
</p>
|
||||
</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>
|
||||
<Label className='text-xs text-gray-500'>Status</Label>
|
||||
<div className='mt-1'>{getStatusBadge(header.status)}</div>
|
||||
|
||||
+5
-2
@@ -12,8 +12,11 @@ export type BaseDailyChecklist = {
|
||||
status: string;
|
||||
category: string;
|
||||
date: string;
|
||||
empty_kandang?: boolean;
|
||||
empty_kandang_end_date?: string | null;
|
||||
empty_kandang?: {
|
||||
id: boolean;
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
};
|
||||
kandang?: Pick<BaseKandang, 'id' | 'name' | 'status' | 'capacity'>;
|
||||
total_phase: number;
|
||||
total_activity: number;
|
||||
|
||||
Reference in New Issue
Block a user