FIx: delete champs par default
This commit is contained in:
@@ -137,7 +137,6 @@ const normalizeCustomFields = (fields = []) =>
|
||||
name: field.name,
|
||||
type: field.type || '',
|
||||
required: !!field.required,
|
||||
defaultValue: field.defaultValue || '',
|
||||
options: parseOptions(field)
|
||||
}))
|
||||
|
||||
|
||||
@@ -160,11 +160,7 @@
|
||||
<IconLucideTag class="w-3 h-3" aria-hidden="true" />
|
||||
<span>{{ machine.reference }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="machine.emplacement" class="flex items-center gap-1">
|
||||
<IconLucideBuilding class="w-3 h-3" aria-hidden="true" />
|
||||
<span>{{ machine.emplacement }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-actions justify-end mt-3">
|
||||
@@ -355,18 +351,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-control mb-4">
|
||||
<label class="label">
|
||||
<span class="label-text">Emplacement</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="newMachine.emplacement"
|
||||
type="text"
|
||||
placeholder="Ex: Atelier A, Zone 1"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Type Preview -->
|
||||
<div v-if="selectedMachineType" class="mb-4 p-4 bg-gray-50 rounded-lg">
|
||||
<h4 class="font-semibold text-sm mb-2">Structure du type sélectionné :</h4>
|
||||
@@ -414,7 +398,6 @@ import IconLucideMapPinned from '~icons/lucide/map-pinned'
|
||||
import IconLucideChevronDown from '~icons/lucide/chevron-down'
|
||||
import IconLucideSettings2 from '~icons/lucide/settings-2'
|
||||
import IconLucideTag from '~icons/lucide/tag'
|
||||
import IconLucideBuilding from '~icons/lucide/building'
|
||||
|
||||
|
||||
const { sites, loading, loadSites, createSite } = useSites()
|
||||
@@ -442,8 +425,7 @@ const newMachine = reactive({
|
||||
name: '',
|
||||
siteId: '',
|
||||
typeMachineId: '',
|
||||
reference: '',
|
||||
emplacement: ''
|
||||
reference: ''
|
||||
})
|
||||
|
||||
// Computed
|
||||
@@ -545,8 +527,7 @@ const handleCreateMachine = async () => {
|
||||
const machineData = {
|
||||
name: newMachine.name,
|
||||
siteId: newMachine.siteId,
|
||||
reference: newMachine.reference,
|
||||
emplacement: newMachine.emplacement
|
||||
reference: newMachine.reference
|
||||
}
|
||||
|
||||
const result = await createMachineFromType(machineData, selectedMachineType.value)
|
||||
@@ -557,7 +538,6 @@ const handleCreateMachine = async () => {
|
||||
newMachine.siteId = ''
|
||||
newMachine.typeMachineId = ''
|
||||
newMachine.reference = ''
|
||||
newMachine.emplacement = ''
|
||||
showAddMachineModal.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
@@ -95,10 +95,6 @@
|
||||
<span class="text-gray-600">{{ machine.reference }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="machine.emplacement" class="flex items-center gap-2">
|
||||
<IconLucideBuilding class="w-4 h-4 text-purple-500" aria-hidden="true" />
|
||||
<span class="text-gray-600">{{ machine.emplacement }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions justify-end mt-4">
|
||||
@@ -130,7 +126,6 @@ import IconLucideFactory from '~icons/lucide/factory'
|
||||
import IconLucideMapPin from '~icons/lucide/map-pin'
|
||||
import IconLucideSettings2 from '~icons/lucide/settings-2'
|
||||
import IconLucideTag from '~icons/lucide/tag'
|
||||
import IconLucideBuilding from '~icons/lucide/building'
|
||||
|
||||
const { machines, loading, loadMachines, deleteMachine } = useMachines()
|
||||
const { sites, loadSites } = useSites()
|
||||
|
||||
@@ -66,18 +66,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label">
|
||||
<span class="label-text">Emplacement</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="newMachine.emplacement"
|
||||
type="text"
|
||||
placeholder="Ex: Atelier A, Zone 1"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="selectedMachineType" class="p-4 bg-gray-50 rounded-lg space-y-2 text-sm">
|
||||
<h4 class="font-semibold text-sm">Structure du type sélectionné :</h4>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
@@ -670,7 +658,6 @@ const newMachine = reactive({
|
||||
siteId: '',
|
||||
typeMachineId: '',
|
||||
reference: '',
|
||||
emplacement: '',
|
||||
})
|
||||
|
||||
const componentRequirementSelections = reactive({})
|
||||
@@ -727,7 +714,6 @@ const machinePreview = computed(() => {
|
||||
? sites.value.find((site) => site.id === newMachine.siteId) || null
|
||||
: null
|
||||
const trimmedReference = (newMachine.reference || '').trim()
|
||||
const trimmedEmplacement = (newMachine.emplacement || '').trim()
|
||||
|
||||
const baseFields = [
|
||||
{
|
||||
@@ -754,12 +740,6 @@ const machinePreview = computed(() => {
|
||||
display: trimmedReference || 'Non renseignée',
|
||||
status: trimmedReference ? 'complete' : 'optional',
|
||||
},
|
||||
{
|
||||
key: 'emplacement',
|
||||
label: 'Emplacement',
|
||||
display: trimmedEmplacement || 'Non renseigné',
|
||||
status: trimmedEmplacement ? 'complete' : 'optional',
|
||||
},
|
||||
]
|
||||
|
||||
const baseIssues = []
|
||||
@@ -1307,7 +1287,6 @@ const finalizeMachineCreation = async () => {
|
||||
name: newMachine.name,
|
||||
siteId: newMachine.siteId,
|
||||
reference: newMachine.reference,
|
||||
emplacement: newMachine.emplacement,
|
||||
typeMachineId: type.id,
|
||||
}
|
||||
|
||||
@@ -1345,7 +1324,6 @@ const finalizeMachineCreation = async () => {
|
||||
newMachine.siteId = ''
|
||||
newMachine.typeMachineId = ''
|
||||
newMachine.reference = ''
|
||||
newMachine.emplacement = ''
|
||||
clearRequirementSelections()
|
||||
await navigateTo('/machines')
|
||||
} else if (result.error) {
|
||||
|
||||
@@ -94,7 +94,6 @@ const normalizeCustomFields = (fields = []) =>
|
||||
name: field.name,
|
||||
type: field.type || '',
|
||||
required: !!field.required,
|
||||
defaultValue: field.defaultValue || '',
|
||||
options: parseOptions(field)
|
||||
}))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user