diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue
index 1032d4024..07992f616 100644
--- a/src/components/VnTable/VnTable.vue
+++ b/src/components/VnTable/VnTable.vue
@@ -314,7 +314,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
show-if-above
>
-
+
diff --git a/src/components/common/VnDmsList.vue b/src/components/common/VnDmsList.vue
index 52dd6ef79..ed3cadc6b 100644
--- a/src/components/common/VnDmsList.vue
+++ b/src/components/common/VnDmsList.vue
@@ -297,7 +297,7 @@ defineExpose({
ref="dmsRef"
:data-key="$props.model"
:url="$props.model"
- :filter="dmsFilter"
+ :user-filter="dmsFilter"
:order="['dmsFk DESC']"
:auto-load="true"
@on-fetch="setData"
diff --git a/src/components/common/VnModule.vue b/src/components/common/VnModule.vue
index 4757587f9..038ee1d60 100644
--- a/src/components/common/VnModule.vue
+++ b/src/components/common/VnModule.vue
@@ -20,16 +20,15 @@ const hasContent = ref();
let observer;
onMounted(() => {
- if (teleportRef.value) {
- const checkContent = () => {
- hasContent.value = teleportRef?.value?.innerHTML?.trim() !== '';
- };
+ if (!teleportRef.value) return;
+ const checkContent = () => {
+ hasContent.value = teleportRef.value?.innerHTML?.trim() !== '';
+ };
- observer = new MutationObserver(checkContent);
- observer.observe(teleportRef.value, { childList: true, subtree: true });
+ observer = new MutationObserver(checkContent);
+ observer.observe(teleportRef.value, { childList: true, subtree: true });
- checkContent();
- }
+ checkContent();
});
diff --git a/src/components/common/VnSection.vue b/src/components/common/VnSection.vue
index e69e586b5..edd8d3dfa 100644
--- a/src/components/common/VnSection.vue
+++ b/src/components/common/VnSection.vue
@@ -4,11 +4,12 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnTableFilter from '../VnTable/VnTableFilter.vue';
import { onBeforeMount, computed } from 'vue';
import { useArrayData } from 'src/composables/useArrayData';
+import { useRoute } from 'vue-router';
const $props = defineProps({
section: {
type: String,
- required: true,
+ default: null,
},
dataKey: {
type: String,
@@ -38,14 +39,28 @@ const $props = defineProps({
type: Boolean,
default: true,
},
+ keepData: {
+ type: Boolean,
+ default: true,
+ },
});
-const sectionValue = computed(() => $props.section ?? $props.dataKey);
+const route = useRoute();
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(() => {
if ($props.dataKey)
arrayData = useArrayData($props.dataKey, {
searchUrl: 'table',
+ keepData: $props.keepData,
...$props.arrayDataProps,
navigate: $props.redirect,
});
@@ -74,6 +89,6 @@ onBeforeMount(() => {
-
+
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index a2ccd5d92..0111366f5 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -111,6 +111,7 @@ onMounted(async () => {
});
onBeforeUnmount(() => {
+ if (!store.keepData) arrayData.reset(['data']);
arrayData.resetPagination();
});
diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue
index 4e284d8e4..a2d3b9ee1 100644
--- a/src/components/ui/VnSearchbar.vue
+++ b/src/components/ui/VnSearchbar.vue
@@ -126,6 +126,7 @@ async function search() {
delete filter.params.search;
}
await arrayData.applyFilter(filter);
+ searchText.value = undefined;
}
diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js
index 1a91cc50b..fd6e3a9b3 100644
--- a/src/composables/useArrayData.js
+++ b/src/composables/useArrayData.js
@@ -53,6 +53,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
'searchUrl',
'navigate',
'mapKey',
+ 'keepData',
];
if (typeof userOptions === 'object') {
for (const option in userOptions) {
@@ -302,7 +303,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
for (const row of data) {
const key = row[store.mapKey];
const val = { ...row, key };
- if (store.map.has(key)) {
+ if (key && store.map.has(key)) {
const { position } = store.map.get(key);
val.position = position;
store.map.set(key, val);
diff --git a/src/pages/Customer/Card/CustomerMandates.vue b/src/pages/Customer/Card/CustomerMandates.vue
index 248515b4a..66cb44bc2 100644
--- a/src/pages/Customer/Card/CustomerMandates.vue
+++ b/src/pages/Customer/Card/CustomerMandates.vue
@@ -63,9 +63,10 @@ const columns = computed(() => [
-
+
[
name: 'itemFk',
...defaultColumnAttrs,
isId: true,
- cardVisible: true,
columnField: {
component: 'input',
type: 'number',
@@ -65,14 +64,12 @@ const columns = computed(() => [
name: 'name',
...defaultColumnAttrs,
create: true,
- cardVisible: true,
},
{
label: t('item.fixedPrice.groupingPrice'),
field: 'rate2',
name: 'rate2',
...defaultColumnAttrs,
- cardVisible: true,
component: 'input',
type: 'number',
},
@@ -81,7 +78,6 @@ const columns = computed(() => [
field: 'rate3',
name: 'rate3',
...defaultColumnAttrs,
- cardVisible: true,
component: 'input',
type: 'number',
},
@@ -91,7 +87,6 @@ const columns = computed(() => [
field: 'minPrice',
name: 'minPrice',
...defaultColumnAttrs,
- cardVisible: true,
component: 'input',
type: 'number',
},
@@ -100,7 +95,6 @@ const columns = computed(() => [
field: 'started',
name: 'started',
format: ({ started }) => toDate(started),
- cardVisible: true,
...defaultColumnAttrs,
columnField: {
component: 'date',
@@ -116,7 +110,6 @@ const columns = computed(() => [
field: 'ended',
name: 'ended',
...defaultColumnAttrs,
- cardVisible: true,
columnField: {
component: 'date',
class: 'shrink',
@@ -251,11 +244,14 @@ const upsertPrice = async (props, resetMinPrice = false) => {
}
if (!changes.updates && !changes.creates) return;
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) {
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
+ data.hasMinPrice = data.hasMinPrice ? 1 : 0;
return data;
}
@@ -395,18 +391,11 @@ function handleOnDataSave({ CrudModelRef }) {
- data.forEach((item) => {
- item.hasMinPrice = `${item.hasMinPrice !== 0}`;
- })
- "
:default-remove="false"
:default-reset="false"
:default-save="false"
data-key="ItemFixedPrices"
url="FixedPrices/filter"
- :order="['itemFk DESC', 'name DESC']"
save-url="FixedPrices/crud"
ref="tableRef"
dense
@@ -498,14 +487,15 @@ function handleOnDataSave({ CrudModelRef }) {
diff --git a/src/pages/Order/Card/OrderSummary.vue b/src/pages/Order/Card/OrderSummary.vue
index b8016abac..ad06dfe43 100644
--- a/src/pages/Order/Card/OrderSummary.vue
+++ b/src/pages/Order/Card/OrderSummary.vue
@@ -221,7 +221,7 @@ async function handleConfirm() {
-
+
{{ props.row.quantity }}
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index 2a5d290ef..e4a1774fe 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -17,6 +17,7 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
+import FetchData from 'src/components/FetchData.vue';
const { t } = useI18n();
const router = useRouter();
@@ -25,6 +26,7 @@ const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const warehouseOptions = ref([]);
+const validAddresses = ref([]);
const tableFilter = {
include: [
@@ -34,6 +36,32 @@ const tableFilter = {
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'),
cardVisible: true,
format: (row) => toTimeFormat(row.hour),
- hidden: true,
+ columnFilter: false,
+ },
+ {
+ align: 'left',
+ name: 'addressFk',
+ label: t('list.addressFk'),
+ cardVisible: true,
+ columnFilter: false,
},
{
align: 'right',
@@ -129,9 +164,27 @@ const handleClone = (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 '-';
+}
+ (validAddresses = data)"
+ />
@@ -153,6 +206,9 @@ const handleClone = (id) => {
redirect="zone"
:right-search="false"
>
+
+ {{ showValidAddresses(row) }}
+
{
navigate: null,
page: 1,
mapKey: 'id',
+ keepData: false,
};
function get(key) {
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
index 995eb9b15..fbac64d09 100644
--- a/test/cypress/integration/ticket/ticketExpedition.spec.js
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -16,8 +16,9 @@ describe('Ticket expedtion', () => {
cy.wait('@show');
cy.selectRows([1, 2]);
+
cy.dataCy('change-state').click();
- cy.dataCy('undefined_select').type('Perdida{enter}');
+ cy.selectOption('[data-cy="vnBtnSelect_select"]', 'Perdida');
cy.wait('@add');
cy.get(`${tableContent} tr:nth-child(-n+2) ${stateTd}`).each(($el) => {