Struttura Scheda Prodotti...

This commit is contained in:
Surya Paolo
2023-11-30 14:27:46 +01:00
parent dffcc28690
commit 39e21600ca
16 changed files with 136 additions and 58 deletions

View File

@@ -12,6 +12,7 @@ const msg_website_es = {
stars: 'Voto', stars: 'Voto',
color: 'Colore', color: 'Colore',
theme: 'Tema', theme: 'Tema',
producer: 'Produttore',
}, },
hours: { hours: {
descr: 'Descrizione', descr: 'Descrizione',

View File

@@ -17,6 +17,42 @@ export const shared_consts = {
}, },
LIMIT_NOTIF_FOR_USER: 200, LIMIT_NOTIF_FOR_USER: 200,
UNITS_OF_MEASURE: {
NESSUNO: 0,
GRAMMI: 1,
CHILI: 2,
LITRI: 3,
PEZZI: 4,
},
Units_Of_Measure_ListBox: [
{
label: '[Nessuno]',
value: 0,
short: '',
},
{
label: 'Grammi (g)',
value: 1,
short: 'g',
},
{
label: 'Chili (kg)',
value: 2,
short: 'kg',
},
{
label: 'Litri (l)',
value: 3,
short: 'lt',
},
{
label: 'Pezzi (p)',
value: 4,
short: 'pz',
},
],
CallFunz: { CallFunz: {
SOSTITUISCI: 345, SOSTITUISCI: 345,
AGGIUNGI_NUOVO_IMBARCO: 380, AGGIUNGI_NUOVO_IMBARCO: 380,

View File

@@ -1,3 +1,4 @@
import { ref, onMounted, onBeforeMount, PropType, reactive, watch } from 'vue'
import { CCardState } from '../CCardState' import { CCardState } from '../CCardState'
import { computed, defineComponent } from 'vue' import { computed, defineComponent } from 'vue'
@@ -50,6 +51,12 @@ export default defineComponent({
globalStore.rightCartOpen = false globalStore.rightCartOpen = false
} }
function mounted() {
products.loadOrders()
}
onMounted(mounted)
return { return {
myCart, myCart,
myTotalPrice, myTotalPrice,

View File

@@ -1,6 +1,5 @@
<template> <template>
<div> <div>
MyCart:<br>
<div id="mycontainer"> <div id="mycontainer">
<div class="myheader row justify-between"> <div class="myheader row justify-between">
<div class="col-6"> <div class="col-6">

View File

@@ -80,23 +80,23 @@ export default defineComponent({
function addtoCart() { function addtoCart() {
if (!userStore.isLogged) { if (!userStore.isLogged) {
tools.showNeutralNotif($q, 'Devi prima accedere alla tua Area Personale') tools.showNeutralNotif($q, t('ecomm.area_personale'))
globalStore.rightDrawerOpen = true globalStore.rightDrawerOpen = true
return false return false
} }
// Controlla se esiste già nel carrello il prodotto // Controlla se esiste già nel carrello il prodotto
if (products.existProductInCart(myproduct.value._id)) { if (products.existProductInCart(myproduct.value._id)) {
tools.showNegativeNotif($q, 'Questo prodotto è stato già aggiunto al Carrello') tools.showNegativeNotif($q, t('ecomm.already_in_cart'))
} else { } else {
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => { products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
let strprod = 'prodotto' let strprod = t('ecomm.prodotto')
if (myorder.value.quantity! > 1) if (myorder.value.quantity! > 1)
strprod = 'prodotti' strprod = t('ecomm.prodotti')
if (ris) if (ris)
tools.showPositiveNotif($q, 'Hai Aggiunto ' + myorder.value.quantity + ' ' + strprod + ' al Carrello') tools.showPositiveNotif($q, t('ecomm.haveadded') + ' ' + myorder.value.quantity + ' ' + strprod + ' ' + t('ecomm.tocart'))
else else
tools.showNegativeNotif($q, 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.') tools.showNegativeNotif($q, t('ecomm.error_cart'))
}) })
} }
} }
@@ -110,7 +110,10 @@ export default defineComponent({
function getSingleStorehouse() { function getSingleStorehouse() {
const mystore = myproduct.value.storehouses[0] const mystore = myproduct.value.storehouses[0]
return mystore.name + ' (' + mystore.city + ')' if (mystore)
return mystore.name + ' (' + mystore.city + ')'
else
return ''
} }
function getStorehouses() { function getStorehouses() {
@@ -182,6 +185,8 @@ export default defineComponent({
checkifCartDisable, checkifCartDisable,
myproduct, myproduct,
myorder, myorder,
tools,
t,
} }
} }
}) })

View File

@@ -1,17 +1,14 @@
<template> <template>
<q-card :class="getmycardcl()" v-if="!!myproduct"> <q-card :class="getmycardcl()" v-if="!!myproduct">
<div v-if="myorder">
qta: {{ myorder.quantity }}
</div>
<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img> <q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>
<q-card-section> <q-card-section>
<q-btn <q-btn v-if="!complete" fab color="primary" icon="fas fa-info" class="absolute"
v-if="!complete" style="top: 0; right: 12px; transform: translateY(-50%);" :to="`/product/` + myproduct.code" />
fab
color="primary"
icon="fas fa-info"
class="absolute"
style="top: 0; right: 12px; transform: translateY(-50%);"
:to="`/product/`+ myproduct.code"
/>
<div class="row items-center centeritems"> <div class="row items-center centeritems">
<div class="text-h7 boldhigh"> <div class="text-h7 boldhigh">
@@ -24,18 +21,23 @@
</div> </div>
</div> </div>
<div> <div>
<div v-if="complete"> <div v-if="complete && myproduct.producer.city">
<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" />
Origine: <span class="text-blue q-ml-xs text-h8"> {{ myproduct.producer.city }} ({{ {{ t('products.origine') }}: <span class="text-blue q-ml-xs text-h8"> {{ myproduct.producer.city }} ({{
myproduct.producer.region myproduct.producer.region
}})</span> }})</span>
</div> </div>
</div> </div>
<div v-if="complete" class="text-grey text-title row items-center"> <div v-if="complete && myproduct.producer.name" class="text-grey text-title row items-center">
<q-icon name="place" class="q-mr-xs"/> <q-icon name="place" class="q-mr-xs" />
Produttore: <span class="text-black q-ml-xs text-h8"> {{ myproduct.producer.name }}</span> {{ t('products.producer') }}: <span class="text-black q-ml-xs text-h8"> {{ myproduct.producer.name }}</span>
</div>
<div v-if="complete && myproduct.weight" class="text-grey text-title row items-center">
<q-icon name="fas fa-balance-scale" class="q-mr-xs" />
{{ t('products.weight') }}: <span class="text-black q-ml-xs text-h8"> {{ myproduct.weight }} {{
tools.getUnitsMeasure(myproduct.unit, true) }}</span>
</div> </div>
</div> </div>
@@ -58,17 +60,14 @@
</div> </div>
<div v-if="complete || getnumstore() > 1"> <div v-if="complete || getnumstore() > 1">
<div class="text-blue text-title row items-center q-mr-md centeritems"> <div class="text-blue text-title row items-center q-mr-md centeritems">
<q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm"/> <q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm" />
Ritiro presso: {{ t('products.ritiro_presso') }}:
</div> </div>
<div class="text-green-6 text-title row items-center q-my-sm centeritems"> <div 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="order.idStorehouse"
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" :options="getStorehouses()" :label="t('products.magazzino') + `:`" emit-value map-options>
outlined v-model="order.idStorehouse"
:options="getStorehouses()"
label="Magazzino:" emit-value map-options>
</q-select> </q-select>
</div> </div>
<div v-else> <div v-else>
@@ -78,12 +77,11 @@
</div> </div>
</q-card-section> </q-card-section>
<q-separator/> <q-separator />
<q-card-actions vertical align="center"> <q-card-actions vertical align="center">
<q-btn <q-btn icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md"
icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md" :label="t('products.addcart')" @click="addtoCart">
label="Aggiungi al Carrello" @click="addtoCart">
</q-btn> </q-btn>
<!-- <!--
<q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri"> <q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">

View File

@@ -341,7 +341,10 @@ h3 {
.myimgtitle { .myimgtitle {
max-width: 100%; max-width: 100%;
height: auto; height: 300px;
@media (max-width: 718px) {
height: 200px;
}
} }
.my-card-big { .my-card-big {

View File

@@ -18,6 +18,7 @@ export interface IProduct {
canBeShipped?: boolean, canBeShipped?: boolean,
canBeBuyOnline?: boolean, canBeBuyOnline?: boolean,
weight?: number, weight?: number,
unit: number,
stars?: number, stars?: number,
date?: Date, date?: Date,
icon?: string, icon?: string,

View File

@@ -197,27 +197,9 @@ function getRoutesEcomm(site: ISites) {
] ]
const menuEcomm = [ const menuEcomm = [
...routes_admin_ecommerce_menu,
{ {
active: site.confpages && site.confpages.enableEcommerce, active: site.confpages && site.confpages.enableEcommerce,
path: '/admin/ecommerce', path: '/ecommerce',
order: 31,
faIcon: 'fa fa-list-alt',
materialIcon: 'next_week',
name: 'pages.admin_ecommerce',
routes2: routes_admin_ecommerce,
inmenu: false,
submenu: true,
level_parent: 0.5,
level_child: 0.5,
solotitle: true,
onlyAdmin: true,
onlyManager: true,
onlyDepartment: true
},
{
active: site.confpages && site.confpages.enableEcommerce,
path: '',
order: 1402, order: 1402,
faIcon: 'fa fa-list-alt', faIcon: 'fa fa-list-alt',
materialIcon: 'next_week', materialIcon: 'next_week',
@@ -230,6 +212,21 @@ function getRoutesEcomm(site: ISites) {
infooter: true infooter: true
}, },
...routes_ecommerce, ...routes_ecommerce,
{
active: site.confpages && site.confpages.enableEcommerce,
path: '/admin/ecommerce',
order: 1420,
faIcon: 'fa fa-list-alt',
materialIcon: 'next_week',
name: 'pages.admin_ecommerce',
routes2: routes_admin_ecommerce,
inmenu: true,
solotitle: true,
onlyAdmin: true,
onlyManager: true,
onlyDepartment: true
},
...routes_admin_ecommerce,
{ {
active: true, active: true,
order: 1000, order: 1000,

View File

@@ -62,9 +62,14 @@ const msg_it = {
quantity: 'Quantità', quantity: 'Quantità',
quantityAvailable: 'Disponibili', quantityAvailable: 'Disponibili',
weight: 'Peso', weight: 'Peso',
unit: 'Unità di Misura',
stars: 'Voto', stars: 'Voto',
color: 'Colore', color: 'Colore',
theme: 'Tema', theme: 'Tema',
ritiro_presso: 'Ritiro presso',
magazzino: 'Magazzino',
addcart: 'Aggiungi al Carrello',
origine: 'Origine',
}, },
otherpages: { otherpages: {
myactivities: 'Attività', myactivities: 'Attività',
@@ -1583,6 +1588,15 @@ const msg_it = {
seen: 'Visto da {num} utenti', seen: 'Visto da {num} utenti',
attend: '{num} Partecipanti', attend: '{num} Partecipanti',
}, },
ecomm: {
already_in_cart: 'Questo prodotto è stato già aggiunto al Carrello',
area_personale: 'Devi prima accedere alla tua Area Personale',
prodotto: 'prodotto',
prodotti: 'prodotti',
haveadded: 'Hai Aggiunto',
error_cart: 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.',
tocart: 'al Carrello',
},
}, },
}; };

View File

@@ -1949,6 +1949,8 @@ export const colTableProducts = [
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: costanti.FieldType.number }), AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: costanti.FieldType.number }),
AddCol({ 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(DeleteRec), AddCol(DeleteRec),
@@ -4052,6 +4054,15 @@ export const fieldsTable = {
colicon: 'icon', colicon: 'icon',
noshow: true, noshow: true,
}, },
{
value: toolsext.TABUNITS,
label: 'Unità di Misura',
columns: colTableGeneric,
colkey: 'value',
collabel: 'label',
colicon: 'icon',
noshow: true,
},
], ],
} }

View File

@@ -8227,6 +8227,12 @@ export const tools = {
} }
return 0 return 0
}, },
getUnitsMeasure(unit: number, short: boolean) {
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
return unitrec ? (short ? unitrec.short : unitrec.label) : ''
},
isPartecipero(myrec: any) { isPartecipero(myrec: any) {
const userStore = useUserStore() const userStore = useUserStore()
if (myrec && myrec.mybookings && myrec.mybookings.length > 0) { if (myrec && myrec.mybookings && myrec.mybookings.length > 0) {

View File

@@ -96,6 +96,7 @@ export const toolsext = {
TABPREF: 'hosps_preferences', TABPREF: 'hosps_preferences',
TABPEOPLE: 'people', TABPEOPLE: 'people',
TABCIRCUITS: 'circuits', TABCIRCUITS: 'circuits',
TABUNITS: 'units',
SERVKEY_VERS: 'vers', SERVKEY_VERS: 'vers',
ERR_GENERICO: -1, ERR_GENERICO: -1,

View File

@@ -79,6 +79,7 @@ export const useProducts = defineStore('Products', {
canBeShipped: false, canBeShipped: false,
canBeBuyOnline: false, canBeBuyOnline: false,
weight: 0, weight: 0,
unit: 0,
stars: 0, stars: 0,
date: tools.getDateNow(), date: tools.getDateNow(),
icon: '', icon: '',
@@ -214,8 +215,6 @@ export const useProducts = defineStore('Products', {
if (!globalStore.site.confpages.enableEcommerce) if (!globalStore.site.confpages.enableEcommerce)
return null return null
console.log('loadOrders', 'userid=', userStore.my._id)
// if (userStore.my._id === '') { // if (userStore.my._id === '') {
// return new Types.AxiosError(0, null, 0, '') // return new Types.AxiosError(0, null, 0, '')
// } // }
@@ -239,7 +238,6 @@ export const useProducts = defineStore('Products', {
}) })
// ApiTables.aftercalling(ris, checkPending, 'categories') // ApiTables.aftercalling(ris, checkPending, 'categories')
return ris return ris
}, },

View File

@@ -1798,6 +1798,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === toolsext.TABTYPEACCOM) myarr = shared_consts.TypeAccom else if (table === toolsext.TABTYPEACCOM) myarr = shared_consts.TypeAccom
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 === '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) else myarr = this.getListByTable(table)

View File

@@ -12,7 +12,7 @@
<q-separator></q-separator> <q-separator></q-separator>
<div class="col-6 q-mr-sm" style="text-align: right"> <div class="col-6 q-mr-sm" style="text-align: right">
<span class="text-grey q-mr-xs">Totale:</span> <span <span class="text-grey q-mr-xs">Totale:</span> <span
class="text-subtitle1 q-mr-sm "> {{ myTotalPrice }}</span> class="text-subtitle1 q-mr-sm "> {{ (myTotalPrice()) }}</span>
</div> </div>
<q-input v-if="getNumItems() > 0" v-model="note" style="max-width: 400px;" label="Scrivi qui per eventuali note o chiarimenti:" <q-input v-if="getNumItems() > 0" v-model="note" style="max-width: 400px;" label="Scrivi qui per eventuali note o chiarimenti:"