diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 39c849e..a9a2761 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -83,6 +83,9 @@ export const shared_consts = { TypeMsg: { SEND_TO_ALL: 1, + SEND_TO_SOCI: 2, + SEND_TO_SOCIO_RESIDENTE: 3, + SEND_TO_NON_SOCI: 10 }, 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() { return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on'] } diff --git a/src/components/CEventsCalendar/CEventsCalendar.ts b/src/components/CEventsCalendar/CEventsCalendar.ts index 663fa43..4735947 100755 --- a/src/components/CEventsCalendar/CEventsCalendar.ts +++ b/src/components/CEventsCalendar/CEventsCalendar.ts @@ -467,7 +467,7 @@ export default class CEventsCalendar extends MixinEvents { public addBookEventMenu(eventparam) { if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { // Visu right Toolbar to make SignIn - GlobalStore.state.RightDrawerOpen = true + GlobalStore.state.rightDrawerOpen = true tools.showNeutralNotif(this.$q, this.$t('login.needlogin')) tools.scrollToTop() // window.scrollTo(0, 0) @@ -490,7 +490,7 @@ export default class CEventsCalendar extends MixinEvents { public askForInfoEventMenu(eventparam) { if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) { // Visu right Toolbar to make SignIn - GlobalStore.state.RightDrawerOpen = true + GlobalStore.state.rightDrawerOpen = true tools.showNeutralNotif(this.$q, this.$t('login.needlogin')) tools.scrollToTop() diff --git a/src/components/CMyCart/CMyCart.ts b/src/components/CMyCart/CMyCart.ts index 045e30c..fead140 100755 --- a/src/components/CMyCart/CMyCart.ts +++ b/src/components/CMyCart/CMyCart.ts @@ -6,7 +6,7 @@ import { CCardState } from '../CCardState' import { CCopyBtn } from '../CCopyBtn' import { IOrder, IProduct } from '@src/model' -import { Products, UserStore } from '@store' +import { GlobalStore, Products, UserStore } from '@store' import { CSingleCart } from '../../components/CSingleCart' import MixinUsers from '@src/mixins/mixin-users' @@ -44,4 +44,8 @@ export default class CMyCart extends MixinUsers { return 0 } } + + public closecart() { + GlobalStore.state.rightCartOpen = false + } } diff --git a/src/components/CMyCart/CMyCart.vue b/src/components/CMyCart/CMyCart.vue index 7ca49f8..7c6680e 100755 --- a/src/components/CMyCart/CMyCart.vue +++ b/src/components/CMyCart/CMyCart.vue @@ -30,7 +30,7 @@ Il Carrello è Vuoto
- +
diff --git a/src/components/CProductCard/CProductCard.ts b/src/components/CProductCard/CProductCard.ts index 8d254b1..91e0ffa 100755 --- a/src/components/CProductCard/CProductCard.ts +++ b/src/components/CProductCard/CProductCard.ts @@ -17,7 +17,10 @@ import { Products, UserStore } from '@store' export default class CProductCard extends MixinBase { 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({ required: false, type: Object, @@ -50,11 +53,17 @@ export default class CProductCard extends MixinBase { 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 - 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') } 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' if (this.order.quantity > 1) strprod = 'prodotti' @@ -67,14 +76,14 @@ export default class CProductCard extends MixinBase { } public getnumstore() { - if (!!this.product.storehouses) - return this.product.storehouses.length + if (!!this.myproduct.storehouses) + return this.myproduct.storehouses.length else return 0 } public getSingleStorehouse() { - const mystore = this.product.storehouses[0] + const mystore = this.myproduct.storehouses[0] return mystore.name + ' (' + mystore.city + ')' } @@ -82,7 +91,7 @@ export default class CProductCard extends MixinBase { const myarr = [] let ind = 1 - this.product.storehouses.forEach((store) => { + this.myproduct.storehouses.forEach((store) => { myarr.push( { id: ind, @@ -101,13 +110,36 @@ export default class CProductCard extends MixinBase { return !this.order.idStorehouse } - public infoproduct() { + @Watch('code') + public codechanged(value) { + console.log('change code') + this.load() } - public created() { - if (this.product.storehouses.length === 1) { - this.order.idStorehouse = this.product.storehouses[0]._id + public async load() { + // console.log('created Cproductcard', this.code) + 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' + } + + } diff --git a/src/components/CProductCard/CProductCard.vue b/src/components/CProductCard/CProductCard.vue index 33f108e..f717991 100755 --- a/src/components/CProductCard/CProductCard.vue +++ b/src/components/CProductCard/CProductCard.vue @@ -1,50 +1,49 @@