Error on search empty product
Some checks are pending
deploy / deploy (push) Waiting to run

This commit is contained in:
2024-01-03 18:41:37 +01:00
parent a5c3da9436
commit 597f9c111f
2 changed files with 25 additions and 15 deletions

View File

@@ -107,5 +107,6 @@
"exchange": "Exchange", "exchange": "Exchange",
"referenceerror: rates is not defined": "ReferenceError: rates is not defined", "referenceerror: rates is not defined": "ReferenceError: rates is not defined",
"referenceerror: currency is not defined": "ReferenceError: currency is not defined", "referenceerror: currency is not defined": "ReferenceError: currency is not defined",
"typeerror: can't access property \"unshift\", currency.velue is undefined": "TypeError: can't access property \"unshift\", currency.velue is undefined" "typeerror: can't access property \"unshift\", currency.velue is undefined": "TypeError: can't access property \"unshift\", currency.velue is undefined",
"item must be selected": "Item must be selected"
} }

View File

@@ -25,15 +25,15 @@ const props = defineProps({
type: Object, type: Object,
default: [] default: []
} }
}) })
console.log(props.countryHash); console.log(props.countryHash);
let tproducts = computed(() => { let tproducts = computed(() => {
return props.products.map((prod) => { return props.products.map((prod) => {
prod.salesPrice = parseFloat(prod.salesPrice); prod.salesPrice = parseFloat(prod.salesPrice);
prod.country = props.countryHash[prod.country]; prod.country = props.countryHash[prod.country];
return prod; return prod;
} ) })
}) })
const type = 'GeoChart'; const type = 'GeoChart';
@@ -55,9 +55,9 @@ const hrates = ref([
]); ]);
// { "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([ const hproducts = ref([
{ text: "Country", value:"country", sortable: true}, { text: "Country", value: "country", sortable: true },
{ text: "Name", value:"name", sortable: true}, { text: "Name", value: "name", sortable: true },
{ text: "Price", value:"salesPrice", sortable: true} { text: "Price", value: "salesPrice", sortable: true }
]); ]);
const rates = ref([]); const rates = ref([]);
@@ -174,6 +174,15 @@ onMounted(fetch);
onMounted(fetch_rates); onMounted(fetch_rates);
const submit = () => { const submit = () => {
console.log('ITEM=', form);
if (form.codes.length == 0) {
Swal.fire({
title: "Empty code",
text: "You must enter product!",
icon: "error"
});
return false;
}
form.post(route('products.compare')); form.post(route('products.compare'));
}; };
</script> </script>
@@ -206,8 +215,8 @@ const submit = () => {
<span class="font-extrabold font-mono">Prepocet do meny</span> <span class="font-extrabold font-mono">Prepocet do meny</span>
</div> </div>
<div> <div>
<multiselect v-model="form.currency" :multiple="flase" :allow-empty="false" <multiselect v-model="form.currency" :multiple="false" :allow-empty="false" placeholder="Currency"
placeholder="Currency" :searchable="true" :options="currency" /> :searchable="true" :options="currency" />
</div> </div>
<div class="text-end mt-2"> <div class="text-end mt-2">
<button type="submit" <button type="submit"