Inspection reports: support uploading file-type required report slots on mobile
Objective
- Let inspectors fill empty
file-type required report slots from the mobile app (e.g. PDF pick/upload), instead of relying on web-only uploads. - Preserve existing Spectora and link flows; add clear handling for oversize, wrong type, and network failures.
Background
- In
ReportsSection, empty slots only allow adding whenrequiredReport.reportTypeisspectoraorlink(canAdd);fileslots show the label but cannot start an add flow. handleAddUrlbranches support Spectora URL validation and generic link creation; there is nofilebranch wired to an upload or document pick.- Web workorder reports use
useReportUpload.ts(FilePond, presigned-style server actions, size/type constants such asMAX_FILE_SIZE/ACCEPTED_FILE_TYPES) fromattik-frontend/src/app/tools/inspections/[id]/components/reports/— mobile work should mirror the same backend contracts (multipart vs presigned finalize, inspection/report fields,_requiredReportTypeId/ index behavior) rather than inventing a parallel API.
Scope
Attik Mobile
- Primary UI:
components/inspection/ReportsSection.tsx— extendcanAdd/ empty-slot actions forreportType === "file", wire mutations after a document pick, and keep slot keys (createSlotKey) andgetUploadedReportsbehavior consistent. - Report mutations already used for Spectora/link:
hooks/useReportMutations.ts(e.g.useCreateLinkReport,useCreateSpectoraReport) — evaluate whether a new mutation or API helper is needed for file-backed reports vs reusing an existing endpoint. - Document picking precedent:
components/inspection/AttachmentsSection.tsxusesexpo-document-picker(DocumentPicker.getDocumentAsync); reuse patterns or shared utilities where appropriate. - Hooks:
hooks/useInspectionReports.tsand any report list invalidation after upload.
Attik Frontend (reference only)
src/app/tools/inspections/[id]/components/reports/useReportUpload.ts— server action URLs, metadata passed with uploads, and validation limits for parity.ReportCard.tsx/Reports.tsx— how file slots render after upload.
Attik Backend
- Confirm the routes and payload shape used when web creates or attaches file reports to an inspection (report + storage finalize if applicable); mobile must call the same contracts.
References
- Mobile:
attik-mobile/components/inspection/ReportsSection.tsx,attik-mobile/components/inspection/AttachmentsSection.tsx,attik-mobile/hooks/useReportMutations.ts,attik-mobile/hooks/useInspectionReports.ts - Web:
attik-frontend/src/app/tools/inspections/[id]/components/reports/useReportUpload.ts
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.