feat : M5 — Tickets de pesée (ERP-188 → ERP-193) #144
@@ -192,6 +192,7 @@ import { useWeighbridge } from '~/modules/logistique/composables/useWeighbridge'
|
||||
import { useWeighingTicket } from '~/modules/logistique/composables/useWeighingTicket'
|
||||
import { useWeighingTicketReferentials, type RefOption } from '~/modules/logistique/composables/useWeighingTicketReferentials'
|
||||
import { NUMERIC_MASK, PLATE_MASK, FREE_PLATE_MASK } from '~/modules/logistique/utils/weighingMasks'
|
||||
import { mapViolationsToRecord } from '~/shared/utils/api'
|
||||
|
||||
const { t } = useI18n()
|
||||
const api = useApi()
|
||||
@@ -344,7 +345,13 @@ async function confirmManual(): Promise<void> {
|
||||
await saveDraft()
|
||||
}
|
||||
catch (e) {
|
||||
manualModal.errors = { weight: weighbridge.extractWeighbridgeError(e) }
|
||||
// 422 de pesée (poids/DSD ≤ 0, Assert\Positive) → erreur sous le BON champ
|
||||
// (le propertyPath back `weight`/`dsd` = nom du champ de la modale). Sinon
|
||||
// (503 pont indispo, réseau) → message générique sous le champ Poids.
|
||||
const violations = mapViolationsToRecord((e as { response?: { _data?: unknown } })?.response?._data)
|
||||
manualModal.errors = Object.keys(violations).length > 0
|
||||
? violations
|
||||
: { weight: weighbridge.extractWeighbridgeError(e) }
|
||||
}
|
||||
finally {
|
||||
manualModal.loading = false
|
||||
|
||||
@@ -181,6 +181,7 @@ import { useWeighingTicketForm, type WeighingBlockState } from '~/modules/logist
|
||||
import { useWeighbridge } from '~/modules/logistique/composables/useWeighbridge'
|
||||
import { useWeighingTicketReferentials, type RefOption } from '~/modules/logistique/composables/useWeighingTicketReferentials'
|
||||
import { NUMERIC_MASK, PLATE_MASK, FREE_PLATE_MASK } from '~/modules/logistique/utils/weighingMasks'
|
||||
import { mapViolationsToRecord } from '~/shared/utils/api'
|
||||
|
||||
const { t } = useI18n()
|
||||
const api = useApi()
|
||||
@@ -309,7 +310,13 @@ async function confirmManual(): Promise<void> {
|
||||
await saveDraft()
|
||||
}
|
||||
catch (error) {
|
||||
|
|
||||
manualModal.errors = { weight: weighbridge.extractWeighbridgeError(error) }
|
||||
// 422 de pesée (poids/DSD ≤ 0, Assert\Positive) → erreur sous le BON champ
|
||||
// (le propertyPath back `weight`/`dsd` = nom du champ de la modale). Sinon
|
||||
// (503 pont indispo, réseau) → message générique sous le champ Poids.
|
||||
const violations = mapViolationsToRecord((error as { response?: { _data?: unknown } })?.response?._data)
|
||||
manualModal.errors = Object.keys(violations).length > 0
|
||||
? violations
|
||||
: { weight: weighbridge.extractWeighbridgeError(error) }
|
||||
}
|
||||
finally {
|
||||
manualModal.loading = false
|
||||
|
||||
Reference in New Issue
Block a user
🟡 Bug UX — un 422 sur le DSD s'affiche sous le champ Poids
dsdporte#[Assert\Positive]côtéWeighbridgeReadingResource. Si l'opérateur saisit0(ou ≤ 0), lePOST /weighbridge_readingsrenvoie une 422 depropertyPathdsd, mais lecatchmappe toujours le message sousweight({ weight: extractWeighbridgeError(error) }). L'erreur DSD apparaît sous Poids, le champ DSD reste vierge. Router le message vers le bon champ (réutilisermapViolationsToRecord). Idem dans[id]/edit.vue.