forked from verdnatura/hedera-web
Fix order by
This commit is contained in:
parent
509a7870a9
commit
a1b54d50b5
|
@ -362,48 +362,99 @@ const producer = ref(null);
|
||||||
const origin = ref(null);
|
const origin = ref(null);
|
||||||
const subcategory = ref(null);
|
const subcategory = ref(null);
|
||||||
// Order by options
|
// Order by options
|
||||||
const orderBy = ref('i.relevancy DESC, longName');
|
const orderBy = ref({
|
||||||
|
field: 'relevancy DESC, name',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
});
|
||||||
const orderByOptions = ref([
|
const orderByOptions = ref([
|
||||||
{
|
{
|
||||||
label: t('relevancy'),
|
label: t('relevancy'),
|
||||||
value: 'i.relevancy DESC, longName'
|
value: {
|
||||||
|
field: 'relevancy DESC, name',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('name'),
|
label: t('name'),
|
||||||
value: 'longName ASC'
|
value: {
|
||||||
|
field: 'name',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lowerSize'),
|
label: t('lowerSize'),
|
||||||
value: 'size ASC'
|
value: {
|
||||||
|
field: 'i.size',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('higherSize'),
|
label: t('higherSize'),
|
||||||
value: 'size DESC'
|
value: {
|
||||||
|
field: 'i.size',
|
||||||
|
way: 'DESC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('lowerPrice'),
|
label: t('lowerPrice'),
|
||||||
value: 'price ASC'
|
value: {
|
||||||
|
field: 'price',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('higherPrice'),
|
label: t('higherPrice'),
|
||||||
value: 'price DESC'
|
value: {
|
||||||
|
field: 'price',
|
||||||
|
way: 'DESC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('available'),
|
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'),
|
label: t('producer'),
|
||||||
value: 'producer ASC'
|
value: {
|
||||||
|
field: 'producerFk',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('origin'),
|
label: t('origin'),
|
||||||
value: 'origin ASC'
|
value: {
|
||||||
|
field: 'originFk',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('category'),
|
label: t('category'),
|
||||||
value: 'category ASC'
|
value: {
|
||||||
|
field: 'categoryFk',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -494,7 +545,11 @@ const selectedOrderBy = computed({
|
||||||
if (value) {
|
if (value) {
|
||||||
orderBy.value = value;
|
orderBy.value = value;
|
||||||
} else {
|
} else {
|
||||||
orderBy.value = 'i.relevancy DESC, longName';
|
orderBy.value = {
|
||||||
|
field: 'relevancy DESC, name',
|
||||||
|
way: 'ASC',
|
||||||
|
isTag: false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
debouncedGetItems();
|
debouncedGetItems();
|
||||||
}
|
}
|
||||||
|
@ -581,9 +636,9 @@ const getItems = async () => {
|
||||||
params: {
|
params: {
|
||||||
orderFk: basketOrderId.value,
|
orderFk: basketOrderId.value,
|
||||||
orderBy: JSON.stringify({
|
orderBy: JSON.stringify({
|
||||||
field: 'relevancy DESC, name',
|
field: selectedOrderBy.value.field,
|
||||||
way: 'ASC',
|
way: selectedOrderBy.value.way,
|
||||||
isTag: false
|
isTag: selectedOrderBy.value.isTag
|
||||||
}),
|
}),
|
||||||
filter: {
|
filter: {
|
||||||
where: {
|
where: {
|
||||||
|
|
Loading…
Reference in New Issue