fix: minor changes

This commit is contained in:
Javier Segarra 2024-09-10 00:18:09 +02:00
parent b4b65ad0fd
commit d734674eb6
1 changed files with 67 additions and 82 deletions

View File

@ -212,15 +212,6 @@ const editTableFieldsOptions = [
type: 'number',
},
},
{
field: 'hasMinPrice',
label: t('item.fixedPrice.hasMinPrice'),
component: 'checkbox',
attrs: {
'false-value': 0,
'true-value': 1,
},
},
{
field: 'started',
label: t('item.fixedPrice.started'),
@ -286,8 +277,7 @@ async function upsertFixedPrice(row) {
async function saveOnRowChange(row) {
if (rowsSelected.value.length > 1) return;
if (rowsSelected.value[0]?.id === row.id) return;
else if (rowsSelected.value.length === 1)
await upsertFixedPrice(rowsSelected.value[0]);
else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]);
rowsSelected.value = [row];
}
@ -457,6 +447,12 @@ function handleOnDataSave({ CrudModelRef }) {
</VnSubToolbar>
<QPage>
<VnTable
@on-fetch="
(data) =>
data.forEach((item) => {
item.hasMinPrice = `${item.hasMinPrice !== 0}`;
})
"
:default-remove="false"
:default-reset="false"
:default-save="false"
@ -497,7 +493,6 @@ function handleOnDataSave({ CrudModelRef }) {
</template>
<template #column-itemId="props">
<QTd>
<VnSelect
style="max-width: 100px"
url="Items/withName"
@ -516,7 +511,6 @@ function handleOnDataSave({ CrudModelRef }) {
</QItem>
</template>
</VnSelect>
</QTd>
</template>
<template #column-description="{ row }">
<span class="link">
@ -527,7 +521,6 @@ function handleOnDataSave({ CrudModelRef }) {
<FetchedTags style="width: max-content; max-width: 220px" :item="row" />
</template>
<template #column-rate2="props">
<QTd class="col">
<VnInput
mask="###.##"
v-model.number="props.row.rate2"
@ -535,10 +528,8 @@ function handleOnDataSave({ CrudModelRef }) {
>
<template #append></template>
</VnInput>
</QTd>
</template>
<template #column-rate3="props">
<QTd class="col">
<VnInput
mask="###.##"
v-model.number="props.row.rate3"
@ -546,7 +537,6 @@ function handleOnDataSave({ CrudModelRef }) {
>
<template #append></template>
</VnInput>
</QTd>
</template>
<template #column-minPrice="props">
<QTd class="col">
@ -554,12 +544,11 @@ function handleOnDataSave({ CrudModelRef }) {
<QCheckbox
:model-value="props.row.hasMinPrice"
@update:model-value="updateMinPrice($event, props)"
:false-value="0"
:true-value="1"
:false-value="'false'"
:true-value="'true'"
/>
<VnInput
class="col"
mask="###.##"
:disable="props.row.hasMinPrice === 1"
v-model.number="props.row.minPrice"
v-on="getRowUpdateInputEvents(props)"
@ -588,7 +577,6 @@ function handleOnDataSave({ CrudModelRef }) {
/>
</template>
<template #column-warehouseFk="props">
<QTd class="col">
<VnSelect
style="max-width: 150px"
:options="warehousesOptions"
@ -598,10 +586,8 @@ function handleOnDataSave({ CrudModelRef }) {
v-model="props.row.warehouseFk"
v-on="getRowUpdateInputEvents(props, false, 'select')"
/>
</QTd>
</template>
<template #column-deleteAction="{ row, rowIndex }">
<QTd class="col">
<QIcon
name="delete"
size="sm"
@ -619,7 +605,6 @@ function handleOnDataSave({ CrudModelRef }) {
{{ t('globals.delete') }}
</QTooltip>
</QIcon>
</QTd>
</template>
</VnTable>