-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue
index fd508cea3..9eff3d322 100644
--- a/src/components/ui/VnFilterPanel.vue
+++ b/src/components/ui/VnFilterPanel.vue
@@ -4,11 +4,14 @@ import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
import { useRoute } from 'vue-router';
import toDate from 'filters/toDate';
-import useRedirect from 'src/composables/useRedirect';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
const { t } = useI18n();
-const props = defineProps({
+const $props = defineProps({
+ modelValue: {
+ type: Object,
+ default: () => {}
+ },
dataKey: {
type: String,
required: true,
@@ -18,11 +21,6 @@ const props = defineProps({
required: false,
default: false,
},
- params: {
- type: Object,
- required: false,
- default: null,
- },
showAll: {
type: Boolean,
default: true,
@@ -40,12 +38,20 @@ const props = defineProps({
},
hiddenTags: {
type: Array,
- default: () => [],
+ default: () => ['filter'],
},
customTags: {
type: Array,
default: () => [],
},
+ disableSubmitEvent: {
+ type: Boolean,
+ default: false,
+ },
+ searchUrl: {
+ type: String,
+ default: 'params',
+ },
redirect: {
type: Boolean,
default: true,
@@ -54,50 +60,55 @@ const props = defineProps({
const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
-const arrayData = useArrayData(props.dataKey, {
- exprBuilder: props.exprBuilder,
+const arrayData = useArrayData($props.dataKey, {
+ exprBuilder: $props.exprBuilder,
+ searchUrl: $props.searchUrl,
+ navigate: $props.redirect ? {} : null,
});
const route = useRoute();
const store = arrayData.store;
-const userParams = ref({});
-const { navigate } = useRedirect();
-
+const userParams = ref({})
onMounted(() => {
- if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
- if (Object.keys(store.userParams).length > 0) {
- userParams.value = JSON.parse(JSON.stringify(store.userParams));
- }
+ userParams.value = $props.modelValue ?? {}
emit('init', { params: userParams.value });
});
+function setUserParams(watchedParams) {
+ if (!watchedParams) return;
+
+ if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
+ watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
+ delete watchedParams.filter;
+ userParams.value = { ...userParams.value, ...watchedParams };
+}
+
watch(
- () => route.query.params,
- (val) => {
- if (!val) {
- userParams.value = {};
- } else {
- const parsedParams = JSON.parse(val);
- userParams.value = { ...parsedParams };
- }
- }
+ () => route.query[$props.searchUrl],
+ (val) => setUserParams(val)
+);
+
+watch(
+ () => arrayData.store.userParams,
+ (val) => setUserParams(val)
);
const isLoading = ref(false);
-async function search() {
+async function search(evt) {
+ if (evt && $props.disableSubmitEvent) return;
+
store.filter.where = {};
isLoading.value = true;
- const params = { ...userParams.value };
+ const filter = { ...userParams.value };
store.userParamsChanged = true;
store.filter.skip = 0;
store.skip = 0;
- const { params: newParams } = await arrayData.addFilter({ params });
+ const { params: newParams } = await arrayData.addFilter({ params: userParams.value });
userParams.value = newParams;
- if (!props.showAll && !Object.values(params).length) store.data = [];
+ if (!$props.showAll && !Object.values(filter).length) store.data = [];
isLoading.value = false;
emit('search');
- if (props.redirect) navigate(store.data, {});
}
async function reload() {
@@ -105,10 +116,9 @@ async function reload() {
const params = Object.values(userParams.value).filter((param) => param);
await arrayData.fetch({ append: false });
- if (!props.showAll && !params.length) store.data = [];
+ if (!$props.showAll && !params.length) store.data = [];
isLoading.value = false;
emit('refresh');
- if (props.redirect) navigate(store.data, {});
}
async function clearFilters() {
@@ -118,17 +128,18 @@ async function clearFilters() {
store.skip = 0;
// Filtrar los params no removibles
const removableFilters = Object.keys(userParams.value).filter((param) =>
- props.unremovableParams.includes(param)
+ $props.unremovableParams.includes(param)
);
const newParams = {};
// Conservar solo los params que no son removibles
for (const key of removableFilters) {
newParams[key] = userParams.value[key];
}
+ userParams.value = {};
userParams.value = { ...newParams }; // Actualizar los params con los removibles
await arrayData.applyFilter({ params: userParams.value });
- if (!props.showAll) {
+ if (!$props.showAll) {
store.data = [];
}
@@ -136,36 +147,32 @@ async function clearFilters() {
emit('clear');
}
-const tagsList = computed(() =>
- Object.entries(userParams.value)
- .filter(([key, value]) => value && !(props.hiddenTags || []).includes(key))
- .map(([key, value]) => ({
- label: key,
- value: value,
- }))
-);
+const tagsList = computed(() => {
+ const tagList = [];
+ for (const key of Object.keys(userParams.value)) {
+ const value = userParams.value[key];
+ if (value == null || ($props.hiddenTags || []).includes(key)) continue;
+ tagList.push({ label: key, value });
+ }
+ return tagList;
+});
-const tags = computed(() =>
- tagsList.value.filter((tag) => !(props.customTags || []).includes(tag.label))
-);
+const tags = computed(() => {
+ return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.key));
+});
const customTags = computed(() =>
- tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
+ tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.key))
);
async function remove(key) {
- userParams.value[key] = null;
- await arrayData.applyFilter({ params: userParams.value });
+ userParams.value[key] = undefined;
+ search();
emit('remove', key);
}
function formatValue(value) {
- if (typeof value === 'boolean') {
- return value ? t('Yes') : t('No');
- }
-
- if (isNaN(value) && !isNaN(Date.parse(value))) {
- return toDate(value);
- }
+ if (typeof value === 'boolean') return value ? t('Yes') : t('No');
+ if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
return `"${value}"`;
}
@@ -226,7 +233,7 @@ function formatValue(value) {
{{ chip.label }}:
- "{{ chip.value }}"
+ "{{ formatValue(chip.value) }}"
@@ -245,7 +252,7 @@ function formatValue(value) {
-
+
@@ -269,7 +276,6 @@ function formatValue(value) {
color="primary"
/>
-
diff --git a/src/components/ui/VnLv.vue b/src/components/ui/VnLv.vue
index 3220bce6a..ff65f759b 100644
--- a/src/components/ui/VnLv.vue
+++ b/src/components/ui/VnLv.vue
@@ -2,6 +2,7 @@
import { dashIfEmpty } from 'src/filters';
import { useI18n } from 'vue-i18n';
import { useClipboard } from 'src/composables/useClipboard';
+import { computed } from 'vue';
const $props = defineProps({
label: { type: String, default: null },
@@ -24,52 +25,67 @@ function copyValueText() {
},
});
}
+const val = computed(() => $props.value);
-
-
-
- {{ $props.label }}
-
-
-
-
-
- {{ $props.dash ? dashIfEmpty($props.value) : $props.value }}
-
-
-
-
-
-
- {{ $props.info }}
-
-
-
-
-
- {{ t('globals.copyClipboard') }}
-
-
+
+
+
+
+ {{ label }}
+
+
+
+
+
+ {{ dash ? dashIfEmpty(value) : value }}
+
+
+
+
+
+
+ {{ info }}
+
+
+
+
+
+ {{ t('globals.copyClipboard') }}
+
+
+
-
diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue
index 937ec4b6c..f4cdde310 100644
--- a/src/components/ui/VnNotes.vue
+++ b/src/components/ui/VnNotes.vue
@@ -21,7 +21,7 @@ const currentUser = ref(state.getUser());
const newNote = ref('');
const vnPaginateRef = ref();
function handleKeyUp(event) {
- if (event.key === 'Enter') {
+ if (event.key === 'Enter') {
event.preventDefault();
if (!event.shiftKey) insert();
}
@@ -78,6 +78,7 @@ async function insert() {
ref="vnPaginateRef"
class="show"
v-bind="$attrs"
+ search-url="notes"
>
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index 190393d2f..9a2c06b0c 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -58,14 +58,19 @@ const props = defineProps({
type: Function,
default: null,
},
+ searchUrl: {
+ type: String,
+ default: null,
+ },
disableInfiniteScroll: {
type: Boolean,
default: false,
},
});
-const emit = defineEmits(['onFetch', 'onPaginate']);
+const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
const isLoading = ref(false);
+const mounted = ref(false);
const pagination = ref({
sortBy: props.order,
rowsPerPage: props.limit,
@@ -81,11 +86,13 @@ const arrayData = useArrayData(props.dataKey, {
userParams: props.userParams,
exprBuilder: props.exprBuilder,
keepOpts: props.keepOpts,
+ searchUrl: props.searchUrl,
});
const store = arrayData.store;
-onMounted(() => {
- if (props.autoLoad) fetch();
+onMounted(async () => {
+ if (props.autoLoad) await fetch();
+ mounted.value = true;
});
watch(
@@ -95,11 +102,22 @@ watch(
}
);
+watch(
+ () => store.data,
+ (data) => emit('onChange', data)
+);
+
+watch(
+ () => props.url,
+ (url) => fetch({ url })
+);
+
const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params });
};
-async function fetch() {
+async function fetch(params) {
+ useArrayData(props.dataKey, params);
store.filter.skip = 0;
store.skip = 0;
await arrayData.fetch({ append: false });
@@ -107,6 +125,7 @@ async function fetch() {
isLoading.value = false;
}
emit('onFetch', store.data);
+ return store.data;
}
async function paginate() {
@@ -138,7 +157,7 @@ function endPagination() {
emit('onPaginate');
}
async function onLoad(index, done) {
- if (!store.data) return done();
+ if (!store.data || !mounted.value) return done();
if (store.data.length === 0 || !props.url) return done(false);
@@ -150,7 +169,7 @@ async function onLoad(index, done) {
done(isDone);
}
-defineExpose({ fetch, addFilter });
+defineExpose({ fetch, addFilter, paginate });
@@ -199,12 +218,6 @@ defineExpose({ fetch, addFilter });
-
-
-
diff --git a/src/pages/Customer/Defaulter/CustomerDefaulter.vue b/src/pages/Customer/Defaulter/CustomerDefaulter.vue
index 06732b944..693b016fb 100644
--- a/src/pages/Customer/Defaulter/CustomerDefaulter.vue
+++ b/src/pages/Customer/Defaulter/CustomerDefaulter.vue
@@ -91,7 +91,6 @@ const tableColumnComponents = {
props: (prop) => ({
disable: true,
'model-value': prop.value,
- class: 'disabled-checkbox',
}),
event: () => {},
},
diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
index 6b4d8baaa..1d7f63f36 100644
--- a/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
+++ b/src/pages/Customer/Defaulter/CustomerDefaulterFilter.vue
@@ -119,7 +119,7 @@ const departments = ref();
emit-value
hide-selected
map-options
- option-label="country"
+ option-label="name"
option-value="id"
outlined
rounded
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue
deleted file mode 100644
index 79459d1a1..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue
+++ /dev/null
@@ -1,619 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- navigateToTravelId(row.id)"
- >
-
-
- {{ value }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ props.row.id }}
-
-
-
-
-
-
-
- {{ props.row.salesPerson }}
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue
deleted file mode 100644
index 8355c7560..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedListActions.vue
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
- {{ t('Client ticket list') }}
-
-
-
-
- {{ t('Preview') }}
-
-
-
-
-
-
-es:
- Client ticket list: Listado de tickets del cliente
- Preview: Vista previa
-
diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue b/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue
deleted file mode 100644
index 1be20f26c..000000000
--- a/src/pages/Customer/ExtendedList/CustomerExtendedListFilter.vue
+++ /dev/null
@@ -1,571 +0,0 @@
-
-
-
- (clients = data)"
- auto-load
- />
- (workers = data)"
- auto-load
- />
- (workers = data)"
- auto-load
- />
- (countriesOptions = data)"
- auto-load
- />
- (provincesOptions = data)"
- auto-load
- url="Provinces"
- />
- (paymethodsOptions = data)"
- auto-load
- />
- (businessTypesOptions = data)"
- auto-load
- />
- (sageTaxTypesOptions = data)"
- />
- (sageTransactionTypesOptions = data)"
- />
-
-
-
- {{ t(`customer.extendedList.tableVisibleColumns.${tag.label}`) }}:
-
- {{ formatFn(tag.value) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-es:
- Social name: Razón social
-
diff --git a/src/pages/Department/Card/DepartmentDescriptorProxy.vue b/src/pages/Department/Card/DepartmentDescriptorProxy.vue
index 07a6b6af1..5b556f655 100644
--- a/src/pages/Department/Card/DepartmentDescriptorProxy.vue
+++ b/src/pages/Department/Card/DepartmentDescriptorProxy.vue
@@ -1,6 +1,6 @@
diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue
index e96c74689..84a79661e 100644
--- a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue
+++ b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue
@@ -150,21 +150,19 @@ const downloadCSV = async () => {
>
- {{ row.clientId }}
+ {{ row.clientId }}
- {{ row.ticketFk }}
+ {{ row.ticketFk }}
- {{
- row.workerName
- }}
+ {{ row.workerName }}
diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue
index 66b9257a0..9eeac8355 100644
--- a/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue
+++ b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue
@@ -20,6 +20,7 @@ const props = defineProps({
:data-key="props.dataKey"
:search-button="true"
:unremovable-params="['from', 'to']"
+ :hidden-tags="['from', 'to']"
>
diff --git a/src/pages/Item/Card/ItemDescriptor.vue b/src/pages/Item/Card/ItemDescriptor.vue
index 155c9eb4c..f3eba8c82 100644
--- a/src/pages/Item/Card/ItemDescriptor.vue
+++ b/src/pages/Item/Card/ItemDescriptor.vue
@@ -13,7 +13,6 @@ import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
import { useState } from 'src/composables/useState';
import useCardDescription from 'src/composables/useCardDescription';
-import { useSession } from 'src/composables/useSession';
import { getUrl } from 'src/composables/getUrl';
import axios from 'axios';
import { dashIfEmpty } from 'src/filters';
@@ -42,14 +41,12 @@ const quasar = useQuasar();
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
const state = useState();
const user = state.getUser();
const entityId = computed(() => {
return $props.id || route.params.id;
});
-const image = ref(null);
const regularizeStockFormDialog = ref(null);
const item = ref(null);
const available = ref(null);
@@ -67,17 +64,10 @@ const warehouseFk = computed({
});
onMounted(async () => {
- await getItemAvatar();
warehouseFk.value = user.value.warehouseFk;
salixUrl.value = await getUrl('');
});
-const getItemAvatar = async () => {
- const token = getTokenMultimedia();
- const timeStamp = `timestamp=${Date.now()}`;
- image.value = `/api/Images/catalog/200x200/${entityId.value}/download?access_token=${token}&${timeStamp}`;
-};
-
const data = ref(useCardDescription());
const setData = (entity) => {
if (!entity) return;
diff --git a/src/pages/Item/Card/ItemDescriptorImage.vue b/src/pages/Item/Card/ItemDescriptorImage.vue
index f16a57548..aceede880 100644
--- a/src/pages/Item/Card/ItemDescriptorImage.vue
+++ b/src/pages/Item/Card/ItemDescriptorImage.vue
@@ -3,8 +3,7 @@ import { ref, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import EditPictureForm from 'components/EditPictureForm.vue';
-
-import { useSession } from 'src/composables/useSession';
+import VnImg from 'src/components/ui/VnImg.vue';
import axios from 'axios';
const $props = defineProps({
@@ -27,19 +26,12 @@ const $props = defineProps({
});
const { t } = useI18n();
-const { getTokenMultimedia } = useSession();
const image = ref(null);
const editPhotoFormDialog = ref(null);
const showEditPhotoForm = ref(false);
const warehouseName = ref(null);
-const getItemAvatar = async () => {
- const token = getTokenMultimedia();
- const timeStamp = `timestamp=${Date.now()}`;
- image.value = `/api/Images/catalog/200x200/${$props.entityId}/download?access_token=${token}&${timeStamp}`;
-};
-
const toggleEditPictureForm = () => {
showEditPhotoForm.value = !showEditPhotoForm.value;
};
@@ -62,14 +54,17 @@ const getWarehouseName = async (warehouseFk) => {
};
onMounted(async () => {
- getItemAvatar();
getItemConfigs();
});
+
+const handlePhotoUpdated = (evt = false) => {
+ image.value.reload(evt);
+};
-
+
@@ -82,7 +77,7 @@ onMounted(async () => {
-
+
{
collection="catalog"
:id="entityId"
@close-form="toggleEditPictureForm()"
- @on-photo-uploaded="getItemAvatar()"
+ @on-photo-uploaded="handlePhotoUpdated"
/>
diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue
index 0e40740b9..f1e3629cd 100644
--- a/src/pages/Item/ItemList.vue
+++ b/src/pages/Item/ItemList.vue
@@ -16,17 +16,15 @@ import ItemListFilter from './ItemListFilter.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js';
-import { useSession } from 'composables/useSession';
import { dashIfEmpty } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
+import VnImg from 'src/components/ui/VnImg.vue';
const router = useRouter();
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
const stateStore = useStateStore();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@@ -491,10 +489,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
- {
+ if (val.length > 2) {
+ if (!tagOptions.value.includes(val)) {
+ done(tagOptions.value, 'add-unique');
+ }
+ tagValues.value.push({ value: val });
+ }
+};
const resetCategory = () => {
selectedCategoryFk.value = null;
typeList.value = null;
};
-const selectedOrder = ref(null);
-const orderList = [
- { way: 'ASC', name: 'Ascendant' },
- { way: 'DESC', name: 'Descendant' },
-];
-
-const selectedOrderField = ref(null);
-const OrderFields = [
- { field: 'relevancy DESC, name', name: 'Relevancy', priority: 999 },
- { field: 'showOrder, price', name: 'Color and price', priority: 999 },
- { field: 'name', name: 'Name', priority: 999 },
- { field: 'price', name: 'Price', priority: 999 },
-];
-
const clearFilter = (key) => {
if (key === 'categoryFk') {
resetCategory();
@@ -72,21 +75,6 @@ const loadTypes = async (categoryFk) => {
typeList.value = data;
};
-const onFilterInit = async ({ params }) => {
- if (params.typeFk) {
- selectedTypeFk.value = params.typeFk;
- }
- if (params.categoryFk) {
- await loadTypes(params.categoryFk);
- selectedCategoryFk.value = params.categoryFk;
- }
- if (params.orderBy) {
- orderByParam.value = JSON.parse(params.orderBy);
- selectedOrder.value = orderByParam.value?.way;
- selectedOrderField.value = orderByParam.value?.field;
- }
-};
-
const selectedCategory = computed(() =>
(categoryList.value || []).find(
(category) => category?.id === selectedCategoryFk.value
@@ -109,10 +97,7 @@ function exprBuilder(param, value) {
const selectedTag = ref(null);
const tagValues = ref([{}]);
-const tagOptions = ref(null);
-const isButtonDisabled = computed(
- () => !selectedTag.value || tagValues.value.some((item) => !item.value)
-);
+const tagOptions = ref([]);
const applyTagFilter = (params, search) => {
if (!tagValues.value?.length) {
@@ -125,12 +110,12 @@ const applyTagFilter = (params, search) => {
}
params.tagGroups.push(
JSON.stringify({
- values: tagValues.value,
+ values: tagValues.value.filter((obj) => Object.keys(obj).length > 0),
tagSelection: {
...selectedTag.value,
- orgShowField: selectedTag.value.name,
+ orgShowField: selectedTag?.value?.name,
},
- tagFk: selectedTag.value.tagFk,
+ tagFk: selectedTag?.value?.tagFk,
})
);
search();
@@ -147,20 +132,48 @@ const removeTagChip = (selection, params, search) => {
search();
};
-const orderByParam = ref(null);
-
-const onOrderFieldChange = (value, params, search) => {
- const orderBy = Object.assign({}, orderByParam.value, { field: value.field });
- params.orderBy = JSON.stringify(orderBy);
- search();
+const onOrderChange = (value, params) => {
+ const tagObj = JSON.parse(params.orderBy);
+ tagObj.way = value.name;
+ params.orderBy = JSON.stringify(tagObj);
};
-const onOrderChange = (value, params, search) => {
- const orderBy = Object.assign({}, orderByParam.value, { way: value.way });
- params.orderBy = JSON.stringify(orderBy);
- search();
+const onOrderFieldChange = (value, params) => {
+ const tagObj = JSON.parse(params.orderBy); // esto donde va
+ const fields = {
+ Relevancy: (value) => value + ' DESC, name',
+ ColorAndPrice: 'showOrder, price',
+ Name: 'name',
+ Price: 'price',
+ };
+ let tagField = fields[value];
+ if (!tagField) return;
+
+ if (typeof tagField === 'function') tagField = tagField(value);
+ tagObj.field = tagField;
+ params.orderBy = JSON.stringify(tagObj);
+ switch (value) {
+ case 'Relevancy':
+ tagObj.field = value + ' DESC, name';
+ params.orderBy = JSON.stringify(tagObj);
+ break;
+ case 'ColorAndPrice':
+ tagObj.field = 'showOrder, price';
+ params.orderBy = JSON.stringify(tagObj);
+ break;
+ case 'Name':
+ tagObj.field = 'name';
+ params.orderBy = JSON.stringify(tagObj);
+ break;
+ case 'Price':
+ tagObj.field = 'price';
+ params.orderBy = JSON.stringify(tagObj);
+ break;
+ }
};
+const _moreFields = ['ASC', 'DESC'];
+const _moreFieldsTypes = ['Relevancy', 'ColorAndPrice', 'Name', 'Price'];
const setCategoryList = (data) => {
categoryList.value = (data || [])
.filter((category) => category.display)
@@ -168,6 +181,8 @@ const setCategoryList = (data) => {
...category,
icon: `vn:${(category.icon || '').split('-')[1]}`,
}));
+ moreFields.value = useLang(_moreFields);
+ moreFieldsOrder.value = useLang(_moreFieldsTypes);
};
const getCategoryClass = (category, params) => {
@@ -175,6 +190,20 @@ const getCategoryClass = (category, params) => {
return 'active';
}
};
+
+const useLang = (values) => {
+ const { models } = validationsStore;
+ const properties = models.Item?.properties || {};
+ return values.map((name) => {
+ let prop = properties[name];
+ const label = t(`params.${name}`);
+ return {
+ name,
+ label,
+ type: prop ? prop.type : null,
+ };
+ });
+};
@@ -182,10 +211,11 @@ const getCategoryClass = (category, params) => {
@@ -274,40 +304,29 @@ const getCategoryClass = (category, params) => {
onOrderChange(value, params, searchFn)
- "
+ @update:model-value="(value) => onOrderChange(value, params)"
/>
onOrderFieldChange(value, params, searchFn)
- "
+ @update:model-value="(value) => onOrderFieldChange(value, params)"
/>
@@ -333,15 +352,30 @@ const getCategoryClass = (category, params) => {
:key="value"
class="q-mt-md filter-value"
>
- (tagOptions = data)"
/>
+ {
rounded
emit-value
use-input
- :disable="!selectedTag"
+ class="filter-input"
+ @new-value="createValue"
+ />
+
-
- (tagOptions = data)"
- />
-
{
rounded
type="button"
unelevated
- :disable="isButtonDisabled"
@click.stop="applyTagFilter(params, searchFn)"
/>
@@ -453,6 +486,12 @@ en:
tag: Tag
value: Value
order: Order
+ ASC: Ascendant
+ DESC: Descendant
+ Relevancy: Relevancy
+ ColorAndPrice: Color and price
+ Name: Name
+ Price: Price
es:
params:
type: Tipo
@@ -460,6 +499,14 @@ es:
tag: Etiqueta
value: Valor
order: Orden
+ ASC: Ascendiente
+ DESC: Descendiente
+ Relevancy: Relevancia
+ ColorAndPrice: Color y precio
+ Name: Nombre
+ Price: Precio
+ Order: Orden
+ Order by: Ordenar por
Plant: Planta
Flower: Flor
Handmade: Confección
diff --git a/src/pages/Order/Card/OrderCatalogItem.vue b/src/pages/Order/Card/OrderCatalogItem.vue
index 0e1005493..34e22915d 100644
--- a/src/pages/Order/Card/OrderCatalogItem.vue
+++ b/src/pages/Order/Card/OrderCatalogItem.vue
@@ -3,16 +3,14 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnLv from 'components/ui/VnLv.vue';
+import VnImg from 'src/components/ui/VnImg.vue';
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
-import { useSession } from 'composables/useSession';
import toCurrency from '../../../filters/toCurrency';
const DEFAULT_PRICE_KG = 0;
-const { getTokenMultimedia } = useSession();
-const token = getTokenMultimedia();
const { t } = useI18n();
defineProps({
@@ -29,14 +27,7 @@ const dialog = ref(null);