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