- Aggiornamento template mail (tramite i campi in HTML)

- Aggiornato Carrello
This commit is contained in:
Surya Paolo
2023-12-28 00:50:42 +01:00
parent 6be8ccc906
commit d90b46c206
17 changed files with 354 additions and 237 deletions

View File

@@ -33,28 +33,28 @@ export const shared_consts = {
Units_Of_Measure_ListBox: [ Units_Of_Measure_ListBox: [
{ {
label: '[Nessuno]', label: '[Nessuno]',
value: 0,
short: '', short: '',
value: 0,
}, },
{ {
label: 'Grammi (g)', label: 'Grammi (g)',
value: 1,
short: 'g', short: 'g',
value: 1,
}, },
{ {
label: 'Chili (kg)', label: 'Chili (kg)',
short: 'Kg',
value: 2, value: 2,
short: 'kg',
}, },
{ {
label: 'Litri (l)', label: 'Litri (L)',
short: 'L',
value: 3, value: 3,
short: 'lt',
}, },
{ {
label: 'Pezzi (p)', label: 'Pezzi (p)',
short: 'p',
value: 4, value: 4,
short: 'pz',
}, },
], ],

View File

@@ -55,6 +55,10 @@ export default defineComponent({
products.loadOrders() products.loadOrders()
} }
function existsOrders() {
return products.getNumOrders() > 0
}
onMounted(mounted) onMounted(mounted)
return { return {
@@ -64,6 +68,8 @@ export default defineComponent({
numOrders, numOrders,
closecart, closecart,
getnumItemsCart, getnumItemsCart,
existsOrders,
globalStore,
} }
}, },
}) })

View File

@@ -4,23 +4,27 @@
<div class="myheader row justify-between"> <div class="myheader row justify-between">
<div class="col-6"> <div class="col-6">
<q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart"> <q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart">
<q-badge v-if="getnumItemsCart() > 0" color="red" floating transparent> <q-badge
v-if="getnumItemsCart() > 0"
color="red"
floating
transparent
>
{{ getnumItemsCart() }} {{ getnumItemsCart() }}
</q-badge> </q-badge>
</q-btn> </q-btn>
</div> </div>
<div class="col-6" style="text-align: right"> <div class="col-6" style="text-align: right">
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span> <span class="text-subtitle1 q-mr-sm "> {{ <span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span>
myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span> <span class="text-subtitle1 q-mr-sm"
> {{ myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span
>
</div> </div>
</div> </div>
<q-separator></q-separator> <q-separator></q-separator>
<div id="mybody"> <div id="mybody">
<div v-for="(rec, index) in ordersCart" :key="index" class="col"> <div v-for="(rec, index) in ordersCart" :key="index" class="col">
<CSingleCart :order="rec.order" :showall="false"> </CSingleCart>
<CSingleCart :order="rec.order" :showall="false">
</CSingleCart>
</div> </div>
</div> </div>
<div v-if="numOrders === 0" style="text-align: center" class="text-grey"> <div v-if="numOrders === 0" style="text-align: center" class="text-grey">
@@ -28,12 +32,31 @@
</div> </div>
<div v-else style="text-align: center"> <div v-else style="text-align: center">
<div class="text-center"> <div class="text-center">
<q-btn rounded icon="fas fa-shopping-cart" color="primary" :label="$t('ecomm.btn_cassa')" <q-btn
class="q-mb-sm" to="/checkout"> rounded
icon="fas fa-shopping-cart"
color="primary"
:label="$t('ecomm.btn_cassa')"
@click="globalStore.rightCartOpen = false"
class="q-mb-sm"
to="/checkout"
>
</q-btn> </q-btn>
</div> </div>
</div> </div>
<div class="text-center">
<q-btn
v-if="existsOrders()"
rounded
icon="fas fa-clipboard-list"
color="positive"
:label="$t('ecomm.btn_ordini')"
class="q-mb-sm"
@click="globalStore.rightCartOpen = false"
to="/orderinfo"
>
</q-btn>
</div>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -192,16 +192,6 @@ export default defineComponent({
return false return false
} }
function getQtyAvailable() {
let qty = myproduct.value.quantityAvailable!
return qty
}
function getQtyBookableAvailable() {
let qty = myproduct.value.bookableAvailableQty!
return qty
}
function getQtyWarn() { function getQtyWarn() {
if (myorder.quantity > 0) { if (myorder.quantity > 0) {
return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantity }) return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantity })
@@ -274,55 +264,6 @@ export default defineComponent({
return 'myimgproduct centermydiv' return 'myimgproduct centermydiv'
} }
function enableSubQty() {
let qty = myorder.quantity + myorder.quantitypreordered
return qty ? qty > 0 : false
}
function enableAddQty() {
if (site.value.ecomm && site.value.ecomm.enablePreOrders) {
return (getQtyBookableAvailable() > 0
&& (myproduct.value.maxBookableQty === 0
|| (myorder.quantitypreordered + 1 < myproduct.value.maxBookableQty))
)
|| (getQtyAvailable() > 0)
&& (myproduct.value.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.value.maxBookableQty ))
} else {
return (getQtyAvailable() > 0)
&& (myproduct.value.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.value.maxBookableQty ))
}
}
function qtaNextAdd() {
let step = 1
if (getQtyAvailable() > 0) {
if (myorder.quantity === 0)
step = myproduct.value.minBuyQty | 1
} else {
if (myorder.quantitypreordered === 0)
step = myproduct.value.minBuyQty | 1
}
return step
}
function qtaNextSub() {
let step = 1
let minqta = myproduct.value.minBuyQty | 1
if (getQtyAvailable() > 0) {
if (myorder.quantity === minqta)
step = minqta
} else {
if (myorder.quantitypreordered === minqta)
step = minqta
}
return step
}
function visuListDisponibili() { function visuListDisponibili() {
openlistorders.value = true openlistorders.value = true
@@ -362,9 +303,6 @@ export default defineComponent({
t, t,
storeSelected, storeSelected,
gasordineSelected, gasordineSelected,
enableSubQty,
enableAddQty,
getQtyAvailable,
getQtyWarn, getQtyWarn,
openlistorders, openlistorders,
func_tools, func_tools,
@@ -375,12 +313,9 @@ export default defineComponent({
shared_consts, shared_consts,
site, site,
getQtyWarnPreOrdered, getQtyWarnPreOrdered,
getQtyBookableAvailable,
listord, listord,
sumval, sumval,
getGasordines, getGasordines,
qtaNextAdd,
qtaNextSub,
} }
} }
}) })

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="q-pa-md row items-start q-gutter-md"> <div class="row items-start q-gutter-md">
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" /> <q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
<q-card <q-card
@@ -163,7 +163,7 @@
<q-item <q-item
v-if=" v-if="
cosa === shared_consts.PROD.BOTTEGA || cosa === shared_consts.PROD.BOTTEGA ||
(cosa === shared_consts.PROD.GAS && getQtyAvailable() > 0) (cosa === shared_consts.PROD.GAS && products.getQtyAvailable(myproduct) > 0)
" "
:clickable="tools.isManager()" :clickable="tools.isManager()"
@click="tools.isManager() ? visuListDisponibili() : null" @click="tools.isManager() ? visuListDisponibili() : null"
@@ -178,7 +178,7 @@
</q-item-label> </q-item-label>
<q-item-label> <q-item-label>
<span class="prod_disp"> <span class="prod_disp">
{{ getQtyAvailable() }} {{ products.getQtyAvailable(myproduct) }}
</span> </span>
<div class="prod_qtywarn"> <div class="prod_qtywarn">
{{ getQtyWarn() }} {{ getQtyWarn() }}
@@ -200,7 +200,7 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item <q-item
v-if="getQtyBookableAvailable() > 0 || myproduct.bookableQty > 0" v-if="products.getQtyBookableAvailable(myproduct) > 0 || myproduct.bookableQty > 0"
:clickable="tools.isManager()" :clickable="tools.isManager()"
@click="tools.isManager() ? visuListBookable() : null" @click="tools.isManager() ? visuListBookable() : null"
> >
@@ -214,7 +214,7 @@
</q-item-label> </q-item-label>
<q-item-label> <q-item-label>
<span class="prod_preorder"> <span class="prod_preorder">
{{ getQtyBookableAvailable() }} {{ products.getQtyBookableAvailable(myproduct) }}
</span> </span>
<div class="prod_qtywarn"> <div class="prod_qtywarn">
<span v-if="getQtyWarnPreOrdered()">{{ <span v-if="getQtyWarnPreOrdered()">{{
@@ -269,11 +269,11 @@
<div class="row q-mb-sm no-wrap items-center centeritems"> <div class="row q-mb-sm no-wrap items-center centeritems">
<q-btn <q-btn
icon="fas fa-cart-arrow-down" icon="fas fa-cart-arrow-down"
:color="enableSubQty() ? 'negative' : 'grey'" :color="products.enableSubQty(myorder) ? 'negative' : 'grey'"
:disable="checkifCartDisable() || !enableSubQty()" :disable="checkifCartDisable() || !products.enableSubQty(myorder)"
rounded rounded
size="md" size="md"
:label="t('products.subcart', { qta: qtaNextSub() })" :label="t('products.subcart', { qta: products.qtaNextSub(myorder, myproduct) })"
@click="addtoCart(false)" @click="addtoCart(false)"
> >
</q-btn> </q-btn>
@@ -294,10 +294,10 @@
<q-btn <q-btn
icon-right="fas fa-cart-plus" icon-right="fas fa-cart-plus"
color="positive" color="positive"
:disable="checkifCartDisable() || !enableAddQty()" :disable="checkifCartDisable() || !products.enableAddQty(myorder, myproduct)"
rounded rounded
size="md" size="md"
:label="t('products.addcart', { qta: qtaNextAdd() })" :label="t('products.addcart', { qta: products.qtaNextAdd(myorder, myproduct) })"
@click="addtoCart(true)" @click="addtoCart(true)"
> >
</q-btn> </q-btn>

View File

@@ -7,11 +7,11 @@
} }
.imgNormal{ .imgNormal{
height: 80px; height: 110px !important;
width: 80px; width: 80px;
} }
.imgSmall{ .imgSmall{
height: 50px; height: 60px !important;
width: 50px; width: 50px;
} }
@@ -35,3 +35,11 @@
font-style: italic; font-style: italic;
color: blue; color: blue;
} }
.prezzo_singolo{
font-style: italic;
}
.q-item__section--thumbnail img{
height: 100px;
}

View File

@@ -1,37 +1,47 @@
<template> <template>
<div v-if="order && order.product" class="q-pa-xs q-gutter-xs"> <div v-if="order && order.product" class="q-pa-xs q-gutter-xs">
<div v-if="order.product" class="row items-center justify-evenly no-wrap"> <div v-if="order.product">
<div class="col-2 text-h6 ellipsis"> <q-item>
<q-img <q-item-section top thumbnail class="q-ml-none">
<img
v-if="order.product && order.product.productInfo.img" v-if="order.product && order.product.productInfo.img"
:src="`` + order.product.productInfo.img" :src="`` + order.product.productInfo.img"
:alt="order.product.productInfo.name" :alt="order.product.productInfo.name"
:class="myimgclass" :class="myimgclass()"
> />
</q-img> </q-item-section>
</div>
<div class="col-4 q-ml-xs"> <q-item-section>
<q-item-label>
<div v-if="order.idGasordine" class="gasordine"> <div v-if="order.idGasordine" class="gasordine">
{{ products.getSingleGasordine(order, true) }}<br> {{ products.getSingleGasordine(order, true) }}<br />
</div> </div>
{{ order.product.productInfo.name }} {{ order.product.productInfo.name }}
</q-item-label>
<!--<div v-if="showalle"> <q-item-label caption>
<br /><span class="text-grey">{{ order.product.description }}</span> <div
class="text-black text-h8"
v-if="order.product.productInfo.unit"
>
{{ tools.getWeightTotalByOrder(order) }}
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true) }}
</div> </div>
-->
</div>
<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">
<q-btn <q-btn
v-if="showall && !nomodif" v-if="showall && !nomodif"
round :disable="!products.enableSubQty(order)"
size="xs" size="sm"
text-color="grey" icon="fas fa-cart-arrow-down"
icon="fas fa-minus" :color="products.enableSubQty(order) ? 'negative' : 'grey'"
@click="addsubqty(false, true)" @click="addsubqty(false, true)"
rounded
:label="
t('products.subcart', {
qta: products.qtaNextSub(order, order.product),
})
"
></q-btn> ></q-btn>
<div v-if="order.quantity > 0" :class="`q-mx-sm text-blue-14`"> <div v-if="showall" :class="`q-mx-sm text-blue-14`">
{{ order.quantity }} {{ order.quantity }}
</div> </div>
<div v-if="order.quantity > 0 && order.quantitypreordered > 0"> <div v-if="order.quantity > 0 && order.quantitypreordered > 0">
@@ -46,27 +56,35 @@
</div> </div>
<q-btn <q-btn
v-if="showall && !nomodif" v-if="showall && !nomodif"
round icon-right="fas fa-cart-plus"
size="xs" color="positive"
text-color="grey" :disable="!products.enableAddQty(order, order.product)"
icon="fas fa-plus" rounded
size="sm"
:label="
t('products.addcart', {
qta: products.qtaNextAdd(order, order.product),
})
"
@click="addsubqty(true, false)" @click="addsubqty(true, false)"
></q-btn>
</div>
<div
class="text-black q-ml-xs text-h8 text-center"
v-if="order.product.productInfo.unit"
> >
{{ tools.getWeightTotalByOrder(order) }} </q-btn>
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true) }}
</div>
</div> </div>
</q-item-label>
<q-item-label>
<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="prezzo_singolo">
>&nbsp;{{ {{ order.quantity + order.quantitypreordered }} x
order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 {{ order.price ? order.price : 0 }}
}}</span </span>
> <span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
=
{{
order.TotalPriceProduct
? order.TotalPriceProduct.toFixed(2)
: 0
}}
</span>
<span v-if="isApplicatoSconto()"> <span v-if="isApplicatoSconto()">
&nbsp;<span class="ordine_scontato" &nbsp;<span class="ordine_scontato"
>(<span class="barrato" >(<span class="barrato"
@@ -84,10 +102,14 @@
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() }) $t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
}}</span> }}</span>
</div> </div>
</q-item-label>
</q-item-section>
<q-item-section side top>
<q-item-label>
<div class="col-1"> <div class="col-1">
<q-btn <q-btn
v-if="!nomodif" v-if="!nomodif"
icon="fas fa-times" icon="fas fa-trash"
color="negative" color="negative"
round round
size="xs" size="xs"
@@ -95,6 +117,14 @@
> >
</q-btn> </q-btn>
</div> </div>
</q-item-label>
</q-item-section>
<!--<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
-->
</q-item>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -7,7 +7,7 @@
dense dense
:class=" :class="
bgcolor + bgcolor +
` cursor-pointer q-my-sm ` + ` cursor-pointer q-mx-sm ` +
clcolor + clcolor +
` ` + ` ` +
myclass + myclass +

View File

@@ -315,3 +315,7 @@ canvas {
.titlesite { .titlesite {
font-size: 1rem; font-size: 1rem;
} }
.q-drawer-cart{
width: 350px !important;
}

View File

@@ -52,7 +52,9 @@
<q-avatar @click="toHome" class="imglink"> <q-avatar @click="toHome" class="imglink">
<img :src="imglogo()" height="27" alt="Immagine Logo" /> <img :src="imglogo()" height="27" alt="Immagine Logo" />
</q-avatar> </q-avatar>
<div v-if="$q.screen.gt.xs" class="q-mx-sm titlesite">{{ getappname() }}</div> <div v-if="$q.screen.gt.xs" class="q-mx-sm titlesite">
{{ getappname() }}
</div>
</q-toolbar-title> </q-toolbar-title>
<!-- <!--
@@ -234,6 +236,7 @@
<q-drawer <q-drawer
v-if="site.confpages && site.confpages.enableEcommerce" v-if="site.confpages && site.confpages.enableEcommerce"
v-model="rightCartOpen" v-model="rightCartOpen"
class="q-drawer-cart"
side="right" side="right"
elevated elevated
> >
@@ -248,7 +251,7 @@
> >
</q-btn> </q-btn>
<div v-if="tools.isLogged()" class="text-weight-bold text-cart"> <div v-if="tools.isLogged()" class="text-weight-bold text-cart">
Carrello {{ $t('ecomm.carrello') }}
</div> </div>
<CMyCart v-if="isfinishLoading"></CMyCart> <CMyCart v-if="isfinishLoading"></CMyCart>
</q-drawer> </q-drawer>
@@ -373,7 +376,6 @@
id="user-actions" id="user-actions"
class="column justify-center q-gutter-sm q-ma-sm center-150" class="column justify-center q-gutter-sm q-ma-sm center-150"
> >
<q-btn <q-btn
rounded rounded
color="primary" color="primary"
@@ -387,7 +389,8 @@
color="orange" color="orange"
icon="house" icon="house"
:to="`/attivita/` + getMyUsername()" :to="`/attivita/` + getMyUsername()"
> &nbsp;{{ t('otherpages.myactivities') }} >
&nbsp;{{ t('otherpages.myactivities') }}
</q-btn> </q-btn>
<!--<q-btn round color="warning" icon="lock"></q-btn>--> <!--<q-btn round color="warning" icon="lock"></q-btn>-->
<q-btn <q-btn

View File

@@ -127,7 +127,12 @@ export interface IStorehouse {
region?: string, region?: string,
img?: string, img?: string,
website?: string, website?: string,
email_html_header?: string,
email_html_footer?: string,
email_html_makeorder?: string,
email_html_order_confirmed?: string,
} }
export interface IProvider { export interface IProvider {
_id?: any _id?: any
idapp?: string idapp?: string

View File

@@ -10,6 +10,7 @@ import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { IParamsQuery } from 'model' import { IParamsQuery } from 'model'
import { toolsext } from '@store/Modules/toolsext' import { toolsext } from '@store/Modules/toolsext'
import { StringDecoder } from 'string_decoder'
export default defineComponent({ export default defineComponent({
name: 'Sendpushnotif', name: 'Sendpushnotif',
@@ -335,6 +336,23 @@ export default defineComponent({
return importNoSpazi(cmd, testo); return importNoSpazi(cmd, testo);
} }
function addfield(col: number, field: string, rec: any, conv_euro: boolean, isnumero?: boolean, strinput?: string, primo?: boolean) {
let risultato = ''
let valstr = strinput ? strinput : rec[col]
if (isnumero) {
valstr = valstr.replace(',', '.');
}
if (conv_euro) {
valstr = tools.convertPriceEurToValue(valstr)
}
valstr = tools.removeescape(tools.addslashes(valstr))
if (!primo)
risultato += ', '
risultato += '"' + field + '":"' + valstr + '"'
return risultato;
}
const myarr = tools.CSVToArray(testo, delim) const myarr = tools.CSVToArray(testo, delim)
let strris = '' let strris = ''
@@ -373,22 +391,27 @@ export default defineComponent({
} else if (cmd === shared_consts.Cmd.PRODUCTS) { } else if (cmd === shared_consts.Cmd.PRODUCTS) {
if (!primo){ if (!primo) {
strris += ', ' strris += ', '
} }
strris += '{ ' strris += '{ '
strris += ' "idapp":"' + tools.appid() + '"' let col = 0;
strris += ', "code":"' + tools.removeescape(tools.addslashes(rec[0])) + '"' strris += addfield(col, 'idapp', rec, false, false, tools.appid(), true);
strris += ', "name":"' + tools.removeescape(tools.addslashes(rec[1])) + '"' strris += addfield(col, 'code', rec, false); col++;
strris += ', "price":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[2]))) + '"' strris += addfield(col, 'name', rec, false); col++;
strris += ', "stockQty":"' + tools.removeescape(tools.addslashes(rec[3])) + '"' strris += addfield(col, 'price', rec, true); col++;
strris += ', "link":"' + tools.removeescape(tools.addslashes(rec[4])) + '"' strris += addfield(col, 'stockQty', rec, true); col++;
strris += ', "perc_iva":"' + tools.removeescape(tools.addslashes(rec[5])) + '"' col++;
strris += ', "price_acquistato":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[6]))) + '"' strris += addfield(col, 'weight', rec, false, true); col++;
strris += ', "cat_name":"' + tools.removeescape(tools.addslashes(rec[7])) + '"' strris += addfield(col, 'unit', rec, false); col++;
strris += ', "producer_name":"' + tools.removeescape(tools.addslashes(rec[8])) + '"' strris += addfield(col, 'link', rec, false); col++;
strris += ', "provider_name":"' + tools.removeescape(tools.addslashes(rec[9])) + '"' strris += addfield(col, 'perc_iva', rec, false); col++;
strris += ', "magazzino_name":"' + tools.removeescape(tools.addslashes(rec[10])) + '"' strris += addfield(col, 'price_acquistato', rec, true); col++;
strris += addfield(col, 'minBuyQty', rec, true); col++;
strris += addfield(col, 'cat_name', rec, false); col++;
strris += addfield(col, 'producer_name', rec, false); col++;
strris += addfield(col, 'provider_name', rec, false); col++;
strris += addfield(col, 'magazzino_name', rec, false); col++;
strris += '} ' strris += '} '
} else if (cmd === shared_consts.Cmd.CITIES_SERVER) { } else if (cmd === shared_consts.Cmd.CITIES_SERVER) {

View File

@@ -1117,6 +1117,10 @@ const msg_it = {
main: 'Principale', main: 'Principale',
img: 'Immagine', img: 'Immagine',
icon: 'Icona', icon: 'Icona',
email_html_header: 'Instestazione',
email_html_footer: 'Footer',
email_html_makeorder: 'Ordine Inviato',
email_html_order_confirmed: 'Ordine Confermato',
}, },
sectors: { sectors: {
name: 'Settore', name: 'Settore',
@@ -1651,12 +1655,13 @@ const msg_it = {
prod_sul_carrello: '{qty} {strprod} sul Carrello', prod_sul_carrello: '{qty} {strprod} sul Carrello',
prodotto_tolto: 'Il prodotto è stato tolto dal Carrello', prodotto_tolto: 'Il prodotto è stato tolto dal Carrello',
error_cart: 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.', error_cart: 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.',
completa_ord: 'Completa l\'Ordine', completa_ord: 'Invia l\'Ordine',
conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?', conferma_acq: 'Confermare l\'ordine di acquisto di {qty} prodotti ?',
order: 'Ordine', order: 'Ordine',
ord_confirmed: 'Ordine Confermato', ord_confirmed: 'Ordine Confermato',
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',
btn_ordini: 'Vai agli Ordini',
available: 'Disponibili', available: 'Disponibili',
preorders: 'Quantità Pre-Ordinabili', preorders: 'Quantità Pre-Ordinabili',
preord: 'Pre-Ordinate', preord: 'Pre-Ordinate',

View File

@@ -433,6 +433,10 @@ export const colTableStorehouse = [
AddCol({ name: 'region', label_trans: 'store.region' }), AddCol({ name: 'region', label_trans: 'store.region' }),
AddCol({ name: 'img', label_trans: 'store.img' }), AddCol({ name: 'img', label_trans: 'store.img' }),
AddCol({ name: 'website', label_trans: 'reg.website' }), AddCol({ name: 'website', label_trans: 'reg.website' }),
AddCol({ name: 'email_html_header', label_trans: 'store.email_html_header', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_footer', label_trans: 'store.email_html_footer', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_makeorder', label_trans: 'store.email_html_makeorder', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_order_confirmed', label_trans: 'store.email_html_order_confirmed', fieldtype: costanti.FieldType.html }),
AddCol(DeleteRec), AddCol(DeleteRec),
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]

View File

@@ -137,6 +137,10 @@ export const useProducts = defineStore('Products', {
return state.orders return state.orders
}, },
getNumOrders: (state: IProductsState) => (): number => {
return state.orders.length
},
getOrdersCart: (state: IProductsState) => (tipoord: number): IOrderCart[] | undefined => { getOrdersCart: (state: IProductsState) => (tipoord: number): IOrderCart[] | undefined => {
console.log('state.orders', state.orders) console.log('state.orders', state.orders)
if (tipoord === shared_consts.OrderStat.IN_CORSO.value) if (tipoord === shared_consts.OrderStat.IN_CORSO.value)
@@ -510,7 +514,9 @@ export const useProducts = defineStore('Products', {
subqty: !addqty, subqty: !addqty,
order: ordcart, order: ordcart,
}).then((res: any) => { }).then((res: any) => {
if (res && res.risult) { if (res && res.msgerr) {
return res;
} else if (res && res.risult) {
order.quantity = res.myord.quantity order.quantity = res.myord.quantity
order.quantitypreordered = res.myord.quantitypreordered order.quantitypreordered = res.myord.quantitypreordered
} }
@@ -557,7 +563,7 @@ export const useProducts = defineStore('Products', {
} }
this.updateDataProduct(res) this.updateDataProduct(res)
return { risult: !!res, myord: res.data.myord } return { risult: !!res, myord: res.data.myord, msgerr: res.data.msgerr }
}) })
.catch((error) => { .catch((error) => {
console.log('error addToCart', error) console.log('error addToCart', error)
@@ -583,10 +589,10 @@ export const useProducts = defineStore('Products', {
let ris = null let ris = null
ris = await Api.SendReq('/cart/' + userStore.my._id, 'POST', { addqty, subqty, order }) ris = await Api.SendReq('/cart/' + userStore.my._id, 'POST', { addqty, subqty, order })
.then((res) => { .then((res: any) => {
this.updateDataProduct(res) this.updateDataProduct(res)
return { risult: !!res, myord: res.data.myord } return { risult: !!res, myord: res.data.myord, msgerr: res.msgerr }
}) })
.catch((error) => { .catch((error) => {
console.log('error addSubQtyToItem', error) console.log('error addSubQtyToItem', error)
@@ -690,6 +696,9 @@ export const useProducts = defineStore('Products', {
return await this.addToCart({ product, order, addqty }) return await this.addToCart({ product, order, addqty })
.then((ris) => { .then((ris) => {
if (ris && ris.msgerr) {
tools.showNegativeNotif($q, ris.msgerr)
} else {
let strprod = t('ecomm.prodotto') let strprod = t('ecomm.prodotto')
let msg = '' let msg = ''
@@ -714,14 +723,15 @@ export const useProducts = defineStore('Products', {
} }
} }
//updateproduct()
if (ris === null || ris.myord.quantity === 0) if (ris === null || ris.myord.quantity === 0)
tools.showNotif($q, msg) tools.showNotif($q, msg)
else else
tools.showPositiveNotif($q, msg) tools.showPositiveNotif($q, msg)
}
//updateproduct()
return ris return ris
}) })
}, },
@@ -783,10 +793,71 @@ export const useProducts = defineStore('Products', {
} catch (e) { } catch (e) {
return '' return ''
} }
},
getQtyAvailable(myproduct: IProduct): number {
let qty = myproduct.quantityAvailable!
return qty
},
getQtyBookableAvailable(myproduct: IProduct): number {
let qty = myproduct.bookableAvailableQty!
return qty
},
enableSubQty(myorder: IOrder): boolean {
let qty = myorder.quantity + myorder.quantitypreordered
return qty ? qty > 0 : false
},
enableAddQty(myorder: IOrder, myproduct: IProduct): boolean {
const globalStore = useGlobalStore()
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
return (this.getQtyBookableAvailable(myproduct) > 0
&& (myproduct.maxBookableQty === 0
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableQty))
)
|| (this.getQtyAvailable(myproduct) > 0)
&& (myproduct.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
} else {
return (this.getQtyAvailable(myproduct) > 0)
&& (myproduct.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
} }
}, },
qtaNextAdd(myorder: IOrder, myproduct: IProduct): number {
let step = 1
if (this.getQtyAvailable(myproduct) > 0) {
if (myorder.quantity === 0)
step = myproduct.minBuyQty | 1
} else {
if (myorder.quantitypreordered === 0)
step = myproduct.minBuyQty | 1
}
return step
},
qtaNextSub(myorder: IOrder, myproduct: IProduct) {
let step = 1
let minqta = myproduct.minBuyQty | 1
if (this.getQtyAvailable(myproduct) > 0) {
if (myorder.quantity === minqta)
step = minqta
} else {
if (myorder.quantitypreordered === minqta)
step = minqta
}
return step
},
},
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB