feat : cycle de vie brouillon/validé du ticket de pesée (ERP-193)
Une pesée (bascule ou manuelle) s'enregistre désormais dès la validation de sa
modale, sans exiger la contrepartie ni l'immatriculation : le ticket naît
« brouillon » (status DRAFT, sans numéro). Le bouton « Valider » finalise quand
les 3 champs du haut (contrepartie + champ associé + immatriculation) ET les 2
pesées sont renseignés : attribution du numéro {siteCode}-TP-{NNNN} et passage
en VALIDATED, puis ouverture du bon de pesée PDF.
Back : counterparty_type/immatriculation/number nullables + colonne status
(migration racine), contraintes strictes déplacées en groupe de validation
finalize, opération PATCH /weighing_tickets/{id}/validate, numéro attribué à la
validation. Front : 4 champs en haut hors blocs, persistance immédiate des
pesées, écrans Ajouter/Modifier refondus, colonne Statut dans la liste, form à
plat pleine largeur. Tests back (lifecycle brouillon/validate) + front à jour.
This commit is contained in:
@@ -48,9 +48,10 @@ const InputStub = defineComponent({
|
||||
},
|
||||
})
|
||||
|
||||
// WeighingBlock stubbe : rend le slot counterparty (présent sur le bloc vide).
|
||||
// WeighingBlock stubbé (Date/Poids/DSD + boutons) — la contrepartie vit désormais
|
||||
// dans les 4 champs du haut, hors bloc (ERP-193).
|
||||
const BlockStub = defineComponent({
|
||||
setup(_, { slots }) { return () => h('div', { 'data-testid': 'block' }, slots.counterparty?.()) },
|
||||
setup() { return () => h('div', { 'data-testid': 'block' }) },
|
||||
})
|
||||
|
||||
const ModalStub = defineComponent({
|
||||
@@ -82,6 +83,7 @@ async function mountPage() {
|
||||
|
||||
const DETAIL = {
|
||||
id: 9,
|
||||
status: 'VALIDATED',
|
||||
number: '86-TP-0001',
|
||||
site: { id: 1, name: 'Chatellerault', code: '86' },
|
||||
counterpartyType: 'CLIENT',
|
||||
@@ -105,11 +107,11 @@ describe('Écran Modification ticket de pesée (page /weighing-tickets/{id}/edit
|
||||
expect(mockFetchTicket).toHaveBeenCalledWith('9')
|
||||
})
|
||||
|
||||
it('bascule des boutons : « Enregistrer » + « Imprimer » présents, pas de « Valider »', async () => {
|
||||
it('ticket validé : action principale « Enregistrer » + « Imprimer » (pas « Valider »)', async () => {
|
||||
const wrapper = await mountPage()
|
||||
// DETAIL.status = VALIDATED → l'action principale s'intitule « Enregistrer ».
|
||||
expect(wrapper.find('[data-label="logistique.weighingTickets.form.save"]').exists()).toBe(true)
|
||||
expect(wrapper.find('[data-label="logistique.weighingTickets.form.print"]').exists()).toBe(true)
|
||||
// « Valider » est le bouton de l'écran d'AJOUT — absent en modification (RG-5.08).
|
||||
expect(wrapper.find('[data-label="logistique.weighingTickets.form.validate"]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
@@ -119,15 +121,24 @@ describe('Écran Modification ticket de pesée (page /weighing-tickets/{id}/edit
|
||||
expect(mockOpen).toHaveBeenCalledWith('/api/weighing_tickets/9/print.pdf', '_blank')
|
||||
})
|
||||
|
||||
it('« Enregistrer » PATCH le ticket puis revient à la liste', async () => {
|
||||
it('« Enregistrer » : PATCH brouillon puis PATCH /validate, retour à la liste', async () => {
|
||||
const wrapper = await mountPage()
|
||||
await wrapper.find('[data-label="logistique.weighingTickets.form.save"]').trigger('click')
|
||||
await flushPromises()
|
||||
// 1. Persistance de l'état courant (brouillon) avec les 2 pesées.
|
||||
expect(mockPatch).toHaveBeenCalledWith(
|
||||
'/weighing_tickets/9',
|
||||
expect.objectContaining({ counterpartyType: 'CLIENT', client: '/api/clients/629', fullWeight: 14300 }),
|
||||
expect.objectContaining({ toast: false }),
|
||||
)
|
||||
// 2. Validation (back autoritaire) — ne porte que les 4 champs du haut.
|
||||
expect(mockPatch).toHaveBeenCalledWith(
|
||||
'/weighing_tickets/9/validate',
|
||||
expect.objectContaining({ counterpartyType: 'CLIENT', immatriculation: 'AB-123-CD' }),
|
||||
expect.objectContaining({ toast: false }),
|
||||
)
|
||||
// « Enregistrer » ouvre aussi le bon de pesée PDF (RG-5.08).
|
||||
expect(mockOpen).toHaveBeenCalledWith('/api/weighing_tickets/9/print.pdf', '_blank')
|
||||
expect(mockPush).toHaveBeenCalledWith('/weighing-tickets')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount, flushPromises } from '@vue/test-utils'
|
||||
import { defineComponent, h, ref, reactive, Suspense } from 'vue'
|
||||
|
||||
// ── Mocks des composables modules (le form RÉEL est conservé). ────────────────
|
||||
const mockPost = vi.hoisted(() => vi.fn())
|
||||
const mockPatch = vi.hoisted(() => vi.fn())
|
||||
const mockPush = vi.hoisted(() => vi.fn())
|
||||
const mockOpen = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('~/modules/logistique/composables/useWeighingTicketReferentials', () => ({
|
||||
useWeighingTicketReferentials: () => ({ clients: ref([]), suppliers: ref([]), load: vi.fn().mockResolvedValue(undefined) }),
|
||||
}))
|
||||
vi.mock('~/modules/logistique/composables/useWeighbridge', () => ({
|
||||
useWeighbridge: () => ({ triggerAuto: vi.fn(), triggerManual: vi.fn(), extractWeighbridgeError: () => 'err' }),
|
||||
}))
|
||||
|
||||
// ── Auto-imports Nuxt stubbés globalement ───────────────────────────────────
|
||||
vi.stubGlobal('useI18n', () => ({ t: (key: string) => key }))
|
||||
vi.stubGlobal('useHead', () => undefined)
|
||||
vi.stubGlobal('useApi', () => ({ get: vi.fn(), post: mockPost, patch: mockPatch }))
|
||||
vi.stubGlobal('useRouter', () => ({ push: mockPush }))
|
||||
vi.stubGlobal('usePermissions', () => ({ can: () => true }))
|
||||
vi.stubGlobal('navigateTo', vi.fn())
|
||||
vi.stubGlobal('useFormErrors', () => ({ errors: reactive({}), setError: vi.fn(), clearErrors: vi.fn(), handleApiError: vi.fn() }))
|
||||
globalThis.open = mockOpen
|
||||
|
||||
const NewPage = (await import('../weighing-tickets/new.vue')).default
|
||||
|
||||
const ButtonStub = defineComponent({
|
||||
props: { label: { type: String, default: '' }, disabled: { type: Boolean, default: false } },
|
||||
emits: ['click'],
|
||||
setup(props, { emit }) {
|
||||
return () => h('button', { 'data-label': props.label, onClick: () => emit('click') }, props.label)
|
||||
},
|
||||
})
|
||||
const InputStub = defineComponent({
|
||||
props: { label: { type: String, default: '' }, modelValue: { default: null } },
|
||||
setup(props) { return () => h('input', { 'data-label': props.label, 'value': props.modelValue as string }) },
|
||||
})
|
||||
const BlockStub = defineComponent({ setup() { return () => h('div', { 'data-testid': 'block' }) } })
|
||||
const ModalStub = defineComponent({
|
||||
props: { modelValue: { type: Boolean, default: false } },
|
||||
setup(_, { slots }) { return () => h('div', {}, [slots.header?.(), slots.default?.(), slots.footer?.()]) },
|
||||
})
|
||||
|
||||
const stubs = {
|
||||
MalioButtonIcon: ButtonStub,
|
||||
MalioButton: ButtonStub,
|
||||
MalioInputText: InputStub,
|
||||
MalioSelect: InputStub,
|
||||
MalioDateTime: InputStub,
|
||||
MalioCheckbox: InputStub,
|
||||
MalioModal: ModalStub,
|
||||
WeighingBlock: BlockStub,
|
||||
}
|
||||
|
||||
async function mountPage() {
|
||||
const wrapper = mount(defineComponent({
|
||||
components: { NewPage },
|
||||
setup: () => () => h(Suspense, null, { default: () => h(NewPage) }),
|
||||
}), { global: { stubs } })
|
||||
await flushPromises()
|
||||
return wrapper
|
||||
}
|
||||
|
||||
describe('Écran Ajouter ticket de pesée (page /weighing-tickets/new)', () => {
|
||||
beforeEach(() => {
|
||||
mockPost.mockReset().mockResolvedValue({ id: 42 })
|
||||
mockPatch.mockReset().mockResolvedValue({})
|
||||
mockPush.mockReset()
|
||||
mockOpen.mockReset()
|
||||
})
|
||||
|
||||
it('un seul bouton « Valider » (pas de « Enregistrer » séparé)', async () => {
|
||||
const wrapper = await mountPage()
|
||||
expect(wrapper.find('[data-label="logistique.weighingTickets.form.validate"]').exists()).toBe(true)
|
||||
expect(wrapper.find('[data-label="logistique.weighingTickets.form.save"]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('« Valider » : POST brouillon (création) puis PATCH /validate, PDF + retour liste', async () => {
|
||||
const wrapper = await mountPage()
|
||||
await wrapper.find('[data-label="logistique.weighingTickets.form.validate"]').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
// 1. Création du brouillon (POST) → récupère l'id.
|
||||
expect(mockPost).toHaveBeenCalledWith(
|
||||
'/weighing_tickets',
|
||||
expect.any(Object),
|
||||
expect.objectContaining({ toast: false }),
|
||||
)
|
||||
// 2. Validation (back autoritaire) sur l'id retourné.
|
||||
expect(mockPatch).toHaveBeenCalledWith(
|
||||
'/weighing_tickets/42/validate',
|
||||
expect.any(Object),
|
||||
expect.objectContaining({ toast: false }),
|
||||
)
|
||||
// 3. Ouverture du bon de pesée PDF + retour à la liste.
|
||||
expect(mockOpen).toHaveBeenCalledWith('/api/weighing_tickets/42/print.pdf', '_blank')
|
||||
expect(mockPush).toHaveBeenCalledWith('/weighing-tickets')
|
||||
})
|
||||
})
|
||||
@@ -18,23 +18,14 @@
|
||||
<p v-else-if="error" class="mt-12 text-center text-m-danger">{{ t('logistique.weighingTickets.edit.notFound') }}</p>
|
||||
|
||||
<template v-else>
|
||||
<!-- Numéro + site : immuables (RG-5.09), rappelés dans le titre de l'écran. -->
|
||||
<div class="mt-[48px] flex flex-col gap-8">
|
||||
<!-- ── Bloc « Poids à vide » (porte la contrepartie, RG-5.03) ──── -->
|
||||
<WeighingBlock
|
||||
block-id="empty"
|
||||
:title="t('logistique.weighingTickets.form.emptyBlock')"
|
||||
:block="form.empty"
|
||||
:immatriculation="form.immatriculation.value"
|
||||
:plate-free-format="form.plateFreeFormat.value"
|
||||
:errors="emptyBlockErrors"
|
||||
@update:block="(field, value) => updateBlock('empty', field, value)"
|
||||
@update:immatriculation="(v) => form.immatriculation.value = v"
|
||||
@update:plate-free-format="(v) => form.plateFreeFormat.value = v"
|
||||
@request-auto="openAuto('empty')"
|
||||
@request-manual="openManual('empty')"
|
||||
>
|
||||
<template #counterparty>
|
||||
<!-- Form à plat, pleine largeur (sans box-shadow) : un filet noir 1px
|
||||
sépare chacun des 3 blocs (divide-y). -->
|
||||
<div class="mt-[48px] flex flex-col divide-y divide-black">
|
||||
<!-- ── 4 champs du haut : contrepartie + immatriculation + « Tout
|
||||
format » (ERP-193, hors blocs de pesée). 1er bloc : pas de
|
||||
padding-top (marge titre→form = mt-[48px] standard). ───────── -->
|
||||
<div class="pb-[20px]">
|
||||
<div class="grid grid-cols-3 xl:grid-cols-4 gap-x-[44px] gap-y-4">
|
||||
<MalioSelect
|
||||
:model-value="form.counterpartyType.value"
|
||||
:options="counterpartyOptions"
|
||||
@@ -72,28 +63,56 @@
|
||||
:error="errors.otherLabel"
|
||||
@update:model-value="(v: string | null) => form.otherLabel.value = v"
|
||||
/>
|
||||
</template>
|
||||
</WeighingBlock>
|
||||
|
||||
<!-- Bloc « Poids à plein » : le bouton « Enregistrer » du bloc vide
|
||||
DISPARAÎT en modification (RG-5.08) — on enregistre via le bas. -->
|
||||
<!-- Pas de cellule vide sans type sélectionné : immat et « Tout
|
||||
format » se collent au type ; le champ conditionnel les
|
||||
décale une fois un type choisi. -->
|
||||
<MalioInputText
|
||||
:model-value="form.immatriculation.value"
|
||||
:mask="form.plateFreeFormat.value ? FREE_PLATE_MASK : PLATE_MASK"
|
||||
:label="t('logistique.weighingTickets.form.immatriculation')"
|
||||
:required="true"
|
||||
:error="errors.immatriculation"
|
||||
@update:model-value="(v: string | null) => form.immatriculation.value = v"
|
||||
/>
|
||||
<MalioCheckbox
|
||||
id="plate-free-format"
|
||||
:model-value="form.plateFreeFormat.value"
|
||||
:label="t('logistique.weighingTickets.form.plateFreeFormat')"
|
||||
group-class="self-center"
|
||||
@update:model-value="(v: boolean) => form.plateFreeFormat.value = v"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Bloc « Poids à vide » ──────────────────────────────────── -->
|
||||
<WeighingBlock
|
||||
class="py-[20px]"
|
||||
block-id="empty"
|
||||
:title="t('logistique.weighingTickets.form.emptyBlock')"
|
||||
:block="form.empty"
|
||||
:errors="emptyBlockErrors"
|
||||
@update:block="(field, value) => updateBlock('empty', field, value)"
|
||||
@request-auto="openAuto('empty')"
|
||||
@request-manual="openManual('empty')"
|
||||
/>
|
||||
|
||||
<!-- ── Bloc « Poids à plein » (dernier bloc : pas de padding-bottom,
|
||||
pour ne pas écarter le bouton). ──────────────────────────── -->
|
||||
<WeighingBlock
|
||||
class="pt-[20px]"
|
||||
block-id="full"
|
||||
:title="t('logistique.weighingTickets.form.fullBlock')"
|
||||
:block="form.full"
|
||||
:immatriculation="form.immatriculation.value"
|
||||
:plate-free-format="form.plateFreeFormat.value"
|
||||
:errors="fullBlockErrors"
|
||||
@update:block="(field, value) => updateBlock('full', field, value)"
|
||||
@update:immatriculation="(v) => form.immatriculation.value = v"
|
||||
@update:plate-free-format="(v) => form.plateFreeFormat.value = v"
|
||||
@request-auto="openAuto('full')"
|
||||
@request-manual="openManual('full')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Bas d'écran : « Enregistrer » (remplace « Valider », RG-5.08) +
|
||||
« Imprimer » (absent à l'ajout, RG-5.08). -->
|
||||
<!-- Bas d'écran : « Imprimer » (ouvre le PDF back) + action principale
|
||||
(« Valider » si brouillon, « Enregistrer » si déjà validé). -->
|
||||
<div class="mt-12 flex justify-center gap-6">
|
||||
<MalioButton
|
||||
variant="secondary"
|
||||
@@ -104,16 +123,14 @@
|
||||
/>
|
||||
<MalioButton
|
||||
variant="primary"
|
||||
:label="t('logistique.weighingTickets.form.save')"
|
||||
:label="primaryLabel"
|
||||
:disabled="saving"
|
||||
@click="submitSave"
|
||||
@click="submitPrimary"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- ── Modal « Confirmation pesée bascule » (RG-5.06) ──────────────────-->
|
||||
<!-- La question est portée par le titre ; pas de texte de corps. Bouton
|
||||
« Valider » seul, centré (l'annulation se fait via la croix). -->
|
||||
<MalioModal v-model="autoModal.open" modal-class="max-w-md" footer-class="justify-center pb-6">
|
||||
<template #header>
|
||||
<h2 class="text-[24px] font-bold">{{ t('logistique.weighingTickets.form.weighbridge.confirmTitle') }}</h2>
|
||||
@@ -130,9 +147,6 @@
|
||||
</MalioModal>
|
||||
|
||||
<!-- ── Modal « Pesée manuelle » ────────────────────────────────────────-->
|
||||
<!-- Marges : titre UPPERCASE à 24px du haut (pt-6), 28px horizontaux (mx-7 header
|
||||
/ px-7 body+footer), bordure à 12px sous le titre (pb-3) et insérée (mx-7,
|
||||
ne touche pas les bords), formulaire à 36px sous la bordure (pt-9). -->
|
||||
<MalioModal
|
||||
v-model="manualModal.open"
|
||||
modal-class="max-w-md"
|
||||
@@ -144,7 +158,6 @@
|
||||
<h2 class="text-[24px] font-bold uppercase">{{ t('logistique.weighingTickets.form.manual.title') }}</h2>
|
||||
</template>
|
||||
<div class="flex flex-col gap-2">
|
||||
<!-- Poids : champ texte verrouillé sur les chiffres (comme le formulaire). -->
|
||||
<MalioInputText
|
||||
v-model="manualModal.weight"
|
||||
:mask="NUMERIC_MASK"
|
||||
@@ -177,7 +190,7 @@ import { useWeighingTicketForm, type WeighingBlockState } from '~/modules/logist
|
||||
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 } from '~/modules/logistique/utils/weighingMasks'
|
||||
import { NUMERIC_MASK, PLATE_MASK, FREE_PLATE_MASK } from '~/modules/logistique/utils/weighingMasks'
|
||||
|
||||
const { t } = useI18n()
|
||||
const api = useApi()
|
||||
@@ -196,30 +209,13 @@ const form = useWeighingTicketForm()
|
||||
const weighbridge = useWeighbridge()
|
||||
const referentials = useWeighingTicketReferentials()
|
||||
const { fetchTicket } = useWeighingTicket()
|
||||
const { errors, setError, clearErrors, handleApiError } = useFormErrors()
|
||||
|
||||
/**
|
||||
* Marque Poids/DSD manquants d'un bloc (RG-5.07). `emptyWeight` est validé côté
|
||||
* back (NotBlank → renvoyé avec les autres violations) ; `fullWeight` n'a pas
|
||||
* d'équivalent back (workflow 2 temps) et reste donc front-only. Le DSD est
|
||||
* alloué serveur → simple repère front en miroir du poids. Retourne false si une
|
||||
* pesée manque.
|
||||
*/
|
||||
function validateWeighing(which: 'empty' | 'full'): boolean {
|
||||
const missing = form.missingWeighingFields(which)
|
||||
for (const path of missing) {
|
||||
setError(path, path.endsWith('Weight')
|
||||
? t('logistique.weighingTickets.form.weightRequired')
|
||||
: t('logistique.weighingTickets.form.dsdRequired'))
|
||||
}
|
||||
return missing.length === 0
|
||||
}
|
||||
const { errors, clearErrors, handleApiError } = useFormErrors()
|
||||
|
||||
const loading = ref(true)
|
||||
const error = ref(false)
|
||||
const saving = ref(false)
|
||||
|
||||
// Numéro immuable (RG-5.09), rappelé dans le titre de l'écran.
|
||||
// Numéro immuable (RG-5.09), rappelé dans le titre — vide tant que brouillon.
|
||||
const ticketNumber = ref<string>('')
|
||||
|
||||
const headerTitle = computed(() =>
|
||||
@@ -228,6 +224,15 @@ const headerTitle = computed(() =>
|
||||
: t('logistique.weighingTickets.edit.titleFallback'),
|
||||
)
|
||||
|
||||
// Libellé de l'action principale : « Valider » pour un brouillon (finalisation),
|
||||
// « Enregistrer » pour un ticket déjà validé (mise à jour, ERP-193).
|
||||
const isValidated = computed(() => form.status.value === 'VALIDATED')
|
||||
const primaryLabel = computed(() =>
|
||||
isValidated.value
|
||||
? t('logistique.weighingTickets.form.save')
|
||||
: t('logistique.weighingTickets.form.validate'),
|
||||
)
|
||||
|
||||
useHead({ title: t('logistique.weighingTickets.edit.titleFallback') })
|
||||
|
||||
/** Retour vers la liste (flèche d'en-tête). */
|
||||
@@ -235,7 +240,7 @@ function goBack(): void {
|
||||
router.push('/weighing-tickets')
|
||||
}
|
||||
|
||||
// ── Contrepartie (RG-5.03) ───────────────────────────────────────────────────
|
||||
// ── Contrepartie (RG-5.03) — ordre maquette : Fournisseur / Client / Autre. ───
|
||||
const counterpartyOptions = computed<RefOption[]>(() => [
|
||||
{ value: 'FOURNISSEUR', label: t('logistique.weighingTickets.form.counterparty.supplier') },
|
||||
{ value: 'CLIENT', label: t('logistique.weighingTickets.form.counterparty.client') },
|
||||
@@ -252,11 +257,7 @@ const emptyBlockErrors = computed<Record<string, string>>(() => ({
|
||||
date: errors.emptyDate,
|
||||
weight: errors.emptyWeight,
|
||||
dsd: errors.emptyDsd,
|
||||
immatriculation: errors.immatriculation,
|
||||
}))
|
||||
// Immatriculation volontairement ABSENTE ici : partagée entre les 2 blocs
|
||||
// (RG-5.01) mais affichée/validée sur le bloc « Poids à vide » uniquement — pas
|
||||
// de doublon d'erreur sur le bloc « Poids à plein ».
|
||||
const fullBlockErrors = computed<Record<string, string>>(() => ({
|
||||
date: errors.fullDate,
|
||||
weight: errors.fullWeight,
|
||||
@@ -282,6 +283,7 @@ function openAuto(target: 'empty' | 'full'): void {
|
||||
autoModal.open = true
|
||||
}
|
||||
|
||||
/** Déclenche la pesée bascule puis enregistre le brouillon (ERP-193). */
|
||||
async function confirmAuto(): Promise<void> {
|
||||
if (autoModal.loading) return
|
||||
autoModal.loading = true
|
||||
@@ -290,6 +292,7 @@ async function confirmAuto(): Promise<void> {
|
||||
const reading = await weighbridge.triggerAuto()
|
||||
form.applyReading(form[autoModal.target], reading)
|
||||
autoModal.open = false
|
||||
await saveDraft()
|
||||
}
|
||||
catch (e) {
|
||||
autoModal.error = weighbridge.extractWeighbridgeError(e)
|
||||
@@ -317,6 +320,7 @@ function openManual(target: 'empty' | 'full'): void {
|
||||
manualModal.open = true
|
||||
}
|
||||
|
||||
/** Valide la saisie manuelle, remplit le bloc puis enregistre le brouillon. */
|
||||
async function confirmManual(): Promise<void> {
|
||||
if (manualModal.loading) return
|
||||
manualModal.errors = {}
|
||||
@@ -336,6 +340,7 @@ async function confirmManual(): Promise<void> {
|
||||
const reading = await weighbridge.triggerManual(weight as number, manualNumber)
|
||||
form.applyReading(form[manualModal.target], reading)
|
||||
manualModal.open = false
|
||||
await saveDraft()
|
||||
}
|
||||
catch (e) {
|
||||
manualModal.errors = { weight: weighbridge.extractWeighbridgeError(e) }
|
||||
@@ -345,18 +350,34 @@ async function confirmManual(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Soumission / impression ───────────────────────────────────────────────────
|
||||
/** « Enregistrer » : PATCH /weighing_tickets/{id} (recalcul net serveur, RG-5.05). */
|
||||
async function submitSave(): Promise<void> {
|
||||
if (saving.value) return
|
||||
// ── Persistance / impression ──────────────────────────────────────────────────
|
||||
/** Enregistre l'état courant en BROUILLON (PATCH). False sur erreur (422 inline). */
|
||||
async function saveDraft(): Promise<boolean> {
|
||||
clearErrors()
|
||||
// Vide : marqué seulement (le back garde emptyWeight et renvoie tout d'un coup).
|
||||
// Plein : bloquant côté front (pas de règle back, workflow 2 temps).
|
||||
validateWeighing('empty')
|
||||
if (!validateWeighing('full')) return
|
||||
try {
|
||||
await api.patch(`/weighing_tickets/${ticketId}`, form.buildDraftPayload(), { toast: false })
|
||||
return true
|
||||
}
|
||||
catch (e) {
|
||||
handleApiError(e, { fallbackMessage: t('logistique.weighingTickets.toast.error') })
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action principale : persiste l'état courant puis finalise/re-valide via
|
||||
* PATCH /validate (back autoritaire : 3 champs du haut + 2 pesées). Ouvre le bon de
|
||||
* pesée PDF (RG-5.08) — aussi bien à la validation d'un brouillon qu'à
|
||||
* l'enregistrement d'un ticket déjà validé. Retour à la liste au succès.
|
||||
*/
|
||||
async function submitPrimary(): Promise<void> {
|
||||
if (saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
await api.patch(`/weighing_tickets/${ticketId}`, form.buildUpdatePayload(), { toast: false })
|
||||
if (!(await saveDraft())) return
|
||||
|
||||
await api.patch(`/weighing_tickets/${ticketId}/validate`, form.buildValidatePayload(), { toast: false })
|
||||
window.open(`/api/weighing_tickets/${ticketId}/print.pdf`, '_blank')
|
||||
router.push('/weighing-tickets')
|
||||
}
|
||||
catch (e) {
|
||||
@@ -376,11 +397,10 @@ function printTicket(): void {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// Référentiels (selects contrepartie) en parallèle, non bloquants.
|
||||
referentials.load().catch(() => {})
|
||||
try {
|
||||
const detail = await fetchTicket(ticketId)
|
||||
ticketNumber.value = detail.number
|
||||
ticketNumber.value = detail.number ?? ''
|
||||
form.hydrate(detail)
|
||||
}
|
||||
catch {
|
||||
|
||||
@@ -84,12 +84,16 @@ const {
|
||||
// restent vides. Date et poids sont formates ici (cf. helpers ci-dessous).
|
||||
const rows = computed(() => tickets.value.map(ticket => ({
|
||||
id: ticket.id,
|
||||
number: ticket.number,
|
||||
// Numéro vide tant que brouillon (attribué à la validation, ERP-193).
|
||||
number: ticket.number ?? '',
|
||||
client: ticket.client?.companyName ?? '',
|
||||
supplier: ticket.supplier?.companyName ?? '',
|
||||
otherLabel: ticket.otherLabel ?? '',
|
||||
displayDate: formatDateFr(ticket.displayDate),
|
||||
netWeight: formatWeightKg(ticket.netWeight),
|
||||
status: t(ticket.status === 'VALIDATED'
|
||||
? 'logistique.weighingTickets.status.validated'
|
||||
: 'logistique.weighingTickets.status.draft'),
|
||||
})))
|
||||
|
||||
const columns = [
|
||||
@@ -99,6 +103,7 @@ const columns = [
|
||||
{ key: 'otherLabel', label: t('logistique.weighingTickets.column.other') },
|
||||
{ key: 'displayDate', label: t('logistique.weighingTickets.column.date') },
|
||||
{ key: 'netWeight', label: t('logistique.weighingTickets.column.weight') },
|
||||
{ key: 'status', label: t('logistique.weighingTickets.column.status') },
|
||||
]
|
||||
|
||||
/** Clic sur une ligne → ecran Modification (pas de consultation separee, spec § Navigation). */
|
||||
|
||||
@@ -13,30 +13,19 @@
|
||||
<h1 class="text-[30px] font-semibold text-m-primary">{{ t('logistique.weighingTickets.form.addTitle') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="mt-[48px] flex flex-col gap-8">
|
||||
<!-- ── Bloc « Poids à vide » (porte la contrepartie, RG-5.03) ──────── -->
|
||||
<WeighingBlock
|
||||
block-id="empty"
|
||||
:title="t('logistique.weighingTickets.form.emptyBlock')"
|
||||
:block="form.empty"
|
||||
:immatriculation="form.immatriculation.value"
|
||||
:plate-free-format="form.plateFreeFormat.value"
|
||||
:errors="emptyBlockErrors"
|
||||
:disabled="emptyLocked"
|
||||
@update:block="(field, value) => updateBlock('empty', field, value)"
|
||||
@update:immatriculation="(v) => form.immatriculation.value = v"
|
||||
@update:plate-free-format="(v) => form.plateFreeFormat.value = v"
|
||||
@request-auto="openAuto('empty')"
|
||||
@request-manual="openManual('empty')"
|
||||
>
|
||||
<!-- Contrepartie : sélecteur + champ conditionnel (RG-5.03). -->
|
||||
<template #counterparty>
|
||||
<!-- Form à plat, pleine largeur (sans box-shadow) : un filet noir 1px
|
||||
sépare chacun des 3 blocs (divide-y). -->
|
||||
<div class="mt-[48px] flex flex-col divide-y divide-black">
|
||||
<!-- ── 4 champs du haut : contrepartie (type + champ conditionnel),
|
||||
immatriculation, « Tout format » (ERP-193, hors blocs de pesée).
|
||||
1er bloc : pas de padding-top (marge titre→form = mt-[48px] standard). ── -->
|
||||
<div class="pb-[20px]">
|
||||
<div class="grid grid-cols-3 xl:grid-cols-4 gap-x-[44px] gap-y-4">
|
||||
<MalioSelect
|
||||
:model-value="form.counterpartyType.value"
|
||||
:options="counterpartyOptions"
|
||||
:label="t('logistique.weighingTickets.form.counterparty.type')"
|
||||
:required="true"
|
||||
:disabled="emptyLocked"
|
||||
empty-option-label=""
|
||||
:error="errors.counterpartyType"
|
||||
@update:model-value="onCounterpartyTypeChange"
|
||||
@@ -47,7 +36,6 @@
|
||||
:options="referentials.suppliers.value"
|
||||
:label="t('logistique.weighingTickets.form.counterparty.supplier')"
|
||||
:required="true"
|
||||
:disabled="emptyLocked"
|
||||
empty-option-label=""
|
||||
:error="errors.supplier"
|
||||
@update:model-value="(v: string | number | null) => form.supplierIri.value = v === null ? null : String(v)"
|
||||
@@ -58,7 +46,6 @@
|
||||
:options="referentials.clients.value"
|
||||
:label="t('logistique.weighingTickets.form.counterparty.client')"
|
||||
:required="true"
|
||||
:disabled="emptyLocked"
|
||||
empty-option-label=""
|
||||
:error="errors.client"
|
||||
@update:model-value="(v: string | number | null) => form.clientIri.value = v === null ? null : String(v)"
|
||||
@@ -68,60 +55,76 @@
|
||||
:model-value="form.otherLabel.value"
|
||||
:label="t('logistique.weighingTickets.form.counterparty.other')"
|
||||
:required="true"
|
||||
:disabled="emptyLocked"
|
||||
:error="errors.otherLabel"
|
||||
@update:model-value="(v: string | null) => form.otherLabel.value = v"
|
||||
/>
|
||||
</template>
|
||||
</WeighingBlock>
|
||||
|
||||
<!-- « Enregistrer » du bloc vide : POST initial du ticket (disparaît une
|
||||
fois le ticket créé — RG-5.08). -->
|
||||
<div v-if="form.ticketId.value === null" class="flex justify-center">
|
||||
<MalioButton
|
||||
variant="primary"
|
||||
:label="t('logistique.weighingTickets.form.save')"
|
||||
:disabled="creating"
|
||||
@click="submitCreate"
|
||||
/>
|
||||
<!-- Pas de cellule vide quand aucun type n'est choisi : immat et
|
||||
« Tout format » se collent au type, et le champ conditionnel
|
||||
les décale une fois un type sélectionné. -->
|
||||
<!-- Immatriculation : masque XX-000-XX (plaque FR SIV) ; en « Tout
|
||||
format », masque élargi. Partagée par les 2 pesées (RG-5.01). -->
|
||||
<MalioInputText
|
||||
:model-value="form.immatriculation.value"
|
||||
:mask="form.plateFreeFormat.value ? FREE_PLATE_MASK : PLATE_MASK"
|
||||
:label="t('logistique.weighingTickets.form.immatriculation')"
|
||||
:required="true"
|
||||
:error="errors.immatriculation"
|
||||
@update:model-value="(v: string | null) => form.immatriculation.value = v"
|
||||
/>
|
||||
<MalioCheckbox
|
||||
id="plate-free-format"
|
||||
:model-value="form.plateFreeFormat.value"
|
||||
:label="t('logistique.weighingTickets.form.plateFreeFormat')"
|
||||
group-class="self-center"
|
||||
@update:model-value="(v: boolean) => form.plateFreeFormat.value = v"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Bloc « Poids à plein » ───────────────────────────────────────-->
|
||||
<!-- ── Bloc « Poids à vide » ──────────────────────────────────────── -->
|
||||
<WeighingBlock
|
||||
class="py-[20px]"
|
||||
block-id="empty"
|
||||
:title="t('logistique.weighingTickets.form.emptyBlock')"
|
||||
:block="form.empty"
|
||||
:errors="emptyBlockErrors"
|
||||
@update:block="(field, value) => updateBlock('empty', field, value)"
|
||||
@request-auto="openAuto('empty')"
|
||||
@request-manual="openManual('empty')"
|
||||
/>
|
||||
|
||||
<!-- ── Bloc « Poids à plein » (dernier bloc : pas de padding-bottom,
|
||||
pour ne pas écarter le bouton « Valider »). ───────────────────── -->
|
||||
<WeighingBlock
|
||||
class="pt-[20px]"
|
||||
block-id="full"
|
||||
:title="t('logistique.weighingTickets.form.fullBlock')"
|
||||
:block="form.full"
|
||||
:immatriculation="form.immatriculation.value"
|
||||
:plate-free-format="form.plateFreeFormat.value"
|
||||
:errors="fullBlockErrors"
|
||||
@update:block="(field, value) => updateBlock('full', field, value)"
|
||||
@update:immatriculation="(v) => form.immatriculation.value = v"
|
||||
@update:plate-free-format="(v) => form.plateFreeFormat.value = v"
|
||||
@request-auto="openAuto('full')"
|
||||
@request-manual="openManual('full')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- « Valider » (bas d'écran) : PATCH de la pesée à plein puis ouverture du
|
||||
bon de pesée PDF (RG-5.08). Indisponible tant que le ticket n'est pas créé. -->
|
||||
<!-- « Valider » : persiste l'état courant (brouillon) puis finalise (3 champs
|
||||
du haut + 2 pesées, validation back autoritaire) et ouvre le bon de
|
||||
pesée PDF (RG-5.08, ERP-193). Toujours actif : les 422 s'affichent inline. -->
|
||||
<div class="mt-12 flex justify-center">
|
||||
<MalioButton
|
||||
variant="primary"
|
||||
:label="t('logistique.weighingTickets.form.validate')"
|
||||
:disabled="validating || form.ticketId.value === null"
|
||||
:disabled="validating"
|
||||
@click="submitValidate"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- ── Modal « Confirmation pesée bascule » (RG-5.06) ──────────────────-->
|
||||
<!-- La question est portée par le titre ; pas de texte de corps. Bouton
|
||||
« Valider » seul, centré (l'annulation se fait via la croix). -->
|
||||
<MalioModal v-model="autoModal.open" modal-class="max-w-md" footer-class="justify-center pb-6">
|
||||
<template #header>
|
||||
<h2 class="text-[24px] font-bold">{{ t('logistique.weighingTickets.form.weighbridge.confirmTitle') }}</h2>
|
||||
</template>
|
||||
<!-- Erreur de pont indisponible affichée INLINE dans la modal + invite
|
||||
à la pesée manuelle (RG-5.06). -->
|
||||
<p v-if="autoModal.error" class="text-m-danger">{{ autoModal.error }}</p>
|
||||
<template #footer>
|
||||
<MalioButton
|
||||
@@ -134,9 +137,6 @@
|
||||
</MalioModal>
|
||||
|
||||
<!-- ── Modal « Pesée manuelle » ────────────────────────────────────────-->
|
||||
<!-- Marges : titre UPPERCASE à 24px du haut (pt-6), 28px horizontaux (mx-7 header
|
||||
/ px-7 body+footer), bordure à 12px sous le titre (pb-3) et insérée (mx-7,
|
||||
ne touche pas les bords), formulaire à 36px sous la bordure (pt-9). -->
|
||||
<MalioModal
|
||||
v-model="manualModal.open"
|
||||
modal-class="max-w-md"
|
||||
@@ -148,7 +148,6 @@
|
||||
<h2 class="text-[24px] font-bold uppercase">{{ t('logistique.weighingTickets.form.manual.title') }}</h2>
|
||||
</template>
|
||||
<div class="flex flex-col gap-2">
|
||||
<!-- Poids : champ texte verrouillé sur les chiffres (comme le formulaire). -->
|
||||
<MalioInputText
|
||||
v-model="manualModal.weight"
|
||||
:mask="NUMERIC_MASK"
|
||||
@@ -180,7 +179,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { useWeighingTicketForm, type WeighingBlockState } from '~/modules/logistique/composables/useWeighingTicketForm'
|
||||
import { useWeighbridge } from '~/modules/logistique/composables/useWeighbridge'
|
||||
import { useWeighingTicketReferentials, type RefOption } from '~/modules/logistique/composables/useWeighingTicketReferentials'
|
||||
import { NUMERIC_MASK } from '~/modules/logistique/utils/weighingMasks'
|
||||
import { NUMERIC_MASK, PLATE_MASK, FREE_PLATE_MASK } from '~/modules/logistique/utils/weighingMasks'
|
||||
|
||||
const { t } = useI18n()
|
||||
const api = useApi()
|
||||
@@ -197,28 +196,8 @@ if (!can('logistique.weighing_tickets.manage')) {
|
||||
const form = useWeighingTicketForm()
|
||||
const weighbridge = useWeighbridge()
|
||||
const referentials = useWeighingTicketReferentials()
|
||||
const { errors, setError, clearErrors, handleApiError } = useFormErrors()
|
||||
const { errors, clearErrors, handleApiError } = useFormErrors()
|
||||
|
||||
/**
|
||||
* Validation front-only de la pesée d'un bloc (Poids + DSD obligatoires, RG-5.07).
|
||||
* Le back rend ces colonnes nullable (workflow 2 temps), l'obligation est donc
|
||||
* portée côté front (ERP-101). Pose l'erreur inline sous chaque champ manquant et
|
||||
* retourne false si une pesée manque.
|
||||
*/
|
||||
function validateWeighing(which: 'empty' | 'full'): boolean {
|
||||
const missing = form.missingWeighingFields(which)
|
||||
for (const path of missing) {
|
||||
setError(path, path.endsWith('Weight')
|
||||
? t('logistique.weighingTickets.form.weightRequired')
|
||||
: t('logistique.weighingTickets.form.dsdRequired'))
|
||||
}
|
||||
return missing.length === 0
|
||||
}
|
||||
|
||||
// Le bloc vide se verrouille une fois le ticket créé (numéro/site attribués).
|
||||
const emptyLocked = computed(() => form.ticketId.value !== null)
|
||||
|
||||
const creating = ref(false)
|
||||
const validating = ref(false)
|
||||
|
||||
/** Retour vers la liste (flèche d'en-tête). */
|
||||
@@ -226,8 +205,7 @@ function goBack(): void {
|
||||
router.push('/weighing-tickets')
|
||||
}
|
||||
|
||||
// ── Contrepartie (RG-5.03) ───────────────────────────────────────────────────
|
||||
// Ordre maquette : Fournisseur / Client / Autre.
|
||||
// ── Contrepartie (RG-5.03) — ordre maquette : Fournisseur / Client / Autre. ───
|
||||
const counterpartyOptions = computed<RefOption[]>(() => [
|
||||
{ value: 'FOURNISSEUR', label: t('logistique.weighingTickets.form.counterparty.supplier') },
|
||||
{ value: 'CLIENT', label: t('logistique.weighingTickets.form.counterparty.client') },
|
||||
@@ -244,12 +222,7 @@ const emptyBlockErrors = computed<Record<string, string>>(() => ({
|
||||
date: errors.emptyDate,
|
||||
weight: errors.emptyWeight,
|
||||
dsd: errors.emptyDsd,
|
||||
immatriculation: errors.immatriculation,
|
||||
}))
|
||||
// Immatriculation volontairement ABSENTE ici : elle est partagée entre les 2 blocs
|
||||
// (RG-5.01) mais saisie/validée sur le bloc « Poids à vide ». On n'affiche donc
|
||||
// son erreur que sur le 1er bloc, pas en double sur le bloc « Poids à plein »
|
||||
// (le formulaire se valide en 2 temps).
|
||||
const fullBlockErrors = computed<Record<string, string>>(() => ({
|
||||
date: errors.fullDate,
|
||||
weight: errors.fullWeight,
|
||||
@@ -258,7 +231,6 @@ const fullBlockErrors = computed<Record<string, string>>(() => ({
|
||||
|
||||
/** Mute un champ d'un bloc de pesée (état centralisé dans le form). */
|
||||
function updateBlock(target: 'empty' | 'full', field: keyof WeighingBlockState, value: unknown): void {
|
||||
// Affectation typée via l'index du bloc reactif (date est le seul champ éditable).
|
||||
(form[target] as Record<string, unknown>)[field as string] = value
|
||||
}
|
||||
|
||||
@@ -276,7 +248,7 @@ function openAuto(target: 'empty' | 'full'): void {
|
||||
autoModal.open = true
|
||||
}
|
||||
|
||||
/** Déclenche la pesée bascule ; erreur (RG-5.06) affichée dans la modal. */
|
||||
/** Déclenche la pesée bascule puis enregistre le brouillon (ERP-193). */
|
||||
async function confirmAuto(): Promise<void> {
|
||||
if (autoModal.loading) return
|
||||
autoModal.loading = true
|
||||
@@ -285,9 +257,9 @@ async function confirmAuto(): Promise<void> {
|
||||
const reading = await weighbridge.triggerAuto()
|
||||
form.applyReading(form[autoModal.target], reading)
|
||||
autoModal.open = false
|
||||
await saveDraft()
|
||||
}
|
||||
catch (error) {
|
||||
// Pont indisponible : message inline + invite à la pesée manuelle.
|
||||
autoModal.error = weighbridge.extractWeighbridgeError(error)
|
||||
}
|
||||
finally {
|
||||
@@ -313,7 +285,7 @@ function openManual(target: 'empty' | 'full'): void {
|
||||
manualModal.open = true
|
||||
}
|
||||
|
||||
/** Valide la saisie manuelle puis remplit le bloc (DSD calculé serveur, RG-5.04). */
|
||||
/** Valide la saisie manuelle, remplit le bloc puis enregistre le brouillon. */
|
||||
async function confirmManual(): Promise<void> {
|
||||
if (manualModal.loading) return
|
||||
manualModal.errors = {}
|
||||
@@ -333,6 +305,7 @@ async function confirmManual(): Promise<void> {
|
||||
const reading = await weighbridge.triggerManual(weight as number, manualNumber)
|
||||
form.applyReading(form[manualModal.target], reading)
|
||||
manualModal.open = false
|
||||
await saveDraft()
|
||||
}
|
||||
catch (error) {
|
||||
manualModal.errors = { weight: weighbridge.extractWeighbridgeError(error) }
|
||||
@@ -342,45 +315,47 @@ async function confirmManual(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Soumissions ──────────────────────────────────────────────────────────────
|
||||
// ── Persistance ──────────────────────────────────────────────────────────────
|
||||
interface TicketResponse { id: number }
|
||||
|
||||
/** « Enregistrer » du bloc vide : POST /weighing_tickets (création + pesée à vide). */
|
||||
async function submitCreate(): Promise<void> {
|
||||
if (creating.value) return
|
||||
/**
|
||||
* Enregistre l'état courant en BROUILLON (ERP-193) : POST si le ticket n'existe pas
|
||||
* encore (1ʳᵉ pesée enregistrée), PATCH ensuite. Renvoie false sur erreur (422
|
||||
* mappée inline, ex. format d'immatriculation).
|
||||
*/
|
||||
async function saveDraft(): Promise<boolean> {
|
||||
clearErrors()
|
||||
// Marque Poids/DSD manquants pour un retour immédiat, mais on POSTe quand même :
|
||||
// le back renvoie TOUTES les violations d'un coup (counterparty / immat / poids,
|
||||
// NotBlank sur emptyWeight), comme les autres modules. Le DSD est alloué serveur
|
||||
// (pas de règle back) → simple repère front en miroir du poids.
|
||||
validateWeighing('empty')
|
||||
creating.value = true
|
||||
try {
|
||||
const created = await api.post<TicketResponse>('/weighing_tickets', form.buildCreatePayload(), {
|
||||
headers: { Accept: 'application/ld+json' },
|
||||
toast: false,
|
||||
})
|
||||
form.ticketId.value = created.id
|
||||
if (form.ticketId.value === null) {
|
||||
const created = await api.post<TicketResponse>('/weighing_tickets', form.buildDraftPayload(), {
|
||||
headers: { Accept: 'application/ld+json' },
|
||||
toast: false,
|
||||
})
|
||||
form.ticketId.value = created.id
|
||||
}
|
||||
else {
|
||||
await api.patch(`/weighing_tickets/${form.ticketId.value}`, form.buildDraftPayload(), { toast: false })
|
||||
}
|
||||
return true
|
||||
}
|
||||
catch (error) {
|
||||
handleApiError(error, { fallbackMessage: t('logistique.weighingTickets.toast.error') })
|
||||
}
|
||||
finally {
|
||||
creating.value = false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/** « Valider » : PATCH de la pesée à plein puis ouverture du bon de pesée PDF (RG-5.08). */
|
||||
/**
|
||||
* « Valider » : persiste l'état courant puis finalise via PATCH /validate. La
|
||||
* validation stricte (3 champs du haut + 2 pesées) est portée par le back ; les 422
|
||||
* remontent inline. Succès → ouverture du bon de pesée PDF + retour à la liste.
|
||||
*/
|
||||
async function submitValidate(): Promise<void> {
|
||||
if (validating.value || form.ticketId.value === null) return
|
||||
clearErrors()
|
||||
// Pesée à plein obligatoire (front-only) avant finalisation/impression.
|
||||
if (!validateWeighing('full')) return
|
||||
if (validating.value) return
|
||||
validating.value = true
|
||||
try {
|
||||
await api.patch(`/weighing_tickets/${form.ticketId.value}`, form.buildFullPayload(), { toast: false })
|
||||
// Bon de pesée = PDF généré côté back (Twig, ERP-192) — on l'ouvre, on ne
|
||||
// dessine aucun gabarit côté front (RG-5.08).
|
||||
if (!(await saveDraft())) return
|
||||
|
||||
await api.patch(`/weighing_tickets/${form.ticketId.value}/validate`, form.buildValidatePayload(), { toast: false })
|
||||
window.open(`/api/weighing_tickets/${form.ticketId.value}/print.pdf`, '_blank')
|
||||
router.push('/weighing-tickets')
|
||||
}
|
||||
@@ -393,7 +368,6 @@ async function submitValidate(): Promise<void> {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// Échec du chargement des référentiels non bloquant : les selects restent vides.
|
||||
referentials.load().catch(() => {})
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user