FIx: delete champs par default

This commit is contained in:
Matthieu
2025-09-25 11:25:43 +02:00
parent bdae2621c5
commit 7980aa186b
17 changed files with 32 additions and 218 deletions

View File

@@ -403,22 +403,6 @@
{{ machineReference || 'Non définie' }}
</div>
</div>
<div class="form-control">
<label class="label">
<span class="label-text">Emplacement</span>
</label>
<input
v-if="isEditMode"
:id="getMachineFieldId('emplacement')"
v-model="machineEmplacement"
type="text"
class="input input-bordered"
@blur="updateMachineInfo"
/>
<div v-else class="input input-bordered bg-base-200">
{{ machineEmplacement || 'Non défini' }}
</div>
</div>
<div class="form-control">
<label class="label">
<span class="label-text">Constructeur</span>
@@ -462,7 +446,6 @@
:value="fieldValue.value"
@input="setMachineCustomFieldValue(fieldValue.id, $event.target.value)"
type="text"
:placeholder="fieldValue.customField.defaultValue || ''"
class="input input-bordered input-sm"
:required="fieldValue.customField.required"
@blur="updateMachineCustomField(fieldValue.id)"
@@ -472,7 +455,6 @@
:value="fieldValue.value"
@input="setMachineCustomFieldValue(fieldValue.id, $event.target.value)"
type="number"
:placeholder="fieldValue.customField.defaultValue || ''"
class="input input-bordered input-sm"
:required="fieldValue.customField.required"
@blur="updateMachineCustomField(fieldValue.id)"
@@ -485,7 +467,7 @@
:required="fieldValue.customField.required"
@blur="updateMachineCustomField(fieldValue.id)"
>
<option value="">{{ fieldValue.customField.defaultValue || 'Sélectionner...' }}</option>
<option value="">Sélectionner...</option>
<option
v-for="option in fieldValue.customField.options"
:key="option"
@@ -510,7 +492,6 @@
:value="fieldValue.value"
@input="setMachineCustomFieldValue(fieldValue.id, $event.target.value)"
type="date"
:placeholder="fieldValue.customField.defaultValue || ''"
class="input input-bordered input-sm"
:required="fieldValue.customField.required"
@blur="updateMachineCustomField(fieldValue.id)"
@@ -518,7 +499,7 @@
</template>
<template v-else>
<div class="input input-bordered input-sm bg-base-200">
{{ fieldValue.value || fieldValue.customField.defaultValue || 'Non défini' }}
{{ fieldValue.value || 'Non défini' }}
</div>
</template>
</div>
@@ -938,7 +919,6 @@ const { constructeurs, loadConstructeurs } = useConstructeurs()
// Champs de la machine
const machineName = ref('')
const machineReference = ref('')
const machineEmplacement = ref('')
const machineConstructeurId = ref(null)
const machineConstructeurDisplay = computed(() => {
const id = machineConstructeurId.value || machine.value?.constructeur?.id || machine.value?.constructeurId
@@ -1408,7 +1388,6 @@ const initMachineFields = () => {
if (machine.value) {
machineName.value = machine.value.name || ''
machineReference.value = machine.value.reference || ''
machineEmplacement.value = machine.value.emplacement || ''
machineConstructeurId.value = machine.value.constructeurId || machine.value.constructeur?.id || null
}
}
@@ -1747,7 +1726,6 @@ const printMachine = (currentSelection = printSelection) => {
machine: machine.value,
machineName: machineName.value,
machineReference: machineReference.value,
machineEmplacement: machineEmplacement.value,
machinePieces: machinePieces.value,
components: components.value,
selection: currentSelection,
@@ -1811,7 +1789,6 @@ const transformCustomFields = (pieces) => {
name: cfv.customField.name,
type: cfv.customField.type,
required: cfv.customField.required,
defaultValue: cfv.customField.defaultValue,
options: cfv.customField.options || [],
value: cfv.value
})) || []
@@ -1839,7 +1816,6 @@ const transformComponentCustomFields = (componentsData) => {
name: cfv.customField.name,
type: cfv.customField.type,
required: cfv.customField.required,
defaultValue: cfv.customField.defaultValue,
options: cfv.customField.options || [],
value: cfv.value
})) || [];
@@ -2242,7 +2218,6 @@ const updateMachineInfo = async () => {
const result = await updateMachineApi(machine.value.id, {
name: machineName.value,
reference: machineReference.value,
emplacement: machineEmplacement.value,
constructeurId: machineConstructeurId.value || null
})
if (result.success) {
@@ -2261,7 +2236,6 @@ const updateComponent = async (updatedComponent) => {
name: updatedComponent.name,
reference: updatedComponent.reference,
constructeurId: updatedComponent.constructeurId || updatedComponent.constructeur?.id || null,
emplacement: updatedComponent.emplacement,
prix: prixValue && prixValue !== '' ? parseFloat(prixValue) : null,
composantModelId: updatedComponent.composantModelId || updatedComponent.composantModel?.id || null,
})
@@ -2280,7 +2254,6 @@ const updatePieceFromComponent = async (updatedPiece) => {
name: updatedPiece.name,
reference: updatedPiece.reference,
constructeurId: updatedPiece.constructeurId || updatedPiece.constructeur?.id || null,
emplacement: updatedPiece.emplacement,
prix: updatedPiece.prix && updatedPiece.prix !== '' ? parseFloat(updatedPiece.prix) : null,
pieceModelId: updatedPiece.pieceModelId || updatedPiece.pieceModel?.id || null,
})
@@ -2312,7 +2285,6 @@ const updatePieceInfo = async (updatedPiece) => {
name: updatedPiece.name,
reference: updatedPiece.reference,
constructeurId: updatedPiece.constructeurId || updatedPiece.constructeur?.id || null,
emplacement: updatedPiece.emplacement,
prix: updatedPiece.prix && updatedPiece.prix !== '' ? parseFloat(updatedPiece.prix) : null,
pieceModelId: updatedPiece.pieceModelId || updatedPiece.pieceModel?.id || null,
})