- 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -317,54 +317,54 @@ module.exports = configure((ctx) => ({
start_url: "/?homescreen=1", start_url: "/?homescreen=1",
icons: [ icons: [
{ {
src: 'images/fv-android-icon-512x512.png', src: 'images/pcb-android-icon-512x512.png',
sizes: '512x512', sizes: '512x512',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-android-icon-384x384.png', src: 'images/pcb-android-icon-384x384.png',
sizes: '384x384', sizes: '384x384',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-android-icon-192x192.png', src: 'images/pcb-android-icon-192x192.png',
sizes: '192x192', sizes: '192x192',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-android-icon-144x144.png', src: 'images/pcb-android-icon-144x144.png',
sizes: '144x144', sizes: '144x144',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-android-icon-96x96.png', src: 'images/pcb-android-icon-96x96.png',
sizes: '96x96', sizes: '96x96',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-apple-icon-120x120.png', src: 'images/pcb-apple-icon-120x120.png',
sizes: '120x120', sizes: '120x120',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-apple-icon-144x144.png', src: 'images/pcb-apple-icon-144x144.png',
sizes: '144x144', sizes: '144x144',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-apple-icon-152x152.png', src: 'images/pcb-apple-icon-152x152.png',
sizes: '152x152', sizes: '152x152',
type: 'image/png', type: 'image/png',
}, },
{ {
src: 'images/fv-apple-icon-180x180.png', src: 'images/pcb-apple-icon-180x180.png',
sizes: '180x180', sizes: '180x180',
type: 'image/png', type: 'image/png',
}, },
], ],
related_applications: [{ related_applications: [{
"platform": "webapp", "platform": "webapp",
"url": "https://www.riso.app/manifest.json" "url": "https://www.piuchebuono.app/manifest.json"
}] }]
}, },
}, },

View File

@@ -10,7 +10,7 @@ import { CCopyBtn } from '../CCopyBtn'
import { func_tools, toolsext } from '@store/Modules/toolsext' import { func_tools, toolsext } from '@store/Modules/toolsext'
import { IBaseOrder, IOrder, IOrderCart, IProduct } from '@src/model' import { IBaseOrder, IGasordine, IOrder, IOrderCart, IProduct } from '@src/model'
import { tools } from '@store/Modules/tools' import { tools } from '@store/Modules/tools'
import { useProducts } from '@store/Products' import { useProducts } from '@store/Products'
@@ -29,6 +29,11 @@ export default defineComponent({
required: false, required: false,
default: '', default: '',
}, },
cosa: {
type: Number,
required: false,
default: 0,
},
complete: { complete: {
type: Boolean, type: Boolean,
required: false, required: false,
@@ -57,6 +62,7 @@ export default defineComponent({
}) })
const storeSelected = ref('') const storeSelected = ref('')
const gasordineSelected = ref('')
const arrordersCart = ref(<IOrderCart[]>[]) const arrordersCart = ref(<IOrderCart[]>[])
const openlistorders = ref(false) const openlistorders = ref(false)
@@ -120,6 +126,19 @@ export default defineComponent({
} }
} }
function getSingleGasordine(gasordine: IGasordine) {
try {
const mygas = gasordine
if (mygas)
return mygas.name + ' (' + mygas.city + ') ' + t('gas.dataora_chiusura_ordini') + ': ' + tools.getstrDateShort(mygas.dataora_chiusura_ordini)
+ ' ' + t('gas.dataora_ritiro') + ': ' + tools.getstrDateShort(mygas.dataora_ritiro)
else
return ''
} catch (e) {
return ''
}
}
function updateproduct() { function updateproduct() {
myproduct.value = products.getProductByCode(props.code) myproduct.value = products.getProductByCode(props.code)
// products.updateQuantityAvailable(myproduct.value._id) // products.updateQuantityAvailable(myproduct.value._id)
@@ -146,6 +165,26 @@ export default defineComponent({
return myarr return myarr
} }
function getGasordines() {
if (!myproduct.value)
return []
const myarr: any = []
let ind = 1
myproduct.value.gasordines.forEach((gasordine: IGasordine) => {
myarr.push(
{
id: ind,
label: getSingleGasordine(gasordine),
value: gasordine._id
})
ind++
})
return myarr
}
function checkifCartDisable() { function checkifCartDisable() {
// return !myorder.idStorehouse // return !myorder.idStorehouse
return false return false
@@ -184,6 +223,10 @@ export default defineComponent({
myorder.idStorehouse = newval myorder.idStorehouse = newval
}) })
watch(() => gasordineSelected.value, (newval, oldval) => {
myorder.idGasordine = newval
})
function load() { function load() {
updateproduct() updateproduct()
// console.log('Load', myproduct.value.name) // console.log('Load', myproduct.value.name)
@@ -196,10 +239,19 @@ export default defineComponent({
myorder.idStorehouse = myproduct.value.storehouses[0]._id myorder.idStorehouse = myproduct.value.storehouses[0]._id
} }
if (myproduct.value.gasordines && myproduct.value.gasordines.length === 1) {
myorder.idGasordine = myproduct.value.gasordines[0]._id
}
const ord = products.getOrderProductInCart(myproduct.value._id) const ord = products.getOrderProductInCart(myproduct.value._id)
if (ord) { if (ord) {
myorder.quantity = ord.quantity myorder.quantity = ord.quantity
myorder.quantitypreordered = ord.quantitypreordered myorder.quantitypreordered = ord.quantitypreordered
if (ord.idGasordine)
gasordineSelected.value = ord.idGasordine!
} }
} }
@@ -258,6 +310,7 @@ export default defineComponent({
getclimgproduct, getclimgproduct,
getnumstore, getnumstore,
getSingleStorehouse, getSingleStorehouse,
getSingleGasordine,
getStorehouses, getStorehouses,
checkifCartDisable, checkifCartDisable,
myproduct, myproduct,
@@ -265,6 +318,7 @@ export default defineComponent({
tools, tools,
t, t,
storeSelected, storeSelected,
gasordineSelected,
enableSubQty, enableSubQty,
enableAddQty, enableAddQty,
getQtyAvailable, getQtyAvailable,
@@ -281,6 +335,7 @@ export default defineComponent({
getQtyBookableAvailable, getQtyBookableAvailable,
listord, listord,
sumval, sumval,
getGasordines,
} }
} }
}) })

View File

@@ -30,8 +30,8 @@
</div> </div>
</div> </div>
</q-item> </q-item>
<q-item> <q-item v-if="complete">
<div v-if="complete" class="row items-center"> <div class="row items-center">
<div class="text-title text-grey-9"> <div class="text-title text-grey-9">
<span class="text-grey-7" v-html="myproduct.description"></span> <span class="text-grey-7" v-html="myproduct.description"></span>
</div> </div>
@@ -66,6 +66,52 @@
</div> </div>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section avatar v-if="myproduct.weight">
<q-icon
name="fas fa-balance-scale"
style="padding-right: 16px !important"
/>
</q-item-section>
<q-item-section v-if="myproduct.weight">
<q-item-label>
{{ t('products.weight') }}
</q-item-label>
<q-item-label>
<span class="text-black q-ml-xs text-h8" v-if="myproduct.unit">
{{ myproduct.weight }}
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span
>
</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="myproduct.gasordines && myproduct.gasordines.length >= 1">
<q-item-section avatar>
<q-icon color="blue" name="fas fa-shipping-fast" />
</q-item-section>
<q-item-section>
<q-item-label>
{{ t('products.gasordine') }}
</q-item-label>
<q-item-label
v-if="(tools.isArray(myproduct.gasordines) && myproduct.gasordines.length > 1) && (!myorder.idGasordine || ((myorder.quantity + myorder.quantitypreordered) === 0 ))">
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
outlined
v-model="gasordineSelected"
:options="getGasordines()"
:label="t('products.select_gasordine') + `:`"
emit-value
map-options
>
</q-select>
</q-item-label>
<q-item-label v-else>
<span class="text-title text-center">{{
getSingleGasordine(myproduct.gasordines[0])
}}</span>
</q-item-label>
</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<div v-if="true"> <div v-if="true">
@@ -90,17 +136,6 @@
{{ myproduct.producer.name }}</span {{ myproduct.producer.name }}</span
> >
</div> </div>
<div
v-if="myproduct.weight"
class="text-grey text-title row items-center"
>
<q-icon name="fas fa-balance-scale" class="q-mr-xs" />
{{ t('products.weight') }}:
<span class="text-black q-ml-xs text-h8" v-if="myproduct.unit">
{{ myproduct.weight }}
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span
>
</div>
</div> </div>
<!--<q-rating v-model="myproduct.stars" :max="5" size="32px" readonly/>--> <!--<q-rating v-model="myproduct.stars" :max="5" size="32px" readonly/>-->
@@ -108,14 +143,15 @@
<div> <div>
<q-list> <q-list>
<q-item <q-item
v-if="
cosa === shared_consts.PROD.BOTTEGA ||
(cosa === shared_consts.PROD.GAS && getQtyAvailable() > 0)
"
:clickable="tools.isManager()" :clickable="tools.isManager()"
@click="tools.isManager() ? (visuListDisponibili()) : null" @click="tools.isManager() ? visuListDisponibili() : null"
> >
<q-item-section avatar> <q-item-section avatar>
<q-icon <q-icon color="green" name="fas fa-store" />
color="green"
name="fas fa-store"
/>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
@@ -146,9 +182,9 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item <q-item
v-if="getQtyBookableAvailable() > 0 || (myproduct.bookableQty > 0)" v-if="getQtyBookableAvailable() > 0 || myproduct.bookableQty > 0"
:clickable="tools.isManager()" :clickable="tools.isManager()"
@click="tools.isManager() ? (visuListBookable()) : null" @click="tools.isManager() ? visuListBookable() : null"
> >
<q-item-section avatar> <q-item-section avatar>
<q-icon color="blue" name="fas fa-edit" /> <q-icon color="blue" name="fas fa-edit" />
@@ -183,48 +219,6 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<div class="row q-mb-sm no-wrap items-center centeritems">
<q-btn
icon="fas fa-cart-arrow-down"
:color="enableSubQty() ? 'negative' : 'grey'"
:disable="checkifCartDisable() || !enableSubQty()"
rounded
size="md"
:label="t('products.subcart', { qta: 1 })"
@click="addtoCart(false)"
>
</q-btn>
<q-field
outlined
dense
style="width: 40px; height: 30px"
class="q-mx-xs"
>
<template v-slot:control>
<div class="self-center no-outline" tabindex="0">
{{ myorder.quantity }}
</div>
<div
v-if="myorder.quantitypreordered"
class="self-center no-outline"
tabindex="0"
>
</div>
</template>
</q-field>
<q-btn
icon-right="fas fa-cart-plus"
color="positive"
:disable="checkifCartDisable() || !enableAddQty()"
rounded
size="md"
:label="t('products.addcart', { qta: 1 })"
@click="addtoCart(true)"
>
</q-btn>
</div>
<div v-if="complete || getnumstore() > 1"> <div v-if="complete || getnumstore() > 1">
<div <div
class="text-blue text-title row items-center q-mr-md centeritems" class="text-blue text-title row items-center q-mr-md centeritems"
@@ -254,6 +248,42 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row q-mb-sm no-wrap items-center centeritems">
<q-btn
icon="fas fa-cart-arrow-down"
:color="enableSubQty() ? 'negative' : 'grey'"
:disable="checkifCartDisable() || !enableSubQty()"
rounded
size="md"
:label="t('products.subcart', { qta: 1 })"
@click="addtoCart(false)"
>
</q-btn>
<q-field
outlined
dense
style="width: 40px; height: 30px"
class="q-mx-xs"
>
<template v-slot:control>
<div class="self-center no-outline" tabindex="0">
{{ myorder.quantity + myorder.quantitypreordered }}
</div>
</template>
</q-field>
<q-btn
icon-right="fas fa-cart-plus"
color="positive"
:disable="checkifCartDisable() || !enableAddQty()"
rounded
size="md"
:label="t('products.addcart', { qta: 1 })"
@click="addtoCart(true)"
>
</q-btn>
</div>
<q-card-actions vertical align="center"> <q-card-actions vertical align="center">
<q-btn <q-btn
@@ -345,9 +375,7 @@
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="text-center"> <td class="text-center">
Totali: Totali:
<span class="totali">{{ <span class="totali">{{ sumval }}</span>
sumval
}}</span>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>

View File

@@ -31,3 +31,7 @@
color: green; color: green;
font-weight: bold; font-weight: bold;
} }
.gasordine {
font-style: italic;
color: blue;
}

View File

@@ -42,7 +42,7 @@ export default defineComponent({
function addsubqty(addqty: boolean, subqty: boolean) { function addsubqty(addqty: boolean, subqty: boolean) {
if (products.isQtyAvailableByOrder(props.order)) { if (products.isQtyAvailableByOrder(props.order)) {
if (addqty) { if (addqty) {
if (props.order.quantity >= 20) if (props.order.quantity >= 100)
return false return false
} }
@@ -54,7 +54,7 @@ export default defineComponent({
if (products.isInPreorderByOrder(props.order)) { if (products.isInPreorderByOrder(props.order)) {
if (addqty) { if (addqty) {
if (props.order.quantitypreordered >= 20) if (props.order.quantitypreordered >= 100)
return false return false
} }
@@ -99,6 +99,8 @@ export default defineComponent({
removeFromCard, removeFromCard,
isApplicatoSconto, isApplicatoSconto,
getRisparmio, getRisparmio,
tools,
products,
} }
}, },
}) })

View File

@@ -11,10 +11,15 @@
</q-img> </q-img>
</div> </div>
<div class="col-4 q-ml-xs"> <div class="col-4 q-ml-xs">
<div v-if="order.idGasordine" class="gasordine">
{{ products.getSingleGasordine(order, true) }}<br>
</div>
{{ order.product.name }} {{ order.product.name }}
<div v-if="showall">
<!--<div v-if="showalle">
<br /><span class="text-grey">{{ order.product.description }}</span> <br /><span class="text-grey">{{ order.product.description }}</span>
</div> </div>
-->
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="row q-mb-xs no-wrap items-center centeritems"> <div class="row q-mb-xs no-wrap items-center centeritems">
@@ -48,6 +53,13 @@
@click="addsubqty(true, false)" @click="addsubqty(true, false)"
></q-btn> ></q-btn>
</div> </div>
<div
class="text-black q-ml-xs text-h8 text-center"
v-if="order.product.unit"
>
{{ tools.getWeightTotalByOrder(order) }}
{{ tools.getUnitsMeasure(order.product.unit, true) }}
</div>
</div> </div>
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm"> <div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''" <span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"

View File

@@ -82,6 +82,8 @@ const msg_it = {
barcode: 'BarCode', barcode: 'BarCode',
price_acquistato: 'Prezzo Acquistato', price_acquistato: 'Prezzo Acquistato',
vegan: 'Vegano', vegan: 'Vegano',
gasordine: 'Ordine Gas',
select_gasordine: 'Scegli l\'Ordine del GAS'
}, },
storehouses: { storehouses: {
name: 'Magazzino', name: 'Magazzino',
@@ -1654,7 +1656,7 @@ const msg_it = {
ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.', ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.',
btn_cassa: 'Vai alla Cassa', btn_cassa: 'Vai alla Cassa',
available: 'Disponibili', available: 'Disponibili',
preorders: 'Pre-Ordinabili', preorders: 'Quantità Pre-Ordinabili',
preord: 'Pre-Ordinate', preord: 'Pre-Ordinate',
di_cui_x_in_carrello: '(nel tuo carrello: {qty})', di_cui_x_in_carrello: '(nel tuo carrello: {qty})',
evaso: 'Ordine Evaso', evaso: 'Ordine Evaso',
@@ -1676,13 +1678,16 @@ const msg_it = {
code_add_to_cart: 'Aggiungi un codice al carrello', code_add_to_cart: 'Aggiungi un codice al carrello',
qta_prenotate_in_attesa: '(Preordinate In attesa {qty})', qta_prenotate_in_attesa: '(Preordinate In attesa {qty})',
}, },
},
gas: { gas: {
name: 'Ordine Gas',
dataora_chiusura_ordini: 'Data Chiusura Ordini', dataora_chiusura_ordini: 'Data Chiusura Ordini',
dataora_ritiro: 'Data Ritiro Prodotti', dataora_ritiro: 'Data Ritiro',
ordina_sul_gas: 'Gruppo di Acquisto',
bottega: 'Bottega',
x_prodotti_gas: '{qta} prodotti',
x_prodotti_bottega: '{qta} prodotti',
} }
},
}; };
export default msg_it; export default msg_it;

View File

@@ -1979,7 +1979,7 @@ export const colTableProducts = [
}), }),
AddCol({ AddCol({
name: 'idGasordines', name: 'idGasordines',
label_trans: 'gasordine.name', label_trans: 'gas.name',
fieldtype: costanti.FieldType.multiselect, fieldtype: costanti.FieldType.multiselect,
jointable: 'gasordines', jointable: 'gasordines',
}), }),

View File

@@ -10,6 +10,7 @@ import {
IProject, IProject,
ITimeLineMain, ITimeLineMain,
ITodo, ITodo,
IOrder,
IUserFields, IUserFields,
Privacy, Privacy,
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang, IGroupShort, IPagination, IFavorite, IBookmark, TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang, IGroupShort, IPagination, IFavorite, IBookmark,
@@ -66,6 +67,7 @@ export const tools = {
COOK_SEARCH: 'SEARCH_', COOK_SEARCH: 'SEARCH_',
COOK_TAB_CIRCUIT: 'TAB_CIRC', COOK_TAB_CIRCUIT: 'TAB_CIRC',
COOK_COSA_PRODOTTI: 'PROD',
FRIENDS_SEARCH: 'FR_SE', FRIENDS_SEARCH: 'FR_SE',
GROUP_SEARCH: 'GR_SE', GROUP_SEARCH: 'GR_SE',
@@ -8250,6 +8252,10 @@ export const tools = {
return unitrec ? (short ? unitrec.short : unitrec.label) : '' return unitrec ? (short ? unitrec.short : unitrec.label) : ''
}, },
getWeightTotalByOrder(order: IOrder) {
return (order.product && order.product.weight ? order.product.weight : 1) * (order.quantitypreordered | 0 + order.quantity | 0)
},
isPartecipero(myrec: any) { isPartecipero(myrec: any) {
const userStore = useUserStore() const userStore = useUserStore()
if (myrec && myrec.mybookings && myrec.mybookings.length > 0) { if (myrec && myrec.mybookings && myrec.mybookings.length > 0) {

View File

@@ -12,6 +12,8 @@ import { toolsext } from '@store/Modules/toolsext'
import { useGlobalStore } from './globalStore' import { useGlobalStore } from './globalStore'
import { ref } from 'vue' import { ref } from 'vue'
import translate from '@src/globalroutines/util'
export const useProducts = defineStore('Products', { export const useProducts = defineStore('Products', {
state: (): IProductsState => ({ state: (): IProductsState => ({
products: [], products: [],
@@ -285,11 +287,12 @@ export const useProducts = defineStore('Products', {
quantity: order.quantity, quantity: order.quantity,
quantitypreordered: order.quantitypreordered, quantitypreordered: order.quantitypreordered,
idStorehouse: order.idStorehouse, idStorehouse: order.idStorehouse,
idGasordine: order.idGasordine,
idScontisticas: product.idScontisticas, idScontisticas: product.idScontisticas,
} }
if (product.storehouses.length === 1) { if (product.storehouses.length === 1) {
order.idStorehouse = product.storehouses[0]._id myorder.idStorehouse = product.storehouses[0]._id
} }
return myorder return myorder
@@ -731,7 +734,25 @@ export const useProducts = defineStore('Products', {
return false; return false;
}, },
getSingleGasordine(order: IOrder, short: boolean): string {
try {
const mygas = order.gasordine
if (mygas) {
if (short)
return mygas.name!
else
return mygas.name + ' (' + mygas.city + ') ' + translate('gas.dataora_chiusura_ordini') + ': ' + tools.getstrDateShort(mygas.dataora_chiusura_ordini)
+ ' ' + translate('gas.dataora_ritiro') + ': ' + tools.getstrDateShort(mygas.dataora_ritiro)
} else
return ''
} catch (e) {
return ''
}
}
}, },
}) })

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 { tools } from '@store/Modules/tools'
import { useUserStore } from '@store/UserStore' import { useUserStore } from '@store/UserStore'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@@ -28,9 +28,14 @@ export default defineComponent({
const search = ref('') 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() { function mounted() {
cosa.value = tools.getCookie(tools.COOK_COSA_PRODOTTI, shared_consts.PROD.BOTTEGA, true)
// Inizializza // Inizializza
productStore.loadProducts() productStore.loadProducts()
} }
@@ -48,6 +53,16 @@ export default defineComponent({
}); });
} }
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) onMounted(mounted)
return { return {
@@ -59,6 +74,8 @@ export default defineComponent({
search, search,
cosa, cosa,
shared_consts, shared_consts,
getNumQtaGas,
getNumQtaBottega,
} }
} }
}) })

View File

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

BIN
upload/products/S0001.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB