fix : corrections de l'entity customer.php et de la partie admin front qui lui est lié + update des fixtures/seed
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
This commit is contained in:
@@ -15,8 +15,9 @@
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-y-8 gap-x-80 mb-10 py-12">
|
||||
<UiTextInput id="customer-label" v-model="form.label" label="Nom du client" :disabled="!auth.isAdmin"/>
|
||||
<UiTextInput id="customer-code" v-model="form.code" label="Code" :disabled="!auth.isAdmin"/>
|
||||
<UiTextInput id="customer-name" v-model="form.name" label="Nom du client" :disabled="!auth.isAdmin"/>
|
||||
<UiTextInput id="customer-phone" v-model="form.phone" label="Téléphone" :disabled="!auth.isAdmin"/>
|
||||
<UiTextInput id="customer-email" v-model="form.email" label="Email" :disabled="!auth.isAdmin"/>
|
||||
</div>
|
||||
|
||||
<div class="mx-24 mb-4 py-6 border-t border-black"></div>
|
||||
@@ -94,8 +95,9 @@ const resolveId = (param: unknown) => {
|
||||
const customerId = computed(() => resolveId(route.params.id))
|
||||
const isLoading = ref(false)
|
||||
const form = reactive<CustomerFormData>({
|
||||
label: "",
|
||||
code: "",
|
||||
name: "",
|
||||
phone: "",
|
||||
email: "",
|
||||
addresses: [],
|
||||
})
|
||||
|
||||
@@ -122,8 +124,9 @@ const goToEditAddress = (addressId: number | null) => {
|
||||
|
||||
const hydrateFromCustomer = (customer: CustomerData | null) => {
|
||||
if (!customer) return
|
||||
form.label = customer.label ?? ""
|
||||
form.code = customer.code ?? ""
|
||||
form.name = customer.name ?? ""
|
||||
form.phone = customer.phone ?? ""
|
||||
form.email = customer.email ?? ""
|
||||
if (!Array.isArray(customer.addresses) || customer.addresses.length === 0) {
|
||||
form.addresses = []
|
||||
return
|
||||
@@ -165,12 +168,14 @@ async function validate() {
|
||||
isLoading.value = true
|
||||
|
||||
try {
|
||||
const label = form.label.trim()
|
||||
const code = form.code.trim()
|
||||
const name = form.name.trim()
|
||||
const phone = form.phone?.trim() || null
|
||||
const email = form.email?.trim() || null
|
||||
|
||||
const customerPayload: CustomerPayload = {
|
||||
label,
|
||||
code,
|
||||
name,
|
||||
phone,
|
||||
email,
|
||||
}
|
||||
let targetId: number | null = null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user