Handle quantity empty value
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
William Buezas 2024-07-05 12:04:18 -03:00
parent 3490ba1a8c
commit b87e88ae7f
1 changed files with 12 additions and 3 deletions

View File

@ -30,6 +30,10 @@ const crudModelRequiredData = computed(() => ({
ticketFk: route.params.id,
}));
const handleInputQuantityClear = (row) => {
if (row.quantity === null || row.quantity === undefined) row.quantity = 0;
};
watch(
() => route.params.id,
async () => {
@ -59,7 +63,7 @@ watch(
auto-load
style="max-width: 800px"
>
<template #body="{ rows }">
<template #body="{ rows, validate }">
<QCard class="q-px-lg q-py-md">
<div
v-for="(row, index) in rows"
@ -77,7 +81,9 @@ watch(
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }} </QItemLabel>
<QItemLabel>
{{ scope.opt?.name }}
</QItemLabel>
<QItemLabel caption>
#{{ scope.opt?.itemFk }}
</QItemLabel>
@ -87,10 +93,13 @@ watch(
</VnSelect>
<VnInput
:label="t('package.quantity')"
v-model="row.quantity"
v-model.number="row.quantity"
class="col"
type="number"
min="1"
:required="true"
@update:model-value="handleInputQuantityClear(row)"
:rules="validate('TicketPackaging.quantity')"
/>
<VnInputDate :label="t('package.added')" v-model="row.created" />
<QIcon