diff --git a/src/components/CCardOperator/CCardOperator.scss b/src/components/CCardOperator/CCardOperator.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/CCardOperator/CCardOperator.ts b/src/components/CCardOperator/CCardOperator.ts new file mode 100644 index 0000000..0da5782 --- /dev/null +++ b/src/components/CCardOperator/CCardOperator.ts @@ -0,0 +1,22 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { tools } from '../../store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' +import { CCard } from '@components' +import MixinOperator from '../../mixins/mixin-operator' + +@Component({ + name: 'CCardOperator', + components: { CCard } +}) + +export default class CCardOperator extends MixinOperator { + @Prop({ required: true}) public username + public tab: string = 'one' + + get tools() { + return tools + } + +} diff --git a/src/components/CCardOperator/CCardOperator.vue b/src/components/CCardOperator/CCardOperator.vue new file mode 100644 index 0000000..d58eb0c --- /dev/null +++ b/src/components/CCardOperator/CCardOperator.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/components/CCardOperator/index.ts b/src/components/CCardOperator/index.ts new file mode 100644 index 0000000..2effd97 --- /dev/null +++ b/src/components/CCardOperator/index.ts @@ -0,0 +1 @@ +export {default as CCardOperator} from './CCardOperator.vue' diff --git a/src/components/CCardState/CCardState.scss b/src/components/CCardState/CCardState.scss new file mode 100644 index 0000000..0a37bb0 --- /dev/null +++ b/src/components/CCardState/CCardState.scss @@ -0,0 +1,13 @@ +.my-card-stat { + width: 100%; + max-width: 200px; + min-width: 120px; + padding: 1rem 1rem; + @media (max-width: 718px) { + // PER VERSIONE MOBILE + max-width: 150px; + padding: 0; + } + + box-shadow: none; +} diff --git a/src/components/CCardState/CCardState.ts b/src/components/CCardState/CCardState.ts new file mode 100644 index 0000000..a3b61e2 --- /dev/null +++ b/src/components/CCardState/CCardState.ts @@ -0,0 +1,26 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { tools } from '../../store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' +import MixinBase from '@src/mixins/mixin-base' + +@Component({ + name: 'CCardState' +}) + +export default class CCardState extends MixinBase { + @Prop({ required: true, default: '' }) public mytext + @Prop({ required: true, default: 0 }) public myval + @Prop({ required: true, default: 0 }) public myperc + @Prop({ required: false, default: '' }) public imgsrc + @Prop({ required: false, default: false }) public isperc + @Prop({ required: false, default: '' }) public textadd + + get getsize() { + if (tools.isMobile()) + return '130px' + else + return '150px' + } +} diff --git a/src/components/CCardState/CCardState.vue b/src/components/CCardState/CCardState.vue new file mode 100644 index 0000000..fd427a5 --- /dev/null +++ b/src/components/CCardState/CCardState.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/components/CCardState/index.ts b/src/components/CCardState/index.ts new file mode 100644 index 0000000..1007149 --- /dev/null +++ b/src/components/CCardState/index.ts @@ -0,0 +1 @@ +export {default as CCardState} from './CCardState.vue' diff --git a/src/components/CMyImg/CMyImg.scss b/src/components/CMyImg/CMyImg.scss new file mode 100644 index 0000000..0f13438 --- /dev/null +++ b/src/components/CMyImg/CMyImg.scss @@ -0,0 +1,3 @@ +.climg { + border-radius: 5px; +} diff --git a/src/components/CMyImg/CMyImg.ts b/src/components/CMyImg/CMyImg.ts new file mode 100644 index 0000000..dd89a89 --- /dev/null +++ b/src/components/CMyImg/CMyImg.ts @@ -0,0 +1,41 @@ +import Vue from 'vue' +import { Component, Prop } from 'vue-property-decorator' +import { GlobalStore, UserStore } from '@store' + +import { tools } from '@src/store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' + +@Component({ + name: 'CMyImg' +}) + +export default class CMyImg extends Vue { + @Prop({ required: true, default: '' }) public src: string + @Prop({ required: false, default: '' }) public alt: string + @Prop({ required: false, default: '' }) public width: string + public srcbase: string = '' + public mystyle: string = '' + + public mounted() { + console.log('mounted') + console.log(this.src) + + if (this.width) + this.mystyle = 'max-width: ' + this.width + 'px; ' + else + this.mystyle = '' + } + + public created() { + console.log('created') + + } + + get getalt() { + if (this.alt) { + return this.alt + } else { + return tools.getimgFullpathbysize(this.src) + } + } +} diff --git a/src/components/CMyImg/CMyImg.vue b/src/components/CMyImg/CMyImg.vue new file mode 100644 index 0000000..504c033 --- /dev/null +++ b/src/components/CMyImg/CMyImg.vue @@ -0,0 +1,12 @@ + + + + diff --git a/src/components/CMyImg/index.ts b/src/components/CMyImg/index.ts new file mode 100644 index 0000000..8992437 --- /dev/null +++ b/src/components/CMyImg/index.ts @@ -0,0 +1 @@ +export {default as CMyImg} from './CMyImg.vue' diff --git a/src/components/CMyInnerPage/CMyInnerPage.scss b/src/components/CMyInnerPage/CMyInnerPage.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/CMyInnerPage/CMyInnerPage.ts b/src/components/CMyInnerPage/CMyInnerPage.ts new file mode 100644 index 0000000..8c1f1b1 --- /dev/null +++ b/src/components/CMyInnerPage/CMyInnerPage.ts @@ -0,0 +1,42 @@ +import Vue from 'vue' +import { Component, Prop, Watch } 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 { colmypage } 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' +import { IMyPage } from '@src/model/GlobalStore' + +@Component({ + name: 'CMyInnerPage', + mixins: [MixinBase], + components: { CImgText, CCard, CMyPage, CTitleBanner } +}) +export default class CMyInnerPage extends MixinMetaTags { + @Prop({ required: true }) public path: string + public heightimg + public imgback + public rec: IMyPage = {} + + public mounted() { + // console.log('this.$route.path', this.$route.path) + this.rec = GlobalStore.getters.getPage(this.path) + console.log(this.rec) + } + + public meta() { + return tools.metafunc(this) + } + + get static_data() { + return static_data + } +} diff --git a/src/components/CMyInnerPage/CMyInnerPage.vue b/src/components/CMyInnerPage/CMyInnerPage.vue new file mode 100644 index 0000000..8d6c9c0 --- /dev/null +++ b/src/components/CMyInnerPage/CMyInnerPage.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/components/CMyInnerPage/index.ts b/src/components/CMyInnerPage/index.ts new file mode 100644 index 0000000..2eb6b45 --- /dev/null +++ b/src/components/CMyInnerPage/index.ts @@ -0,0 +1 @@ +export {default as CMyInnerPage} from './CMyInnerPage.vue' diff --git a/src/components/CProfile/CProfile.scss b/src/components/CProfile/CProfile.scss new file mode 100644 index 0000000..7ce52a9 --- /dev/null +++ b/src/components/CProfile/CProfile.scss @@ -0,0 +1,5 @@ +.signin { + width: 100%; + margin: 0 auto; + max-width: 450px; +} diff --git a/src/components/CProfile/CProfile.ts b/src/components/CProfile/CProfile.ts new file mode 100644 index 0000000..61b92fb --- /dev/null +++ b/src/components/CProfile/CProfile.ts @@ -0,0 +1,23 @@ +import Vue from 'vue' +import { GlobalStore } from '@store' +import { UserStore } from '../../store/Modules' +import { Component, Prop, Watch } from 'vue-property-decorator' +import { toolsext } from '@src/store/Modules/toolsext' + +import { validationMixin } from 'vuelidate' + +import MixinBase from '../../mixins/mixin-base' + +@Component({ + name: 'CProfile', + mixins: [validationMixin], + components: { } +}) + +export default class CProfile extends MixinBase { + @Prop({ required: true }) public mythis: any + public $v + public $t: any + + +} diff --git a/src/components/CProfile/CProfile.vue b/src/components/CProfile/CProfile.vue new file mode 100644 index 0000000..7d4d73e --- /dev/null +++ b/src/components/CProfile/CProfile.vue @@ -0,0 +1,16 @@ + + + + + diff --git a/src/components/CProfile/index.ts b/src/components/CProfile/index.ts new file mode 100644 index 0000000..6b12f73 --- /dev/null +++ b/src/components/CProfile/index.ts @@ -0,0 +1 @@ +export {default as CProfile} from './CProfile.vue' diff --git a/src/components/CSignUpNotevole/CSignUp-validate.ts b/src/components/CSignUpNotevole/CSignUp-validate.ts new file mode 100644 index 0000000..c16e274 --- /dev/null +++ b/src/components/CSignUpNotevole/CSignUp-validate.ts @@ -0,0 +1,43 @@ +import { ISignupOptions } from 'model' +import { email, minLength, required, sameAs } from 'vuelidate/lib/validators' +// import { ValidationRuleset } from 'vuelidate' +import { complexity, registeredemail, registereduser, aportadorexist } from '../../validation' + +export interface TSignup { signup: ISignupOptions, validationGroup: string[] } + +export const validations = { + signup: { + repeatPassword: { + required, + sameAsPassword: sameAs('password') + }, + password: { + required, + minLength: minLength(8), + complexity + }, + username: { + required, + minLength: minLength(6), + registereduser + }, + name: { + required + }, + surname: { + required + }, + email: { + email, + registeredemail, + required + }, + terms: { + required + }, + aportador_solidario: { + aportadorexist, + required + } + } +} diff --git a/src/components/CSignUpNotevole/CSignUpNotevole.scss b/src/components/CSignUpNotevole/CSignUpNotevole.scss new file mode 100644 index 0000000..0934865 --- /dev/null +++ b/src/components/CSignUpNotevole/CSignUpNotevole.scss @@ -0,0 +1,34 @@ +.signup { + width: 100%; + margin: 0 auto; + max-width: 450px; +} + + +.wrapper { + display: flex; + align-items: center; + justify-content: center; +} + +.clCellCode { + border-radius: 32px; + border-right: #2d2260; + height: 50px; + font-size: 1rem; + padding: 8px; +} + +.clCell { + border-radius: 32px; + border-right: #2d2260; + height: 50px; + font-size: 1rem; + padding: 8px; +} + +.vue-country-select{ + border-radius: 32px; +} + + diff --git a/src/components/CSignUpNotevole/CSignUpNotevole.ts b/src/components/CSignUpNotevole/CSignUpNotevole.ts new file mode 100644 index 0000000..f30089f --- /dev/null +++ b/src/components/CSignUpNotevole/CSignUpNotevole.ts @@ -0,0 +1,268 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' +import { UserStore } from '@store' +import { tools } from '../../store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' + +import { ISignupOptions, IUserState, IUserFields } from 'model' +import { validations, TSignup } from './CSignUp-validate' + +import { validationMixin } from 'vuelidate' + +import { Logo } from '../../components/logo' +import { DefaultProfile } from '../../store/Modules/UserStore' + +import 'vue-country-code/dist/vue-country-code.css' +import { serv_constants } from '@src/store/Modules/serv_constants' + +import VueCountryCode from 'vue-country-code' +import { CTitleBanner } from '../CTitleBanner' +import { registereduser } from '../../validation' +import MixinBase from '../../mixins/mixin-base' + +Vue.use(VueCountryCode) +// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar' + +@Component({ + name: 'CSignUp', + mixins: [validationMixin], + validations, + components: { Logo, CTitleBanner } +}) + +export default class CSignUpNotevole extends MixinBase { + @Prop({ required: false, default: false }) public showadultcheck: boolean + @Prop({ required: false, default: false }) public showcell: boolean + @Prop({ required: false, default: false }) public showaportador: boolean + @Prop({ required: false, default: false }) public shownationality: boolean + public $v + public $q + public $t: any + public countryname: string = '' + public iamadult: boolean = false + + public duplicate_email: boolean = false + public duplicate_username: boolean = false + + public options = [ + { label: 'Sono già registrato sulla Chat di Ayni', value: true, color: 'green' }, + { label: 'Nuova Registrazione', value: false, color: 'blue' }, + ] + + public signup: ISignupOptions = { + email: process.env.TEST_EMAIL || '', + username: process.env.TEST_USERNAME || '', + name: process.env.TEST_NAME || '', + surname: process.env.TEST_SURNAME || '', + password: process.env.TEST_PASSWORD || '', + repeatPassword: process.env.TEST_PASSWORD || '', + terms: !process.env.PROD, + profile: DefaultProfile, + aportador_solidario: process.env.TEST_APORTADOR, + } + + public created() { + this.$v.$reset() + + this.signup.aportador_solidario = this.$route.params.invited + if (!this.signup.aportador_solidario) { + this.signup.aportador_solidario = tools.APORTADOR_NONE + } + this.$v.signup.aportador_solidario.$touch() + + } + + // @Watch('signup.already_registered') + // public changealreadyreg() { + // if (this.signup.already_registered) { + // this.signup.aportador_solidario = tools.APORTADOR_NONE + // } else { + // this.signup.aportador_solidario = this.$route.params.invited + // } + // this.$v.signup.aportador_solidario.$touch() + // } + + @Watch('$route.params.invited') + public changeaportador() { + if (this.showaportador) { + console.log('changeaportador', this.$route.params.invited) + if (!this.signup.aportador_solidario) + this.signup.aportador_solidario = this.$route.params.invited + } + } + + get allowSubmit() { + + let error = this.$v.$error || this.$v.$invalid + + if (this.showadultcheck) + error = error || !this.iamadult + + if (this.showcell) + error = error || this.signup.profile.cell.length <= 6 + + return !error + } + + /* + validations: { + isAsync: true, + form: { + email: { + required, email, + isUnique: value => { + if (value === '') return true; + return axios.get(process.env.MONGODB_HOST + '/email/' + value) + .then(res => { + return (res.status !== 200) + }).catch((e) => { + return true; + }) + } + }, + password: {required, minLength: minLength(8), maxLength: maxLength(20)}, + username: { + required, minLength: minLength(6), maxLength: maxLength(20), + isUnique: value => { + if (value === '') return true; + return axios.get(process.env.MONGODB_HOST + '/users/' + value) + .then(res => { + return (res.status !== 200) + }).catch((e) => { + return true; + }) + } + }, + repeatPassword: { + sameAsPassword: sameAs('password') + }, + terms: {required}, + + } + }, */ + public env() { + return process.env + } + + public errorMsg(cosa: string, item: any) { + try { + if (!item.$error) { + return '' + } + // console.log('errorMsg', cosa, item) + if (item.$params.email && !item.email) { + return this.$t('reg.err.email') + } + + if (cosa === 'repeatpassword') { + if (!item.sameAsPassword) { + return this.$t('reg.err.sameaspassword') + } + } + + // console.log('item', item) + + if (item.minLength !== undefined) { + if (!item.minLength) { + return this.$t('reg.err.atleast') + ` ${item.$params.minLength.min} ` + this.$t('reg.err.char') + } + } + if (item.complexity !== undefined) { + if (!item.complexity) { + return this.$t('reg.err.complexity') + } + } +// if (!item.maxLength) { return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char') } + + if (item.required !== undefined) { + if (!item.required) { + return this.$t('reg.err.required') + } + } + + // console.log(' ....avanti') + if (cosa === 'email') { + // console.log("EMAIL " + item.isUnique); + // console.log(item); + if (!item.isUnique) { + return this.$t('reg.err.duplicate_email') + } + } else if (cosa === 'username') { + // console.log(item); + if (!item.isUnique) { + return this.$t('reg.err.duplicate_username') + } + } else if (cosa === 'aportador_solidario') { + // console.log(item); + if (!item.aportadorexist) { + // console.log('!item.aportadorexist !') + return this.$t('reg.err.aportador_not_exist') + } + } else if ((cosa === 'name') || (cosa === 'surname')) { + // console.log(item); + } + + return '' + } catch (error) { + // console.log("ERR : " + error); + } + } + + public submitOk() { + this.$v.signup.$touch() + + this.duplicate_email = false + this.duplicate_username = false + + if (!this.signup.terms) { + tools.showNotif(this.$q, this.$t('reg.err.terms')) + return + } + + if (this.$v.signup.$error) { + tools.showNotif(this.$q, this.$t('reg.err.errore_generico')) + return + } + + this.signup.name = tools.CapitalizeAllWords(this.signup.name) + this.signup.surname = tools.CapitalizeAllWords(this.signup.surname) + + this.$q.loading.show({ message: this.$t('reg.incorso') }) + + console.log(this.signup) + return UserStore.actions.signup(tools.clone(this.signup)) + .then((riscode) => { + if (tools.SignUpcheckErrors(this, riscode)) + this.$q.loading.hide() + }).catch((error) => { + console.log('ERROR = ' + error) + this.$q.loading.hide() + }) + + } + + public intcode_change(coderec) { + // console.log('intcode', coderec) + this.signup.profile.intcode_cell = '+' + coderec.dialCode + this.signup.profile.iso2_cell = coderec.iso2 + } + + public selectcountry({ name, iso2, dialCode }) { + // console.log(name, iso2, dialCode) + this.signup.profile.nationality = iso2 + this.countryname = name + } + + public inputUsername(value) { + this.signup.username = value.trim() + } + + get getplaceholdercell() { + return this.$t('reg.cellreg') + } + + get regvisibile() { + return true + // return this.signup.already_registered || (!this.signup.already_registered && this.signup.aportador_solidario) + } +} diff --git a/src/components/CSignUpNotevole/CSignUpNotevole.vue b/src/components/CSignUpNotevole/CSignUpNotevole.vue new file mode 100644 index 0000000..b2a2463 --- /dev/null +++ b/src/components/CSignUpNotevole/CSignUpNotevole.vue @@ -0,0 +1,230 @@ + + + + diff --git a/src/components/CSignUpNotevole/index.ts b/src/components/CSignUpNotevole/index.ts new file mode 100644 index 0000000..adbfa14 --- /dev/null +++ b/src/components/CSignUpNotevole/index.ts @@ -0,0 +1 @@ +export {default as CSignUpNotevole} from './CSignUpNotevole.vue' diff --git a/src/components/CStatus/CStatus.scss b/src/components/CStatus/CStatus.scss new file mode 100644 index 0000000..f2927ed --- /dev/null +++ b/src/components/CStatus/CStatus.scss @@ -0,0 +1,21 @@ +.signin { + width: 100%; + margin: 0 auto; + max-width: 450px; +} + +.q-stepper__tab { + + @media (max-width: 718px) { + // PER VERSIONE MOBILE + padding: 10px 16px !important; + } +} + +.q-stepper__step-inner { + @media (max-width: 718px) { + padding: 0 12px 24px 40px !important; + } +} + +li {} diff --git a/src/components/CStatus/CStatus.ts b/src/components/CStatus/CStatus.ts new file mode 100644 index 0000000..b15151a --- /dev/null +++ b/src/components/CStatus/CStatus.ts @@ -0,0 +1,266 @@ +import Vue from 'vue' +import { GlobalStore } from '@store' +import { NotevoleStore, UserStore } from '../../store/Modules' +import { Component, Prop, Watch } from 'vue-property-decorator' +import { toolsext } from '@src/store/Modules/toolsext' + +import MixinBase from '../../mixins/mixin-base' +import { CTitleBanner, CMyFieldDb } from '@components' +import { CMyInnerPage } from '../CMyInnerPage' +import { tools } from '../../store/Modules/tools' + +import { copyToClipboard } from 'quasar' + +@Component({ + components: { CTitleBanner, CMyFieldDb, CMyInnerPage } +}) + +export default class CStatus extends MixinBase { + public $v + public $t: any + public step = 1 + public NUMSTEP_START = 3 + + public arrsteps = [ + { + title: 'steps.zoom', + descr: 'steps.zoom_long', + page: '/zoom', + funccheck(index) { + return UserStore.state.my.profile.saw_zoom_presentation + }, + funccheck_error(index) { + return true + } + }, + { + title: 'steps.dream', + descr: 'steps.dream_long', + page: '/mydream', + funccheck(index) { + if (UserStore.state.my.profile.my_dream) + if (UserStore.state.my.profile.my_dream.length > 10) + return true + + return false + }, + funccheck_error(index) { + return true + }, + }, + { + title: 'steps.sharemovement', + descr: 'steps.sharemovement_long', + page: '/sharemovement', + funccheck(index) { + if (UserStore.state.my.calcstat) + return UserStore.state.my.calcstat.numinvitati_attivi >= 2 + }, + funccheck_error(index) { + return true + }, + }, + { + title: 'steps.paymenttype', + descr: 'steps.paymenttype_long', + page: '', + funccheck(index) { + return this.numpayment >= 2 + }, + funccheck_error(index) { + return true + }, + }, + { + title: 'steps.enter_prog', + descr: 'steps.enter_prog_long', + page: '/enter_prog', + funccheck(index) { + return false + }, + funccheck_error(index) { + return false + }, + }, + { + title: 'steps.collaborate', + descr: 'steps.collaborate_long', + page: '/collaborate', + funccheck(index) { + return false + }, + funccheck_error(index) { + return false + }, + }, + { + title: 'steps.dono', + descr: 'steps.dono_long', + page: '/gift', + funccheck(index) { + return false + }, + funccheck_error(index) { + return false + }, + }, + { + title: 'steps.support', + descr: 'steps.support_long', + page: '/support', + funccheck(index) { + return false + }, + funccheck_error(index) { + return false + }, + }, + { + title: 'steps.ricevo_dono', + descr: 'steps.ricevo_dono_long', + page: '/receivegift', + funccheck(index) { + return false + }, + funccheck_error(index) { + return false + }, + }, + +/* + sharemovement: 'Condivido il movimento', + sharemovement_long: 'Condivido il movimento con almeno 2 amici e li guido alla registrazione e agli zoom', + enter_prog: 'entro in Programmazione', + enter_prog_long: 'entro in programmazione, e vengo aggiunto al Mandala, ed entro così nella chat corrispondente.', + collaborate: 'Collaborazione', + collaborate_long: 'Continuo a collaborare con il miei compagni, per arrivare al giorno della programmazione dove si attiverà il mio Mandala', + dono: 'Dono', + dono_long: 'Faccio il mio dono al proprietario della Bigliettera', + support: 'Sostengo il movimento', + support_long: 'Continuo a sostenere il movimento partecipando attivamente! Organizzando zoom e partecipando, sostenendo, informando, aiutando e diffondendo', + ricevo_dono: 'Ricevo il mio dono e CELEBRO', + ricevo_dono_long: 'Ricevo il mio dono e CELEBRO', +*/ + + ] + + public setstep() { + if (this.isEmailVerified) { + this.step = 2 + if (this.TelegVerificato) { + this.step = 3 + for (let indstep = 0; indstep < this.arrsteps.length; indstep++){ + if (this.arrsteps[indstep].funccheck(indstep)) { + this.step++ + } + } + // if (this.numpayment > 0) { + // this.step = 4 + // } + } + } + console.log('step', this.step) + } + + public mounted() { + this.setstep() + } + + get TelegCode() { + return UserStore.state.my.profile.teleg_checkcode + } + get TelegVerificato() { + return UserStore.state.my.profile.teleg_id > 0 + } + + get isEmailVerified() { + return UserStore.state.my.verified_email + } + + get emailtext() { + if (this.isEmailVerified) + return `Email ` + this.$t('pages.statusreg.verified') + else + return `Email ` + this.$t('pages.statusreg.nonverified') + } + + get telegramtext() { + if (this.TelegVerificato) + return `Telegram ` + this.$t('pages.statusreg.verified') + else + return `Telegram ` + this.$t('pages.statusreg.nonverified') + } + + get paymenttext() { + return ' (' + this.numpayment + ' ' + this.$t('reg.selected') + ')' + } + + get numpayment() { + if (UserStore.state.my.profile) + if (UserStore.state.my.profile.paymenttypes) + return UserStore.state.my.profile.paymenttypes.length + + return 0 + } + + get getLinkBotTelegram() { + const link = this.getValDb('TELEG_BOT_LINK', false) + // console.log('link', link) + return link + } + + get getlaststep() { + return this.arrsteps.length + this.NUMSTEP_START - 1 + } + + public getnuminvitati() { + if (UserStore.state.my) + if (UserStore.state.my.calcstat) + return UserStore.state.my.calcstat.numinvitati + + return 0 + } + public getnuminvitati_attivi() { + if (UserStore.state.my) + if (UserStore.state.my.calcstat) + return UserStore.state.my.calcstat.numinvitati_attivi + + return 0 + } + + public gettextstep(step) { + let tit = this.$t(step.title) + + if (step.title === 'steps.sharemovement') { + tit += ' (' + this.getnuminvitati_attivi() + ' / ' + this.getnuminvitati() + ' invitati Attivi)' + } else if (step.title === 'steps.paymenttype') { + tit += this.paymenttext + } + + return tit + } + + get getRefLink() { + return UserStore.getters.getRefLink() + } + + public copylink() { + copyToClipboard(this.getRefLink).then(() => { + tools.showNotif(this.$q, this.$t('dialog.copyclipboard') + ' \'' + this.getRefLink + '\'') + }) + + } + + public getiferror(checkerror, value) { + if (checkerror) { + return !value + } else { + return false + } + } + + public geterricon(value) { + return 'fas fa-exclamation-triangle' + } + +} diff --git a/src/components/CStatus/CStatus.vue b/src/components/CStatus/CStatus.vue new file mode 100644 index 0000000..2424e06 --- /dev/null +++ b/src/components/CStatus/CStatus.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/src/components/CStatus/index.ts b/src/components/CStatus/index.ts new file mode 100644 index 0000000..6728a81 --- /dev/null +++ b/src/components/CStatus/index.ts @@ -0,0 +1 @@ +export {default as CStatus} from './CStatus.vue' diff --git a/src/components/CStatusReg/CStatusReg.scss b/src/components/CStatusReg/CStatusReg.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/CStatusReg/CStatusReg.ts b/src/components/CStatusReg/CStatusReg.ts new file mode 100644 index 0000000..000563b --- /dev/null +++ b/src/components/CStatusReg/CStatusReg.ts @@ -0,0 +1,146 @@ +import { Component, Prop, Watch } from 'vue-property-decorator' +import { INotData } 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' + +@Component({ + name: 'CStatusReg', + components: { CTitleBanner, CCardState } +}) + +export default class CStatusReg extends MixinBase { + public NUMSEC_TO_POLLING: number = 60 + public MAXNUM_POLLING: number = 10 + + public myloadingload: boolean = false + public eseguipolling: boolean = false + public polling = null + public numpolled: number = 0 + public datastat: INotData = { + num_tot_lista: 0, + num_reg_lista: 0, + num_reg: 0, + lastsreg: [], + checkuser: { verified_email: false } + } + + public async checkifpolling() { + if (UserStore.state.my.profile) { + if (!UserStore.state.my.verified_email || UserStore.state.my.profile.teleg_id <= 0) + this.NUMSEC_TO_POLLING = 10 + } + + if (this.eseguipolling) { + clearInterval(this.polling) + this.polling = null + if (this.numpolled > 100) { + this.NUMSEC_TO_POLLING = 60 * 5 + } + if (this.numpolled < this.MAXNUM_POLLING) { + if (!this.polling) { + this.polling = setInterval(() => { + this.load() + this.numpolled++ + }, this.NUMSEC_TO_POLLING * 1000) + } + } + } + } + + public beforeDestroy() { + clearInterval(this.polling) + } + + public created() { + if (tools.isManager()) { + this.MAXNUM_POLLING = 1000 + } + this.load() + } + + get lastsreg() { + return this.datastat.lastsreg + } + + public async load() { + // console.log('load') + this.myloadingload = true + const datastat = await NotevoleStore.actions.notevoleload() + if (datastat) { + this.datastat = datastat + } + + // console.log('this.datastat.lastsreg') + // console.table(this.datastat.lastsreg) + + // console.log('newsstate') + // console.table('GlobalStore.state.serv_settings', GlobalStore.state.serv_settings) + + this.eseguipolling = true + + // console.log('this.eseguipolling', this.eseguipolling) + this.myloadingload = false + + if (UserStore.state.my) { + if (this.datastat.checkuser) { + if (this.datastat.checkuser.verified_email && !UserStore.state.my.verified_email) { + UserStore.state.my.verified_email = true + this.riaggiorna() + } + if (UserStore.state.my.profile) { + if ((UserStore.state.my.profile.teleg_id <= 0 && this.datastat.checkuser.profile.teleg_id > 0) || + (UserStore.state.my.profile.teleg_id !== this.datastat.checkuser.profile.teleg_id > 0)) { + UserStore.state.my.profile.teleg_id = this.datastat.checkuser.profile.teleg_id + this.riaggiorna() + } + if ((UserStore.state.my.profile.teleg_checkcode <= 0 && this.datastat.checkuser.profile.teleg_checkcode > 0) || + (UserStore.state.my.profile.teleg_checkcode !== this.datastat.checkuser.profile.teleg_checkcode)) { + UserStore.state.my.profile.teleg_checkcode = this.datastat.checkuser.profile.teleg_checkcode + this.riaggiorna() + } + } + } + } + + this.checkifpolling() + } + + public riaggiorna() { + // clearInterval(this.polling) + // this.polling = null + this.checkifpolling() + } + + get perc_reg() { + if (this.datastat.num_tot_lista > 0) + return (this.datastat.num_reg_lista / this.datastat.num_tot_lista * 100) + else + return 0 + } + + public geticon(reg) { + if (reg.profile.nationality === 'IT') + return 'fa-flag-it' + else if (reg.profile.nationality === 'ES') + return 'fa-flag-es' + else if (reg.profile.nationality === 'US') + return 'fa-flag-us' + else if ((reg.profile.nationality === 'GB') || (reg.profile.nationality === 'UK')) + return 'fa-flag-gb' + else if (reg.profile.nationality === 'DE') + return 'fa-flag-de' + + return '' + } + + get visustat() { + return this.datastat.num_reg > 0 || this.datastat.num_reg_lista > 0 + } + +} diff --git a/src/components/CStatusReg/CStatusReg.vue b/src/components/CStatusReg/CStatusReg.vue new file mode 100644 index 0000000..686d85c --- /dev/null +++ b/src/components/CStatusReg/CStatusReg.vue @@ -0,0 +1,53 @@ + + + + + diff --git a/src/components/CStatusReg/index.ts b/src/components/CStatusReg/index.ts new file mode 100644 index 0000000..270f4a4 --- /dev/null +++ b/src/components/CStatusReg/index.ts @@ -0,0 +1 @@ +export {default as CStatusReg} from './CStatusReg.vue'