- Seleziona l'ordine GAS e compare sulla email

- img logo
This commit is contained in:
Surya Paolo
2023-12-24 00:56:05 +01:00
parent 3f4eb0877c
commit c27c293fbf
30 changed files with 285 additions and 109 deletions

View File

@@ -1,4 +1,4 @@
import { defineComponent, onMounted, ref } from 'vue'
import { defineComponent, onMounted, ref, watch } from 'vue'
import { tools } from '@store/Modules/tools'
import { useUserStore } from '@store/UserStore'
import { useRouter } from 'vue-router'
@@ -28,9 +28,14 @@ export default defineComponent({
const search = ref('')
const cosa = ref(shared_consts.PROD.GAS)
const cosa = ref(0)
watch(() => cosa.value, (newval, oldval) => {
tools.setCookie(tools.COOK_COSA_PRODOTTI, cosa.value.toString())
})
function mounted() {
cosa.value = tools.getCookie(tools.COOK_COSA_PRODOTTI, shared_consts.PROD.BOTTEGA, true)
// Inizializza
productStore.loadProducts()
}
@@ -47,6 +52,16 @@ export default defineComponent({
return product.code!.includes(search.value) || lowerName.includes(lowerSearchText);
});
}
function getNumQtaGas() {
const arrprod = productStore.getProducts(shared_consts.PROD.GAS)
return arrprod.length
}
function getNumQtaBottega() {
const arrprod = productStore.getProducts(shared_consts.PROD.BOTTEGA)
return arrprod.length
}
onMounted(mounted)
@@ -59,6 +74,8 @@ export default defineComponent({
search,
cosa,
shared_consts,
getNumQtaGas,
getNumQtaBottega,
}
}
})

View File

@@ -3,14 +3,24 @@
<div class="panel">
<div>
<div class="q-gutter-md text-center q-mb-md">
<q-btn-toggle v-model="cosa" push rounded glossy toggle-color="purple" :options="[
{ value: shared_consts.PROD.GAS, slot: 'gas' },
{ value: shared_consts.PROD.BOTTEGA, slot: 'bottega' },
]">
<q-btn-toggle
v-model="cosa"
push
:size="cosa === 0 ? 'lg' : 'md'"
rounded
glossy
toggle-color="purple"
:options="[
{ value: shared_consts.PROD.BOTTEGA, slot: 'bottega' },
{ value: shared_consts.PROD.GAS, slot: 'gas' },
]"
>
<template v-slot:gas>
<div class="row items-center no-wrap">
<div class="text-center">
Ordina sul GAS
{{ $t('gas.ordina_sul_gas') }}
<br />
{{ $t('gas.x_prodotti_gas', { qta: getNumQtaGas() }) }}
</div>
<q-icon right name="fas fa-user-friends" />
</div>
@@ -19,26 +29,42 @@
<template v-slot:bottega>
<div class="row items-center no-wrap">
<div class="text-center">
Vai alla Bottega
{{ $t('gas.bottega') }}
<br />
{{
$t('gas.x_prodotti_bottega', { qta: getNumQtaBottega() })
}}
</div>
<q-icon right name="fas fa-store" />
</div>
</template>
</q-btn-toggle>
</div>
</div>
<div class="container">
<div class="q-gutter-y-md column text-center q-mx-auto" style="width: 350px; max-width: 100%">
<q-input filled stack-label :label="$t('ecomm.code_o_text_search')" v-model="search" class="q-ml-md">
<div
class="q-gutter-y-md column text-center q-mx-auto"
style="width: 350px; max-width: 100%"
>
<q-input
filledd
stack-label
:label="$t('ecomm.code_o_text_search')"
v-model="search"
class="q-ml-md"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</div>
<div class="row">
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts()" :key="index">
<CProductCard :code="product.code" :complete="false" />
<div
class="q-pa-md row items-start q-gutter-md"
v-for="(product, index) in getProducts()"
:key="index"
>
<CProductCard :code="product.code" :complete="false" :cosa="cosa" />
</div>
</div>
</div>