0
0
Fork 0

feat: dense rows

This commit is contained in:
Javier Segarra 2024-07-04 17:31:08 +02:00
parent b59f8374b3
commit b3ea05fb32
1 changed files with 61 additions and 12 deletions

View File

@ -108,8 +108,10 @@ const defaultColumnAttrs = {
sortable: true, sortable: true,
}; };
const columns = computed(() => [ const columns = ref([
{ {
sortable: true,
align: 'left',
label: t('item.fixedPrice.itemId'), label: t('item.fixedPrice.itemId'),
name: 'itemId', name: 'itemId',
field: 'itemFk', field: 'itemFk',
@ -380,6 +382,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
dense
:rows="fixedPrices" :rows="fixedPrices"
:columns="columns" :columns="columns"
row-key="id" row-key="id"
@ -408,10 +411,33 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</QTr> </QTr>
</template> </template>
<template #header="props">
<QTr :props="props" class="bg">
<QTh />
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
style="text-wrap: balance"
>
{{ col.label }}
</QTh>
</QTr>
</template>
<template #body-selection="scope">
<QCheckbox
flat
style="width: 10px; margin-left: -20px"
v-model="scope.selected"
/>
</template>
<template #header-selection="scope">
<QCheckbox style="margin-left: -15px" v-model="scope.selected" />
</template>
<template #body-cell-itemId="props"> <template #body-cell-itemId="props">
<QTd> <QTd>
<VnSelect <VnSelect
style="width: 115px"
url="Items/withName" url="Items/withName"
hide-selected hide-selected
option-label="id" option-label="id"
@ -436,12 +462,14 @@ onUnmounted(() => (stateStore.rightDrawer = false));
{{ row.name }} {{ row.name }}
</span> </span>
<ItemDescriptorProxy :id="row.itemFk" /> <ItemDescriptorProxy :id="row.itemFk" />
<FetchedTags :item="row" :max-length="6" /> <FetchedTags style="width: 200px" :item="row" :max-length="6" />
</QTd> </QTd>
</template> </template>
<template #body-cell-groupingPrice="props"> <template #body-cell-groupingPrice="props">
<QTd class="col"> <QTd class="col">
<VnInput <VnInput
style="width: 80px"
mask="###.##"
v-model.number="props.row.rate2" v-model.number="props.row.rate2"
v-on="getRowUpdateInputEvents(props)" v-on="getRowUpdateInputEvents(props)"
> >
@ -452,6 +480,8 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #body-cell-packingPrice="props"> <template #body-cell-packingPrice="props">
<QTd class="col"> <QTd class="col">
<VnInput <VnInput
mask="###.##"
style="width: 80px"
v-model.number="props.row.rate3" v-model.number="props.row.rate3"
v-on="getRowUpdateInputEvents(props)" v-on="getRowUpdateInputEvents(props)"
> >
@ -463,7 +493,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<QTd class="col"> <QTd class="col">
<div class="row"> <div class="row">
<QCheckbox <QCheckbox
class="col"
:model-value="props.row.hasMinPrice" :model-value="props.row.hasMinPrice"
@update:model-value="updateMinPrice($event, props)" @update:model-value="updateMinPrice($event, props)"
:false-value="0" :false-value="0"
@ -471,8 +500,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
:toggle-indeterminate="false" :toggle-indeterminate="false"
/> />
<VnInput <VnInput
style="padding-left: -20px; width: 80px"
class="col" class="col"
:disable="!props.row.hasMinPrice" :disable="props.row.hasMinPrice === 'false'"
v-model.number="props.row.minPrice" v-model.number="props.row.minPrice"
v-on="getRowUpdateInputEvents(props)" v-on="getRowUpdateInputEvents(props)"
type="number" type="number"
@ -481,33 +511,43 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</template> </template>
<template #body-cell-started="props"> <template #body-cell-started="props">
<QTd class="col" style="min-width: 160px"> <QTd class="col">
<VnInputDate <VnInputDate
style="max-width: 125px"
:show-event="false"
v-model="props.row.started" v-model="props.row.started"
v-on="getRowUpdateInputEvents(props, false, 'date')" v-on="getRowUpdateInputEvents(props, false, 'date')"
v-bind=" v-bind="
isBigger(props.row.started) isBigger(props.row.started)
? { 'bg-color': 'warning', 'is-outlined': true } ? {
'bg-color': 'warning',
'is-outlined': true,
}
: {} : {}
" "
/> />
</QTd> </QTd>
</template> </template>
<template #body-cell-ended="props"> <template #body-cell-ended="props">
<QTd class="col" style="min-width: 150px"> <QTd class="col">
<VnInputDate <VnInputDate
style="max-width: 125px"
:show-event="false"
v-model="props.row.ended" v-model="props.row.ended"
v-on="getRowUpdateInputEvents(props, false, 'date')" v-on="getRowUpdateInputEvents(props, false, 'date')"
v-bind=" v-bind="
isLower(props.row.ended) isLower(props.row.started)
? { 'bg-color': 'warning', 'is-outlined': true } ? {
'bg-color': 'warning',
'is-outlined': true,
}
: {} : {}
" "
/> />
</QTd> </QTd>
</template> </template>
<template #body-cell-warehouse="props"> <template #body-cell-warehouse="props">
<QTd class="col"> <QTd class="col" style="max-width: 180px">
<VnSelect <VnSelect
:options="warehousesOptions" :options="warehousesOptions"
hide-selected hide-selected
@ -571,7 +611,16 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QDialog> </QDialog>
</QPage> </QPage>
</template> </template>
<style lang="scss" scoped>
.q-table th,
.q-table td {
padding-inline: 5px !important;
}
.q-field__after,
.q-field__append {
padding: 0;
}
</style>
<i18n> <i18n>
es: es:
Add fixed price: Añadir precio fijado Add fixed price: Añadir precio fijado