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',
color: 'Colore',
theme: 'Tema',
producer: 'Produttore',
},
hours: {
descr: 'Descrizione',

View File

@@ -17,6 +17,42 @@ export const shared_consts = {
},
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: {
SOSTITUISCI: 345,
AGGIUNGI_NUOVO_IMBARCO: 380,

View File

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

View File

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

View File

@@ -80,23 +80,23 @@ export default defineComponent({
function addtoCart() {
if (!userStore.isLogged) {
tools.showNeutralNotif($q, 'Devi prima accedere alla tua Area Personale')
tools.showNeutralNotif($q, t('ecomm.area_personale'))
globalStore.rightDrawerOpen = true
return false
}
// Controlla se esiste già nel carrello il prodotto
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 {
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
let strprod = 'prodotto'
let strprod = t('ecomm.prodotto')
if (myorder.value.quantity! > 1)
strprod = 'prodotti'
strprod = t('ecomm.prodotti')
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
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() {
const mystore = myproduct.value.storehouses[0]
if (mystore)
return mystore.name + ' (' + mystore.city + ')'
else
return ''
}
function getStorehouses() {
@@ -182,6 +185,8 @@ export default defineComponent({
checkifCartDisable,
myproduct,
myorder,
tools,
t,
}
}
})

View File

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

View File

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

View File

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

View File

@@ -197,27 +197,9 @@ function getRoutesEcomm(site: ISites) {
]
const menuEcomm = [
...routes_admin_ecommerce_menu,
{
active: site.confpages && site.confpages.enableEcommerce,
path: '/admin/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: '',
path: '/ecommerce',
order: 1402,
faIcon: 'fa fa-list-alt',
materialIcon: 'next_week',
@@ -230,6 +212,21 @@ function getRoutesEcomm(site: ISites) {
infooter: true
},
...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,
order: 1000,

View File

@@ -62,9 +62,14 @@ const msg_it = {
quantity: 'Quantità',
quantityAvailable: 'Disponibili',
weight: 'Peso',
unit: 'Unità di Misura',
stars: 'Voto',
color: 'Colore',
theme: 'Tema',
ritiro_presso: 'Ritiro presso',
magazzino: 'Magazzino',
addcart: 'Aggiungi al Carrello',
origine: 'Origine',
},
otherpages: {
myactivities: 'Attività',
@@ -1583,6 +1588,15 @@ const msg_it = {
seen: 'Visto da {num} utenti',
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: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
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: 'date', label_trans: 'products.date', fieldtype: costanti.FieldType.date }),
AddCol(DeleteRec),
@@ -4052,6 +4054,15 @@ export const fieldsTable = {
colicon: 'icon',
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
},
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) {
const userStore = useUserStore()
if (myrec && myrec.mybookings && myrec.mybookings.length > 0) {

View File

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

View File

@@ -79,6 +79,7 @@ export const useProducts = defineStore('Products', {
canBeShipped: false,
canBeBuyOnline: false,
weight: 0,
unit: 0,
stars: 0,
date: tools.getDateNow(),
icon: '',
@@ -214,8 +215,6 @@ export const useProducts = defineStore('Products', {
if (!globalStore.site.confpages.enableEcommerce)
return null
console.log('loadOrders', 'userid=', userStore.my._id)
// if (userStore.my._id === '') {
// return new Types.AxiosError(0, null, 0, '')
// }
@@ -239,7 +238,6 @@ export const useProducts = defineStore('Products', {
})
// ApiTables.aftercalling(ris, checkPending, 'categories')
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.TABLOCACCOM) myarr = shared_consts.LocationAccom
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 === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr
else myarr = this.getListByTable(table)

View File

@@ -12,7 +12,7 @@
<q-separator></q-separator>
<div class="col-6 q-mr-sm" style="text-align: right">
<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>
<q-input v-if="getNumItems() > 0" v-model="note" style="max-width: 400px;" label="Scrivi qui per eventuali note o chiarimenti:"