fix: lsp error

This commit is contained in:
Methapon2001 2024-08-09 10:29:54 +07:00
parent 0194d7efcc
commit a4670dd538

View file

@ -1916,6 +1916,7 @@ watch(
await fetchListCustomer();
}
"
greedy
:style="{
opacity: customerFormState.branchIndex !== -1 ? '0.5' : undefined,
}"
@ -1973,69 +1974,73 @@ watch(
:disabled="!customerFormState.readonly"
/>
</div>
<q-form
class="full-width"
v-if="customerFormData.customerBranch"
<template
v-for="(_, idx) in customerFormData.customerBranch"
:key="idx"
@submit.prevent="
async () => {
if (!customerFormData.customerBranch) return;
if (!customerFormState.editCustomerId) return;
if (!customerFormData.customerBranch[idx].id) {
await customerStore.createBranch({
...customerFormData.customerBranch[idx],
customerId: customerFormState.editCustomerId,
id: undefined,
});
} else {
await customerStore.editBranchById(
customerFormData.customerBranch[idx].id,
{
...customerFormData.customerBranch[idx],
id: undefined,
},
);
}
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
customerFormStore.resetForm();
}
"
>
<EmployerFormBranch
v-if="!!customerFormState.editCustomerId"
v-model:customer-branch="customerFormData.customerBranch[idx]"
:customer-type="customerFormData.customerType"
:action-disabled="
!customerFormState.readonly ||
(customerFormState.branchIndex !== -1 &&
customerFormState.branchIndex !== idx)
"
:readonly="customerFormState.branchIndex !== idx"
@edit="() => (customerFormState.branchIndex = idx)"
@cancel="() => customerFormUndo(false)"
@delete="
<q-form
class="full-width"
v-if="customerFormData.customerBranch"
greedy
@submit.prevent="
async () => {
if (!!customerFormData.customerBranch?.[idx].id) {
const action = await deleteCustomerBranchById(
if (!customerFormData.customerBranch) return;
if (!customerFormState.editCustomerId) return;
if (!customerFormData.customerBranch[idx].id) {
await customerStore.createBranch({
...customerFormData.customerBranch[idx],
customerId: customerFormState.editCustomerId,
id: undefined,
});
} else {
await customerStore.editBranchById(
customerFormData.customerBranch[idx].id,
{
...customerFormData.customerBranch[idx],
id: undefined,
},
);
if (action) {
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
}
customerFormStore.resetForm();
}
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
customerFormStore.resetForm();
}
"
@save="() => {}"
/>
</q-form>
>
<EmployerFormBranch
v-if="!!customerFormState.editCustomerId"
v-model:customer-branch="customerFormData.customerBranch[idx]"
:customer-type="customerFormData.customerType"
:action-disabled="
!customerFormState.readonly ||
(customerFormState.branchIndex !== -1 &&
customerFormState.branchIndex !== idx)
"
:readonly="customerFormState.branchIndex !== idx"
@edit="() => (customerFormState.branchIndex = idx)"
@cancel="() => customerFormUndo(false)"
@delete="
async () => {
if (!!customerFormData.customerBranch?.[idx].id) {
const action = await deleteCustomerBranchById(
customerFormData.customerBranch[idx].id,
);
if (action) {
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
}
customerFormStore.resetForm();
}
}
"
@save="() => {}"
/>
</q-form>
</template>
</div>
</div>
</div>