Iscrizione Conacreis e Arcadei

This commit is contained in:
paoloar77
2022-10-29 12:37:30 +02:00
parent 2399124a33
commit 392c8bb6af
20 changed files with 668 additions and 380 deletions

View File

@@ -1,9 +1,10 @@
import { ISignupIscrizioneConacreisOptions } from 'model'
import { ISignupIscrizioneArcadeiOptions, ISignupIscrizioneConacreisOptions } from 'model'
import { tools } from '@store/Modules/tools'
import { Logo } from '@/components/logo'
import { CDate } from '@/components/CDate'
import { CMyPage } from '@/components/CMyPage'
import { CMySelect } from '@/components/CMySelect'
import { CTitleBanner } from '../CTitleBanner'
import { computed, defineComponent, reactive, ref, watch } from 'vue'
@@ -14,13 +15,15 @@ import { useGlobalStore } from '@store/globalStore'
import { useI18n } from '@/boot/i18n'
import MixinUsers from '@/mixins/mixin-users'
import useVuelidate from '@vuelidate/core'
import { email, minLength, required } from 'vuelidate/lib/validators'
import { email, minLength, required } from '@vuelidate/validators'
import { shared_consts } from '@src/common/shared_vuejs'
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
export default defineComponent({
name: 'CSignUpIscrizioneArcadei',
components: { Logo, CTitleBanner, CDate, CMyPage },
components: { Logo, CTitleBanner, CDate, CMyPage, CMySelect },
setup() {
const $q = useQuasar()
@@ -29,29 +32,8 @@ export default defineComponent({
const globalStore = useGlobalStore()
const { t } = useI18n()
// @ts-ignore
const v$ = useVuelidate(validations, signup)
const countryname = ref('')
const countryborn = ref('')
const iamadult = ref(false)
const duplicate_email = ref(false)
const duplicate_username = ref(false)
const { mySurname, Email, myCell } = MixinUsers()
const { getMyUsername } = MixinUsers()
const signup = ref({
accetta_carta_costituzionale_on: false,
newsletter_on: false,
terms: false
} as ISignupIscrizioneConacreisOptions)
const validations: any = computed(() => {
const valid: any = {
signup: {
let valid: any = {
name: {
required
},
@@ -62,9 +44,13 @@ export default defineComponent({
email,
required
},
fiscalcode: {
required,
minLength: minLength(16)
cell_phone: {
required
},
cell_phone2: {
},
doctype: {
required
},
residency_address: {
required
@@ -96,28 +82,54 @@ export default defineComponent({
terms: {
required
},
}
quota_versata: {
required
},
}
return valid
})
function created() {
const countryname = ref('')
const countryborn = ref('')
const iamadult = ref(false)
const duplicate_email = ref(false)
const duplicate_username = ref(false)
const { mySurname, Email, myCell } = MixinUsers()
const { getMyUsername } = MixinUsers()
const signup = reactive({
accetta_carta_costituzionale_on: false,
newsletter_on: false,
terms: false
} as ISignupIscrizioneArcadeiOptions)
// @ts-ignore
const v$ = useVuelidate(validations, signup)
const pagetesti_iscriz = ref(null)
async function created() {
if (!!getMyUsername() && (!userStore.my.profile.socio)) {
signup.value.name = userStore.my.name
signup.value.surname = mySurname.toString()
signup.value.email = Email.toString()
signup.value.cell_phone = myCell.toString()
signup.name = userStore.my.name
signup.surname = mySurname()
signup.email = Email()
signup.cell_phone = myCell()
}
signup.categorie_interesse = []
v$.value.$reset()
pagetesti_iscriz.value = await globalStore.loadPage('/testi_iscriz')
}
function allowSubmit() {
const error = v$.value.$error || v$.value.$invalid
// console.log('v', v$, 'error', error, 'terms', signup.value.terms, 'carta', signup.value.accetta_carta_costituzionale_on)
return !error && signup.value.terms && signup.value.accetta_carta_costituzionale_on
// console.log('v', v$, 'error', error, 'terms', signup.terms, 'carta', signup.accetta_carta_costituzionale_on)
return !error && signup.terms && signup.accetta_carta_costituzionale_on
}
function errorMsg(cosa: string, item: any) {
@@ -176,44 +188,44 @@ export default defineComponent({
}
function submitOk() {
v$.value.signup.value.touch()
v$.value.$touch()
if (signup.value) {
signup.value.email = tools.removespaces(signup.value.email!)
signup.value.email = signup.value.email.toLowerCase()
if (signup) {
signup.email = tools.removespaces(signup.email!)
signup.email = signup.email.toLowerCase()
signup.value.residency_country = tools.CapitalizeAllWords(signup.value.residency_country)
signup.value.residency_address = tools.CapitalizeAllWords(signup.value.residency_address)
signup.value.residency_city = tools.CapitalizeAllWords(signup.value.residency_city)
signup.value.residency_province = signup.value.residency_province!.toUpperCase()
signup.value.born_province = signup.value.born_province!.toUpperCase()
signup.residency_country = tools.CapitalizeAllWords(signup.residency_country)
signup.residency_address = tools.CapitalizeAllWords(signup.residency_address)
signup.residency_city = tools.CapitalizeAllWords(signup.residency_city)
signup.residency_province = signup.residency_province!.toUpperCase()
signup.born_province = signup.born_province!.toUpperCase()
duplicate_email.value = false
duplicate_username.value = false
if (!signup.value.terms) {
if (!signup.terms) {
tools.showNotif($q, t('reg.err.terms'))
return
}
if (!signup.value.accetta_carta_costituzionale_on) {
if (!signup.accetta_carta_costituzionale_on) {
tools.showNotif($q, t('reg.err.accetta_carta_costituzionale_on'))
return
}
if (v$.value.signup.value.$error) {
if (v$.value.$error) {
tools.showNotif($q, t('reg.err.errore_generico'))
return
}
signup.value.name = tools.CapitalizeAllWords(signup.value.name)
signup.value.surname = tools.CapitalizeAllWords(signup.value.surname)
signup.value.annoTesseramento = 2023
signup.name = tools.CapitalizeAllWords(signup.name)
signup.surname = tools.CapitalizeAllWords(signup.surname)
signup.annoTesseramento = 2023
$q.loading.show({ message: t('reg.iscrizioneincorso') })
console.log(signup)
return userStore.iscrivitiConacreis(tools.clone(signup))
return userStore.iscrivitiArcadei(tools.clone(signup))
.then((ris) => {
if (tools.SignUpcheckErrors($q, $router, ris.code, ris.msg))
$q.loading.hide()
@@ -227,13 +239,13 @@ export default defineComponent({
function selectcountry({ name, iso2, dialCode }: {name: string, iso2: string, dialCode: string}) {
// console.log(name, iso2, dialCode)
signup.value.residency_country = name
signup.residency_country = name
countryname.value = name
}
function selectcountryborn({ name, iso2, dialCode }: {name: string, iso2: string, dialCode: string}) {
// console.log(name, iso2, dialCode)
signup.value.born_country = name
signup.born_country = name
countryborn.value = name
}
@@ -246,7 +258,10 @@ export default defineComponent({
submitOk,
errorMsg,
allowSubmit,
signup,
v$,
pagetesti_iscriz,
shared_consts,
}
}

View File

@@ -2,9 +2,9 @@
<div>
<div class="text-center">
<logo></logo>
<CTitleBanner :title="$t('pages.SignUpIscrizione')" :canopen="true" :visible="false">
<CTitleBanner :title="$t('pages.SignUpArcadei')" :canopen="true" :visible="false">
<div class="q-gutter-xs">
<div class="q-gutter-xs" v-if="signup">
<p class="q-ml-md text-center">
Leggi
@@ -13,29 +13,13 @@
</router-link></span>
</p>
<q-input
v-model="signup.name"
rounded outlined
@blur="v$.signup.name.$touch"
:error="v$.signup.name.$error"
maxlength="30"
:error-message="errorMsg('name', v$.signup.name)"
:label="$t('reg.name')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.surname"
rounded outlined
@blur="v$.signup.surname.$touch"
:error="v$.signup.surname.$error"
@blur="v$.surname.$touch"
:error="v$.surname.$error"
maxlength="30"
:error-message="errorMsg('surname', v$.signup.surname)"
:error-message="errorMsg('surname', v$.surname)"
:label="$t('reg.surname')">
<template v-slot:prepend>
@@ -45,31 +29,13 @@
</q-input>
<q-input
v-model="signup.email"
v-model="signup.name"
rounded outlined
@blur="v$.signup.email.$touch"
:error="v$.signup.email.$error"
:error-message="errorMsg('email', v$.signup.email)"
maxlength="50"
debounce="1000"
:label="$t('reg.email')">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input
v-model="signup.fiscalcode"
rounded outlined
@blur="v$.signup.fiscalcode.$touch"
:error="v$.signup.fiscalcode.$error"
maxlength="20"
mask="AAAAAA##A##A###A"
debounce="1000"
:error-message="errorMsg('fiscalcode', v$.signup.fiscalcode)"
:label="$t('reg.fiscalcode')">
@blur="v$.name.$touch"
:error="v$.name.$error"
maxlength="30"
:error-message="errorMsg('name', v$.name)"
:label="$t('reg.name')">
<template v-slot:prepend>
<q-icon name="person"/>
@@ -77,110 +43,12 @@
</q-input>
<q-input
v-model="signup.residency_address"
rounded outlined
@blur="v$.signup.residency_address.$touch"
:error="v$.signup.residency_address.$error"
maxlength="60"
debounce="1000"
:error-message="errorMsg('residency_address', v$.signup.residency_address)"
:label="$t('reg.residency_address')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_city"
rounded outlined
@blur="v$.signup.residency_city.$touch"
:error="v$.signup.residency_city.$error"
maxlength="60"
debounce="1000"
:error-message="errorMsg('residency_city', v$.signup.residency_city)"
:label="$t('reg.residency_city')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_province"
rounded outlined
@blur="v$.signup.residency_province.$touch"
:error="v$.signup.residency_province.$error"
maxlength="3"
debounce="1000"
:error-message="errorMsg('residency_province', v$.signup.residency_province)"
:label="$t('reg.residency_province')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_zipcode"
rounded outlined
@blur="v$.signup.residency_zipcode.$touch"
:error="v$.signup.residency_zipcode.$error"
maxlength="10"
debounce="1000"
:error-message="errorMsg('residency_zipcode', v$.signup.residency_zipcode)"
:label="$t('reg.residency_zipcode')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="countryname"
:readonly="true"
rounded outlined
debounce="1000"
:label="$t('reg.nationality')">
<template v-slot:prepend>
<vue-country-code
@onSelect="selectcountry"
:preferredCountries="tools.getprefCountries"
:dropdownOptions="{ disabledDialCode: true }"
>
</vue-country-code>
</template>
</q-input>
<br>
<vue-tel-input
v-model="signup.cell_phone"
:placeholder="$t('reg.cell')"
maxlength="20"
debounce="1000"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>
<br>
<q-input
v-model="signup.dateofbirth"
debounce="1000"
@blur="v$.signup.dateofbirth.$touch"
:error="v$.signup.dateofbirth.$error"
:error-message="errorMsg('dateofbirth', v$.signup.dateofbirth)"
@blur="v$.dateofbirth.$touch"
:error="v$.dateofbirth.$error"
:error-message="errorMsg('dateofbirth', v$.dateofbirth)"
stack-label
:label="$t('reg.dateofbirth')"
rounded
@@ -190,14 +58,31 @@
outlined>
</q-input>
<q-input
v-model="signup.born_country"
rounded outlined
@blur="v$.born_country.$touch"
:error="v$.born_country.$error"
maxlength="3"
debounce="1000"
:error-message="errorMsg('born_country', v$.born_country)"
:label="$t('reg.born_country')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.born_city"
rounded outlined
@blur="v$.signup.born_city.$touch"
:error="v$.signup.born_city.$error"
@blur="v$.born_city.$touch"
:error="v$.born_city.$error"
maxlength="60"
debounce="1000"
:error-message="errorMsg('born_city', v$.signup.born_city)"
:error-message="errorMsg('born_city', v$.born_city)"
:label="$t('reg.born_city')">
<template v-slot:prepend>
@@ -209,11 +94,11 @@
<q-input
v-model="signup.born_province"
rounded outlined
@blur="v$.signup.born_province.$touch"
:error="v$.signup.born_province.$error"
@blur="v$.born_province.$touch"
:error="v$.born_province.$error"
maxlength="3"
debounce="1000"
:error-message="errorMsg('born_province', v$.signup.born_province)"
:error-message="errorMsg('born_province', v$.born_province)"
:label="$t('reg.born_province')">
<template v-slot:prepend>
@@ -222,56 +107,257 @@
</q-input>
<!--<CDate :mydate="signup.dateofbirth" @input="setDateOfBirth(arguments[0])"
:rounded="true" :outlined="true"
:dense="false"
:label="$t('reg.dateofbirth')">
</CDate>-->
<q-input
v-model="countryborn"
:readonly="true"
<!--<q-input
v-model="signup.fiscalcode"
rounded outlined
@blur="v$.fiscalcode.$touch"
:error="v$.fiscalcode.$error"
maxlength="20"
mask="AAAAAA##A##A###A"
debounce="1000"
:label="$t('reg.nationality_born')">
:error-message="errorMsg('fiscalcode', v$.fiscalcode)"
:label="$t('reg.fiscalcode')">
<template v-slot:prepend>
<vue-country-code
@onSelect="selectcountryborn"
:preferredCountries="tools.getprefCountries"
:dropdownOptions="{ disabledDialCode: true }"
>
<q-icon name="person"/>
</template>
</vue-country-code>
</q-input>-->
<q-input
v-model="signup.residency_address"
rounded outlined
@blur="v$.residency_address.$touch"
:error="v$.residency_address.$error"
maxlength="60"
debounce="1000"
:error-message="errorMsg('residency_address', v$.residency_address)"
:label="$t('reg.residency_address')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_city"
rounded outlined
@blur="v$.residency_city.$touch"
:error="v$.residency_city.$error"
maxlength="60"
debounce="1000"
:error-message="errorMsg('residency_city', v$.residency_city)"
:label="$t('reg.residency_city')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_province"
rounded outlined
@blur="v$.residency_province.$touch"
:error="v$.residency_province.$error"
maxlength="3"
debounce="1000"
:error-message="errorMsg('residency_province', v$.residency_province)"
:label="$t('reg.residency_province')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.residency_zipcode"
rounded outlined
@blur="v$.residency_zipcode.$touch"
:error="v$.residency_zipcode.$error"
maxlength="10"
debounce="1000"
:error-message="errorMsg('residency_zipcode', v$.residency_zipcode)"
:label="$t('reg.residency_zipcode')">
<template v-slot:prepend>
<q-icon name="person"/>
</template>
</q-input>
<q-input
v-model="signup.cell_phone"
@blur="v$.cell_phone.$touch"
:error="v$.cell_phone.$error"
:error-message="errorMsg('cell_phone', v$.cell_phone)"
rounded outlined
maxlength="20"
debounce="1000"
:label="$t('reg.phone')">
<template v-slot:prepend>
<q-icon name="fas fa-phone"/>
</template>
</q-input>
<q-input
v-model="signup.cell_phone2"
@blur="v$.cell_phone2.$touch"
:error="v$.cell_phone2.$error"
:error-message="errorMsg('cell_phone2', v$.cell_phone2)"
rounded outlined
maxlength="20"
debounce="1000"
:label="$t('reg.phone2')">
<template v-slot:prepend>
<q-icon name="fas fa-phone"/>
</template>
</q-input>
<q-input
v-model="signup.email"
rounded outlined
@blur="v$.email.$touch"
:error="v$.email.$error"
:error-message="errorMsg('email', v$.email)"
maxlength="50"
debounce="1000"
:label="$t('reg.email')">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-input
v-model="signup.email2"
rounded outlined
:error-message="errorMsg('email', v$.email2)"
maxlength="50"
debounce="1000"
:label="$t('reg.email2')">
<template v-slot:prepend>
<q-icon name="email"/>
</template>
</q-input>
<q-select
rounded outlined v-model="signup.doctype"
@blur="v$.doctype.$touch"
:error="v$.doctype.$error"
:error-message="errorMsg('doctype', v$.doctype)"
:options="tools.SelectDocType"
:label="$t('reg.doctype')" emit-value map-options>
</q-select>
<q-input
v-model="signup.documentnumber"
rounded outlined
maxlength="50"
debounce="1000"
:label="$t('reg.documentnumber')">
<template v-slot:prepend>
<q-icon name="fas fa-id-card"/>
</template>
</q-input>
<br>
<div v-html="pagetesti_iscriz.content1"></div>
<br>
<q-select
rounded outlined v-model="signup.quota_versata"
@blur="v$.quota_versata.$touch"
:error="v$.quota_versata.$error"
:error-message="errorMsg('quota_versata', v$.quota_versata)"
:options="tools.SelectQuotaVersata"
:label="$t('reg.quota_versata')" emit-value map-options>
</q-select>
<br>
<div v-html="pagetesti_iscriz.content2"></div>
<!--<CDate :mydate="signup.dateofbirth" @input="setDateOfBirth(arguments[0])"
:rounded="true" :outlined="true"
:dense="false"
:label="$t('reg.dateofbirth')">
</CDate>-->
<br>
<!--<div v-if="!tools.isMobile()"><br></div>-->
<q-select
rounded outlined v-model="signup.metodo_pagamento"
@blur="v$.metodo_pagamento.$touch"
:error="v$.metodo_pagamento.$error"
:error-message="errorMsg('metodo_pagamento', v$.metodo_pagamento)"
:options="tools.SelectMetodiPagamento"
:label="$t('reg.metodopagamento')" emit-value map-options>
</q-select>
<div class="text-weight-bold">
I campi d'Intervento che risuonano maggiormente con le mie passioni e competenze sono i seguenti:
</div>
<br>
<!--
<CMySelect
myclass="myflex" :label="$t('reg.cat_interesse')"
v-model:value="signup.categorie_interesse"
style="min-width: 300px;"
:multiple="true"
optval="value" optlab="label"
:options="shared_consts.Cat_Interesse_Arcadei" :useinput="false">
</CMySelect>-->
<q-option-group
:options="shared_consts.Cat_Interesse_Arcadei"
type="checkbox"
v-model="signup.categorie_interesse"
/>
<br>
<q-input
v-model="signup.altre_comunicazioni"
autofocus
filled
bordered
color="blue-12"
@keyup.enter.stop
type="textarea"
:label="$t('reg.riflessioni')"
>
</q-input>
<q-checkbox
v-model="signup.accetta_carta_costituzionale_on"
color="secondary">
<span v-html="$t('reg.accetta_carta_costituzionale_on')"></span>
<span v-html="$t('reg.acconsento')"></span>
</q-checkbox>
<q-checkbox
v-model="signup.terms"
color="secondary"
@blur="v$.signup.terms.$touch"
:error="v$.signup.terms.$error"
:error-message="`${errorMsg('terms', v$.signup.terms)}`"
@blur="v$.terms.$touch"
:error="v$.terms.$error"
:error-message="`${errorMsg('terms', v$.terms)}`"
:label="$t('reg.terms')">
</q-checkbox>