- Aggiornamento template mail (tramite i campi in HTML)
- Aggiornato Carrello
This commit is contained in:
@@ -33,28 +33,28 @@ export const shared_consts = {
|
||||
Units_Of_Measure_ListBox: [
|
||||
{
|
||||
label: '[Nessuno]',
|
||||
value: 0,
|
||||
short: '',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'Grammi (g)',
|
||||
value: 1,
|
||||
short: 'g',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: 'Chili (kg)',
|
||||
short: 'Kg',
|
||||
value: 2,
|
||||
short: 'kg',
|
||||
},
|
||||
{
|
||||
label: 'Litri (l)',
|
||||
label: 'Litri (L)',
|
||||
short: 'L',
|
||||
value: 3,
|
||||
short: 'lt',
|
||||
},
|
||||
{
|
||||
label: 'Pezzi (p)',
|
||||
short: 'p',
|
||||
value: 4,
|
||||
short: 'pz',
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ export default defineComponent({
|
||||
products.loadOrders()
|
||||
}
|
||||
|
||||
function existsOrders() {
|
||||
return products.getNumOrders() > 0
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -64,6 +68,8 @@ export default defineComponent({
|
||||
numOrders,
|
||||
closecart,
|
||||
getnumItemsCart,
|
||||
existsOrders,
|
||||
globalStore,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -4,23 +4,27 @@
|
||||
<div class="myheader row justify-between">
|
||||
<div class="col-6">
|
||||
<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() }}
|
||||
</q-badge>
|
||||
</q-btn>
|
||||
</div>
|
||||
<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 ">€ {{
|
||||
myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span>
|
||||
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span>
|
||||
<span class="text-subtitle1 q-mr-sm"
|
||||
>€ {{ myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div id="mybody">
|
||||
<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 v-if="numOrders === 0" style="text-align: center" class="text-grey">
|
||||
@@ -28,12 +32,31 @@
|
||||
</div>
|
||||
<div v-else style="text-align: center">
|
||||
<div class="text-center">
|
||||
<q-btn rounded icon="fas fa-shopping-cart" color="primary" :label="$t('ecomm.btn_cassa')"
|
||||
class="q-mb-sm" to="/checkout">
|
||||
<q-btn
|
||||
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>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@@ -192,16 +192,6 @@ export default defineComponent({
|
||||
return false
|
||||
}
|
||||
|
||||
function getQtyAvailable() {
|
||||
let qty = myproduct.value.quantityAvailable!
|
||||
return qty
|
||||
}
|
||||
|
||||
function getQtyBookableAvailable() {
|
||||
let qty = myproduct.value.bookableAvailableQty!
|
||||
return qty
|
||||
}
|
||||
|
||||
function getQtyWarn() {
|
||||
if (myorder.quantity > 0) {
|
||||
return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantity })
|
||||
@@ -274,55 +264,6 @@ export default defineComponent({
|
||||
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() {
|
||||
openlistorders.value = true
|
||||
@@ -362,9 +303,6 @@ export default defineComponent({
|
||||
t,
|
||||
storeSelected,
|
||||
gasordineSelected,
|
||||
enableSubQty,
|
||||
enableAddQty,
|
||||
getQtyAvailable,
|
||||
getQtyWarn,
|
||||
openlistorders,
|
||||
func_tools,
|
||||
@@ -375,12 +313,9 @@ export default defineComponent({
|
||||
shared_consts,
|
||||
site,
|
||||
getQtyWarnPreOrdered,
|
||||
getQtyBookableAvailable,
|
||||
listord,
|
||||
sumval,
|
||||
getGasordines,
|
||||
qtaNextAdd,
|
||||
qtaNextSub,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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-card
|
||||
@@ -163,7 +163,7 @@
|
||||
<q-item
|
||||
v-if="
|
||||
cosa === shared_consts.PROD.BOTTEGA ||
|
||||
(cosa === shared_consts.PROD.GAS && getQtyAvailable() > 0)
|
||||
(cosa === shared_consts.PROD.GAS && products.getQtyAvailable(myproduct) > 0)
|
||||
"
|
||||
:clickable="tools.isManager()"
|
||||
@click="tools.isManager() ? visuListDisponibili() : null"
|
||||
@@ -178,7 +178,7 @@
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<span class="prod_disp">
|
||||
{{ getQtyAvailable() }}
|
||||
{{ products.getQtyAvailable(myproduct) }}
|
||||
</span>
|
||||
<div class="prod_qtywarn">
|
||||
{{ getQtyWarn() }}
|
||||
@@ -200,7 +200,7 @@
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="getQtyBookableAvailable() > 0 || myproduct.bookableQty > 0"
|
||||
v-if="products.getQtyBookableAvailable(myproduct) > 0 || myproduct.bookableQty > 0"
|
||||
:clickable="tools.isManager()"
|
||||
@click="tools.isManager() ? visuListBookable() : null"
|
||||
>
|
||||
@@ -214,7 +214,7 @@
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<span class="prod_preorder">
|
||||
{{ getQtyBookableAvailable() }}
|
||||
{{ products.getQtyBookableAvailable(myproduct) }}
|
||||
</span>
|
||||
<div class="prod_qtywarn">
|
||||
<span v-if="getQtyWarnPreOrdered()">{{
|
||||
@@ -269,11 +269,11 @@
|
||||
<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()"
|
||||
:color="products.enableSubQty(myorder) ? 'negative' : 'grey'"
|
||||
:disable="checkifCartDisable() || !products.enableSubQty(myorder)"
|
||||
rounded
|
||||
size="md"
|
||||
:label="t('products.subcart', { qta: qtaNextSub() })"
|
||||
:label="t('products.subcart', { qta: products.qtaNextSub(myorder, myproduct) })"
|
||||
@click="addtoCart(false)"
|
||||
>
|
||||
</q-btn>
|
||||
@@ -294,10 +294,10 @@
|
||||
<q-btn
|
||||
icon-right="fas fa-cart-plus"
|
||||
color="positive"
|
||||
:disable="checkifCartDisable() || !enableAddQty()"
|
||||
:disable="checkifCartDisable() || !products.enableAddQty(myorder, myproduct)"
|
||||
rounded
|
||||
size="md"
|
||||
:label="t('products.addcart', { qta: qtaNextAdd() })"
|
||||
:label="t('products.addcart', { qta: products.qtaNextAdd(myorder, myproduct) })"
|
||||
@click="addtoCart(true)"
|
||||
>
|
||||
</q-btn>
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
}
|
||||
|
||||
.imgNormal{
|
||||
height: 80px;
|
||||
height: 110px !important;
|
||||
width: 80px;
|
||||
}
|
||||
.imgSmall{
|
||||
height: 50px;
|
||||
height: 60px !important;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
@@ -35,3 +35,11 @@
|
||||
font-style: italic;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.prezzo_singolo{
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.q-item__section--thumbnail img{
|
||||
height: 100px;
|
||||
}
|
||||
@@ -1,100 +1,130 @@
|
||||
<template>
|
||||
<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 class="col-2 text-h6 ellipsis">
|
||||
<q-img
|
||||
v-if="order.product && order.product.productInfo.img"
|
||||
:src="`` + order.product.productInfo.img"
|
||||
:alt="order.product.productInfo.name"
|
||||
:class="myimgclass"
|
||||
>
|
||||
</q-img>
|
||||
</div>
|
||||
<div class="col-4 q-ml-xs">
|
||||
<div v-if="order.idGasordine" class="gasordine">
|
||||
{{ products.getSingleGasordine(order, true) }}<br>
|
||||
</div>
|
||||
{{ order.product.productInfo.name }}
|
||||
<div v-if="order.product">
|
||||
<q-item>
|
||||
<q-item-section top thumbnail class="q-ml-none">
|
||||
<img
|
||||
v-if="order.product && order.product.productInfo.img"
|
||||
:src="`` + order.product.productInfo.img"
|
||||
:alt="order.product.productInfo.name"
|
||||
:class="myimgclass()"
|
||||
/>
|
||||
</q-item-section>
|
||||
|
||||
<!--<div v-if="showalle">
|
||||
<br /><span class="text-grey">{{ order.product.description }}</span>
|
||||
</div>
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
<div v-if="order.idGasordine" class="gasordine">
|
||||
{{ products.getSingleGasordine(order, true) }}<br />
|
||||
</div>
|
||||
{{ order.product.productInfo.name }}
|
||||
</q-item-label>
|
||||
<q-item-label caption>
|
||||
<div
|
||||
class="text-black text-h8"
|
||||
v-if="order.product.productInfo.unit"
|
||||
>
|
||||
{{ tools.getWeightTotalByOrder(order) }}
|
||||
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true) }}
|
||||
</div>
|
||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||
<q-btn
|
||||
v-if="showall && !nomodif"
|
||||
:disable="!products.enableSubQty(order)"
|
||||
size="sm"
|
||||
icon="fas fa-cart-arrow-down"
|
||||
:color="products.enableSubQty(order) ? 'negative' : 'grey'"
|
||||
@click="addsubqty(false, true)"
|
||||
rounded
|
||||
:label="
|
||||
t('products.subcart', {
|
||||
qta: products.qtaNextSub(order, order.product),
|
||||
})
|
||||
"
|
||||
></q-btn>
|
||||
<div v-if="showall" :class="`q-mx-sm text-blue-14`">
|
||||
{{ order.quantity }}
|
||||
</div>
|
||||
<div v-if="order.quantity > 0 && order.quantitypreordered > 0">
|
||||
+ {{ t('ecomm.preord') }}:
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="order.quantitypreordered > 0"
|
||||
:class="`q-mx-sm text-blue-14`"
|
||||
>
|
||||
{{ order.quantitypreordered }}
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="showall && !nomodif"
|
||||
icon-right="fas fa-cart-plus"
|
||||
color="positive"
|
||||
:disable="!products.enableAddQty(order, order.product)"
|
||||
rounded
|
||||
size="sm"
|
||||
:label="
|
||||
t('products.addcart', {
|
||||
qta: products.qtaNextAdd(order, order.product),
|
||||
})
|
||||
"
|
||||
@click="addsubqty(true, false)"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
||||
<span class="prezzo_singolo">
|
||||
{{ order.quantity + order.quantitypreordered }} x €
|
||||
{{ order.price ? order.price : 0 }}
|
||||
</span>
|
||||
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
|
||||
= €
|
||||
{{
|
||||
order.TotalPriceProduct
|
||||
? order.TotalPriceProduct.toFixed(2)
|
||||
: 0
|
||||
}}
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto()">
|
||||
<span class="ordine_scontato"
|
||||
>(<span class="barrato"
|
||||
>€
|
||||
{{
|
||||
(
|
||||
order.price * order.quantity +
|
||||
order.price * order.quantitypreordered
|
||||
).toFixed(2)
|
||||
}}</span
|
||||
>)</span
|
||||
>
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{
|
||||
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
|
||||
}}</span>
|
||||
</div>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
<q-item-section side top>
|
||||
<q-item-label>
|
||||
<div class="col-1">
|
||||
<q-btn
|
||||
v-if="!nomodif"
|
||||
icon="fas fa-trash"
|
||||
color="negative"
|
||||
round
|
||||
size="xs"
|
||||
@click="removeFromCard"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
<!--<q-item-section side top>
|
||||
<q-item-label caption>meta</q-item-label>
|
||||
</q-item-section>
|
||||
-->
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||
<q-btn
|
||||
v-if="showall && !nomodif"
|
||||
round
|
||||
size="xs"
|
||||
text-color="grey"
|
||||
icon="fas fa-minus"
|
||||
@click="addsubqty(false, true)"
|
||||
></q-btn>
|
||||
<div v-if="order.quantity > 0" :class="`q-mx-sm text-blue-14`">
|
||||
{{ order.quantity }}
|
||||
</div>
|
||||
<div v-if="order.quantity > 0 && order.quantitypreordered > 0">
|
||||
+ {{ t('ecomm.preord') }}:
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="order.quantitypreordered > 0"
|
||||
:class="`q-mx-sm text-blue-14`"
|
||||
>
|
||||
{{ order.quantitypreordered }}
|
||||
</div>
|
||||
<q-btn
|
||||
v-if="showall && !nomodif"
|
||||
round
|
||||
size="xs"
|
||||
text-color="grey"
|
||||
icon="fas fa-plus"
|
||||
@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) }}
|
||||
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
||||
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"
|
||||
>€ {{
|
||||
order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0
|
||||
}}</span
|
||||
>
|
||||
<span v-if="isApplicatoSconto()">
|
||||
<span class="ordine_scontato"
|
||||
>(<span class="barrato"
|
||||
>€
|
||||
{{
|
||||
(
|
||||
order.price * order.quantity +
|
||||
order.price * order.quantitypreordered
|
||||
).toFixed(2)
|
||||
}}</span
|
||||
>)</span
|
||||
>
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{
|
||||
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<q-btn
|
||||
v-if="!nomodif"
|
||||
icon="fas fa-times"
|
||||
color="negative"
|
||||
round
|
||||
size="xs"
|
||||
@click="removeFromCard"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-item>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
dense
|
||||
:class="
|
||||
bgcolor +
|
||||
` cursor-pointer q-my-sm ` +
|
||||
` cursor-pointer q-mx-sm ` +
|
||||
clcolor +
|
||||
` ` +
|
||||
myclass +
|
||||
|
||||
@@ -315,3 +315,7 @@ canvas {
|
||||
.titlesite {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.q-drawer-cart{
|
||||
width: 350px !important;
|
||||
}
|
||||
@@ -52,7 +52,9 @@
|
||||
<q-avatar @click="toHome" class="imglink">
|
||||
<img :src="imglogo()" height="27" alt="Immagine Logo" />
|
||||
</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>
|
||||
|
||||
<!--
|
||||
@@ -234,6 +236,7 @@
|
||||
<q-drawer
|
||||
v-if="site.confpages && site.confpages.enableEcommerce"
|
||||
v-model="rightCartOpen"
|
||||
class="q-drawer-cart"
|
||||
side="right"
|
||||
elevated
|
||||
>
|
||||
@@ -248,7 +251,7 @@
|
||||
>
|
||||
</q-btn>
|
||||
<div v-if="tools.isLogged()" class="text-weight-bold text-cart">
|
||||
Carrello
|
||||
{{ $t('ecomm.carrello') }}
|
||||
</div>
|
||||
<CMyCart v-if="isfinishLoading"></CMyCart>
|
||||
</q-drawer>
|
||||
@@ -373,7 +376,6 @@
|
||||
id="user-actions"
|
||||
class="column justify-center q-gutter-sm q-ma-sm center-150"
|
||||
>
|
||||
|
||||
<q-btn
|
||||
rounded
|
||||
color="primary"
|
||||
@@ -387,7 +389,8 @@
|
||||
color="orange"
|
||||
icon="house"
|
||||
:to="`/attivita/` + getMyUsername()"
|
||||
> {{ t('otherpages.myactivities') }}
|
||||
>
|
||||
{{ t('otherpages.myactivities') }}
|
||||
</q-btn>
|
||||
<!--<q-btn round color="warning" icon="lock"></q-btn>-->
|
||||
<q-btn
|
||||
|
||||
@@ -127,7 +127,12 @@ export interface IStorehouse {
|
||||
region?: string,
|
||||
img?: string,
|
||||
website?: string,
|
||||
email_html_header?: string,
|
||||
email_html_footer?: string,
|
||||
email_html_makeorder?: string,
|
||||
email_html_order_confirmed?: string,
|
||||
}
|
||||
|
||||
export interface IProvider {
|
||||
_id?: any
|
||||
idapp?: string
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useGlobalStore } from '@store/globalStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { IParamsQuery } from 'model'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { StringDecoder } from 'string_decoder'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Sendpushnotif',
|
||||
@@ -335,6 +336,23 @@ export default defineComponent({
|
||||
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)
|
||||
|
||||
let strris = ''
|
||||
@@ -373,22 +391,27 @@ export default defineComponent({
|
||||
|
||||
|
||||
} else if (cmd === shared_consts.Cmd.PRODUCTS) {
|
||||
if (!primo){
|
||||
if (!primo) {
|
||||
strris += ', '
|
||||
}
|
||||
strris += '{ '
|
||||
strris += ' "idapp":"' + tools.appid() + '"'
|
||||
strris += ', "code":"' + tools.removeescape(tools.addslashes(rec[0])) + '"'
|
||||
strris += ', "name":"' + tools.removeescape(tools.addslashes(rec[1])) + '"'
|
||||
strris += ', "price":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[2]))) + '"'
|
||||
strris += ', "stockQty":"' + tools.removeescape(tools.addslashes(rec[3])) + '"'
|
||||
strris += ', "link":"' + tools.removeescape(tools.addslashes(rec[4])) + '"'
|
||||
strris += ', "perc_iva":"' + tools.removeescape(tools.addslashes(rec[5])) + '"'
|
||||
strris += ', "price_acquistato":"' + tools.removeescape(tools.addslashes(tools.convertPriceEurToValue(rec[6]))) + '"'
|
||||
strris += ', "cat_name":"' + tools.removeescape(tools.addslashes(rec[7])) + '"'
|
||||
strris += ', "producer_name":"' + tools.removeescape(tools.addslashes(rec[8])) + '"'
|
||||
strris += ', "provider_name":"' + tools.removeescape(tools.addslashes(rec[9])) + '"'
|
||||
strris += ', "magazzino_name":"' + tools.removeescape(tools.addslashes(rec[10])) + '"'
|
||||
let col = 0;
|
||||
strris += addfield(col, 'idapp', rec, false, false, tools.appid(), true);
|
||||
strris += addfield(col, 'code', rec, false); col++;
|
||||
strris += addfield(col, 'name', rec, false); col++;
|
||||
strris += addfield(col, 'price', rec, true); col++;
|
||||
strris += addfield(col, 'stockQty', rec, true); col++;
|
||||
col++;
|
||||
strris += addfield(col, 'weight', rec, false, true); col++;
|
||||
strris += addfield(col, 'unit', rec, false); col++;
|
||||
strris += addfield(col, 'link', rec, false); col++;
|
||||
strris += addfield(col, 'perc_iva', rec, false); col++;
|
||||
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 += '} '
|
||||
|
||||
} else if (cmd === shared_consts.Cmd.CITIES_SERVER) {
|
||||
|
||||
@@ -1117,6 +1117,10 @@ const msg_it = {
|
||||
main: 'Principale',
|
||||
img: 'Immagine',
|
||||
icon: 'Icona',
|
||||
email_html_header: 'Instestazione',
|
||||
email_html_footer: 'Footer',
|
||||
email_html_makeorder: 'Ordine Inviato',
|
||||
email_html_order_confirmed: 'Ordine Confermato',
|
||||
},
|
||||
sectors: {
|
||||
name: 'Settore',
|
||||
@@ -1651,12 +1655,13 @@ const msg_it = {
|
||||
prod_sul_carrello: '{qty} {strprod} sul Carrello',
|
||||
prodotto_tolto: 'Il prodotto è stato tolto dal Carrello',
|
||||
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 ?',
|
||||
order: 'Ordine',
|
||||
ord_confirmed: 'Ordine Confermato',
|
||||
ord_not_confirmed: 'E\' avvenuto un errore. Ordine non Confermato. Ricaricare la pagina e riprovare.',
|
||||
btn_cassa: 'Vai alla Cassa',
|
||||
btn_ordini: 'Vai agli Ordini',
|
||||
available: 'Disponibili',
|
||||
preorders: 'Quantità Pre-Ordinabili',
|
||||
preord: 'Pre-Ordinate',
|
||||
|
||||
@@ -433,6 +433,10 @@ export const colTableStorehouse = [
|
||||
AddCol({ name: 'region', label_trans: 'store.region' }),
|
||||
AddCol({ name: 'img', label_trans: 'store.img' }),
|
||||
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(DuplicateRec),
|
||||
]
|
||||
|
||||
@@ -137,6 +137,10 @@ export const useProducts = defineStore('Products', {
|
||||
return state.orders
|
||||
},
|
||||
|
||||
getNumOrders: (state: IProductsState) => (): number => {
|
||||
return state.orders.length
|
||||
},
|
||||
|
||||
getOrdersCart: (state: IProductsState) => (tipoord: number): IOrderCart[] | undefined => {
|
||||
console.log('state.orders', state.orders)
|
||||
if (tipoord === shared_consts.OrderStat.IN_CORSO.value)
|
||||
@@ -510,7 +514,9 @@ export const useProducts = defineStore('Products', {
|
||||
subqty: !addqty,
|
||||
order: ordcart,
|
||||
}).then((res: any) => {
|
||||
if (res && res.risult) {
|
||||
if (res && res.msgerr) {
|
||||
return res;
|
||||
} else if (res && res.risult) {
|
||||
order.quantity = res.myord.quantity
|
||||
order.quantitypreordered = res.myord.quantitypreordered
|
||||
}
|
||||
@@ -557,7 +563,7 @@ export const useProducts = defineStore('Products', {
|
||||
}
|
||||
this.updateDataProduct(res)
|
||||
|
||||
return { risult: !!res, myord: res.data.myord }
|
||||
return { risult: !!res, myord: res.data.myord, msgerr: res.data.msgerr }
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error addToCart', error)
|
||||
@@ -583,10 +589,10 @@ export const useProducts = defineStore('Products', {
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/cart/' + userStore.my._id, 'POST', { addqty, subqty, order })
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
this.updateDataProduct(res)
|
||||
|
||||
return { risult: !!res, myord: res.data.myord }
|
||||
return { risult: !!res, myord: res.data.myord, msgerr: res.msgerr }
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error addSubQtyToItem', error)
|
||||
@@ -690,38 +696,42 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
return await this.addToCart({ product, order, addqty })
|
||||
.then((ris) => {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
|
||||
let msg = ''
|
||||
console.log('ris', ris)
|
||||
if (ris && ris.myord == null) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
tools.showNotif($q, msg)
|
||||
return
|
||||
}
|
||||
if (ris === null || ris.myord == null) {
|
||||
msg = t('ecomm.error_cart')
|
||||
tools.showNegativeNotif($q, msg)
|
||||
return
|
||||
if (ris && ris.msgerr) {
|
||||
tools.showNegativeNotif($q, ris.msgerr)
|
||||
} else {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
|
||||
let qta = ris.myord.quantity + ris.myord.quantitypreordered
|
||||
if (qta > 1 || qta === 0)
|
||||
strprod = t('ecomm.prodotti')
|
||||
|
||||
if (qta > 0) {
|
||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: qta })
|
||||
let msg = ''
|
||||
console.log('ris', ris)
|
||||
if (ris && ris.myord == null) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
tools.showNotif($q, msg)
|
||||
return
|
||||
}
|
||||
if (ris === null || ris.myord == null) {
|
||||
msg = t('ecomm.error_cart')
|
||||
tools.showNegativeNotif($q, msg)
|
||||
return
|
||||
} else {
|
||||
|
||||
let qta = ris.myord.quantity + ris.myord.quantitypreordered
|
||||
if (qta > 1 || qta === 0)
|
||||
strprod = t('ecomm.prodotti')
|
||||
|
||||
if (qta > 0) {
|
||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: qta })
|
||||
}
|
||||
|
||||
}
|
||||
if (ris === null || ris.myord.quantity === 0)
|
||||
tools.showNotif($q, msg)
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
|
||||
}
|
||||
|
||||
//updateproduct()
|
||||
|
||||
if (ris === null || ris.myord.quantity === 0)
|
||||
tools.showNotif($q, msg)
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
return ris
|
||||
})
|
||||
},
|
||||
@@ -783,7 +793,68 @@ export const useProducts = defineStore('Products', {
|
||||
} catch (e) {
|
||||
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
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
|
||||
BIN
upload/products/5600872803133.jpg
Normal file
BIN
upload/products/5600872803133.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
BIN
upload/products/8017977043550.jpg
Normal file
BIN
upload/products/8017977043550.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
Reference in New Issue
Block a user