diff --git a/web-v2/src/features/inspections/fieldBriefingApi.ts b/web-v2/src/features/inspections/fieldBriefingApi.ts new file mode 100644 index 0000000..a147b2c --- /dev/null +++ b/web-v2/src/features/inspections/fieldBriefingApi.ts @@ -0,0 +1,56 @@ +import { apiRequest } from '../../lib/api'; + +export type FieldBriefingActState = + | 'ACT_RESPONSE_OVERDUE' + | 'ACT_RESPONSE_DUE_SOON' + | 'WAITING_RESPONSE' + | 'COMPANY_COMMITMENT_OVERDUE' + | 'VERIFICATION_PENDING' + | 'RESPONSE_RECEIVED'; + +export interface FieldBriefingFinding { + id: string; + code: string; + title: string; + status: string; + severity: number | null; + nextControlOn: string | null; + asset: { id: string; code: string; name: string; typeName: string }; +} + +export interface FieldBriefingAct { + actId: string; + actCode: string; + occurredAt: string; + adminState: FieldBriefingActState; + responseDueOn: string | null; + responseReceivedOn: string | null; + committedCorrectionOn: string | null; + latestResponseId: string | null; + findings: FieldBriefingFinding[]; +} + +export interface FieldBriefing { + inspection: { + id: string; + code: string; + status: string; + plannedStartAt: string | null; + area: { id: string; code: string; name: string } | null; + operatorCompany: { id: string; code: string; name: string } | null; + }; + plannedOn: string; + summary: { + acts: number; + findings: number; + inventoryItems: number; + responseOverdue: number; + commitmentOverdue: number; + verificationPending: number; + }; + acts: FieldBriefingAct[]; +} + +export function getInspectionFieldBriefing(visitId: string) { + return apiRequest(`/inspection-visits/${visitId}/field-briefing`); +}