Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into Fix-IntegrationE2ETests
This commit is contained in:
commit
52f09357d0
|
@ -314,7 +314,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
show-if-above
|
show-if-above
|
||||||
>
|
>
|
||||||
<QScrollArea class="fit">
|
<QScrollArea class="fit">
|
||||||
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" />
|
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" />
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<CrudModel
|
<CrudModel
|
||||||
|
|
|
@ -14,6 +14,7 @@ defineProps({
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="promise"
|
@update:model-value="promise"
|
||||||
|
data-cy="vnBtnSelect_select"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -297,7 +297,7 @@ defineExpose({
|
||||||
ref="dmsRef"
|
ref="dmsRef"
|
||||||
:data-key="$props.model"
|
:data-key="$props.model"
|
||||||
:url="$props.model"
|
:url="$props.model"
|
||||||
:filter="dmsFilter"
|
:user-filter="dmsFilter"
|
||||||
:order="['dmsFk DESC']"
|
:order="['dmsFk DESC']"
|
||||||
:auto-load="true"
|
:auto-load="true"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
|
|
|
@ -20,16 +20,15 @@ const hasContent = ref();
|
||||||
let observer;
|
let observer;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (teleportRef.value) {
|
if (!teleportRef.value) return;
|
||||||
const checkContent = () => {
|
const checkContent = () => {
|
||||||
hasContent.value = teleportRef?.value?.innerHTML?.trim() !== '';
|
hasContent.value = teleportRef.value?.innerHTML?.trim() !== '';
|
||||||
};
|
};
|
||||||
|
|
||||||
observer = new MutationObserver(checkContent);
|
observer = new MutationObserver(checkContent);
|
||||||
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
observer.observe(teleportRef.value, { childList: true, subtree: true });
|
||||||
|
|
||||||
checkContent();
|
checkContent();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,12 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import VnTableFilter from '../VnTable/VnTableFilter.vue';
|
import VnTableFilter from '../VnTable/VnTableFilter.vue';
|
||||||
import { onBeforeMount, computed } from 'vue';
|
import { onBeforeMount, computed } from 'vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
section: {
|
section: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
default: null,
|
||||||
},
|
},
|
||||||
dataKey: {
|
dataKey: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -38,14 +39,28 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
keepData: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
const route = useRoute();
|
||||||
let arrayData;
|
let arrayData;
|
||||||
|
const sectionValue = computed(() => $props.section ?? $props.dataKey);
|
||||||
|
const isMainSection = computed(() => {
|
||||||
|
const isSame = sectionValue.value == route.name;
|
||||||
|
if (!isSame && arrayData) {
|
||||||
|
arrayData.reset(['userParams', 'userFilter']);
|
||||||
|
}
|
||||||
|
return isSame;
|
||||||
|
});
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
if ($props.dataKey)
|
if ($props.dataKey)
|
||||||
arrayData = useArrayData($props.dataKey, {
|
arrayData = useArrayData($props.dataKey, {
|
||||||
searchUrl: 'table',
|
searchUrl: 'table',
|
||||||
|
keepData: $props.keepData,
|
||||||
...$props.arrayDataProps,
|
...$props.arrayDataProps,
|
||||||
navigate: $props.redirect,
|
navigate: $props.redirect,
|
||||||
});
|
});
|
||||||
|
@ -74,6 +89,6 @@ onBeforeMount(() => {
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<slot name="body" v-if="sectionValue == $route.name" />
|
<slot name="body" v-if="isMainSection" />
|
||||||
<RouterView v-else />
|
<RouterView v-else />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -111,6 +111,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
if (!store.keepData) arrayData.reset(['data']);
|
||||||
arrayData.resetPagination();
|
arrayData.resetPagination();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ async function search() {
|
||||||
delete filter.params.search;
|
delete filter.params.search;
|
||||||
}
|
}
|
||||||
await arrayData.applyFilter(filter);
|
await arrayData.applyFilter(filter);
|
||||||
|
searchText.value = undefined;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
'searchUrl',
|
'searchUrl',
|
||||||
'navigate',
|
'navigate',
|
||||||
'mapKey',
|
'mapKey',
|
||||||
|
'keepData',
|
||||||
];
|
];
|
||||||
if (typeof userOptions === 'object') {
|
if (typeof userOptions === 'object') {
|
||||||
for (const option in userOptions) {
|
for (const option in userOptions) {
|
||||||
|
@ -302,7 +303,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
for (const row of data) {
|
for (const row of data) {
|
||||||
const key = row[store.mapKey];
|
const key = row[store.mapKey];
|
||||||
const val = { ...row, key };
|
const val = { ...row, key };
|
||||||
if (store.map.has(key)) {
|
if (key && store.map.has(key)) {
|
||||||
const { position } = store.map.get(key);
|
const { position } = store.map.get(key);
|
||||||
val.position = position;
|
val.position = position;
|
||||||
store.map.set(key, val);
|
store.map.set(key, val);
|
||||||
|
|
|
@ -63,9 +63,10 @@ const columns = computed(() => [
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<VnTable
|
<VnTable
|
||||||
|
data-key="Mandates"
|
||||||
|
url="Mandates"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
auto-load
|
auto-load
|
||||||
url="Mandates"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
|
|
@ -233,7 +233,7 @@ async function updateWarehouse(warehouseFk) {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemBalances"
|
:rows="itemBalances"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
|
@ -53,7 +53,6 @@ const columns = computed(() => [
|
||||||
name: 'itemFk',
|
name: 'itemFk',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
isId: true,
|
isId: true,
|
||||||
cardVisible: true,
|
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
@ -65,14 +64,12 @@ const columns = computed(() => [
|
||||||
name: 'name',
|
name: 'name',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
create: true,
|
create: true,
|
||||||
cardVisible: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
label: t('item.fixedPrice.groupingPrice'),
|
||||||
field: 'rate2',
|
field: 'rate2',
|
||||||
name: 'rate2',
|
name: 'rate2',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -81,7 +78,6 @@ const columns = computed(() => [
|
||||||
field: 'rate3',
|
field: 'rate3',
|
||||||
name: 'rate3',
|
name: 'rate3',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -91,7 +87,6 @@ const columns = computed(() => [
|
||||||
field: 'minPrice',
|
field: 'minPrice',
|
||||||
name: 'minPrice',
|
name: 'minPrice',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -100,7 +95,6 @@ const columns = computed(() => [
|
||||||
field: 'started',
|
field: 'started',
|
||||||
name: 'started',
|
name: 'started',
|
||||||
format: ({ started }) => toDate(started),
|
format: ({ started }) => toDate(started),
|
||||||
cardVisible: true,
|
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
|
@ -116,7 +110,6 @@ const columns = computed(() => [
|
||||||
field: 'ended',
|
field: 'ended',
|
||||||
name: 'ended',
|
name: 'ended',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
class: 'shrink',
|
class: 'shrink',
|
||||||
|
@ -251,11 +244,14 @@ const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
}
|
}
|
||||||
if (!changes.updates && !changes.creates) return;
|
if (!changes.updates && !changes.creates) return;
|
||||||
const data = await upsertFixedPrice(row);
|
const data = await upsertFixedPrice(row);
|
||||||
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
|
Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||||
|
data.hasMinPrice = data.hasMinPrice ? 1 : 0;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,18 +391,11 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<VnTable
|
<VnTable
|
||||||
@on-fetch="
|
|
||||||
(data) =>
|
|
||||||
data.forEach((item) => {
|
|
||||||
item.hasMinPrice = `${item.hasMinPrice !== 0}`;
|
|
||||||
})
|
|
||||||
"
|
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
data-key="ItemFixedPrices"
|
data-key="ItemFixedPrices"
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
:order="['itemFk DESC', 'name DESC']"
|
|
||||||
save-url="FixedPrices/crud"
|
save-url="FixedPrices/crud"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
dense
|
dense
|
||||||
|
@ -498,14 +487,15 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:model-value="props.row.hasMinPrice"
|
:model-value="props.row.hasMinPrice"
|
||||||
@update:model-value="updateMinPrice($event, props)"
|
@update:model-value="updateMinPrice($event, props)"
|
||||||
:false-value="'false'"
|
:false-value="0"
|
||||||
:true-value="'true'"
|
:true-value="1"
|
||||||
|
:toggle-indeterminate="false"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
class="col"
|
class="col"
|
||||||
type="currency"
|
type="currency"
|
||||||
mask="###.##"
|
mask="###.##"
|
||||||
:disable="props.row.hasMinPrice === 1"
|
:disable="props.row.hasMinPrice === 0"
|
||||||
v-model.number="props.row.minPrice"
|
v-model.number="props.row.minPrice"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -221,7 +221,7 @@ async function handleConfirm() {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FetchedTags :item="props.row.item" />
|
<FetchedTags :item="props.row.item" :columns="3" />
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd key="quantity" :props="props">
|
<QTd key="quantity" :props="props">
|
||||||
{{ props.row.quantity }}
|
{{ props.row.quantity }}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
||||||
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -25,6 +26,7 @@ const { viewSummary } = useSummaryDialog();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const warehouseOptions = ref([]);
|
const warehouseOptions = ref([]);
|
||||||
|
const validAddresses = ref([]);
|
||||||
|
|
||||||
const tableFilter = {
|
const tableFilter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -34,6 +36,32 @@ const tableFilter = {
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
relation: 'address',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'postcode',
|
||||||
|
scope: {
|
||||||
|
fields: ['code', 'townFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'town',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,7 +123,14 @@ const columns = computed(() => [
|
||||||
label: t('list.close'),
|
label: t('list.close'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toTimeFormat(row.hour),
|
format: (row) => toTimeFormat(row.hour),
|
||||||
hidden: true,
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'addressFk',
|
||||||
|
label: t('list.addressFk'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -129,9 +164,27 @@ const handleClone = (id) => {
|
||||||
() => clone(id)
|
() => clone(id)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function showValidAddresses(row) {
|
||||||
|
if (row.addressFk) {
|
||||||
|
const isValid = validAddresses.value.some(
|
||||||
|
(address) => address.addressFk === row.addressFk
|
||||||
|
);
|
||||||
|
if (isValid)
|
||||||
|
return `${row.address?.nickname},
|
||||||
|
${row.address?.postcode?.town?.name} (${row.address?.province?.name})`;
|
||||||
|
else return '-';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="RoadmapAddresses"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (validAddresses = data)"
|
||||||
|
/>
|
||||||
<ZoneSearchbar />
|
<ZoneSearchbar />
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -153,6 +206,9 @@ const handleClone = (id) => {
|
||||||
redirect="zone"
|
redirect="zone"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
>
|
>
|
||||||
|
<template #column-addressFk="{ row }">
|
||||||
|
{{ showValidAddresses(row) }}
|
||||||
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
|
|
@ -32,6 +32,7 @@ list:
|
||||||
warehouse: Warehouse
|
warehouse: Warehouse
|
||||||
createZone: Create zone
|
createZone: Create zone
|
||||||
zoneSummary: Summary
|
zoneSummary: Summary
|
||||||
|
addressFk: Address
|
||||||
create:
|
create:
|
||||||
name: Name
|
name: Name
|
||||||
closingHour: Closing hour
|
closingHour: Closing hour
|
||||||
|
|
|
@ -33,6 +33,7 @@ list:
|
||||||
isVolumetric: Volumétrico
|
isVolumetric: Volumétrico
|
||||||
createZone: Crear zona
|
createZone: Crear zona
|
||||||
zoneSummary: Resumen
|
zoneSummary: Resumen
|
||||||
|
addressFk: Consignatario
|
||||||
create:
|
create:
|
||||||
closingHour: Hora de cierre
|
closingHour: Hora de cierre
|
||||||
itemMaxSize: Medida máxima
|
itemMaxSize: Medida máxima
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
||||||
navigate: null,
|
navigate: null,
|
||||||
page: 1,
|
page: 1,
|
||||||
mapKey: 'id',
|
mapKey: 'id',
|
||||||
|
keepData: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function get(key) {
|
function get(key) {
|
||||||
|
|
|
@ -16,8 +16,9 @@ describe('Ticket expedtion', () => {
|
||||||
|
|
||||||
cy.wait('@show');
|
cy.wait('@show');
|
||||||
cy.selectRows([1, 2]);
|
cy.selectRows([1, 2]);
|
||||||
|
|
||||||
cy.dataCy('change-state').click();
|
cy.dataCy('change-state').click();
|
||||||
cy.dataCy('undefined_select').type('Perdida{enter}');
|
cy.selectOption('[data-cy="vnBtnSelect_select"]', 'Perdida');
|
||||||
cy.wait('@add');
|
cy.wait('@add');
|
||||||
|
|
||||||
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {
|
||||||
|
|
Loading…
Reference in New Issue