Colored row in results

This commit is contained in:
2024-01-21 08:33:32 +01:00
parent 5c3e2b89b8
commit 79b550ae3f

View File

@@ -72,7 +72,9 @@ const tproducts = computed(() => {
return prod;
})
})
const bodyRowClassNameFunction = (item) => {
if (item.country == form.country.code) return 'result-country';
};
const filterOptions = computed(() => {
const filterOptionsArray = [];
if (productsCriteria.value != 'All' && productsCriteria.value != null) {
@@ -169,7 +171,7 @@ const hrates = ref([
{ text: "Country", value: "country_name", sortable: true },
{ text: "Rate", value: "rate", sortable: true }
]);
// { "country": "AT", "code": "50161321", "url": "https://www.ikea.com/at/de/p/hol-aufbewahrungstisch-akazie-50161321/", "name": "HOL", "typeName": "Aufbewahrungstisch", "mainImageUrl": "https://www.ikea.com/at/de/images/products/hol-aufbewahrungstisch-akazie__0104310_pe251255_s5.jpg", "itemNoGlobal": "50161321", "salesPrice": "80.99", "tag": "FAMILY_PRICE", "last_mod": "2023-12-03 16:44:24" },
// { "country": "AT", "code": "50161321", "url": "https://www.ikea.com/at/de/p/hol-aufbewahrungstisch-akazie-50161321/", "name": "HOL", "typeName": "Aufbewahrungstisch", "mainImageUrl": "https://www.ikea.com/at/de/images/products/hol-aufbewahrungstisch-akazie__0104310_pe251255_s5.jpg", "itemNoGlobal": "50161321", "salesPrice": "80.99", "tag": "FAMILY_PRICE", "last_mod": "2023-12-03 16:44:24" },
const hproducts = ref([
{ text: "Country", value: "countryName", sortable: true },
{ text: "Tag", value: "tag", sortable: true },
@@ -227,7 +229,7 @@ const fetch_rates = async () => {
currencyHash.value = Object.fromEntries(
rates.value.map((currency) => [currency.currency, currency.rate]),
);
currency.value.unshift('EUR');
console.log("RATE=", rates.value);
console.log('HASH=', currencyHash.value);
@@ -253,7 +255,7 @@ const fetch_ccodes = async () => {
ccodes.value = response.data;
ccodes.value = Object.entries(ccodes.value).map(([k, v]) => { if (v !== null) return { "country": k, "code": v } }).filter(n => n);
console.log("ccodes=", ccodes.value);
} catch (e) {
const response = await Swal.fire({
title: __('are you want to try again') + '?',
@@ -381,7 +383,7 @@ watch(ccodes, (codes) => {
<span class="font-extrabold font-mono">Results <b v-if="itemCode">for {{ itemCode }}</b> </span>
</div>
<div>
<EasyTable :rows-per-page=25 :headers="hproducts" :items="tproducts" alternating>
<EasyTable :rows-per-page=25 :headers="hproducts" :items="tproducts" :body-row-class-name="bodyRowClassNameFunction" alternating>
<template #item-countryName="{ countryName, url }">
<a class="underline" target="_blank" :href="url">{{ countryName }}</a>
</template>
@@ -402,7 +404,7 @@ watch(ccodes, (codes) => {
<span class="font-extrabold font-mono">Country in which search product</span>
</div>
<div>
<multiselect :close-on-select="false" :multiple="false" v-model="form.country" :options="ccodes"
<multiselect :close-on-select="true" :multiple="false" v-model="form.country" :options="ccodes"
label="country" track-by="code">
</multiselect>
</div>
@@ -503,6 +505,10 @@ watch(ccodes, (codes) => {
top: 40px;
width: 128px;
}
:root .result-country {
--easy-table-body-row-background-color: yellow !important;
}
</style>
<style src="vue-multiselect/dist/vue-multiselect.css"></style>