- Doppia modalità di Registrazione con lista extra utenti

- fixed grid pagination
This commit is contained in:
Paolo Arena
2020-01-13 23:53:27 +01:00
parent 9b9dcbfde1
commit 6541a3a84e
29 changed files with 365 additions and 133 deletions

View File

@@ -34,10 +34,6 @@ export const validations = {
},
terms: {
required
},
aportador_solidario: {
aportadorexist,
required
}
}
}

View File

@@ -33,6 +33,7 @@ Vue.use(VueCountryCode)
export default class CSignUp extends MixinBase {
@Prop({ required: false, default: false }) public showadultcheck: boolean
@Prop({ required: false, default: false }) public showcell: boolean
@Prop({ required: false, default: false }) public shownationality: boolean
public $v
public $q
public $t: any
@@ -51,35 +52,24 @@ export default class CSignUp extends MixinBase {
repeatPassword: process.env.TEST_PASSWORD || '',
terms: !process.env.PROD,
profile: DefaultProfile,
aportador_solidario: ''
aportador_solidario: '',
already_registered: false
}
public created() {
this.$v.$reset()
this.signup.aportador_solidario = this.$route.params.invited || process.env.TEST_APORTADOR
this.$v.signup.aportador_solidario.$touch()
}
@Watch('$route.params.invited')
public changeaportador() {
console.log('changeaportador', this.$route.params.invited)
if (!this.signup.aportador_solidario)
this.signup.aportador_solidario = this.$route.params.invited
}
public mounted() {
}
get allowSubmit() {
let error = this.$v.$error || this.$v.$invalid || this.signup.profile.cell.length <= 6
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
}
@@ -125,9 +115,13 @@ export default class CSignUp extends MixinBase {
public errorMsg(cosa: string, item: any) {
try {
if (!item.$error) { return '' }
if (!item.$error) {
return ''
}
// console.log('errorMsg', cosa, item)
if (item.$params.email && !item.email) { return this.$t('reg.err.email') }
if (item.$params.email && !item.email) {
return this.$t('reg.err.email')
}
if (cosa === 'repeatpassword') {
if (!item.sameAsPassword) {
@@ -159,10 +153,14 @@ export default class CSignUp extends MixinBase {
if (cosa === 'email') {
// console.log("EMAIL " + item.isUnique);
// console.log(item);
if (!item.isUnique) { return this.$t('reg.err.duplicate_email') }
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') }
if (!item.isUnique) {
return this.$t('reg.err.duplicate_username')
}
} else if (cosa === 'aportador_solidario') {
// console.log(item);
if (!item.aportadorexist) {
@@ -179,26 +177,6 @@ export default class CSignUp extends MixinBase {
}
}
public SignUpcheckErrors(riscode: number) {
console.log('SignUpcheckErrors', riscode)
if (riscode === serv_constants.RIS_CODE_EMAIL_ALREADY_EXIST) {
tools.showNotif(this.$q, this.$t('reg.err.duplicate_email'))
} else if (riscode === serv_constants.RIS_CODE_USERNAME_ALREADY_EXIST) {
tools.showNotif(this.$q, this.$t('reg.err.duplicate_username'))
} else if (riscode === tools.ERR_SERVERFETCH) {
tools.showNotif(this.$q, this.$t('fetch.errore_server'))
} else if (riscode === tools.ERR_GENERICO) {
const msg = this.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode)
tools.showNotif(this.$q, msg)
} else if (riscode === tools.OK) {
this.$router.push('/signin')
tools.showNotif(this.$q, this.$t('components.authentication.email_verification.link_sent'), {color: 'warning', textColor: 'black'})
} else {
tools.showNotif(this.$q, 'Errore num ' + riscode)
}
}
public submitOk() {
this.$v.signup.$touch()
@@ -221,14 +199,14 @@ export default class CSignUp extends MixinBase {
this.$q.loading.show({ message: this.$t('reg.incorso') })
console.log(this.signup)
UserStore.actions.signup(this.signup)
return UserStore.actions.signup(tools.clone(this.signup))
.then((riscode) => {
tools.SignUpcheckErrors(this, riscode)
this.$q.loading.hide()
if (tools.SignUpcheckErrors(this, riscode))
this.$q.loading.hide()
}).catch((error) => {
console.log('ERROR = ' + error)
this.$q.loading.hide()
})
console.log('ERROR = ' + error)
this.$q.loading.hide()
})
}
@@ -238,13 +216,13 @@ export default class CSignUp extends MixinBase {
this.signup.profile.iso2_cell = coderec.iso2
}
public selectcountry({name, iso2, dialCode}) {
public selectcountry({ name, iso2, dialCode }) {
// console.log(name, iso2, dialCode)
this.signup.profile.nationality = iso2
this.countryname = name
}
public inputUsername(value){
public inputUsername(value) {
this.signup.username = value.trim()
}

View File

@@ -10,25 +10,6 @@
<div class="q-gutter-sm">
<q-input
bg-color="lightblue"
:readonly="true"
v-model="signup.aportador_solidario"
rounded outlined
@blur="$v.signup.aportador_solidario.$touch"
:error="$v.signup.aportador_solidario.$error"
:error-message="errorMsg('aportador_solidario', $v.signup.aportador_solidario)"
maxlength="20"
debounce="1000"
:label="$t('reg.aportador_solidario')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.email"
rounded outlined
@@ -130,6 +111,7 @@
<!--:hint="$t('reg.tips.repeatpassword')"-->
<q-input
v-if="shownationality"
v-model="countryname"
:readonly="true"
rounded outlined
@@ -180,7 +162,9 @@
:label="$t('reg.onlyadult')">
</q-checkbox>
<br>
<div v-if="showadultcheck">
<br>
</div>
<div class="wrapper">
<q-btn rounded size="lg" color="positive" @click="submitOk" :disabled='!allowSubmit'>