++ Cassa - parte 1

This commit is contained in:
Surya Paolo
2024-01-02 15:24:57 +01:00
parent a2cab9ca60
commit 89d095d1c9
18 changed files with 441 additions and 376 deletions

View File

@@ -31,6 +31,27 @@ export const shared_consts = {
PEZZI: 4, PEZZI: 4,
}, },
TYPECASH: {
NESSUNO: 0,
IN: 1,
OUT: 2,
},
TypeCashStr: [
{
label: '[Nessuno]',
value: 0,
},
{
label: 'Ingresso',
value: 1,
},
{
label: 'Uscita',
value: 2,
},
],
Units_Of_Measure_ListBox: [ Units_Of_Measure_ListBox: [
{ {
label: '[Nessuno]', label: '[Nessuno]',

View File

@@ -97,3 +97,27 @@
max-height: 100%; max-height: 100%;
} }
.titolo_prod{
cursor: pointer;
}
.image-section {
justify-content: center;
}
.image-container {
width: 300px;
height: 300px;
position: relative;
overflow: hidden;
@media (max-width: 718px) {
width: 200px;
height: 200px;
}
}
.img-pic {
width: 100%;
height: 100%;
object-fit: cover;
}

View File

@@ -15,6 +15,7 @@ import { tools } from '@store/Modules/tools'
import { useProducts } from '@store/Products' import { useProducts } from '@store/Products'
import { shared_consts } from '@src/common/shared_vuejs' import { shared_consts } from '@src/common/shared_vuejs'
import { useRouter } from 'vue-router'
export default defineComponent({ export default defineComponent({
name: 'CProductCard', name: 'CProductCard',
@@ -53,6 +54,8 @@ export default defineComponent({
const site = ref(globalStore.site) const site = ref(globalStore.site)
const $router = useRouter()
const fullscreenImage = ref(<any>null) const fullscreenImage = ref(<any>null)
let myorder = reactive(<IOrder>{ let myorder = reactive(<IOrder>{
@@ -293,6 +296,7 @@ export default defineComponent({
function load() { function load() {
initproduct() initproduct()
updateproduct() updateproduct()
// console.log('Load', myproduct.value.name) // console.log('Load', myproduct.value.name)
// console.log('created Cproductcard', code) // console.log('created Cproductcard', code)
@@ -406,6 +410,10 @@ export default defineComponent({
fullscreenImage.value.fullscreenImage.style.transform = 'scale(1)'; fullscreenImage.value.fullscreenImage.style.transform = 'scale(1)';
} }
function naviga(path: string) {
$router.push(path)
}
onMounted(mounted) onMounted(mounted)
onBeforeUnmount(beforeDestroy) onBeforeUnmount(beforeDestroy)
@@ -450,7 +458,8 @@ export default defineComponent({
onTouchStart, onTouchStart,
onTouchMove, onTouchMove,
onTouchEnd, onTouchEnd,
$router,
naviga,
} }
} }
}) })

View File

@@ -1,163 +1,120 @@
<template> <template>
<div class="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 :class="{
:class="{ 'my-card-big': complete,
'my-card-big': complete, 'my-card-prod': !complete,
'my-card-prod': !complete, 'my-card-selected':
'my-card-selected': myorder && myorder.quantity + myorder.quantitypreordered > 0,
myorder && myorder.quantity + myorder.quantitypreordered > 0, }" v-if="!!myproduct && endload && !!myproduct.productInfo" bordered>
}" <q-card-section horizontal class="image-section">
v-if="!!myproduct && endload && !!myproduct.productInfo" <div class="image-container">
bordered <q-img :src="`` + myproduct.productInfo.img" :alt="myproduct.productInfo.name" class="cursor-pointer img-pic"
> @click="complete ? toggleFullScreen : naviga(`/product/` + myproduct._id + '/' + cosa)"></q-img>
<q-card-section horizontal> <q-btn color="primary" round icon="fas fa-eye" class="absolute semi-transparent" size="md"
<q-img
:src="`` + myproduct.productInfo.img"
:alt="myproduct.productInfo.name"
class="col-7 cursor-pointer"
@click="toggleFullScreen" @click="toggleFullScreen"
></q-img> style="bottom: -10px; right: 0px; transform: translateY(-50%);" />
<q-btn </div>
v-if="!complete" <q-btn v-if="!complete" fab color="primary" icon="fas fa-info" class="absolute semi-transparent"
fab style="top: 0; right: 12px; transform: translateY(-90%)" :to="`/product/` + myproduct._id + '/' + cosa" />
color="primary" <q-list>
icon="fas fa-info" <q-item>
class="absolute semi-transparent" <q-item-section avatar>
style="top: 0; right: 12px; transform: translateY(-90%)" <q-icon color="moneygreen" name="fas fa-euro-sign" class="icone_prod" />
:to="`/product/` + myproduct._id + '/' + cosa" </q-item-section>
/>
<q-card-section> <q-item-section>
<q-list> <q-item-label>
<q-item> <span class="prod_price" v-if="!!myproduct.price">{{
<q-item-section avatar> myproduct.price ? myproduct.price.toFixed(2) : 0
<q-icon }}</span>
color="moneygreen" <span v-if="!!myproduct.after_price">{{
name="fas fa-euro-sign" myproduct.after_price
class="icone_prod" }}</span>
/> </q-item-label>
</q-item-section> <q-item-label v-if="myproduct.scontisticas && myproduct.scontisticas.length > 0
">
<div class="prod_sconti" v-for="(sconti, index) of myproduct.scontisticas" :key="index">
{{ sconti.description }}
</div>
</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar v-if="myproduct.productInfo.weight">
<q-icon name="fas fa-balance-scale" class="icone_prod" />
</q-item-section>
<q-item-section v-if="myproduct.productInfo.weight">
<q-item-label>
<span class="text-black q-ml-xs text-h8" v-if="myproduct.productInfo.unit">
{{ myproduct.productInfo.weight }}
{{
tools.getUnitsMeasure(myproduct.productInfo.unit, true)
}}</span>
</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="cosa === shared_consts.PROD.BOTTEGA ||
(cosa === shared_consts.PROD.GAS &&
products.getQtyAvailable(myproduct) > 0)
" :clickable="tools.isManager()" @click="
tools.isManager() &&
myproduct.QuantitaOrdinateInAttesa &&
myproduct.QuantitaOrdinateInAttesa > 0
? visuListDisponibili()
: null
">
<q-item-section avatar>
<q-icon color="green" name="fas fa-store" class="icone_prod" />
</q-item-section>
<q-item-section> <q-item-section>
<q-item-label> <q-item-label class="subtit_prod">
<span class="prod_price" v-if="!!myproduct.price">{{ {{ t('ecomm.available') }}
myproduct.price ? myproduct.price.toFixed(2) : 0 </q-item-label>
}}</span> <q-item-label>
<span v-if="!!myproduct.after_price">{{ <span class="prod_disp">
myproduct.after_price {{ products.getQtyAvailable(myproduct) }}
}}</span> </span>
</q-item-label> <div class="prod_qtywarn">
<q-item-label <div v-if="tools.isManager() &&
v-if=" !!myproduct.QuantitaOrdinateInAttesa
myproduct.scontisticas && myproduct.scontisticas.length > 0 ">
"
>
<div
class="prod_sconti"
v-for="(sconti, index) of myproduct.scontisticas"
:key="index"
>
{{ sconti.description }}
</div>
</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section avatar v-if="myproduct.productInfo.weight">
<q-icon name="fas fa-balance-scale" class="icone_prod" />
</q-item-section>
<q-item-section v-if="myproduct.productInfo.weight">
<q-item-label>
<span
class="text-black q-ml-xs text-h8"
v-if="myproduct.productInfo.unit"
>
{{ myproduct.productInfo.weight }}
{{ {{
tools.getUnitsMeasure(myproduct.productInfo.unit, true) t('ecomm.qta_in_attesa', {
}}</span qty: myproduct.QuantitaOrdinateInAttesa,
> })
</q-item-label> }}
</q-item-section>
</q-item>
<q-item
v-if="
cosa === shared_consts.PROD.BOTTEGA ||
(cosa === shared_consts.PROD.GAS &&
products.getQtyAvailable(myproduct) > 0)
"
:clickable="tools.isManager()"
@click="
tools.isManager() &&
myproduct.QuantitaOrdinateInAttesa &&
myproduct.QuantitaOrdinateInAttesa > 0
? visuListDisponibili()
: null
"
>
<q-item-section avatar>
<q-icon color="green" name="fas fa-store" class="icone_prod" />
</q-item-section>
<q-item-section>
<q-item-label class="subtit_prod">
{{ t('ecomm.available') }}
</q-item-label>
<q-item-label>
<span class="prod_disp">
{{ products.getQtyAvailable(myproduct) }}
</span>
<div class="prod_qtywarn">
<div
v-if="
tools.isManager() &&
!!myproduct.QuantitaOrdinateInAttesa
"
>
{{
t('ecomm.qta_in_attesa', {
qty: myproduct.QuantitaOrdinateInAttesa,
})
}}
</div>
</div> </div>
</div>
</q-item-label>
</q-item-section>
<q-item-section v-if="tools.isManager() &&
products.getQtyBloccataAvailable(myproduct) > 0
">
<q-item-section avatar>
<q-icon name="fas fa-store" style="padding-right: 16px !important" />
</q-item-section>
<q-item-section v-if="tools.isManager() &&
products.getQtyBloccataAvailable(myproduct) > 0
">
<q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label>
<q-item-label>
<span class="text-black q-ml-xs text-h8">
{{ products.getQtyBloccataAvailable(myproduct) }}</span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section </q-item-section>
v-if=" </q-item>
tools.isManager() && </q-list>
products.getQtyBloccataAvailable(myproduct) > 0
"
>
<q-item-section avatar>
<q-icon
name="fas fa-store"
style="padding-right: 16px !important"
/>
</q-item-section>
<q-item-section
v-if="
tools.isManager() &&
products.getQtyBloccataAvailable(myproduct) > 0
"
>
<q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label>
<q-item-label>
<span class="text-black q-ml-xs text-h8">
{{ products.getQtyBloccataAvailable(myproduct) }}</span
>
</q-item-label>
</q-item-section>
</q-item-section>
</q-item>
</q-list>
</q-card-section>
</q-card-section> </q-card-section>
<q-card-section> <q-card-section>
<div class="column items-center centeritems"> <div class="column items-center centeritems">
<div class="text-h7 boldhigh"> <div class="text-h7 boldhigh titolo_prod">
{{ myproduct.productInfo.name }} {{ myproduct.productInfo.name }}
</div> </div>
<div class="product_code"> <div class="product_code">
@@ -168,10 +125,29 @@
<q-card-section v-if="complete && myproduct.productInfo.description"> <q-card-section v-if="complete && myproduct.productInfo.description">
<div class="row items-center"> <div class="row items-center">
<div class="text-title text-grey-9"> <div class="text-title text-grey-9">
<span <span class="text-grey-7" v-html="myproduct.productInfo.description"></span>
class="text-grey-7" </div>
v-html="myproduct.productInfo.description" </div>
></span> </q-card-section>
<q-card-section v-if="complete && myproduct.productInfo.ingredienti">
<div class="text-blue text-title row">
<q-icon size="sm" name="fas fa-list-ul" class="q-mr-sm" />
{{ t('products.ingredienti') }}
</div>
<div class="row items-center">
<div class="text-title text-grey-9">
<span class="text-grey-7" v-html="myproduct.productInfo.ingredienti"></span>
</div>
</div>
</q-card-section>
<q-card-section v-if="complete && myproduct.productInfo.valori_nutrizionali">
<div class="text-blue text-title row">
<q-icon size="sm" name="fas fa-info" class="q-mr-sm" />
{{ t('products.valori_nutrizionali') }}
</div>
<div class="row items-center">
<div class="text-title text-grey-9">
<span class="text-grey-7" v-html="myproduct.productInfo.valori_nutrizionali"></span>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
@@ -180,19 +156,10 @@
<q-icon size="sm" name="fas fa-people-carry" class="q-mr-sm" /> <q-icon size="sm" name="fas fa-people-carry" class="q-mr-sm" />
{{ t('products.ritiro_presso') }}: {{ t('products.ritiro_presso') }}:
</div> </div>
<div <div class="text-green-6 text-title row items-center q-my-sm centeritems">
class="text-green-6 text-title row items-center q-my-sm centeritems"
>
<div v-if="getnumstore() > 1"> <div v-if="getnumstore() > 1">
<q-select <q-select :behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" outlined v-model="storeSelected"
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" :options="getStorehouses()" :label="t('products.magazzino') + `:`" emit-value map-options>
outlined
v-model="storeSelected"
:options="getStorehouses()"
:label="t('products.magazzino') + `:`"
emit-value
map-options
>
</q-select> </q-select>
</div> </div>
<div v-else> <div v-else>
@@ -202,9 +169,7 @@
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
<q-card-section <q-card-section v-if="complete && myproduct.producer && myproduct.producer.city">
v-if="complete && myproduct.producer && myproduct.producer.city"
>
<div> <div>
<div class="text-grey text-title row items-center q-mt-sm"> <div class="text-grey text-title row items-center q-mt-sm">
<q-icon name="map" class="q-mr-xs" /> <q-icon name="map" class="q-mr-xs" />
@@ -212,19 +177,15 @@
<span class="text-blue q-ml-xs text-h8"> <span class="text-blue q-ml-xs text-h8">
{{ myproduct.producer.city }} ({{ {{ myproduct.producer.city }} ({{
myproduct.producer.region myproduct.producer.region
}})</span }})</span>
>
</div> </div>
</div> </div>
<div <div v-if="complete && myproduct.producer && myproduct.producer.name"
v-if="complete && myproduct.producer && myproduct.producer.name" class="text-grey text-title row items-center">
class="text-grey text-title row items-center"
>
<q-icon name="place" class="q-mr-xs" /> <q-icon name="place" class="q-mr-xs" />
{{ t('products.producer') }}: {{ t('products.producer') }}:
<span class="text-black q-ml-xs text-h8"> <span class="text-black q-ml-xs text-h8">
{{ myproduct.producer.name }}</span {{ myproduct.producer.name }}</span>
>
</div> </div>
</q-card-section> </q-card-section>
@@ -242,20 +203,15 @@
</q-item> </q-item>
</q-card-section> </q-card-section>
<q-card-section v-if="isOrdGas()"> <q-card-section v-if="isOrdGas()">
<q-item <q-item v-if="products.getQtyBookableAvailable(myproduct) > 0 ||
v-if=" myproduct.maxbookableGASQty > 0
products.getQtyBookableAvailable(myproduct) > 0 || " :clickable="tools.isManager()" @click="
myproduct.maxbookableGASQty > 0 tools.isManager() &&
" myproduct.QuantitaPrenotateInAttesa &&
:clickable="tools.isManager()" myproduct.QuantitaPrenotateInAttesa > 0
@click=" ? visuListBookable()
tools.isManager() && : null
myproduct.QuantitaPrenotateInAttesa && ">
myproduct.QuantitaPrenotateInAttesa > 0
? 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" />
</q-item-section> </q-item-section>
@@ -269,11 +225,8 @@
{{ products.getQtyBookableAvailable(myproduct) }} {{ products.getQtyBookableAvailable(myproduct) }}
</span> </span>
<div class="prod_qtywarn"> <div class="prod_qtywarn">
<div <div v-if="tools.isManager() && !!myproduct.QuantitaPrenotateInAttesa
v-if=" ">
tools.isManager() && !!myproduct.QuantitaPrenotateInAttesa
"
>
{{ {{
t('ecomm.qta_prenotate_in_attesa', { t('ecomm.qta_prenotate_in_attesa', {
qty: myproduct.QuantitaPrenotateInAttesa, qty: myproduct.QuantitaPrenotateInAttesa,
@@ -283,17 +236,11 @@
</div> </div>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section <q-item-section v-if="tools.isManager() &&
v-if="
tools.isManager() &&
products.getQtyBloccataBookableAvailable(myproduct) > 0 products.getQtyBloccataBookableAvailable(myproduct) > 0
" ">
>
<q-item-section avatar> <q-item-section avatar>
<q-icon <q-icon name="fas fa-store" style="padding-right: 16px !important" />
name="fas fa-store"
style="padding-right: 16px !important"
/>
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
<q-item-label class="subtit_prod"> <q-item-label class="subtit_prod">
@@ -303,8 +250,7 @@
<span class="text-black q-ml-xs text-h8"> <span class="text-black q-ml-xs text-h8">
{{ {{
products.getQtyBloccataBookableAvailable(myproduct) products.getQtyBloccataBookableAvailable(myproduct)
}}</span }}</span>
>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item-section> </q-item-section>
@@ -318,23 +264,13 @@
<q-item-label class="subtit_prod"> <q-item-label class="subtit_prod">
{{ t('products.gasordine') }} {{ t('products.gasordine') }}
</q-item-label> </q-item-label>
<q-item-label <q-item-label v-if="tools.isArray(myproduct.gasordines) &&
v-if=" myproduct.gasordines.length > 1 &&
tools.isArray(myproduct.gasordines) && (!myorder.idGasordine ||
myproduct.gasordines.length > 1 && myorder.quantity + myorder.quantitypreordered === 0)
(!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
: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-select>
</q-item-label> </q-item-label>
<q-item-label v-else> <q-item-label v-else>
@@ -345,40 +281,26 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item <q-item v-if="tools.isManager() && products.getQtyBloccataAvailable(myproduct) > 0
v-if=" ">
tools.isManager() && products.getQtyBloccataAvailable(myproduct) > 0
"
>
<q-item-section> <q-item-section>
<q-item-section avatar> <q-item-section avatar>
<q-icon <q-icon name="fas fa-store" style="padding-right: 16px !important" />
name="fas fa-store"
style="padding-right: 16px !important"
/>
</q-item-section> </q-item-section>
<q-item-section <q-item-section v-if="tools.isManager() &&
v-if=" products.getQtyBloccataAvailable(myproduct) > 0
tools.isManager() && ">
products.getQtyBloccataAvailable(myproduct) > 0
"
>
<q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label> <q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label>
<q-item-label> <q-item-label>
<span class="text-black q-ml-xs text-h8"> <span class="text-black q-ml-xs text-h8">
{{ products.getQtyBloccataAvailable(myproduct) }}</span {{ products.getQtyBloccataAvailable(myproduct) }}</span>
>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="isOrdGas() && myproduct.qtyToReachForGas > 0"> <q-item v-if="isOrdGas() && myproduct.qtyToReachForGas > 0">
<q-item-section avatar> <q-item-section avatar>
<q-icon <q-icon v-if="getpercqtaraggiunta() < 1" color="orange" name="fas fa-lightbulb" />
v-if="getpercqtaraggiunta() < 1"
color="orange"
name="fas fa-lightbulb"
/>
<q-icon v-else color="green" name="fas fa-check" /> <q-icon v-else color="green" name="fas fa-check" />
</q-item-section> </q-item-section>
@@ -408,11 +330,8 @@
<q-linear-progress size="10px" :value="getpercqtaraggiunta()" /> <q-linear-progress size="10px" :value="getpercqtaraggiunta()" />
</span> </span>
<div class="prod_qtywarn"> <div class="prod_qtywarn">
<div <div v-if="tools.isManager() && !!myproduct.QuantitaOrdinateInAttesa
v-if=" ">
tools.isManager() && !!myproduct.QuantitaOrdinateInAttesa
"
>
{{ {{
t('ecomm.qta_in_attesa', { t('ecomm.qta_in_attesa', {
qty: myproduct.QuantitaOrdinateInAttesa, qty: myproduct.QuantitaOrdinateInAttesa,
@@ -422,29 +341,19 @@
</div> </div>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section <q-item-section v-if="tools.isManager() &&
v-if="
tools.isManager() &&
products.getQtyBloccataAvailable(myproduct) > 0 products.getQtyBloccataAvailable(myproduct) > 0
" ">
>
<q-item-section avatar> <q-item-section avatar>
<q-icon <q-icon name="fas fa-store" style="padding-right: 16px !important" />
name="fas fa-store"
style="padding-right: 16px !important"
/>
</q-item-section> </q-item-section>
<q-item-section <q-item-section v-if="tools.isManager() &&
v-if=" products.getQtyBloccataAvailable(myproduct) > 0
tools.isManager() && ">
products.getQtyBloccataAvailable(myproduct) > 0
"
>
<q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label> <q-item-label> {{ t('ecomm.bloccati') }}: </q-item-label>
<q-item-label> <q-item-label>
<span class="text-black q-ml-xs text-h8"> <span class="text-black q-ml-xs text-h8">
{{ products.getQtyBloccataAvailable(myproduct) }}</span {{ products.getQtyBloccataAvailable(myproduct) }}</span>
>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item-section> </q-item-section>
@@ -497,19 +406,11 @@
<q-card-section> <q-card-section>
<div class="row justify-evenly"> <div class="row justify-evenly">
<q-btn <q-btn icon="fas fa-cart-arrow-down" :color="products.enableSubQty(myorder) ? 'negative' : 'grey'"
icon="fas fa-cart-arrow-down" :disable="checkifCartDisable() || !products.enableSubQty(myorder)" rounded size="md" :label="t('products.subcart', {
:color="products.enableSubQty(myorder) ? 'negative' : 'grey'" qta: products.qtaNextSub(myorder, myproduct),
:disable="checkifCartDisable() || !products.enableSubQty(myorder)" })
rounded " @click="addtoCart(false)">
size="md"
:label="
t('products.subcart', {
qta: products.qtaNextSub(myorder, myproduct),
})
"
@click="addtoCart(false)"
>
</q-btn> </q-btn>
<q-field outlined dense class="q-mx-xs"> <q-field outlined dense class="q-mx-xs">
@@ -520,31 +421,14 @@
</template> </template>
</q-field> </q-field>
<q-btn <q-btn icon-right="fas fa-cart-plus" color="positive" :disable="checkifCartDisable() || !products.enableAddQty(myorder, myproduct)
icon-right="fas fa-cart-plus" " rounded size="md" :label="t('products.addcart', {
color="positive" qta: products.qtaNextAdd(myorder, myproduct),
:disable=" })
checkifCartDisable() || !products.enableAddQty(myorder, myproduct) " @click="addtoCart(true)">
"
rounded
size="md"
:label="
t('products.addcart', {
qta: products.qtaNextAdd(myorder, myproduct),
})
"
@click="addtoCart(true)"
>
</q-btn> </q-btn>
<q-btn <q-btn v-if="myorder.quantity + myorder.quantitypreordered > 0" rounded icon="fas fa-shopping-cart"
v-if="myorder.quantity + myorder.quantitypreordered > 0" color="primary" :label="t('ecomm.btn_cassa')" class="q-mb-xs q-mt-md" to="/checkout"></q-btn>
rounded
icon="fas fa-shopping-cart"
color="primary"
:label="t('ecomm.btn_cassa')"
class="q-mb-xs q-mt-md"
to="/checkout"
></q-btn>
</div> </div>
</q-card-section> </q-card-section>
</q-card> </q-card>
@@ -558,12 +442,7 @@
<q-btn flat round color="white" icon="close" v-close-popup></q-btn> <q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-toolbar> </q-toolbar>
<q-card-section class="q-pa-xs inset-shadow"> <q-card-section class="q-pa-xs inset-shadow">
<q-markup-table <q-markup-table wrap-cells bordered separator="horizontal" class="listaev__table">
wrap-cells
bordered
separator="horizontal"
class="listaev__table"
>
<thead> <thead>
<th>Data</th> <th>Data</th>
<th>Persona</th> <th>Persona</th>
@@ -573,11 +452,7 @@
</thead> </thead>
<tbody> <tbody>
<tr <tr v-for="(ordcart, index) of listord" :key="index" class="listaev listaev__table">
v-for="(ordcart, index) of listord"
:key="index"
class="listaev listaev__table"
>
<td class="text-center"> <td class="text-center">
<div> <div>
{{ func_tools.getDateTimeShortStr(ordcart.created_at) }} {{ func_tools.getDateTimeShortStr(ordcart.created_at) }}
@@ -595,22 +470,14 @@
</td> </td>
<td class="text-center"> <td class="text-center">
<div v-for="(singleord, index) in ordcart.items" :key="index"> <div v-for="(singleord, index) in ordcart.items" :key="index">
<span <span v-if="singleord.order.idProduct === myproduct._id &&
v-if=" singleord.order.quantity > 0
singleord.order.idProduct === myproduct._id && ">
singleord.order.quantity > 0 {{ singleord.order.quantity }}</span>
" <span v-if="singleord.order.idProduct === myproduct._id &&
> singleord.order.quantitypreordered > 0
{{ singleord.order.quantity }}</span ">
> {{ singleord.order.quantitypreordered }}</span>
<span
v-if="
singleord.order.idProduct === myproduct._id &&
singleord.order.quantitypreordered > 0
"
>
{{ singleord.order.quantitypreordered }}</span
>
</div> </div>
</td> </td>
<td class="text-center"> <td class="text-center">
@@ -632,38 +499,14 @@
</q-card> </q-card>
</q-dialog> </q-dialog>
<q-dialog <q-dialog v-model="isFullScreen" position="top" :maximized="true" class="q-pt-none">
v-model="isFullScreen" <div v-if="isFullScreen" class="fullscreen-container" @touchmove.prevent @click="toggleFullScreen">
position="top" <q-img :src="`` + myproduct.productInfo.img" :alt="myproduct.productInfo.name" :fit="tools.isMobile() ? 'fill' : 'none'"
:maximized="true" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd" ref="fullscreenImage" />
class="q-pt-none"
>
<div
v-if="isFullScreen"
class="fullscreen-container"
@touchmove.prevent
@click="toggleFullScreen"
>
<img
:src="`` + myproduct.productInfo.img"
:alt="myproduct.productInfo.name"
class="fullscreen-image"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
ref="fullscreenImage"
/>
<br /> <br />
</div> </div>
<div class="text-center"> <div class="text-center">
<q-btn <q-btn class="q-ma-md" @click="isFullScreen = false" label="Chiudi" rounded color="primary" icon="close"></q-btn>
class="q-ma-md"
@click="isFullScreen = false"
label="Chiudi"
rounded
color="primary"
icon="close"
></q-btn>
</div> </div>
</q-dialog> </q-dialog>
</div> </div>

View File

@@ -31,6 +31,7 @@ const msg_website_it = {
producer: 'Produttore', producer: 'Produttore',
orderinfo: 'Ordini Effettuati', orderinfo: 'Ordini Effettuati',
products: 'Prodotti', products: 'Prodotti',
cash: 'Cassa',
productInfos: 'Info Prodotti', productInfos: 'Info Prodotti',
listinoprodotti: 'Listino Prodotti', listinoprodotti: 'Listino Prodotti',
productslist: 'Lista Prodotti', productslist: 'Lista Prodotti',

View File

@@ -17,6 +17,8 @@ export interface IProductInfo {
date?: Date, date?: Date,
icon?: string, icon?: string,
img?: string img?: string
ingredienti?: string,
valori_nutrizionali?: string,
} }
export interface IProduct { export interface IProduct {
@@ -133,6 +135,7 @@ export interface IStorehouse {
_id?: any _id?: any
idapp?: string idapp?: string
name?: string, name?: string,
username?: string,
description?: string, description?: string,
referent?: string, referent?: string,
address?: string, address?: string,

View File

24
src/rootgen/admin/cash/cash.ts Executable file
View File

@@ -0,0 +1,24 @@
import { defineComponent } from 'vue'
import { CImgText } from '../../../components/CImgText/index'
import { CCard } from '@/components/CCard'
import { CMyPage } from '@/components/CMyPage'
import { CTitleBanner } from '@/components/CTitleBanner'
import { CGridTableRec } from '@/components/CGridTableRec'
import { colTableCash } from '@src/store/Modules/fieldsTable'
import MixinMetaTags from '@/mixins/mixin-metatags'
export default defineComponent({
name: 'Cash',
components: { CImgText, CCard, CMyPage, CTitleBanner, CGridTableRec },
setup() {
const { setmeta } = MixinMetaTags()
return {
colTableCash,
setmeta,
}
}
})

32
src/rootgen/admin/cash/cash.vue Executable file
View File

@@ -0,0 +1,32 @@
<template>
<CMyPage title="Cassa" imgbackground="images/prodotti.jpg" sizes="max-height: 120px">
<span>{{
setmeta({
title: 'Cassa',
description: '',
keywords: '',
})
}}
</span>
<div class="q-ma-sm q-gutter-sm q-pa-xs">
<CTitleBanner title="Cassa"></CTitleBanner>
<CGridTableRec
prop_mytable="cashs"
prop_mytitle="Cassa"
:prop_mycolumns="colTableCash"
prop_colkey="name"
nodataLabel="Nessuna Cassa"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato">
</CGridTableRec>
</div>
</CMyPage>
</template>
<script lang="ts" src="./cash.ts">
</script>
<style lang="scss" scoped>
@import 'cash.scss';
</style>

View File

@@ -38,7 +38,7 @@ export const cfgrouter = {
tools.addRoute(arrroutes, route) tools.addRoute(arrroutes, route)
} }
console.log('getmenu', arrroutes) // console.log('getmenu', arrroutes)
return arrroutes return arrroutes
}, },

View File

@@ -83,6 +83,20 @@ function getRoutesEcomm(site: ISites) {
onlyManager: true, onlyManager: true,
onlyEditor: true onlyEditor: true
}, },
{
active: true,
order: 30,
path: '/admin/ecommerce/cash',
materialIcon: 'fas fa-cash-register',
name: 'pages.cash',
component: () => import('@/rootgen/admin/cash/cash.vue'),
inmenu: true,
submenu: true,
level_parent: 0,
level_child: 0.5,
onlyManager: true,
onlyEditor: true
},
{ {
active: true, active: true,
order: 30, order: 30,
@@ -231,6 +245,15 @@ function getRoutesEcomm(site: ISites) {
inmenu: false, inmenu: false,
infooter: false, infooter: false,
}, },
{
active: true,
order: 30,
path: '/admin/ecommerce/cash',
name: 'pages.cash',
component: () => import('@/rootgen/admin/cash/cash.vue'),
inmenu: false,
infooter: false,
},
{ {
active: true, active: true,
order: 31, order: 31,

View File

@@ -79,7 +79,7 @@ const msg_it = {
addcart: '+{qta}', addcart: '+{qta}',
subcart: '-{qta}', subcart: '-{qta}',
origine: 'Origine', origine: 'Origine',
ingredienti: 'ingredienti', ingredienti: 'Ingredienti',
valori_nutrizionali: 'Valori Nutrizionali', valori_nutrizionali: 'Valori Nutrizionali',
note: 'Note', note: 'Note',
codice_EAN: 'EAN', codice_EAN: 'EAN',
@@ -1715,7 +1715,25 @@ const msg_it = {
x_prodotti_gas: '{qta} prodotti', x_prodotti_gas: '{qta} prodotti',
x_prodotti_bottega: '{qta} prodotti', x_prodotti_bottega: '{qta} prodotti',
tutti: 'Tutti', tutti: 'Tutti',
} },
orderscart: {
numorder: 'Ordine',
totalQty: 'totalQty',
totalQtyPreordered: 'totalQty PreOrd',
},
cash: {
creatorUserId: 'Creatore',
date_payment: 'Data Pagamento',
type: 'Entrata/Uscita',
descr: 'Descrizione',
internal: 'Interno',
note: 'Note',
fromUserId: 'Mittente',
toUserId: 'Destinatario',
orderscart: 'Ordine',
confirmed: 'Confermato',
causale: 'Causale',
},
}, },
}; };

View File

@@ -1685,7 +1685,7 @@ export const colTableSites = [
AddCol({ name: 'telegram_support_chat', label_trans: 'sites.telegram_support_chat', fieldtype: costanti.FieldType.string }), AddCol({ name: 'telegram_support_chat', label_trans: 'sites.telegram_support_chat', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'telegram_key_test', label_trans: 'sites.telegram_key_test', fieldtype: costanti.FieldType.string }), AddCol({ name: 'telegram_key_test', label_trans: 'sites.telegram_key_test', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'load_process_telegram_test', label_trans: 'sites.load_process_telegram_test', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'load_process_telegram_test', label_trans: 'sites.load_process_telegram_test', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'load_process_telegramt', label_trans: 'sites.load_process_telegram', fieldtype: costanti.FieldType.boolean}), AddCol({ name: 'load_process_telegramt', label_trans: 'sites.load_process_telegram', fieldtype: costanti.FieldType.boolean }),
AddCol({ AddCol({
name: 'telegram_bot_name_test', name: 'telegram_bot_name_test',
label_trans: 'sites.telegram_bot_name_test', label_trans: 'sites.telegram_bot_name_test',
@@ -1997,17 +1997,28 @@ export const colTableProductInfos = [
AddCol({ name: 'size', label_trans: 'products.size' }), AddCol({ name: 'size', label_trans: 'products.size' }),
AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: costanti.FieldType.number }), AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'vegan', label_trans: 'products.vegan', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'vegan', label_trans: 'products.vegan', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'unit', label_trans: 'products.unit', AddCol({
fieldtype: costanti.FieldType.select, jointable: 'units', }), name: 'unit', label_trans: 'products.unit',
fieldtype: costanti.FieldType.select, jointable: 'units',
}),
AddCol({ name: 'stars', label_trans: 'products.stars', fieldtype: costanti.FieldType.number }), AddCol({ name: 'stars', label_trans: 'products.stars', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'date', label_trans: 'products.date', fieldtype: costanti.FieldType.date }), AddCol({ name: 'date', label_trans: 'products.date', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'ingredienti', label_trans: 'products.ingredienti' }), AddCol({ name: 'ingredienti', label_trans: 'products.ingredienti', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'valori_nutrizionali', label_trans: 'products.valori_nutrizionali' }), AddCol({ name: 'valori_nutrizionali', label_trans: 'products.valori_nutrizionali', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'note', label_trans: 'products.note' }), AddCol({ name: 'note', label_trans: 'products.note', fieldtype: costanti.FieldType.html }),
AddCol(DeleteRec), AddCol(DeleteRec),
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]
export const colTableOrdersCart = [
AddCol({ name: '_id', label_trans: 'others.value' }),
AddCol({ name: 'numorder', label_trans: 'orderscart.numorder', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'totalQty', label_trans: 'orderscart.totalQty', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'totalQtyPreordered', label_trans: 'orderscart.totalQtyPreordered', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'totalPrice', label_trans: 'orderscart.totalPrice', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'status', label_trans: 'orderscart.status', fieldtype: costanti.FieldType.number }),
]
export const colTableProducts = [ export const colTableProducts = [
AddCol({ name: 'active', label_trans: 'products.active', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'active', label_trans: 'products.active', fieldtype: costanti.FieldType.boolean }),
AddCol({ AddCol({
@@ -2375,6 +2386,37 @@ const colTableEvents = [
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]
export const colTableCash = [
AddCol({ name: '_id', label_trans: 'event._id' }),
AddCol({ name: 'creatorUserId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({
name: 'idCashCategory',
label_trans: 'Category.idCashCategory',
fieldtype: costanti.FieldType.select,
jointable: 'cashcategory',
}),
AddCol({ name: 'fromUserId', label_trans: 'cash.fromUserId', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({ name: 'toUserId', label_trans: 'cash.toUserId', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({ name: 'idOrdersCart', label_trans: 'cash.orderscart', fieldtype: costanti.FieldType.select, jointable: 'orderscart' }),
AddCol({ name: 'type', label_trans: 'cash.type', fieldtype: costanti.FieldType.select, jointable: toolsext.TABTYPECASH }),
AddCol({
name: 'date_payment', label_trans: 'cash.date_payment', fieldtype: costanti.FieldType.onlydate,
sortable: true,
}),
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'causale', label_trans: 'cash.causale' }),
AddCol({ name: 'note', label_trans: 'cash.note' }),
AddCol({ name: 'internal', label_trans: 'cash.internal', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'extra', label_trans: 'cash.extra', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'confirmed', label_trans: 'cash.confirmed', fieldtype: costanti.FieldType.boolean }),
AddCol({
name: 'date_created', label_trans: 'reg.pub_created', fieldtype: costanti.FieldType.onlydate,
sortable: true,
}),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]
export const fields = { export const fields = {
colSettings: [ colSettings: [
AddCol({ name: 'key', label_trans: 'col.label' }), AddCol({ name: 'key', label_trans: 'col.label' }),
@@ -3120,8 +3162,6 @@ export const colTableExtraList = [
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]
export const colTableCash = []
export const colTableCashCategory = [ export const colTableCashCategory = [
AddCol({ name: 'descr', label_trans: 'pages.description' }), AddCol({ name: 'descr', label_trans: 'pages.description' }),
AddCol({ name: 'notes', label_trans: 'reg.note' }), AddCol({ name: 'notes', label_trans: 'reg.note' }),
@@ -3642,6 +3682,13 @@ export const fieldsTable = {
colkey: '_id', colkey: '_id',
collabel: '_id', collabel: '_id',
}, },
{
value: 'orderscart',
label: 'Ordini',
columns: colTableOrdersCart,
colkey: '_id',
collabel: 'numorder',
},
{ {
value: 'productinfos', value: 'productinfos',
label: 'Info Prodotti', label: 'Info Prodotti',
@@ -3656,6 +3703,13 @@ export const fieldsTable = {
colkey: '_id', colkey: '_id',
collabel: 'name', collabel: 'name',
}, },
{
value: 'cashs',
label: 'Cassa',
columns: colTableCash,
colkey: '_id',
collabel: 'causale',
},
{ {
value: 'departments', value: 'departments',
label: 'Uffici', label: 'Uffici',
@@ -3874,6 +3928,13 @@ export const fieldsTable = {
colicon: 'icon', colicon: 'icon',
noshow: true, noshow: true,
}, },
{
value: toolsext.TABTYPECASH,
label: 'Ingresso/Uscita',
columns: colTableGeneric,
colkey: 'value',
collabel: 'label',
},
{ {
value: 'confsite_opt', value: 'confsite_opt',
label: 'Configura Opzioni Sito', label: 'Configura Opzioni Sito',

View File

@@ -98,6 +98,7 @@ export const toolsext = {
TABCIRCUITS: 'circuits', TABCIRCUITS: 'circuits',
TABUNITS: 'units', TABUNITS: 'units',
SERVKEY_VERS: 'vers', SERVKEY_VERS: 'vers',
TABTYPECASH: 'typecash',
ERR_GENERICO: -1, ERR_GENERICO: -1,
ERR_SERVERFETCH: -2, ERR_SERVERFETCH: -2,

View File

@@ -138,7 +138,6 @@ export const useProducts = defineStore('Products', {
}, },
getProductById: (state: IProductsState) => (id: string): IProduct => { getProductById: (state: IProductsState) => (id: string): IProduct => {
const prod = state.products.find((prod: IProduct) => prod._id === id) const prod = state.products.find((prod: IProduct) => prod._id === id)
return prod ? prod : getRecordProductEmpty() return prod ? prod : getRecordProductEmpty()
@@ -692,7 +691,7 @@ export const useProducts = defineStore('Products', {
let ris = null let ris = null
ris = await Api.SendReq('/cart/' + userStore.my._id + '/ordercartstatus', 'POST', { order_id, status }) ris = await Api.SendReq('/cart/' + userStore.my._id + '/ordercartstatus', 'POST', { order_id, status, options })
.then((res) => { .then((res) => {
this.updateDataProduct(res) this.updateDataProduct(res)

View File

@@ -315,6 +315,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'storehouses') ris = state.storehouses else if (table === 'storehouses') ris = state.storehouses
else if (table === 'providers') ris = state.providers else if (table === 'providers') ris = state.providers
else if (table === 'productinfos') ris = Products.productInfos else if (table === 'productinfos') ris = Products.productInfos
else if (table === 'product') ris = Products.products
else if (table === 'gasordines') ris = state.gasordines else if (table === 'gasordines') ris = state.gasordines
else if (table === 'scontisticas') ris = state.scontisticas else if (table === 'scontisticas') ris = state.scontisticas
else if (table === 'groups') ris = state.groups else if (table === 'groups') ris = state.groups
@@ -1542,6 +1543,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.paymenttypes = (res.data.paymenttypes) ? [...res.data.paymenttypes] : [] this.paymenttypes = (res.data.paymenttypes) ? [...res.data.paymenttypes] : []
this.gallery = (res.data.gallery) ? [...res.data.gallery] : [] this.gallery = (res.data.gallery) ? [...res.data.gallery] : []
this.calzoom = (res.data.calzoom) ? [...res.data.calzoom] : [] this.calzoom = (res.data.calzoom) ? [...res.data.calzoom] : []
Products.products = (res.data.products) ? [...res.data.products] : []
Products.productInfos = (res.data.productInfos) ? [...res.data.productInfos] : [] Products.productInfos = (res.data.productInfos) ? [...res.data.productInfos] : []
this.producers = (res.data.producers) ? [...res.data.producers] : [] this.producers = (res.data.producers) ? [...res.data.producers] : []
this.storehouses = (res.data.storehouses) ? [...res.data.storehouses] : [] this.storehouses = (res.data.storehouses) ? [...res.data.storehouses] : []
@@ -1849,6 +1851,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === toolsext.TABLOCACCOM) myarr = shared_consts.LocationAccom else if (table === toolsext.TABLOCACCOM) myarr = shared_consts.LocationAccom
else if (table === toolsext.TABPREF) myarr = shared_consts.Preferences else if (table === toolsext.TABPREF) myarr = shared_consts.Preferences
else if (table === toolsext.TABUNITS) myarr = shared_consts.Units_Of_Measure_ListBox else if (table === toolsext.TABUNITS) myarr = shared_consts.Units_Of_Measure_ListBox
else if (table === toolsext.TABTYPECASH) myarr = shared_consts.TypeCashStr
else if (table === 'usernotifs') myarr = shared_consts.UsersNotif_Adv_List else if (table === 'usernotifs') myarr = shared_consts.UsersNotif_Adv_List
else if (table === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr else if (table === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr
else myarr = this.getListByTable(table, value2) else myarr = this.getListByTable(table, value2)

View File

@@ -300,7 +300,11 @@ export default defineComponent({
title: 'Ordine' title: 'Ordine'
}).onOk(async () => { }).onOk(async () => {
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status }) let options = {
// userIdStore: order.items ? order.items[0].order.storehouse.username : '',
}
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status, options })
if (statusnow.value === status) { if (statusnow.value === status) {
order.status = statusnow.value order.status = statusnow.value

View File

@@ -39,18 +39,17 @@ export default defineComponent({
const getArrProducts = computed(() => { const getArrProducts = computed(() => {
let arrprod = productStore.getProducts(cosa.value) let arrprod = productStore.getProducts(cosa.value)
let catstr = cat.value; let catstr = cat.value;
if ((!search.value || (search.value && search.value.length < 2)) && !catstr) { let lowerSearchText = search.value.toLowerCase().trim();
if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr) {
return arrprod return arrprod
} }
let lowerSearchText = search.value.toLowerCase();
return arrprod.filter((product: IProduct) => { return arrprod.filter((product: IProduct) => {
let lowerName = product.productInfo.name!.toLowerCase(); let lowerName = product.productInfo.name!.toLowerCase();
let hasCategoria = !catstr || (catstr && product.productInfo.idCatProds?.includes(catstr)); let hasCategoria = !catstr || (catstr && product.productInfo.idCatProds?.includes(catstr));
// Use a regular expression to match whole words // Use a regular expression to match whole words
let codeMatch = new RegExp(`\\b${search.value}\\b`, 'i'); let codeMatch = new RegExp(`\\b${lowerSearchText}\\b`, 'i');
let nameMatch = new RegExp(`\\b${lowerSearchText}`, 'i'); let nameMatch = new RegExp(`\\b${lowerSearchText}`, 'i');
// Check if any word in lowerName starts with lowerSearchText // Check if any word in lowerName starts with lowerSearchText