Skip to content

VSN-2436/ feat(demandes): refactor mes demandes with document workflow, date validation and download

fatima senan a demandé de fusionner feature/VSN-2436 vers develop

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, in DemandeForm, addDemandeScreen, and validateForm
  • Fixed DatePickerModal stale internal state — added useEffect on visible to reset tempDate to selectedDate (clamped to minimumDate if needed), preventing iOS from silently keeping an out-of-range value

File Upload

  • Added inferMimeType helper 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
  • selectFromFiles now 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/upload to the dedicated /api/document/docs/absence/upload endpoint, 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 uuid may be absent from the create response)

Document Display in Detail Screen

  • Added refreshDemande store 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.openURL with FileSystem.downloadAsync + Sharing.shareAsync for 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_progress status to DemandeStatus type and DEMANDE_STATUS config
  • Removed mandatory employeeComment requirement for absence requests

Rapports de requête de fusion