0
1
Fork 0

Fix order by

This commit is contained in:
William Buezas 2025-04-02 15:37:12 +02:00
parent 509a7870a9
commit a1b54d50b5
1 changed files with 71 additions and 16 deletions

View File

@ -362,48 +362,99 @@ const producer = ref(null);
const origin = ref(null);
const subcategory = ref(null);
// Order by options
const orderBy = ref('i.relevancy DESC, longName');
const orderBy = ref({
field: 'relevancy DESC, name',
way: 'ASC',
isTag: false
});
const orderByOptions = ref([
{
label: t('relevancy'),
value: 'i.relevancy DESC, longName'
value: {
field: 'relevancy DESC, name',
way: 'ASC',
isTag: false
}
},
{
label: t('name'),
value: 'longName ASC'
value: {
field: 'name',
way: 'ASC',
isTag: false
}
},
{
label: t('lowerSize'),
value: 'size ASC'
value: {
field: 'i.size',
way: 'ASC',
isTag: false
}
},
{
label: t('higherSize'),
value: 'size DESC'
value: {
field: 'i.size',
way: 'DESC',
isTag: false
}
},
{
label: t('lowerPrice'),
value: 'price ASC'
value: {
field: 'price',
way: 'ASC',
isTag: false
}
},
{
label: t('higherPrice'),
value: 'price DESC'
value: {
field: 'price',
way: 'DESC',
isTag: false
}
},
{
label: t('available'),
value: 'available'
value: {
field: 'available',
way: 'ASC',
isTag: false
}
},
{
label: t('color'),
value: {
field: 'i.inkFk',
way: 'ASC',
isTag: false
}
},
{ label: t('color'), value: 'ink ASC' },
{
label: t('producer'),
value: 'producer ASC'
value: {
field: 'producerFk',
way: 'ASC',
isTag: false
}
},
{
label: t('origin'),
value: 'origin ASC'
value: {
field: 'originFk',
way: 'ASC',
isTag: false
}
},
{
label: t('category'),
value: 'category ASC'
value: {
field: 'categoryFk',
way: 'ASC',
isTag: false
}
}
]);
@ -494,7 +545,11 @@ const selectedOrderBy = computed({
if (value) {
orderBy.value = value;
} else {
orderBy.value = 'i.relevancy DESC, longName';
orderBy.value = {
field: 'relevancy DESC, name',
way: 'ASC',
isTag: false
};
}
debouncedGetItems();
}
@ -581,9 +636,9 @@ const getItems = async () => {
params: {
orderFk: basketOrderId.value,
orderBy: JSON.stringify({
field: 'relevancy DESC, name',
way: 'ASC',
isTag: false
field: selectedOrderBy.value.field,
way: selectedOrderBy.value.way,
isTag: selectedOrderBy.value.isTag
}),
filter: {
where: {