0
0
Fork 0

fix: refs #7354 fix VnTable filters and agency field

This commit is contained in:
Jon Elias 2024-07-10 09:37:32 +02:00
parent 6a4161de66
commit 8913c6a31b
4 changed files with 57 additions and 19 deletions

View File

@ -11,6 +11,9 @@ import useNotify from 'src/composables/useNotify.js';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
const { t } = useI18n();
const router = useRouter();
@ -18,7 +21,9 @@ const { notify } = useNotify();
const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const tableFilter = ref({
const warehouseOptions = ref([]);
const tableFilter = {
include: [
{
relation: 'agencyMode',
@ -27,7 +32,7 @@ const tableFilter = ref({
},
},
],
});
};
const columns = computed(() => [
{
@ -44,21 +49,22 @@ const columns = computed(() => [
name: 'name',
label: t('list.name'),
isTitle: true,
create: true,
},
{
align: 'left',
name: 'agencyModeFk',
label: t('list.agency'),
cardVisible: true,
create: true,
component: 'select',
attrs: {
url: 'agencyModes',
fields: ['id', 'name'],
url: 'AgencyModes',
},
columnField: {
component: null,
},
format: (row) => row?.agencyMode?.name,
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
},
{
align: 'left',
@ -112,16 +118,42 @@ const handleClone = (id) => {
ref="tableRef"
data-key="ZoneList"
url="Zones"
:filter="tableFilter"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {},
}"
:user-filter="tableFilter"
:columns="columns"
default-mode="table"
redirect="zone"
:use-model="true"
auto-load
>
<template #more-create-dialog="{ data }">
<VnInput v-model="data.price" :label="t('list.price')" min="0" />
<VnInput v-model="data.bonus" :label="t('list.bonus')" min="0" />
<VnInput
v-model="data.travelingDays"
:label="t('list.travelingDays')"
type="number"
min="0"
/>
<QPageSticky position="bottom-right" :offset="[18, 18]" style="z-index: 2">
<QBtn :to="{ path: `/zone/create` }" fab icon="add" color="primary">
<QTooltip>{{ t('list.create') }}</QTooltip>
</QBtn>
</QPageSticky>
<VnInputTime v-model="data.hour" :label="t('list.hour')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</template>

View File

@ -63,13 +63,7 @@ onMounted(() => weekdayStore.initStore());
<span class="header">
{{ getHeaderTitle(detail.shipped) }}
</span>
<QTable
flat
:columns="columns"
:rows="detail.lines"
class="full-width"
style="text-align: center"
/>
<QTable flat :columns="columns" :rows="detail.lines" class="full-width" />
</div>
</QCard>
</QPage>

View File

@ -21,6 +21,12 @@ list:
searchInfo: Search zone by id or name
confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone?
travelingDays: Traveling days
warehouse: Warehouse
bonus: Bonus
hour: Close
isVolumetric: Volumetric
createZone: Create zone
create:
name: Name
warehouse: Warehouse

View File

@ -21,6 +21,12 @@ list:
searchInfo: Buscar zonas por identificador o nombre
confirmCloneTitle: Todas sus propiedades serán copiadas
confirmCloneSubtitle: ¿Seguro que quieres clonar esta zona?
travelingDays: Días de viaje
warehouse: Almacén
bonus: Bonus
hour: Cierre
isVolumetric: Volumétrico
createZone: Crear zona
create:
name: Nombre
warehouse: Almacén