@@ -34,8 +29,6 @@
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 36eedf6..d32b6ec 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -10,6 +10,7 @@
"@nuxtjs/i18n": "^10.2.1",
"@pinia/nuxt": "^0.11.3",
"izitoast": "^1.4.0",
+ "maska": "^3.2.0",
"nuxt": "^4.2.2",
"nuxt-toast": "^1.4.0",
"pinia": "^3.0.4",
@@ -9195,6 +9196,11 @@
"source-map-js": "^1.2.1"
}
},
+ "node_modules/maska": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/maska/-/maska-3.2.0.tgz",
+ "integrity": "sha512-zSmSgs5/q9vMSmrdZT3rKOv9uLznNWR/niuuAdBZDTvB3SMKOX9vhMtDijFyExz+B4UClu2rvksylUh/ea1bLA=="
+ },
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 80c95d1..a13235f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -14,6 +14,7 @@
"@nuxtjs/i18n": "^10.2.1",
"@pinia/nuxt": "^0.11.3",
"izitoast": "^1.4.0",
+ "maska": "^3.2.0",
"nuxt": "^4.2.2",
"nuxt-toast": "^1.4.0",
"pinia": "^3.0.4",
diff --git a/frontend/pages/reception/[[id]].vue b/frontend/pages/reception/[[id]].vue
index b4ae006..482f5e9 100644
--- a/frontend/pages/reception/[[id]].vue
+++ b/frontend/pages/reception/[[id]].vue
@@ -2,7 +2,11 @@
Indicateur d’étapes
-
Mettre en attente
+
@@ -21,13 +25,39 @@ const router = useRouter()
const receptionStore = useReceptionStore()
const { current: storeReception } = storeToRefs(receptionStore)
-onMounted(async () => {
- const raw = route.params.id
- const idStr = Array.isArray(raw) ? raw[0] : raw
- const id = idStr ? Number(idStr) : null
-
- if (id !== null) {
- await receptionStore.loadReception(id)
+const resolveReceptionId = (param: unknown) => {
+ const idStr = Array.isArray(param) ? param[0] : param
+ if (!idStr) {
+ return null
}
-})
+ const id = Number(idStr)
+ return Number.isFinite(id) ? id : null
+}
+
+watch(
+ () => route.params.id,
+ async (param) => {
+ const id = resolveReceptionId(param)
+ if (id === null) {
+ receptionStore.clearCurrent()
+ return
+ }
+ await receptionStore.loadReception(id)
+ },
+ { immediate: true }
+)
+
+const saveAndHold = async () => {
+ if (!receptionStore.current) {
+ await router.push('/')
+ return
+ }
+
+ await receptionStore.updateReception(receptionStore.current.id, {
+ currentStep: receptionStore.current.currentStep,
+ licensePlate: receptionStore.current.licensePlate,
+ receptionDate: receptionStore.current.receptionDate
+ })
+ await router.push('/')
+}