This commit is contained in:
Paolo Arena
2021-01-18 00:48:53 +01:00
parent 9828f4818a
commit d02044ae17
49 changed files with 1318 additions and 142 deletions

View File

@@ -83,6 +83,9 @@ export const shared_consts = {
TypeMsg: { TypeMsg: {
SEND_TO_ALL: 1, SEND_TO_ALL: 1,
SEND_TO_SOCI: 2,
SEND_TO_SOCIO_RESIDENTE: 3,
SEND_TO_NON_SOCI: 10
}, },
TypeMsg_Actions: { TypeMsg_Actions: {
@@ -109,6 +112,40 @@ export const shared_consts = {
} }
], ],
selectDestination: [
{
id: 0,
label: 'A Tutti',
value: 1
},
{
id: 1,
label: 'Solo ai Soci',
value: 2
},
{
id: 2,
label: 'Solo ai Soci Residenti',
value: 3
},
{
id: 3,
label: 'Solo ai NON Soci',
value: 10
}
],
OrderStatus: {
NONE: 0,
IN_CART: 1,
CHECKOUT_CONFIRMED: 2,
PAYED: 3,
DELIVEDED: 4,
RECEIVED: 5,
CANCELED: 10,
},
fieldsUserToChange() { fieldsUserToChange() {
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on'] return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on']
} }

View File

@@ -467,7 +467,7 @@ export default class CEventsCalendar extends MixinEvents {
public addBookEventMenu(eventparam) { public addBookEventMenu(eventparam) {
if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) {
// Visu right Toolbar to make SignIn // Visu right Toolbar to make SignIn
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
tools.showNeutralNotif(this.$q, this.$t('login.needlogin')) tools.showNeutralNotif(this.$q, this.$t('login.needlogin'))
tools.scrollToTop() tools.scrollToTop()
// window.scrollTo(0, 0) // window.scrollTo(0, 0)
@@ -490,7 +490,7 @@ export default class CEventsCalendar extends MixinEvents {
public askForInfoEventMenu(eventparam) { public askForInfoEventMenu(eventparam) {
if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) {
// Visu right Toolbar to make SignIn // Visu right Toolbar to make SignIn
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
tools.showNeutralNotif(this.$q, this.$t('login.needlogin')) tools.showNeutralNotif(this.$q, this.$t('login.needlogin'))
tools.scrollToTop() tools.scrollToTop()

View File

@@ -6,7 +6,7 @@ import { CCardState } from '../CCardState'
import { CCopyBtn } from '../CCopyBtn' import { CCopyBtn } from '../CCopyBtn'
import { IOrder, IProduct } from '@src/model' import { IOrder, IProduct } from '@src/model'
import { Products, UserStore } from '@store' import { GlobalStore, Products, UserStore } from '@store'
import { CSingleCart } from '../../components/CSingleCart' import { CSingleCart } from '../../components/CSingleCart'
import MixinUsers from '@src/mixins/mixin-users' import MixinUsers from '@src/mixins/mixin-users'
@@ -44,4 +44,8 @@ export default class CMyCart extends MixinUsers {
return 0 return 0
} }
} }
public closecart() {
GlobalStore.state.rightCartOpen = false
}
} }

View File

@@ -30,7 +30,7 @@
Il Carrello è Vuoto Il Carrello è Vuoto
</div> </div>
<div v-else style="text-align: center"> <div v-else style="text-align: center">
<q-btn rounded icon="fas fa-shopping-cart" color="green" label="Vai alla Cassa" class="q-mb-sm" to="/checkout"></q-btn> <q-btn rounded icon="fas fa-shopping-cart" color="green" label="Vai alla Cassa" class="q-mb-sm" to="/checkout" @click="closecart"></q-btn>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -17,7 +17,10 @@ import { Products, UserStore } from '@store'
export default class CProductCard extends MixinBase { export default class CProductCard extends MixinBase {
public $t public $t
@Prop({ required: true }) public product: IProduct @Prop({ required: false, default: null }) public product: IProduct
public myproduct: IProduct = null
@Prop({ required: false, default: '' }) public code: string
@Prop({ required: false, default: false }) public complete: boolean
@Prop({ @Prop({
required: false, required: false,
type: Object, type: Object,
@@ -50,11 +53,17 @@ export default class CProductCard extends MixinBase {
public addtoCart() { public addtoCart() {
if (!UserStore.state.isLogged) {
tools.showNeutralNotif(this.$q, 'Devi prima accedere alla tua Area Personale')
GlobalStore.state.rightDrawerOpen = true
return false
}
// Controlla se esiste già nel carrello il prodotto // Controlla se esiste già nel carrello il prodotto
if (Products.getters.existProductInCart(this.product._id)) { if (Products.getters.existProductInCart(this.myproduct._id)) {
tools.showNegativeNotif(this.$q, 'Questo prodotto è stato già aggiunto al Carrello') tools.showNegativeNotif(this.$q, 'Questo prodotto è stato già aggiunto al Carrello')
} else { } else {
Products.actions.addToCart({ product: this.product, order: this.order }).then((ris) => { Products.actions.addToCart({ product: this.myproduct, order: this.order }).then((ris) => {
let strprod = 'prodotto' let strprod = 'prodotto'
if (this.order.quantity > 1) if (this.order.quantity > 1)
strprod = 'prodotti' strprod = 'prodotti'
@@ -67,14 +76,14 @@ export default class CProductCard extends MixinBase {
} }
public getnumstore() { public getnumstore() {
if (!!this.product.storehouses) if (!!this.myproduct.storehouses)
return this.product.storehouses.length return this.myproduct.storehouses.length
else else
return 0 return 0
} }
public getSingleStorehouse() { public getSingleStorehouse() {
const mystore = this.product.storehouses[0] const mystore = this.myproduct.storehouses[0]
return mystore.name + ' (' + mystore.city + ')' return mystore.name + ' (' + mystore.city + ')'
} }
@@ -82,7 +91,7 @@ export default class CProductCard extends MixinBase {
const myarr = [] const myarr = []
let ind = 1 let ind = 1
this.product.storehouses.forEach((store) => { this.myproduct.storehouses.forEach((store) => {
myarr.push( myarr.push(
{ {
id: ind, id: ind,
@@ -101,13 +110,36 @@ export default class CProductCard extends MixinBase {
return !this.order.idStorehouse return !this.order.idStorehouse
} }
public infoproduct() {
@Watch('code')
public codechanged(value) {
console.log('change code')
this.load()
} }
public created() { public async load() {
if (this.product.storehouses.length === 1) { // console.log('created Cproductcard', this.code)
this.order.idStorehouse = this.product.storehouses[0]._id if (this.code) {
this.myproduct = await Products.actions.loadProduct({ code: this.code })
} else {
this.myproduct = this.product
}
// console.log('this.myproduct', this.myproduct)
if (!!this.myproduct) {
if (this.myproduct.storehouses.length === 1) {
this.order.idStorehouse = this.myproduct.storehouses[0]._id
}
} }
} }
public async created() {
this.load()
}
get getmycardcl() {
return (this.complete) ? 'my-card-big' : 'my-card'
}
} }

View File

@@ -1,50 +1,49 @@
<template> <template>
<q-card class="my-card"> <q-card :class="getmycardcl" v-if="!!myproduct">
<img :src="`statics/` + product.img" :alt="product.name"> <img :src="`statics/` + myproduct.img" :alt="myproduct.name">
<q-card-section> <q-card-section>
<q-btn <q-btn
v-if="!complete"
fab fab
color="primary" color="primary"
icon="fas fa-info" icon="fas fa-info"
class="absolute" class="absolute"
style="top: 0; right: 12px; transform: translateY(-50%);" style="top: 0; right: 12px; transform: translateY(-50%);"
@click="infoproduct" :to="`/product/`+ myproduct.code"
/> />
<div class="row items-center"> <div class="row items-center centeritems">
<div class="text-h7"> <div class="text-h7 boldhigh">
{{ product.name }} {{ myproduct.name }}
</div> </div>
</div> </div>
<div class="row items-center"> <div v-if="complete" class="row items-center">
<div class="text-title text-grey-9"> <div class="text-title text-grey-9">
<span class="text-grey-7">{{ product.description }}</span> <span class="text-grey-7">{{ myproduct.description }}</span>
</div> </div>
</div> </div>
<div> <div>
<div> <div v-if="complete">
<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"> {{ product.producer.city }} ({{ Origine: <span class="text-blue q-ml-xs text-h8"> {{ myproduct.producer.city }} ({{
product.producer.region myproduct.producer.region
}})</span> }})</span>
</div> </div>
</div> </div>
<div class="text-grey text-title row items-center"> <div v-if="complete" 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"> {{ product.producer.name }}</span> Produttore: <span class="text-black q-ml-xs text-h8"> {{ myproduct.producer.name }}</span>
</div> </div>
</div> </div>
<!--<q-rating v-model="product.stars" :max="5" size="32px" readonly/>--> <!--<q-rating v-model="myproduct.stars" :max="5" size="32px" readonly/>-->
</q-card-section>
<q-card-section class="q-pt-none">
<div class="row q-mb-sm no-wrap items-center centeritems"> <div class="row q-mb-sm no-wrap items-center centeritems">
<div class="text-price q-mr-md no-wrap"> <div class="text-price no-wrap">
{{ product.price.toFixed(2) }} {{ myproduct.price.toFixed(2) }}
</div> </div>
</div> </div>
<div class="row q-mb-sm no-wrap items-center centeritems"> <div class="row q-mb-sm no-wrap items-center centeritems">
@@ -56,21 +55,23 @@
</q-field> </q-field>
<q-btn round size="xs" text-color="grey" icon="fas fa-plus" @click="addqty"></q-btn> <q-btn round size="xs" text-color="grey" icon="fas fa-plus" @click="addqty"></q-btn>
</div> </div>
<div class="text-blue text-title row items-center q-mr-md centeritems"> <div v-if="complete || getnumstore() > 1">
<q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm"/> <div class="text-blue text-title row items-center q-mr-md centeritems">
Ritiro presso: <q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm"/>
</div> Ritiro presso:
<div class="text-green-6 text-title row items-center q-my-sm centeritems">
<div v-if="getnumstore() > 1">
<q-select
outlined v-model="order.idStorehouse"
:options="getStorehouses()"
label="Magazzino:" emit-value map-options>
</q-select>
</div> </div>
<div v-else> <div class="text-green-6 text-title row items-center q-my-sm centeritems">
<span class="text-title text-center">{{ getSingleStorehouse() }}</span>
<div v-if="getnumstore() > 1">
<q-select
outlined v-model="order.idStorehouse"
:options="getStorehouses()"
label="Magazzino:" emit-value map-options>
</q-select>
</div>
<div v-else>
<span class="text-title text-center">{{ getSingleStorehouse() }}</span>
</div>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
@@ -78,9 +79,10 @@
<q-separator/> <q-separator/>
<q-card-actions vertical align="center"> <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="Aggiungi al Carrello" @click="addtoCart">
</q-btn> </q-btn>
<q-btn :icon="iconWhishlist(product)" flat color="primary" rounded label="Lista Desideri"> <q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</q-card> </q-card>

View File

@@ -0,0 +1,18 @@
.zoom_data{
font-size:1rem;
font-weight: bold;
text-shadow: .05rem .05rem .05rem #3d3d3d;
color: green;
}
.title {
font-weight: bold;
}
.id_conf{
font-weight: normal;
}
.note{
font-style: italic;
}

View File

@@ -0,0 +1,224 @@
import { Component, Prop, Watch } from 'vue-property-decorator'
import { INotData, IParamsQuery, IShareWithUs } from '../../model/index'
import { tools } from '../../store/Modules/tools'
import { NotevoleStore } from '@store'
import MixinBase from '@src/mixins/mixin-base'
import { validationMixin } from 'vuelidate'
import { validations } from '../CSignUpNotevole/CSignUp-validate'
import { CTitleBanner } from '@components'
import { CCardState } from '../CCardState'
import { UserStore } from '../../store/Modules'
import { GlobalStore } from '../../store'
import { CCopyBtn } from '../CCopyBtn'
import { date } from 'quasar'
import objectId from '@src/js/objectId'
@Component({
name: 'CShareWithUs',
components: { CTitleBanner, CCardState, CCopyBtn }
})
export default class CShareWithUs extends MixinBase {
public $t
public myshares: IShareWithUs[] = []
public mydescr: string = ''
get listasharewithus() {
return GlobalStore.state.sharewithus.sort((a, b) => b.numshared - a.numshared)
}
get listamyshare() {
return UserStore.state.my.profile.myshares
}
public myload() {
const sortBy = 'numshared'
const descending = 1
const myobj = {}
if (descending)
myobj[sortBy] = -1
else
myobj[sortBy] = 1
const params: IParamsQuery = {
table: 'sharewithus',
startRow: 0,
endRow: 10000,
filter: '',
filterand: '',
sortBy: myobj,
descending
}
console.log('myload', params)
GlobalStore.actions.loadTable(params).then((data) => {
GlobalStore.state.sharewithus = data.rows
})
}
public mounted() {
this.myload()
}
public recsharenow(mydescr): IShareWithUs {
return {
idapp: process.env.APP_ID,
description: mydescr,
userId: UserStore.state.my._id,
numshared: 0,
rating: 0
}
}
public add_newshare(mydescr) {
if (!mydescr)
return false
const recfound = UserStore.state.my.profile.myshares.find((rec) => rec.description.toLowerCase() === mydescr.toLowerCase())
if (!!recfound) {
tools.showNegativeNotif(this.$q, '"' + mydescr + '" è già presente!')
return false
}
UserStore.state.my.profile.myshares.push({ description: mydescr, rating: 5 })
const mydata = {
'profile.myshares': UserStore.state.my.profile.myshares
}
tools.saveFieldToServer(this, 'users', UserStore.state.my._id, mydata)
const myrec = this.recsharenow(mydescr)
const updatedexistingrec = this.updaterecnow(mydescr, true)
if (!updatedexistingrec) {
tools.createNewRecord(this, 'sharewithus', myrec, false).then((myrecris) => {
GlobalStore.state.sharewithus.push(myrecris)
this.myload()
this.mydescr = ''
return true
})
}
}
public updaterecnow(mydescr, add) {
const recesistente = GlobalStore.state.sharewithus.find((rec) => rec.description.toLowerCase() === mydescr.toLowerCase())
const indrec = GlobalStore.state.sharewithus.findIndex((rec) => rec.description.toLowerCase() === mydescr.toLowerCase())
console.log('recesistente', recesistente)
if (recesistente) {
const mydatatosave = {
id: recesistente._id,
table: tools.TABSHAREWITHUS,
fieldsvalue: recesistente
}
if (add)
recesistente.numshared++
else {
if (recesistente.numshared <= 0)
return false
else
recesistente.numshared--
}
GlobalStore.actions.saveFieldValue(mydatatosave).then((myrecris) => {
if (myrecris) {
GlobalStore.state.sharewithus[indrec] = recesistente
this.myload()
}
this.mydescr = ''
})
return true
} else {
return false
}
}
public selected(value, shared) {
shared.numshared++
tools.saveFieldToServer(this, 'sharewithus', shared._id, { numshared: shared.numshared })
}
public checkifICanRemove(shared) {
// Controlla se questo è stato aggiunto da me
const recfound = GlobalStore.state.sharewithus.find((rec) => rec.description.toLowerCase() === shared.description.toLowerCase())
if (!!recfound)
return recfound.userId === UserStore.state.my._id
else
return true
}
public removeShared(shared) {
this.$q.dialog({
message: 'Vuoi cancellare "' + shared.description + '" dalla tua lista ?',
ok: {
label: this.$t('dialog.yes'),
push: true
},
cancel: {
label: this.$t('dialog.cancel')
},
title: this.$t('pages.sharedwithus')
}).onOk(async () => {
const descr = shared.description
// Aggiorna Record Personale
UserStore.state.my.profile.myshares = UserStore.state.my.profile.myshares.filter((rec) => rec.description !== descr)
const mydata = {
'profile.myshares': UserStore.state.my.profile.myshares
}
tools.saveFieldToServer(this, 'users', UserStore.state.my._id, mydata)
const updatedexistingrec = this.updaterecnow(shared.description, false)
if (!updatedexistingrec) {
if (this.checkifICanRemove(shared)) {
const myrec = GlobalStore.state.sharewithus.find((rec) => rec.description.toLowerCase() === descr.toLowerCase())
if (!!myrec) {
GlobalStore.actions.DeleteRec({ table: tools.TABSHAREWITHUS, id: myrec._id })
.then((ris) => {
console.log('DELETEREC ris=', ris)
if (ris) {
// Aggiorna Array Globale
GlobalStore.state.sharewithus = GlobalStore.state.sharewithus.filter((rec) => rec.description !== descr)
this.myload()
console.log('GlobalStore.state.sharewithus', GlobalStore.state.sharewithus)
tools.showPositiveNotif(this.$q, this.$t('db.deletedrecord'))
}
})
}
}
}
}
)
}
public findrec(descr) {
if (UserStore.state.my.profile.myshares.length === 0)
return false
return UserStore.state.my.profile.myshares.find((rec) => rec.description.toLowerCase() === descr.toLowerCase())
}
public mycolorbtn(shared) {
if (this.findrec(shared.description)) {
return 'positive'
} else {
return 'primary'
}
}
public geticon(shared) {
if (this.findrec(shared.description))
return undefined
else
return 'fas fa-plus'
}
public getifdisable(shared) {
return this.findrec(shared.description)
}
}

View File

@@ -0,0 +1,91 @@
<template>
<div>
<div>
<CTitleBanner v-if="listasharewithus && listasharewithus.length > 0" class="q-pa-xs"
:title="$t('pages.sharewithus')"
bgcolor="bg-white" clcolor="text-blue"
mystyle="" myclass="myshad" canopen="true">
<div class="flex flex-center">
<div class="row animazione justify-center q-gutter-xs">
<q-item v-for="(shared, index) in listamyshare" :key="shared._id"
class="q-mb-xs animated clBorderShare q-pa-sm" v-ripple>
<transition name="fade" mode="out-in"
appear
enter-active-class="animazione fadeIn"
leave-active-class="animazione fadeOut">
<div class="row">
<q-item-section class="text-center">
<q-item-label class="title">{{ shared.description }}</q-item-label>
<!--<q-item-label class="title">Condiviso: {{ shared.numshared }}</q-item-label>
<q-item-label class="title">Rating: {{ shared.rating }}</q-item-label>-->
</q-item-section>
<!--<q-rating v-model="shared.rating" :max="5" size="16px" @input="change_rating(shared.rating, shared)"/>-->
</div>
</transition>
<q-btn class="q-ml-sm" round icon="fas fa-times" color="white" text-color="grey" size="sm" @click="removeShared(shared)"></q-btn>
</q-item>
</div>
</div>
</CTitleBanner>
Scrivi cosa vorresti fare con noi:<br>
<div class="row no-wrap justify-between q-pa-md q-gutter-sm">
<q-input v-model="mydescr" label="Cosa vorresti fare?" class="full-width">
</q-input>
<q-btn rounded label="Aggiungi" color="positive" @click="add_newshare(mydescr)" :disable="mydescr === ''"></q-btn>
</div>
<CTitleBanner v-if="listasharewithus && listasharewithus.length > 0" class="q-pa-xs"
title="Graduatoria Attuale"
bgcolor="bg-white" clcolor="text-blue"
mystyle="" myclass="myshad" canopen="true">
<div class="flex flex-center text-center">
<div class="animazione justify-center q-gutter-xs">
<q-item v-for="(shared, index) in listasharewithus" :key="shared._id"
class="animated" style="padding: 4px;" v-ripple>
<transition name="fade" mode="out-in"
appear
enter-active-class="animazione fadeIn"
leave-active-class="animazione fadeOut">
<div class="row no-wrap">
<q-btn dense size="md" :color="mycolorbtn(shared)" rounded :icon="geticon(shared)" :label="shared.description + ` (` + (shared.numshared + 1) + `)`"
@click="add_newshare(shared.description)"></q-btn>
<!--<q-item-label class="title">Condiviso: {{ shared.numshared }}</q-item-label>
<q-item-label class="title">Rating: {{ shared.rating }}</q-item-label>-->
<!--<q-rating v-model="shared.rating" :max="5" size="16px" @input="change_rating(shared.rating, shared)"/>-->
</div>
</transition>
</q-item>
</div>
</div>
</CTitleBanner>
</div>
</div>
</template>
<script lang="ts" src="./CShareWithUs.ts">
</script>
<style lang="scss" scoped>
@import './CShareWithUs.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CShareWithUs} from './CShareWithUs.vue'

View File

@@ -117,6 +117,7 @@ export default class CSignUp extends MixinBase {
if (!item.$error) { if (!item.$error) {
return '' return ''
} }
console.log('item', item)
// console.log('errorMsg', cosa, item) // console.log('errorMsg', cosa, item)
if (item.$params.email && !item.email) { if (item.$params.email && !item.email) {
return this.$t('reg.err.email') return this.$t('reg.err.email')
@@ -157,6 +158,8 @@ export default class CSignUp extends MixinBase {
} }
} else if (cosa === 'username') { } else if (cosa === 'username') {
// console.log(item); // console.log(item);
console.log('username')
console.log(item.$error)
if (!item.isUnique) { if (!item.isUnique) {
return this.$t('reg.err.duplicate_username') return this.$t('reg.err.duplicate_username')
} }
@@ -176,9 +179,22 @@ export default class CSignUp extends MixinBase {
} }
} }
public changeemail(value) {
this.signup.email = tools.removespaces(this.signup.email)
this.signup.email = this.signup.email.toLowerCase()
this.$emit('update:value', this.signup.email)
}
public changeusername(value) {
this.signup.username = tools.removespaces(this.signup.username)
this.$emit('update:value', this.signup.username)
}
public submitOk() { public submitOk() {
this.$v.signup.$touch() this.$v.signup.$touch()
this.signup.email = tools.removespaces(this.signup.email)
this.signup.email = this.signup.email.toLowerCase()
this.signup.username = tools.removespaces(this.signup.username) this.signup.username = tools.removespaces(this.signup.username)
this.duplicate_email = false this.duplicate_email = false

View File

@@ -14,6 +14,7 @@
v-model="signup.email" v-model="signup.email"
rounded outlined rounded outlined
@blur="$v.signup.email.$touch" @blur="$v.signup.email.$touch"
@input="changeemail"
:error="$v.signup.email.$error" :error="$v.signup.email.$error"
:error-message="errorMsg('email', $v.signup.email)" :error-message="errorMsg('email', $v.signup.email)"
maxlength="50" maxlength="50"
@@ -29,6 +30,7 @@
<q-input <q-input
v-model="signup.username" v-model="signup.username"
rounded outlined rounded outlined
@input="changeusername"
@blur="$v.signup.username.$touch" @blur="$v.signup.username.$touch"
:error="$v.signup.username.$error" :error="$v.signup.username.$error"
@keydown.native.54="(event) => event.preventDefault()" @keydown.native.54="(event) => event.preventDefault()"

View File

@@ -18,6 +18,7 @@ export default class CSingleCart extends MixinBase {
public $t public $t
@Prop({ required: true }) public order: IOrder @Prop({ required: true }) public order: IOrder
@Prop({ required: false, default: false }) public showall: boolean @Prop({ required: false, default: false }) public showall: boolean
@Prop({ required: false, default: false }) public nomodif: boolean
get myimgclass() { get myimgclass() {
if (this.showall) { if (this.showall) {

View File

@@ -13,7 +13,7 @@
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="row q-mb-xs no-wrap items-center centeritems"> <div class="row q-mb-xs no-wrap items-center centeritems">
<q-btn v-if="showall" round size="xs" text-color="grey" icon="fas fa-minus" <q-btn v-if="showall && !nomodif" round size="xs" text-color="grey" icon="fas fa-minus"
@click="addsubqty(false, true)"></q-btn> @click="addsubqty(false, true)"></q-btn>
<!--<q-field outlined dense style="width: 25px; height: 20px; " class="q-mx-xs text-subtitle4"> <!--<q-field outlined dense style="width: 25px; height: 20px; " class="q-mx-xs text-subtitle4">
<template v-slot:control> <template v-slot:control>
@@ -21,15 +21,15 @@
</template> </template>
</q-field>--> </q-field>-->
<div class="q-mx-sm text-blue-14">{{ order.quantity }}</div> <div class="q-mx-sm text-blue-14">{{ order.quantity }}</div>
<q-btn v-if="showall" round size="xs" text-color="grey" icon="fas fa-plus" <q-btn v-if="showall && !nomodif" round size="xs" text-color="grey" icon="fas fa-plus"
@click="addsubqty(true, false)"></q-btn> @click="addsubqty(true, false)"></q-btn>
</div> </div>
</div> </div>
<div class="col-2 no-wrap text-subtitle3 q-mr-sm"> <div class="col-2 no-wrap text-subtitle3 q-mr-sm">
{{ (order.price * order.quantity).toFixed(2) }} &nbsp;{{ (order.price * order.quantity).toFixed(2) }}
</div> </div>
<div class="col-1"> <div class="col-1">
<q-btn icon="fas fa-times" color="negative" round size="xs" @click="removeFromCard"> <q-btn v-if="!nomodif" icon="fas fa-times" color="negative" round size="xs" @click="removeFromCard">
</q-btn> </q-btn>
</div> </div>
</div> </div>

View File

@@ -18,6 +18,7 @@ import MixinUsers from '../../mixins/mixin-users'
import { CMyAvatar } from '../CMyAvatar' import { CMyAvatar } from '../CMyAvatar'
import { CSigninNoreg } from '../CSigninNoreg' import { CSigninNoreg } from '../CSigninNoreg'
import { CMyCart } from '@components' import { CMyCart } from '@components'
import { shared_consts } from '@src/common/shared_vuejs'
@Component({ @Component({
name: 'Header', name: 'Header',
@@ -62,6 +63,18 @@ export default class Header extends Vue {
return UserStore.state.isManager return UserStore.state.isManager
} }
get isSocio() {
return UserStore.state.my.profile.socio
}
get isSocioResidente() {
return UserStore.state.my.profile.socioresidente
}
get getcolormenu() {
return this.isSocio ? 'green-7' : 'white'
}
get isTutor() { get isTutor() {
return UserStore.state.isTutor return UserStore.state.isTutor
} }
@@ -120,19 +133,25 @@ export default class Header extends Vue {
} }
get rightDrawerOpen() { get rightDrawerOpen() {
return GlobalStore.state.RightDrawerOpen return GlobalStore.state.rightDrawerOpen
}
set rightDrawerOpen(value) {
GlobalStore.state.rightDrawerOpen = value
if (GlobalStore.state.rightDrawerOpen)
GlobalStore.state.rightCartOpen = false
} }
get rightCartOpen() { get rightCartOpen() {
return GlobalStore.state.rightCartOpen return GlobalStore.state.rightCartOpen
} }
set rightDrawerOpen(value) {
GlobalStore.state.RightDrawerOpen = value
}
set rightCartOpen(value) { set rightCartOpen(value) {
GlobalStore.state.rightCartOpen = value GlobalStore.state.rightCartOpen = value
if (GlobalStore.state.rightCartOpen)
GlobalStore.state.rightDrawerOpen = false
} }
get lang() { get lang() {
@@ -195,11 +214,12 @@ export default class Header extends Vue {
// console.log('SSSSSSSS: ', value, oldValue) // console.log('SSSSSSSS: ', value, oldValue)
const color = (value === 'online') ? 'positive' : 'warning' const color = (value === 'online') ? 'positive' : 'warning'
const statoconn = this.$t('connection.conn') + ' ' + ((value === 'online') ? this.$t('connection.online') : this.$t('connection.offline'))
if (this.static_data.functionality.SHOW_IF_IS_SERVER_CONNECTION) { if (this.static_data.functionality.SHOW_IF_IS_SERVER_CONNECTION) {
if (!!oldValue) { if (!!oldValue) {
tools.showNotif(this.$q, this.$t('connection') + ` {disc__value}`, { tools.showNotif(this.$q, statoconn, {
color, color,
icon: 'wifi' icon: 'wifi'
}) })
@@ -390,6 +410,15 @@ export default class Header extends Vue {
return 0 return 0
} }
get getnumOrdersCart() {
// const arrorderscart = Products.state.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED)
const arrorderscart = Products.state.orders
if (!!arrorderscart) {
return arrorderscart.length
}
return 0
}
get getcart() { get getcart() {
return Products.state.cart return Products.state.cart
} }

View File

@@ -40,8 +40,8 @@
<q-avatar> <q-avatar>
<img :src="imglogo" height="27" alt="Immagine Logo"> <img :src="imglogo" height="27" alt="Immagine Logo">
</q-avatar> </q-avatar>
<div class="q-mx-sm titlesite">{{getappname}}</div> <div class="q-mx-sm titlesite">{{ getappname }}</div>
<div slot="subtitle">{{$t('msg.myDescriz')}} {{ getAppVersion() }}</div> <div slot="subtitle">{{ $t('msg.myDescriz') }} {{ getAppVersion() }}</div>
</q-toolbar-title> </q-toolbar-title>
@@ -87,7 +87,7 @@
<img :src="langrec.image" class="flagimg" alt="flag"> <img :src="langrec.image" class="flagimg" alt="flag">
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
{{langrec.label}} {{ langrec.label }}
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -108,16 +108,32 @@
icon="menu" icon="menu"
@click="rightDrawerOpen = !rightDrawerOpen"> @click="rightDrawerOpen = !rightDrawerOpen">
</q-btn> </q-btn>
<q-btn class="q-mx-xs" v-if="static_data.functionality.ENABLE_ECOMMERCE && isLogged" round dense flat <q-btn class="q-mx-xs" v-if="static_data.functionality.ENABLE_ECOMMERCE && isLogged" round dense flat
@click="rightCartOpen = !rightCartOpen" icon="fas fa-shopping-cart"> @click="rightCartOpen = !rightCartOpen" icon="fas fa-shopping-cart">
<q-badge v-if="getnumItemsCart > 0" color="red" floating transparent> <q-badge v-if="getnumItemsCart > 0" color="red" floating transparent>
{{getnumItemsCart}} {{ getnumItemsCart }}
</q-badge> </q-badge>
</q-btn> </q-btn>
<q-btn class="q-mx-xs" v-if="static_data.functionality.ENABLE_ECOMMERCE && isLogged && getnumOrdersCart > 0" round dense flat
to="/orderinfo" icon="fas fa-list-ol">
<q-badge v-if="getnumOrdersCart > 0" color="blue" floating transparent>
{{ getnumOrdersCart }}
</q-badge>
</q-btn>
<q-btn class="q-mx-xs" v-if="static_data.functionality.SHOW_USER_MENU && isLogged" round dense flat <q-btn class="q-mx-xs" v-if="static_data.functionality.SHOW_USER_MENU && isLogged" round dense flat
@click="rightDrawerOpen = !rightDrawerOpen" :icon="getMyImgforIcon"> @click="rightDrawerOpen = !rightDrawerOpen" :icon="getMyImgforIcon" :color="getcolormenu">
<!--<q-badge v-if="isSocio" color="green" floating transparent>
s
</q-badge>-->
</q-btn> </q-btn>
</q-toolbar> </q-toolbar>
@@ -152,33 +168,40 @@
style="height: 150px" alt="section page"> style="height: 150px" alt="section page">
</q-img> </q-img>
<div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;"> <div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;">
<div class="text-center q-ma-xs boldhigh text-white text-h7">Area Personale</div>
<CMyAvatar :myimg="getMyImg"></CMyAvatar> <CMyAvatar :myimg="getMyImg"></CMyAvatar>
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;" <q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
dense flat round icon="close" @click="rightDrawerOpen = !rightDrawerOpen"> dense flat round icon="close" @click="rightDrawerOpen = !rightDrawerOpen">
</q-btn> </q-btn>
<div v-if="isLogged" class="text-weight-bold text-user">{{ Username }} - {{ myName }} <span
v-if="isAdmin"> [Admin]</span> <div v-if="isLogged" class="text-weight-bold text-user">{{ Username }} - {{ myName }}
<span v-if="isManager"> [Manager]</span>
<span v-if="isTutor"> [Tutor]</span>
<span v-if="isTratuttrici"> [Trad]</span>
</div> </div>
<div v-else class="text-user text-italic bg-red"> <div class="row justify-evenly q-pa-xs-sm">
<div v-if="isLogged && isAdmin" class="text-weight-bold text-user bg-red q-px-xs">Admin</div>
<div v-if="isSocio" class="text-weight-bold text-user q-px-xs">Socio</div>
<div v-if="isSocioResidente" class="text-weight-bold text-user q-px-xs bg-amber">Residente</div>
<div v-if="isManager" class="text-weight-bold text-user bg-blue q-px-xs">Segreteria</div>
<div v-if="isTutor" class="text-weight-bold text-user q-px-xs">Tutor</div>
<div v-if="isTratuttrici" class="text-weight-bold text-user q-px-xs">Traduttrici</div>
</div>
<div v-if="!isLogged" class="text-user text-italic bg-red">
{{ $t('user.loggati') }} {{ $t('user.loggati') }}
</div> </div>
<div v-if="isLogged && !isEmailVerified" class="text-verified">{{ <div v-if="isLogged && !isEmailVerified" class="text-verified">{{
$t('components.authentication.email_verification.verify_email') }} $t('components.authentication.email_verification.verify_email')
}}
</div> </div>
<!--<span class="text-white" v-if="Verificato"> {{$t('reg.verificato')}} </span>--> <!--<span class="text-white" v-if="Verificato"> {{$t('reg.verificato')}} </span>-->
<!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>--> <!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>-->
<div v-if="isLogged" id="user-actions" class="column justify-center q-gutter-sm q-ma-sm center-150"> <div v-if="isLogged" id="user-actions" class="column justify-center q-gutter-sm q-ma-sm center-150">
<q-btn rounded color="primary" icon="person" to="/profile">{{$t('pages.profile')}}</q-btn> <q-btn rounded color="primary" icon="person" to="/profile">{{ $t('pages.profile') }}</q-btn>
<!--<q-btn round color="warning" icon="lock"></q-btn>--> <!--<q-btn round color="warning" icon="lock"></q-btn>-->
<q-btn rounded color="negative" icon="exit_to_app" @click='logoutHandler'>{{$t('login.esci')}}</q-btn> <q-btn rounded color="negative" icon="exit_to_app" @click='logoutHandler'>{{ $t('login.esci') }}</q-btn>
</div> </div>
</div> </div>
@@ -204,6 +227,6 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './Header.scss'; @import './Header.scss';
</style> </style>

View File

@@ -27,6 +27,6 @@ export default class CTesseraElettronica extends Vue {
} }
get rightDrawerOpen() { get rightDrawerOpen() {
return GlobalStore.state.RightDrawerOpen return GlobalStore.state.rightDrawerOpen
} }
} }

View File

@@ -63,4 +63,5 @@ export * from './CMyFlotta'
export * from './CECommerce' export * from './CECommerce'
export * from './CSingleCart' export * from './CSingleCart'
export * from './CMyCart' export * from './CMyCart'
export * from './CShareWithUs'
export * from '../views/ecommerce/' export * from '../views/ecommerce/'

View File

@@ -9,6 +9,8 @@ import { fieldsTable } from '@src/store/Modules/fieldsTable'
import { CalendarStore } from '@store' import { CalendarStore } from '@store'
import MixinMetaTags from '@src/mixins/mixin-metatags' import MixinMetaTags from '@src/mixins/mixin-metatags'
import { shared_consts } from '../common/shared_vuejs'
// You can declare a mixin as the same style as components. // You can declare a mixin as the same style as components.
@Component @Component
export default class MixinBase extends MixinMetaTags { export default class MixinBase extends MixinMetaTags {
@@ -36,6 +38,10 @@ export default class MixinBase extends MixinMetaTags {
return tools return tools
} }
get shared_consts() {
return shared_consts
}
public getValDb(keystr, serv, def?, table?, subkey?, id?) { public getValDb(keystr, serv, def?, table?, subkey?, id?) {
return tools.getValDb(keystr, serv, def, table, subkey, id) return tools.getValDb(keystr, serv, def, table, subkey, id)

View File

@@ -70,7 +70,7 @@ export default class MixinUsers extends Vue {
get getMyImgforIcon() { get getMyImgforIcon() {
const ris = UserStore.getters.getImgByUsername(UserStore.state.my.username) const ris = UserStore.getters.getImgByUsername(UserStore.state.my.username)
return (ris !== '') ? 'img:statics/' + ris : 'fas fa-user-circle' return (ris !== '') ? 'img:statics/' + ris : 'fas fa-user'
} }
get getIconCart() { get getIconCart() {

View File

@@ -2,7 +2,7 @@ import { IAction } from '@src/model/Projects'
import { Component } from 'vue-router/types/router' import { Component } from 'vue-router/types/router'
import { lists } from '@src/store/Modules/lists' import { lists } from '@src/store/Modules/lists'
import { IPaymentType } from '@src/model/UserStore' import { IPaymentType } from '@src/model/UserStore'
import { ICart, IProducer, IProduct, IStorehouse } from '@src/model/Products' import { ICart, IProducer, IProduct, IShareWithUs, IStorehouse } from '@src/model/Products'
export interface IPost { export interface IPost {
title: string title: string
@@ -149,7 +149,7 @@ export interface IGlobalState {
mobileMode: boolean mobileMode: boolean
menuCollapse: boolean menuCollapse: boolean
leftDrawerOpen: boolean leftDrawerOpen: boolean
RightDrawerOpen: boolean rightDrawerOpen: boolean
rightCartOpen: boolean rightCartOpen: boolean
category: string category: string
stateConnection: string stateConnection: string
@@ -175,6 +175,7 @@ export interface IGlobalState {
calzoom: ICalZoom[], calzoom: ICalZoom[],
producers: IProducer[], producers: IProducer[],
storehouses: IStorehouse[], storehouses: IStorehouse[],
sharewithus: IShareWithUs[],
autoplaydisc: number autoplaydisc: number
} }
@@ -345,6 +346,7 @@ export interface IFunctionality {
BOOKING_EVENTS?: boolean BOOKING_EVENTS?: boolean
ENABLE_REG_AYNI?: boolean ENABLE_REG_AYNI?: boolean
ENABLE_REG_SIP?: boolean ENABLE_REG_SIP?: boolean
ENABLE_REG_CNM?: boolean
} }
export interface IParamsQuery { export interface IParamsQuery {

View File

@@ -1,17 +1,20 @@
export interface IProduct { export interface IProduct {
_id?: any _id?: any
descr?: string,
idProducer?: string, idProducer?: string,
idStorehouses?: string[], idStorehouses?: string[],
producer?: IProducer, producer?: IProducer,
storehouses?: IStorehouse[], storehouses?: IStorehouse[],
code?: string,
name?: string, name?: string,
description?: string,
department?: string, department?: string,
category?: string, category?: string,
price?: number, price?: number,
color?: string, color?: string,
size?: string, size?: string,
quantityAvailable?: number, quantityAvailable?: number,
canBeShipped?: boolean,
canBeBuyOnline?: boolean,
weight?: number, weight?: number,
stars?: number, stars?: number,
date?: Date, date?: Date,
@@ -51,6 +54,7 @@ export interface IOrder {
export interface IProductsState { export interface IProductsState {
products: IProduct[] products: IProduct[]
cart: ICart cart: ICart
orders: IOrderCart[]
} }
export interface IProducer { export interface IProducer {
@@ -59,6 +63,7 @@ export interface IProducer {
name?: string, name?: string,
description?: string, description?: string,
referent?: string, referent?: string,
username?: string,
region?: string, region?: string,
city?: string, city?: string,
img?: string, img?: string,
@@ -85,4 +90,28 @@ export interface ICart {
totalQty?: number totalQty?: number
totalPrice?: number totalPrice?: number
items?: IBaseOrder[] items?: IBaseOrder[]
note?: string
modify_at?: Date
}
export interface IOrderCart {
_id?: any
idapp?: string
numorder?: number
userId?: string
totalQty?: number
totalPrice?: number
items?: IBaseOrder[]
status?: number
note?: string
modify_at?: Date
}
export interface IShareWithUs {
_id?: any
idapp?: string
userId?: string
description?: string
numshared?: number
rating?: number
} }

View File

@@ -1,5 +1,5 @@
import { IToken } from 'model/other' import { IToken } from 'model/other'
import { ICart } from '@src/model/Products' import { ICart, IOrderCart, IShareWithUs } from '@src/model/Products'
const enum ESexType { const enum ESexType {
None = 0, None = 0,
@@ -33,6 +33,9 @@ export interface IUserProfile {
saw_and_accepted?: boolean saw_and_accepted?: boolean
qualified?: boolean qualified?: boolean
qualified_2invitati?: boolean qualified_2invitati?: boolean
myshares?: IShareWithUs[]
socio?: boolean
socioresidente?: boolean
} }
export interface IPaymentType { export interface IPaymentType {
@@ -88,6 +91,7 @@ export interface IUserFields {
numinvitati?: number numinvitati?: number
numinvitatiattivi?: number numinvitatiattivi?: number
cart?: ICart cart?: ICart
ordercart?: IOrderCart
} }
/* /*

View File

@@ -6,6 +6,7 @@
keywords: '' } ) }} keywords: '' } ) }}
</span> </span>
<div class="q-ma-sm q-gutter-sm q-pa-xs"> <div class="q-ma-sm q-gutter-sm q-pa-xs">
<CTitleBanner title="Prodotti"></CTitleBanner> <CTitleBanner title="Prodotti"></CTitleBanner>
<CGridTableRec prop_mytable="products" <CGridTableRec prop_mytable="products"

View File

@@ -7,6 +7,7 @@ import { fieldsTable, func } from '@src/store/Modules/fieldsTable'
import { shared_consts } from '@src/common/shared_vuejs' import { shared_consts } from '@src/common/shared_vuejs'
import { GlobalStore, UserStore } from '../../../store/Modules' import { GlobalStore, UserStore } from '../../../store/Modules'
import { tools } from '@src/store/Modules/tools'
@Component({ @Component({
components: { CMyPage } components: { CMyPage }
@@ -24,6 +25,7 @@ export default class Sendpushnotif extends Vue {
public opz2: string = '' public opz2: string = ''
public tag: string = '' public tag: string = ''
public actiontype: number = shared_consts.TypeMsg_Actions.NORMAL public actiontype: number = shared_consts.TypeMsg_Actions.NORMAL
public destination: number = shared_consts.TypeMsg.SEND_TO_ALL
public created() { public created() {
this.title = this.$t('ws.sitename') this.title = this.$t('ws.sitename')
@@ -54,6 +56,9 @@ export default class Sendpushnotif extends Vue {
const ris = await GlobalStore.actions.sendPushNotif({ params }) const ris = await GlobalStore.actions.sendPushNotif({ params })
if (!!ris.msg)
tools.showPositiveNotif(this.$q, ris.msg)
this.$q.loading.hide() this.$q.loading.hide()
this.incaricamento = false this.incaricamento = false
@@ -94,6 +99,7 @@ export default class Sendpushnotif extends Vue {
} }
public SendMsgToAll() { public SendMsgToAll() {
this.SendMsgToParam(shared_consts.TypeMsg.SEND_TO_ALL)
this.SendMsgToParam(this.destination)
} }
} }

View File

@@ -20,13 +20,18 @@
:options="shared_consts.selectActions" :options="shared_consts.selectActions"
label="Tipo Msg" emit-value map-options> label="Tipo Msg" emit-value map-options>
</q-select> </q-select>
<q-select
rounded outlined v-model="destination"
:options="shared_consts.selectDestination"
label="Destinazione" emit-value map-options>
</q-select>
<div v-if="actiontype === shared_consts.TypeMsg_Actions.OPZ1_2" class="row"> <div v-if="actiontype === shared_consts.TypeMsg_Actions.OPZ1_2" class="row">
<q-input v-model="opz1" autofocus label="Opzione 1" style="width: 100px;"></q-input> <q-input v-model="opz1" autofocus label="Opzione 1" style="width: 100px;"></q-input>
<q-input v-model="opz2" autofocus label="Opzione 2" style="width: 100px;"></q-input> <q-input v-model="opz2" autofocus label="Opzione 2" style="width: 100px;"></q-input>
</div> </div>
<br /> <br />
<div class=""> <div class="">
<q-btn label="Invia Msg a Tutti" color="primary" @click="SendMsgToAll()"></q-btn> <q-btn label="Invia Msg" color="primary" @click="SendMsgToAll()"></q-btn>
</div> </div>
</div> </div>
<q-inner-loading id="spinner" :showing="incaricamento"> <q-inner-loading id="spinner" :showing="incaricamento">

View File

View File

@@ -0,0 +1,44 @@
import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator'
import { GlobalStore, UserStore } from '@store'
import { tools } from '../../../store/Modules/tools'
import { toolsext } from '../../../store/Modules/toolsext'
import { static_data } from '../../../db/static_data'
import { Screen } from 'quasar'
import { colTableShareWithUs, colTableStorehouse } from '@src/store/Modules/fieldsTable'
import { CImgText } from '../../../components/CImgText/index'
import { CCard, CGridTableRec, CMyPage, CTitleBanner } from '@components'
import MixinMetaTags from '../../../mixins/mixin-metatags'
import MixinBase from '@src/mixins/mixin-base'
@Component({
mixins: [MixinBase],
components: { CImgText, CCard, CMyPage, CTitleBanner, CGridTableRec }
})
export default class ShareWithUsPage extends MixinMetaTags {
public pagination = {
sortBy: 'name',
descending: false,
page: 2,
rowsPerPage: 5
// rowsNumber: xx if getting data from a server
}
public selected = []
public dataPages = []
get getcolsharewithus() {
return colTableShareWithUs
}
public meta() {
return tools.metafunc(this)
}
get static_data() {
return static_data
}
}

View File

@@ -0,0 +1,27 @@
<template>
<CMyPage title="Condividi" imgbackground="../../statics/images/sharewithus.jpg" sizes="max-height: 120px">
<span>{{ setmeta({
title: 'Condividi',
description: "",
keywords: '' } ) }}
</span>
<div class="q-ma-sm q-gutter-sm q-pa-xs">
<CTitleBanner title="Condividi Con Noi"></CTitleBanner>
<CGridTableRec prop_mytable="sharewithus"
prop_mytitle="Lista Condivisioni"
:prop_mycolumns="getcolsharewithus"
prop_colkey="description"
nodataLabel="Nessuna Condivisione"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato">
</CGridTableRec>
</div>
</CMyPage>
</template>
<script lang="ts" src="./sharewithus.ts">
</script>
<style lang="scss" scoped>
@import 'sharewithus.scss';
</style>

View File

@@ -74,8 +74,8 @@ export default class UsersList extends Vue {
if (static_data.functionality.ENABLE_REG_AYNI) { if (static_data.functionality.ENABLE_REG_AYNI) {
return this.db_fieldsTable.colTableUsers return this.db_fieldsTable.colTableUsers
} else if (static_data.functionality.ENABLE_REG_SIP) { } else if (static_data.functionality.ENABLE_REG_CNM) {
return this.db_fieldsTable.colTableUsersSIP return this.db_fieldsTable.colTableUsersCNM
} else { } else {
return this.db_fieldsTable.colTableUsersBase return this.db_fieldsTable.colTableUsersBase
} }

View File

@@ -28,6 +28,7 @@ const msg_it = {
come_aiutare: 'Cosa vorresti fare per aiutare il pianeta?', come_aiutare: 'Cosa vorresti fare per aiutare il pianeta?',
}, },
otherpages: { otherpages: {
product: 'Prodotto',
sito_offline: 'Sito in Aggiornamento', sito_offline: 'Sito in Aggiornamento',
modifprof: 'Modifica Profilo', modifprof: 'Modifica Profilo',
biografia: 'Biografia', biografia: 'Biografia',
@@ -52,8 +53,8 @@ const msg_it = {
listaflotte: 'Flotte', listaflotte: 'Flotte',
}, },
manage: { manage: {
menu: 'Gestione', menu: 'Segreteria',
manager: 'Gestore', manager: 'Segreteria',
nessuno: 'Nessuno', nessuno: 'Nessuno',
sendpushnotif: 'Invia Msg Push', sendpushnotif: 'Invia Msg Push',
}, },
@@ -320,6 +321,8 @@ const msg_it = {
ritessitura: 'RITESSITURA', ritessitura: 'RITESSITURA',
}, },
reg: { reg: {
socio: 'Socio',
socioresidente: 'Residente',
volta: 'volta', volta: 'volta',
volte: 'volte', volte: 'volte',
registered: 'Registrato', registered: 'Registrato',
@@ -508,7 +511,11 @@ const msg_it = {
subscribed: 'Ora potrai ricevere i messaggi e le notifiche.', subscribed: 'Ora potrai ricevere i messaggi e le notifiche.',
newVersionAvailable: 'Aggiorna', newVersionAvailable: 'Aggiorna',
}, },
connection: 'Connessione', connection: {
conn: 'Connessione',
online: 'Attiva',
offline: 'Disattiva',
},
proj: { proj: {
newproj: 'Titolo Progetto', newproj: 'Titolo Progetto',
newsubproj: 'Titolo Sotto-Progetto', newsubproj: 'Titolo Sotto-Progetto',

View File

@@ -44,7 +44,7 @@ const state: IGlobalState = {
mobileMode: false, mobileMode: false,
menuCollapse: true, menuCollapse: true,
leftDrawerOpen: true, leftDrawerOpen: true,
RightDrawerOpen: false, rightDrawerOpen: false,
rightCartOpen: false, rightCartOpen: false,
stateConnection: stateConnDefault, stateConnection: stateConnDefault,
networkDataReceived: false, networkDataReceived: false,
@@ -83,7 +83,8 @@ const state: IGlobalState = {
mypage: [], mypage: [],
calzoom: [], calzoom: [],
producers: [], producers: [],
storehouses: [] storehouses: [],
sharewithus: []
} }
async function getConfig(id) { async function getConfig(id) {
@@ -204,6 +205,8 @@ namespace Getters {
return GlobalStore.state.producers return GlobalStore.state.producers
else if (table === 'storehouses') else if (table === 'storehouses')
return GlobalStore.state.storehouses return GlobalStore.state.storehouses
else if (table === 'sharewithus')
return GlobalStore.state.sharewithus
else if (table === 'paymenttypes') else if (table === 'paymenttypes')
return GlobalStore.state.paymenttypes return GlobalStore.state.paymenttypes
else if (table === 'bookings') else if (table === 'bookings')
@@ -1093,8 +1096,9 @@ namespace Actions {
if (res.data.cart) if (res.data.cart)
Products.state.cart = (res.data.cart) ? {...res.data.cart} : {} Products.state.cart = (res.data.cart) ? {...res.data.cart} : {}
else else
Products.state.cart = {} Products.state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: ''}
Products.state.orders = (res.data.orders) ? [...res.data.orders] : []
if (showall) { if (showall) {
GlobalStore.state.newstosent = (res.data.newstosent) ? [...res.data.newstosent] : [] GlobalStore.state.newstosent = (res.data.newstosent) ? [...res.data.newstosent] : []
@@ -1121,7 +1125,7 @@ namespace Actions {
// Fai Logout // Fai Logout
console.log('Fai Logout', 'islogged', islogged) console.log('Fai Logout', 'islogged', islogged)
UserStore.actions.logout() UserStore.actions.logout()
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
return false return false
} }
} }

View File

@@ -1,11 +1,11 @@
import { ICart, IOrder, IProduct, IProductsState } from 'model' import { ICart, IOrder, IOrderCart, IProduct, IProductsState } from 'model'
import { storeBuilder } from './Store/Store' import { storeBuilder } from './Store/Store'
import Api from '@api' import Api from '@api'
import { tools } from './tools' import { tools } from './tools'
import { lists } from './lists' import { lists } from './lists'
import * as ApiTables from './ApiTables' import * as ApiTables from './ApiTables'
import { GlobalStore, Todos, UserStore } from '@store' import { GlobalStore, Products, Todos, UserStore } from '@store'
import globalroutines from './../../globalroutines/index' import globalroutines from './../../globalroutines/index'
import { Mutation } from 'vuex-module-decorators' import { Mutation } from 'vuex-module-decorators'
import { serv_constants } from '@src/store/Modules/serv_constants' import { serv_constants } from '@src/store/Modules/serv_constants'
@@ -15,10 +15,12 @@ import { costanti } from '@src/store/Modules/costanti'
import { IAction } from '@src/model' import { IAction } from '@src/model'
import * as Types from '@src/store/Api/ApiTypes' import * as Types from '@src/store/Api/ApiTypes'
import { static_data } from '@src/db/static_data' import { static_data } from '@src/db/static_data'
import { shared_consts } from '@src/common/shared_vuejs'
const state: IProductsState = { const state: IProductsState = {
products: [], products: [],
cart: null, cart: { items: [], totalPrice: 0, totalQty: 0, userId: '' },
orders: []
} }
// const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at', 'themecolor', 'themebgcolor'] // const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at', 'themecolor', 'themebgcolor']
@@ -36,7 +38,7 @@ function createOrderByProduct(product: IProduct, order: IOrder): IOrder {
idapp: process.env.APP_ID, idapp: process.env.APP_ID,
idProduct: product._id, idProduct: product._id,
idProducer: product.idProducer, idProducer: product.idProducer,
status: tools.OrderStatus.IN_CART, status: shared_consts.OrderStatus.IN_CART,
price: product.price, price: product.price,
color: product.color, color: product.color,
size: product.size, size: product.size,
@@ -71,7 +73,15 @@ namespace Getters {
return state.cart return state.cart
}, 'getCart') }, 'getCart')
const getOrdersCart = b.read((stateparamf: IProductsState) => (tipoord: string): IOrderCart[] => {
if (tipoord === 'incorso')
return state.orders.filter((rec) => rec.status <= shared_consts.OrderStatus.CHECKOUT_CONFIRMED)
else
return state.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED && rec.status > shared_consts.OrderStatus.CHECKOUT_CONFIRMED)
}, 'getOrdersCart')
const existProductInCart = b.read((stateparamf: IProductsState) => (idproduct): boolean => { const existProductInCart = b.read((stateparamf: IProductsState) => (idproduct): boolean => {
// console.log('.state.cart.items', state.cart.items)
const ris = state.cart.items.filter((item) => item.order.idProduct === idproduct).reduce((sum, rec) => sum + 1, 0) const ris = state.cart.items.filter((item) => item.order.idProduct === idproduct).reduce((sum, rec) => sum + 1, 0)
return ris > 0 return ris > 0
}, 'existProductInCart') }, 'existProductInCart')
@@ -83,18 +93,21 @@ namespace Getters {
const objproduct: IProduct = { const objproduct: IProduct = {
// _id: tools.getDateNow().toISOString(), // Create NEW // _id: tools.getDateNow().toISOString(), // Create NEW
descr: '',
idProducer: '', idProducer: '',
idStorehouses: [], idStorehouses: [],
producer: null, producer: null,
storehouses: null, storehouses: null,
code: '',
name: '', name: '',
description: '',
department: '', department: '',
category: '', category: '',
price: 0.0, price: 0.0,
color: '', color: '',
size: '', size: '',
quantityAvailable: 0, quantityAvailable: 0,
canBeShipped: false,
canBeBuyOnline: false,
weight: 0, weight: 0,
stars: 0, stars: 0,
date: tools.getDateNow(), date: tools.getDateNow(),
@@ -114,6 +127,9 @@ namespace Getters {
get getCart() { get getCart() {
return getCart() return getCart()
}, },
get getOrdersCart() {
return getOrdersCart()
},
get existProductInCart() { get existProductInCart() {
return existProductInCart() return existProductInCart()
}, },
@@ -151,9 +167,9 @@ namespace Actions {
state.products = [] state.products = []
} }
console.log('ARRAY PRODUCTS = ', state.products) // console.log('ARRAY PRODUCTS = ', state.products)
if (process.env.DEBUG === '1') { if (process.env.DEBUG === '1') {
console.log('dbLoad', 'state.products', state.products) // console.log('dbLoad', 'state.products', state.products)
} }
return res return res
@@ -169,6 +185,39 @@ namespace Actions {
return ris return ris
} }
async function loadProduct(context, { code }) {
console.log('loadProduct', code)
if (!static_data.functionality.ENABLE_ECOMMERCE)
return null
console.log('getProduct', 'code', code)
// if (UserStore.state.my._id === '') {
// return new Types.AxiosError(0, null, 0, '')
// }
let ris = null
ris = await Api.SendReq('/products/' + code, 'POST', { code })
.then((res) => {
console.log('product', res.data.product)
if (res.data.product) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
return res.data.product
} else {
return null
}
})
.catch((error) => {
console.log('error getProduct', error)
UserStore.mutations.setErrorCatch(error)
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
})
return ris
}
async function loadCart(context) { async function loadCart(context) {
console.log('loadCart') console.log('loadCart')
@@ -189,7 +238,7 @@ namespace Actions {
if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories) if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
state.cart = res.data.cart state.cart = res.data.cart
} else { } else {
state.cart = null state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' }
} }
return res return res
@@ -212,7 +261,7 @@ namespace Actions {
if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories) if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
state.cart = res.data.cart state.cart = res.data.cart
} else { } else {
state.cart = null state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' }
} }
return res return res
@@ -240,7 +289,7 @@ namespace Actions {
if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories) if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
state.cart = res.data.cart state.cart = res.data.cart
} else { } else {
state.cart = null state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' }
} }
return res return res
@@ -270,7 +319,7 @@ namespace Actions {
state.cart = res.data.cart state.cart = res.data.cart
if (!!res.data.qty) { if (!!res.data.qty) {
// const ind = state.cart.items.findIndex((rec) => rec.order._id === order._id) // const ind = state.cart.items.findIndex((rec) => rec.order._id === order._id)
// state.cart.items[ind].order.quantity = res.data.qty // state.cart.items[ind].order.quantity = res.data.qty
return res.data.qty return res.data.qty
} }
@@ -288,11 +337,41 @@ namespace Actions {
return ris return ris
} }
async function UpdateStatusCart(context, { cart_id, status }) {
if (!static_data.functionality.ENABLE_ECOMMERCE)
return null
// console.log('addSubQtyToItem', 'userid=', UserStore.state.my._id, order)
let ris = null
ris = await Api.SendReq('/cart/' + UserStore.state.my._id + '/cartstatus', 'POST', { cart_id, status })
.then((res) => {
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_CONFIRMED) {
ProductsModule.state.cart = {}
if (res.data.orders)
Products.state.orders = res.data.orders
}
return res.data.status
})
.catch((error) => {
console.log('error UpdateStatusCart', error)
UserStore.mutations.setErrorCatch(error)
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
})
return ris
}
export const actions = { export const actions = {
// loadCart: b.dispatch(loadCart), // loadCart: b.dispatch(loadCart),
loadProduct: b.dispatch(loadProduct),
loadProducts: b.dispatch(loadProducts), loadProducts: b.dispatch(loadProducts),
addToCart: b.dispatch(addToCart), addToCart: b.dispatch(addToCart),
addSubQtyToItem: b.dispatch(addSubQtyToItem), addSubQtyToItem: b.dispatch(addSubQtyToItem),
UpdateStatusCart: b.dispatch(UpdateStatusCart),
removeFromCart: b.dispatch(removeFromCart), removeFromCart: b.dispatch(removeFromCart),
} }

View File

@@ -45,6 +45,9 @@ export const DefaultUser: IUserFields = {
saw_and_accepted: false, saw_and_accepted: false,
qualified: false, qualified: false,
qualified_2invitati: false, qualified_2invitati: false,
socio: false,
socioresidente: false,
myshares: [],
}, },
downline: [], downline: [],
calcstat: DefaultCalc, calcstat: DefaultCalc,
@@ -54,7 +57,8 @@ export const DefaultUser: IUserFields = {
userId: '', userId: '',
items: [], items: [],
totalPrice: 0, totalPrice: 0,
totalQty: 0 totalQty: 0,
note: '',
} }
} }
@@ -80,6 +84,9 @@ export const DefaultProfile: IUserProfile = {
saw_zoom_presentation: false, saw_zoom_presentation: false,
ask_zoom_partecipato: false, ask_zoom_partecipato: false,
saw_and_accepted: false, saw_and_accepted: false,
socio: false,
socioresidente: false,
myshares: [],
paymenttypes: [], paymenttypes: [],
qualified: false, qualified: false,
qualified_2invitati: false, qualified_2invitati: false,

View File

@@ -167,12 +167,19 @@ export const colTableProducer = [
AddCol({ name: 'name', label_trans: 'producer.name' }), AddCol({ name: 'name', label_trans: 'producer.name' }),
AddCol({ name: 'description', label_trans: 'producer.description' }), AddCol({ name: 'description', label_trans: 'producer.description' }),
AddCol({ name: 'referent', label_trans: 'producer.referent' }), AddCol({ name: 'referent', label_trans: 'producer.referent' }),
AddCol({ name: 'username', label_trans: 'producer.username' }),
AddCol({ name: 'region', label_trans: 'producer.region' }), AddCol({ name: 'region', label_trans: 'producer.region' }),
AddCol({ name: 'city', label_trans: 'producer.city' }), AddCol({ name: 'city', label_trans: 'producer.city' }),
AddCol({ name: 'img', label_trans: 'producer.img' }), AddCol({ name: 'img', label_trans: 'producer.img' }),
AddCol({ name: 'website', label_trans: 'producer.website' }), AddCol({ name: 'website', label_trans: 'producer.website' }),
] ]
export const colTableShareWithUs = [
AddCol({ name: 'description', label_trans: 'share.description' }),
AddCol({ name: 'numshared', label_trans: 'share.numshared', fieldtype: tools.FieldType.number }),
AddCol({ name: 'rating', label_trans: 'share.rating', fieldtype: tools.FieldType.number }),
]
export const colTableStorehouse = [ export const colTableStorehouse = [
AddCol({ name: 'name', label_trans: 'store.name' }), AddCol({ name: 'name', label_trans: 'store.name' }),
AddCol({ name: 'description', label_trans: 'store.description' }), AddCol({ name: 'description', label_trans: 'store.description' }),
@@ -185,6 +192,7 @@ export const colTableStorehouse = [
] ]
export const colTableProducts = [ export const colTableProducts = [
AddCol({ name: 'code', label_trans: 'products.code' }),
AddCol({ name: 'name', label_trans: 'products.name' }), AddCol({ name: 'name', label_trans: 'products.name' }),
AddCol({ name: 'description', label_trans: 'products.description' }), AddCol({ name: 'description', label_trans: 'products.description' }),
AddCol({ name: 'icon', label_trans: 'products.icon' }), AddCol({ name: 'icon', label_trans: 'products.icon' }),
@@ -208,6 +216,8 @@ export const colTableProducts = [
AddCol({ name: 'color', label_trans: 'products.color' }), AddCol({ name: 'color', label_trans: 'products.color' }),
AddCol({ name: 'size', label_trans: 'products.size' }), AddCol({ name: 'size', label_trans: 'products.size' }),
AddCol({ name: 'quantityAvailable', label_trans: 'products.quantityAvailable', fieldtype: tools.FieldType.number }), AddCol({ name: 'quantityAvailable', label_trans: 'products.quantityAvailable', fieldtype: tools.FieldType.number }),
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: tools.FieldType.boolean }),
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: tools.FieldType.boolean }),
AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: tools.FieldType.number }), AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: tools.FieldType.number }),
AddCol({ name: 'stars', label_trans: 'products.stars', fieldtype: tools.FieldType.number }), AddCol({ name: 'stars', label_trans: 'products.stars', fieldtype: tools.FieldType.number }),
AddCol({ name: 'date', label_trans: 'products.date', fieldtype: tools.FieldType.date }), AddCol({ name: 'date', label_trans: 'products.date', fieldtype: tools.FieldType.date }),
@@ -723,6 +733,12 @@ export const fieldsTable = {
label_trans: 'reg.manage_telegram', label_trans: 'reg.manage_telegram',
fieldtype: tools.FieldType.boolean fieldtype: tools.FieldType.boolean
}), }),
AddCol({
name: 'profile.myshares',
field: 'profile',
subfield: 'myshares',
label_trans: 'reg.myshares'
}),
AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }), AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),
AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }), AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }),
AddCol({ name: 'lasttimeonline', label_trans: 'reg.lasttimeonline', fieldtype: tools.FieldType.date }), AddCol({ name: 'lasttimeonline', label_trans: 'reg.lasttimeonline', fieldtype: tools.FieldType.date }),
@@ -733,7 +749,7 @@ export const fieldsTable = {
AddCol(DuplicateRec) AddCol(DuplicateRec)
], ],
colTableUsersSIP: [ colTableUsersCNM: [
// AddCol({ name: '_id', label_trans: 'reg.id' }), // AddCol({ name: '_id', label_trans: 'reg.id' }),
AddCol({ name: 'ind_order', label_trans: 'reg.ind_order' }), AddCol({ name: 'ind_order', label_trans: 'reg.ind_order' }),
AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: tools.FieldType.boolean }), AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: tools.FieldType.boolean }),
@@ -744,7 +760,7 @@ export const fieldsTable = {
AddCol({ name: 'email', label_trans: 'reg.email' }), AddCol({ name: 'email', label_trans: 'reg.email' }),
AddCol({ name: 'made_gift', label_trans: 'reg.made_gift', fieldtype: tools.FieldType.boolean }), AddCol({ name: 'made_gift', label_trans: 'reg.made_gift', fieldtype: tools.FieldType.boolean }),
AddCol({ name: 'note', label_trans: 'reg.note' }), AddCol({ name: 'note', label_trans: 'reg.note' }),
AddCol({ name: 'aportador_solidario', label_trans: 'reg.aportador_solidario' }), // AddCol({ name: 'aportador_solidario', label_trans: 'reg.aportador_solidario' }),
AddCol({ name: 'verified_email', label_trans: 'reg.verified_email', fieldtype: tools.FieldType.boolean }), AddCol({ name: 'verified_email', label_trans: 'reg.verified_email', fieldtype: tools.FieldType.boolean }),
AddCol({ AddCol({
name: 'profile.special_req', name: 'profile.special_req',
@@ -816,6 +832,20 @@ export const fieldsTable = {
label_trans: 'reg.manage_telegram', label_trans: 'reg.manage_telegram',
fieldtype: tools.FieldType.boolean fieldtype: tools.FieldType.boolean
}), }),
AddCol({
name: 'profile.socio',
field: 'profile',
subfield: 'socio',
label_trans: 'reg.socio',
fieldtype: tools.FieldType.boolean
}),
AddCol({
name: 'profile.socioresidente',
field: 'profile',
subfield: 'socioresidente',
label_trans: 'reg.socioresidente',
fieldtype: tools.FieldType.boolean
}),
AddCol({ name: 'profile.chisei', field: 'profile', subfield: 'chisei', label_trans: 'reg.chisei' }), AddCol({ name: 'profile.chisei', field: 'profile', subfield: 'chisei', label_trans: 'reg.chisei' }),
AddCol({ AddCol({
name: 'profile.iltuoimpegno', name: 'profile.iltuoimpegno',
@@ -827,7 +857,7 @@ export const fieldsTable = {
name: 'profile.come_aiutare', name: 'profile.come_aiutare',
field: 'profile', field: 'profile',
subfield: 'come_aiutare', subfield: 'come_aiutare',
label_trans: 'reg.iltuoimpegno' label_trans: 'reg.come_aiutare'
}), }),
AddCol({ AddCol({
name: 'profile.paymenttypes', name: 'profile.paymenttypes',
@@ -909,6 +939,13 @@ export const fieldsTable = {
colkey: '_id', colkey: '_id',
collabel: (rec) => rec.name + ' (' + rec.city + ')' collabel: (rec) => rec.name + ' (' + rec.city + ')'
}, },
{
value: 'sharewithus',
label: 'Condividi con Noi',
columns: colTableShareWithUs,
colkey: '_id',
collabel: 'description'
},
{ {
value: 'wheres', value: 'wheres',
label: 'Luoghi', label: 'Luoghi',

View File

@@ -112,6 +112,7 @@ export const tools = {
TABCALZOOM: 'calzoom', TABCALZOOM: 'calzoom',
TABTEMPLEMAIL: 'templemail', TABTEMPLEMAIL: 'templemail',
TABOPZEMAIL: 'opzemail', TABOPZEMAIL: 'opzemail',
TABSHAREWITHUS: 'sharewithus',
MAX_CHARACTERS: 60, MAX_CHARACTERS: 60,
projects: 'projects', projects: 'projects',
@@ -164,16 +165,6 @@ export const tools = {
PRIORITY_LOW: 0 PRIORITY_LOW: 0
}, },
OrderStatus: {
NONE: 0,
IN_CART: 1,
CHECKOUT_CONFIRMED: 2,
PAYED: 3,
DELIVEDED: 4,
RECEIVED: 5,
CANCELED: 10,
},
Status: { Status: {
NONE: 0, NONE: 0,
OPENED: 1, OPENED: 1,
@@ -1775,7 +1766,7 @@ export const tools = {
} }
}, },
async saveFieldToServer(myself: any, table, id, mydata) { async saveFieldToServer(myself: any, table, id, mydata, notif = true) {
const mydatatosave = { const mydatatosave = {
id, id,
table, table,
@@ -1785,7 +1776,8 @@ export const tools = {
GlobalStore.actions.saveFieldValue(mydatatosave).then((ris) => { GlobalStore.actions.saveFieldValue(mydatatosave).then((ris) => {
if (ris) { if (ris) {
tools.showPositiveNotif(myself.$q, myself.$t('db.recupdated')) if (notif)
tools.showPositiveNotif(myself.$q, myself.$t('db.recupdated'))
} else { } else {
tools.showNegativeNotif(myself.$q, myself.$t('db.recfailed')) tools.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
} }
@@ -1898,7 +1890,7 @@ export const tools = {
if (!(static_data.arrLangUsed.includes(mylang))) { if (!(static_data.arrLangUsed.includes(mylang))) {
// console.log('non incluso ', mylang) // console.log('non incluso ', mylang)
// mylang = static_data.arrLangUsed[0] // mylang = static_data.arrLangUsed[0]
mylang = 'enUs' mylang = 'it'
// Metti come default // Metti come default
UserStore.mutations.setlang(mylang) UserStore.mutations.setlang(mylang)
@@ -2620,7 +2612,7 @@ export const tools = {
if (GlobalStore.state.leftDrawerOpen) if (GlobalStore.state.leftDrawerOpen)
myw -= 300 myw -= 300
if (!this.isMobile()) if (!this.isMobile())
if (GlobalStore.state.RightDrawerOpen) if (GlobalStore.state.rightDrawerOpen)
myw -= 300 myw -= 300
maxh2 = (myw / coeff) + 20 maxh2 = (myw / coeff) + 20
@@ -3040,7 +3032,7 @@ export const tools = {
tools.showNotif(mythis.$q, mythis.$t('login.errato'), { color: 'negative', icon: 'notifications' }) tools.showNotif(mythis.$q, mythis.$t('login.errato'), { color: 'negative', icon: 'notifications' })
mythis.iswaitingforRes = false mythis.iswaitingforRes = false
if (ispageLogin) { if (ispageLogin) {
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
// mythis.$router.push('/signin') // mythis.$router.push('/signin')
} }
}) })
@@ -3060,7 +3052,7 @@ export const tools = {
tools.showNotif(mythis.$q, mythis.$t('login.subaccount'), { color: 'negative', icon: 'notifications' }) tools.showNotif(mythis.$q, mythis.$t('login.subaccount'), { color: 'negative', icon: 'notifications' })
mythis.iswaitingforRes = false mythis.iswaitingforRes = false
if (ispageLogin) { if (ispageLogin) {
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
// mythis.$router.push('/signin') // mythis.$router.push('/signin')
} }
}) })
@@ -3177,7 +3169,7 @@ export const tools = {
} }
, ,
async createNewRecord(mythis, table, data) { async createNewRecord(mythis, table, data, withnotif = true) {
const mydata = { const mydata = {
table, table,
@@ -3187,10 +3179,12 @@ export const tools = {
return await return await
GlobalStore.actions.saveTable(mydata) GlobalStore.actions.saveTable(mydata)
.then((record) => { .then((record) => {
if (record) { if (withnotif) {
tools.showPositiveNotif(mythis.$q, mythis.$t('db.recupdated')) if (record) {
} else { tools.showPositiveNotif(mythis.$q, mythis.$t('db.recupdated'))
tools.showNegativeNotif(mythis.$q, mythis.$t('db.recfailed')) } else {
tools.showNegativeNotif(mythis.$q, mythis.$t('db.recfailed'))
}
} }
return record return record
}) })
@@ -3208,7 +3202,7 @@ export const tools = {
} }
if (withright) if (withright)
if (GlobalStore.state.RightDrawerOpen) if (GlobalStore.state.rightDrawerOpen)
myw -= 300 myw -= 300
return myw return myw

View File

@@ -7,7 +7,7 @@ const VALIDATE_USER_URL = process.env.MONGODB_HOST + '/users/'
export function registereduser(userName: string) { export function registereduser(userName: string) {
let onSuccess = (res: AxiosResponse) => { const onSuccess = (res: AxiosResponse) => {
return res.status !== PayloadMessageTypes.statusfound return res.status !== PayloadMessageTypes.statusfound
} }

View File

@@ -9,12 +9,17 @@ import { CDate } from '../../../components/CDate'
import { Action } from 'vuex' import { Action } from 'vuex'
import Products from '@src/store/Modules/Products' import Products from '@src/store/Modules/Products'
import { CSingleCart } from '../../../components/CSingleCart' import { CSingleCart } from '../../../components/CSingleCart'
import { CTitleBanner } from '@components'
import { tools } from '@src/store/Modules/tools'
import { ICart } from '@src/model'
import MixinBase from '@src/mixins/mixin-base'
import { shared_consts } from '@src/common/shared_vuejs'
const namespace: string = 'Products' const namespace: string = 'Products'
@Component({ @Component({
name: 'checkOut', name: 'checkOut',
components: { SingleProject, CProgress, CTodo, CDate, CSingleCart }, components: { SingleProject, CProgress, CTodo, CDate, CSingleCart, CTitleBanner },
filters: { filters: {
capitalize(value) { capitalize(value) {
if (!value) { if (!value) {
@@ -26,8 +31,14 @@ const namespace: string = 'Products'
} }
}) })
export default class CheckOut extends Vue { export default class CheckOut extends MixinBase {
public $q: any public $q: any
public mycart: ICart = {}
public myrec: any[]
public note: string = ''
public conferma_carrello: boolean = false
public conferma_ordine: boolean = false
/*public $refs: { /*public $refs: {
singleproject: SingleProject[], singleproject: SingleProject[],
@@ -39,16 +50,110 @@ export default class CheckOut extends Vue {
return cart.items || null return cart.items || null
} }
get getCart() {
return Products.getters.getCart()
}
get getNote() {
const cart = Products.getters.getCart()
return cart.note
}
public change_field(fieldname) {
if (this.myrec[fieldname] !== this[fieldname]) {
this.myrec[fieldname] = this[fieldname]
const mydata = {
[fieldname]: this.myrec[fieldname]
}
const aggiorna = fieldname !== 'status'
tools.saveFieldToServer(this, 'carts', this.mycart._id, mydata, aggiorna)
}
}
get myTotalPrice() { get myTotalPrice() {
if (Products.state.cart && Products.state.cart.totalPrice) {
return Products.state.cart.totalPrice.toFixed(2)
} else {
return 0
}
}
get myTotalQty() {
if (Products.state.cart) { if (Products.state.cart) {
return Products.state.cart.totalPrice return Products.state.cart.totalQty
} else { } else {
return 0 return 0
} }
} }
public mounted() { public mounted() {
this.mycart = this.getCart
this.myrec = Object.keys(this.mycart)
this.note = this.mycart.note
console.log('myrec', this.myrec)
// Products.actions.loadCart() // Products.actions.loadCart()
} }
public CanBeShipped() {
return Products.state.cart.items.filter((rec) => rec.order.product.canBeShipped).length
}
public CanBeBuyOnline() {
return Products.state.cart.items.filter((rec) => rec.order.product.canBeBuyOnline).length
}
get getnumsteps() {
let numsteps = 1
if (this.CanBeShipped())
numsteps++
if (this.CanBeBuyOnline())
numsteps++
return numsteps
}
public docheckout() {
// Può essere spedito?
if (this.CanBeShipped()) {
// mostra form di spedizione
}
if (this.CanBeBuyOnline()) {
// mostra form di acquisto Online
}
}
get nextstep() {
return 0
}
public completeOrder() {
this.$q.dialog({
message: 'Confermare l\'ordine di acquisto di ' + this.myTotalQty + ' prodotti ?',
ok: {
label: this.$t('dialog.yes'),
push: true
},
cancel: {
label: this.$t('dialog.cancel')
},
title: 'Ordine'
}).onOk(async () => {
const status = shared_consts.OrderStatus.CHECKOUT_CONFIRMED
const statusnow = await Products.actions.UpdateStatusCart({ cart_id: this.mycart._id, status })
if (statusnow === status) {
tools.showPositiveNotif(this.$q, 'Ordine Confermato')
}
// this.change_field('status')
// this.change_field('status')
})
}
} }

View File

@@ -1,17 +1,36 @@
<template> <template>
<q-page> <q-page>
<CTitleBanner title="Carrello"></CTitleBanner>
<div class="panel"> <div class="panel">
<div class="container"> <div>
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in getItemsCart" :key="index"> <div class="container">
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in getItemsCart" :key="index">
<CSingleCart :order="itemorder.order" :showall="true"/> <CSingleCart :order="itemorder.order" :showall="true"/>
</div>
</div> </div>
<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>
</div>
<q-input v-model="note" style="max-width: 400px;" label="Note aggiuntive:"
filled dense
debounce="1000"
autogrow
@input="change_field('note')">
</q-input>
<br>
</div> </div>
<q-separator></q-separator>
<div class="col-6 q-mr-sm" style="text-align: right"> <q-stepper-navigation>
<span class="text-grey q-mr-xs">Totale:</span> <span <q-btn rounded icon="fas fa-shopping-cart" color="green" label="Completa l'Ordine" class="q-mb-sm"
class="text-subtitle1 q-mr-sm "> {{ myTotalPrice.toFixed(2) }}</span> :disabled="myTotalQty < 1"
</div> @click="completeOrder"></q-btn>
</q-stepper-navigation>
</div> </div>
</q-page> </q-page>
</template> </template>

View File

@@ -0,0 +1 @@
export {default as orderInfo} from './orderInfo.vue'

View File

@@ -0,0 +1,5 @@
$heightBtn: 100%;
.card .product-image {
height: 300px;
}

View File

@@ -0,0 +1,149 @@
import Vue from 'vue'
import { Component, Watch } from 'vue-property-decorator'
import { SingleProject } from '../../../components/projects/SingleProject/index'
import { CTodo } from '../../../components/todos/CTodo'
import { CProgress } from '../../../components/CProgress'
import { CDate } from '../../../components/CDate'
import { Action } from 'vuex'
import Products from '@src/store/Modules/Products'
import { CSingleCart } from '../../../components/CSingleCart'
import { CTitleBanner } from '@components'
import { tools } from '@src/store/Modules/tools'
import { ICart, IOrderCart } from '@src/model'
import MixinBase from '@src/mixins/mixin-base'
import { shared_consts } from '@src/common/shared_vuejs'
const namespace: string = 'Products'
@Component({
name: 'checkOut',
components: { SingleProject, CProgress, CTodo, CDate, CSingleCart, CTitleBanner },
filters: {
capitalize(value) {
if (!value) {
return ''
}
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
}
}
})
export default class OrderInfo extends MixinBase {
public $q: any
public myorderscart: IOrderCart[] = []
public myarrrec: any = {}
public conferma_carrello: boolean = false
public conferma_ordine: boolean = false
public taborders: string = 'incorso'
public columns = [
{
name: 'numorder',
required: true,
align: 'left',
label: 'Numero Ordine',
field: 'numorder',
sortable: true
},
{
name: 'created_at',
required: true,
align: 'center',
label: 'Effettuato il',
field: 'created_at',
sortable: true
},
{
name: 'items',
required: true,
label: 'Articoli',
field: 'items',
sortable: true
},
{
name: 'totalPrice',
required: true,
label: 'Totale',
field: 'totalPrice',
sortable: true
},
{
name: 'status',
align: 'center',
required: true,
label: 'Stato',
field: 'status',
sortable: true
}
]
/*public $refs: {
singleproject: SingleProject[],
ctodo: CTodo
}*/
get getOrdersCart() {
return Products.getters.getOrdersCart(this.taborders)
}
public change_field(myorderid, fieldname) {
if (this.myarrrec[myorderid][fieldname] !== this[fieldname]) {
this.myarrrec[myorderid][fieldname] = this[fieldname]
const mydata = {
[fieldname]: this.myarrrec[myorderid][fieldname]
}
const aggiorna = fieldname !== 'status'
tools.saveFieldToServer(this, 'orderscart', myorderid, mydata, aggiorna)
}
}
public mounted() {
this.myorderscart = this.getOrdersCart
for (const ordercart of this.myorderscart) {
this.myarrrec[ordercart._id] = Object.keys(ordercart)
}
}
public CanBeShipped() {
return Products.state.cart.items.filter((rec) => rec.order.product.canBeShipped).length
}
public CanBeBuyOnline() {
return Products.state.cart.items.filter((rec) => rec.order.product.canBeBuyOnline).length
}
get getnumsteps() {
let numsteps = 1
if (this.CanBeShipped())
numsteps++
if (this.CanBeBuyOnline())
numsteps++
return numsteps
}
public docheckout() {
// Può essere spedito?
if (this.CanBeShipped()) {
// mostra form di spedizione
}
if (this.CanBeBuyOnline()) {
// mostra form di acquisto Online
}
}
get nextstep() {
return 0
}
}

View File

@@ -0,0 +1,88 @@
<template>
<q-page>
<CTitleBanner title="Ordini"></CTitleBanner>
<div class="panel">
<q-tabs
v-model="taborders"
inline-label
class="text-blue"
>
<q-tab name="incorso" icon="fas fa-tasks" label="Ordini in Corso"/>
<q-tab name="recenti" icon="fas fa-calendar" label="Ordini Recenti"/>
</q-tabs>
<div class="q-pa-sm">
<q-table
:columns="columns"
row-key="numorder"
:data="getOrdersCart">
<template v-slot:body="props">
<q-tr :props="props">
<q-td key="numorder" :props="props">
&nbsp; n. {{ props.row.numorder }}
</q-td>
<q-td key="created_at" :props="props">
{{ tools.getstrDateTime(props.row.created_at) }}
</q-td>
<q-td key="items" :props="props">
<div v-for="item of props.row.items">
<div v-if="!!item.order.product">
{{ item.order.product.name }} ({{ item.order.quantity }})<br>
</div>
</div>
</q-td>
<q-td key="totalPrice" :props="props">
{{ props.row.totalPrice }}
</q-td>
<q-td key="status" :props="props">
{{ props.row.status }}
</q-td>
</q-tr>
</template>
</q-table>
</div>
<!--
<div v-for="(ordercart, index) in getOrdersCart" :key="index">
<div>
{{ ordercart.numorder }}<br>
</div>
<div class="container">
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in ordercart.items" :key="index">
<CSingleCart :order="itemorder.order" :showall="true" :nomodif="true"/>
</div>
</div>
<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 "> {{ ordercart.totalPrice.toFixed(2) }}</span>
</div>
<q-input v-model="ordercart.note" style="max-width: 400px;" label="Note aggiuntive:"
filled dense
debounce="1000"
autogrow
@input="change_field(ordercart.id, 'note')">
</q-input>
<br>
</div>
-->
</div>
</q-page>
</template>
<script lang="ts" src="./orderInfo.ts">
</script>
<style lang="scss" scoped>
@import './orderInfo';
</style>

View File

@@ -0,0 +1 @@
export {default as ProductInfo} from './ProductInfo.vue'

View File

@@ -0,0 +1,5 @@
$heightBtn: 100%;
.card .product-image {
height: 300px;
}

View File

@@ -0,0 +1,51 @@
import Vue from 'vue'
import { Component, Prop, Watch } from 'vue-property-decorator'
import {
IAction,
IDrag, IProduct,
IProductsState, ITodo, ITodosState,
TypeProj
} from '../../../model/index'
import { SingleProject } from '../../../components/projects/SingleProject/index'
import { CTodo } from '../../../components/todos/CTodo'
import { tools } from '../../../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { lists } from '../../../store/Modules/lists'
import * as ApiTables from '../../../store/Modules/ApiTables'
import { GlobalStore, Projects, Todos } from '@store'
import { UserStore } from '@store'
import { Getter } from 'vuex-class'
import { date, Screen } from 'quasar'
import { CProgress } from '../../../components/CProgress'
import { CDate } from '../../../components/CDate'
import { RouteNames } from '@src/router/route-names'
import { CProductCard } from '@src/components/CProductCard'
import { Action } from 'vuex'
import Products from '@src/store/Modules/Products'
const namespace: string = 'Products'
@Component({
name: 'ProductInfo',
components: { SingleProject, CProgress, CTodo, CDate, CProductCard }
})
export default class ProductInfo extends Vue {
public $q: any
public code: string = ''
public created() {
console.log('created productInfo')
console.log(this.$route)
if (!!this.$route.params.codprod) {
this.code = this.$route.params.codprod.toString()
}
console.log('this.code', this.code)
}
}

View File

@@ -0,0 +1,19 @@
<template>
<q-page>
<div class="panel">
<div class="container">
<div class="row">
<CProductCard :code="code" complete="true"/>
</div>
</div>
</div>
</q-page>
</template>
<script lang="ts" src="./productInfo.ts">
</script>
<style lang="scss" scoped>
@import './productInfo';
</style>

View File

@@ -4,7 +4,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts" :key="index"> <div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts" :key="index">
<CProductCard :product="product"/> <CProductCard :product="product" :complete="false"/>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -63,6 +63,6 @@ export default class Vreg extends Vue {
} }
public openrighttoolbar() { public openrighttoolbar() {
GlobalStore.state.RightDrawerOpen = true GlobalStore.state.rightDrawerOpen = true
} }
} }