VSN-2436/ feat(demandes): refactor mes demandes with document workflow, date validation and download
This mr refactors the "Mes Demandes" feature for the driver mobile app, addressing validation issues, document upload/display workflow, and UX improvements.
Date Validation
- Fixed same-day start/end date being rejected — dates are now normalized to midnight (
setHours(0,0,0,0)) before any comparison, inDemandeForm,addDemandeScreen, andvalidateForm - Fixed
DatePickerModalstale internal state — addeduseEffectonvisibleto resettempDatetoselectedDate(clamped tominimumDateif needed), preventing iOS from silently keeping an out-of-range value
File Upload
- Added
inferMimeTypehelper to derive MIME type from file extension when the OS returns an unreliable type - Fixed HEIC/HEIF files being rejected — they are now mapped to
image/jpeg -
selectFromFilesnow validates the MIME type against a known list before trusting the OS value
Absence Document Workflow
- Switched document upload from the generic
/api/document/docs/uploadto the dedicated/api/document/docs/absence/uploadendpoint, aligning with the BO's document storage path - Added three new API methods:
uploadDocumentToAbsence,getAbsenceDocumentsList,getAbsenceDocumentDownloadUrl - After absence creation, performs a GET to retrieve the real backend UUID before uploading (fixes LEAVE/OTHER types where
uuidmay be absent from the create response)
Document Display in Detail Screen
- Added
refreshDemandestore action — fetches fresh absence data and queries the dedicated document list endpoint on detail open - Documents uploaded from mobile now appear in the mobile detail view
Download
- Replaced
Linking.openURLwithFileSystem.downloadAsync+Sharing.shareAsyncfor a native download + share/save sheet experience - Added a download progress overlay (
ActivityIndicator) while the file transfers
Other Fixes
- Fixed absence list titles — removed the
"Demande d'"prefix, now shows only the type label (capitalized) - Added
in_progressstatus toDemandeStatustype andDEMANDE_STATUSconfig - Removed mandatory
employeeCommentrequirement for absence requests