Registrazione: far comparire tutti i campi una volta inseriti... cosi comparirà l'errore

This commit is contained in:
Surya Paolo
2022-12-22 16:48:57 +01:00
parent 98fa879112
commit a8677dc644
4 changed files with 526 additions and 336 deletions

View File

@@ -442,7 +442,7 @@
<div v-else-if="myel.type === shared_consts.ELEMTYPE.REGISTRATION">
<div v-if="editOn" class="elemEdit">Registrazione</div>
<div v-if="true">
<div>
<CRegistration />
</div>
</div>

View File

@@ -14,6 +14,15 @@
:label="$t('reg.submit')"
>
</q-btn>
<q-btn
color="blue"
label="pippo"
type="a"
size="sm"
href="http://pippo.it"
target="_blank"
>
</q-btn>
</div>
<q-carousel
v-if="start"
@@ -99,45 +108,38 @@
<div
v-if="site.confpages.enableRegMultiChoice"
style=""
class="row q-ma-sm centermydiv2 q-pa-sm justify-center"
class="column q-ma-sm centermydiv2 q-pa-sm justify-center"
>
<span
v-if="!invited"
:class="
($q.dark.isActive ? `text-white` : `text-black`) +
` text-h7`
<q-btn
rounded
type="a"
class="col-xs-12 col-sm-6 flex-item-btn items-center"
icon="fab fa-telegram"
size="md"
color="primary"
:href="
invited
? tools.getLinkBotTelegram(invited, regexpire)
: `/bot`
"
>Chiedi alla persona che ti ha invitato su RISO il suo
<strong>Username</strong></span
:label="$t('reg.bytelegram')"
>
<div class="row items-center">
<div class="col-12">
<q-btn
rounded
type="a"
class="flex-item-btn"
icon="fab fa-telegram"
size="md"
color="primary"
:href="invited ? tools.getLinkBotTelegram(invited, regexpire) : `/bot`"
:label="$t('reg.bytelegram')"
>
<q-badge color="red" align="bottom" floating
>Consigliato</q-badge
>
</q-btn>
</div>
</div>
<q-badge color="red" align="bottom" floating
>Consigliato</q-badge
>
</q-btn>
<div
:class="
$q.dark.isActive ? `text-white` : `text-black` + ` col-12`
$q.dark.isActive
? `text-white`
: `text-black` + ` col-12 text-center`
"
>
oppure se non riesci ad installare Telegram:
se non riesci ad installare Telegram:
</div>
<q-btn
rounded
class="flex-item-btn"
class="flex-item-btn col-xs-12 col-sm-6"
outline
icon="fas fa-envelope"
size="md"

View File

@@ -119,13 +119,13 @@ export default defineComponent({
const site = computed(() => globalStore.site)
const signup = reactive(<ISignupOptions>{
email: process.env.TEST_EMAIL || '',
username: process.env.TEST_USERNAME || '',
email: '',
username: '',
name: '',
surname: '',
password: process.env.TEST_PASSWORD || '',
repeatPassword: process.env.TEST_PASSWORD || '',
terms: !process.env.PROD,
password: '',
repeatPassword: '',
terms: false,
profile: DefaultProfile,
aportador_solidario: '',
})

View File

@@ -72,169 +72,122 @@
<br /><br />
</div>
<div v-else>
<q-carousel
v-model="slide"
ref="carousel"
transition-prev="slide-right"
transition-next="slide-left"
animated
swipeable
:class="`shadow-1`"
>
<template v-slot:control>
<q-carousel-control
position="bottom-right"
:offset="[18, 18]"
class="q-gutter-xs"
>
<q-btn
v-if="slide !== '1'"
push
text-color="black"
icon="arrow_left"
label="Indietro"
@click="$refs.carousel.previous()"
/>
<q-btn
v-if="slide !== '4'"
push
color="primary"
icon="arrow_right"
label="Avanti"
:disabled="checkifDisabled"
@click="!checkifDisabled ? $refs.carousel.next() : null"
/>
</q-carousel-control>
</template>
<q-carousel-slide name="1">
<div class="">
<q-input
v-if="
showaportador &&
signup.aportador_solidario !== tools.APORTADOR_NONE
"
ref="inputAportador"
bg-color="lightblue"
:readonly="!!ap_iniziale"
v-model="signup.aportador_solidario"
rounded
outlined
@keyup.enter="
v$.aportador_solidario.$touch && !v$.aportador_solidario.$error
? $refs.inputEmail.focus()
: null
"
@blur="v$.aportador_solidario.$touch"
:error="v$.aportador_solidario.$error"
:error-message="
tools.errorMsg(
'aportador_solidario',
v$.aportador_solidario
)
"
maxlength="20"
debounce="1000"
:label="$t('reg.aportador_solidario')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div style="margin-top: 5px"></div>
<div v-if="signup.terms">
<q-input
v-if="
showaportador &&
signup.aportador_solidario !== tools.APORTADOR_NONE
"
ref="inputAportador"
bg-color="lightblue"
:readonly="!!ap_iniziale"
v-model="signup.aportador_solidario"
rounded
outlined
@keyup.enter="
v$.aportador_solidario.$touch && !v$.aportador_solidario.$error
? $refs.inputEmail.focus()
: null
"
@blur="v$.aportador_solidario.$touch"
:error="v$.aportador_solidario.$error"
:error-message="
tools.errorMsg('aportador_solidario', v$.aportador_solidario)
"
maxlength="20"
debounce="1000"
:label="$t('reg.aportador_solidario')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div style="margin-top: 5px"></div>
<q-input
ref="inputEmail"
v-model="signup.email"
rounded
outlined
@update:model-value="changeemail()"
maxlength="50"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
debounce="2000"
:rules="[myRuleEmail]"
:label="$t('reg.email_reg')"
>
<template v-slot:prepend>
<q-icon name="email" />
</template>
</q-input>
</div>
</q-carousel-slide>
<q-carousel-slide name="2">
<div class="cosa_chiedere">{{ $t('reg.scegli_username') }}</div>
<q-input
ref="inputEmail"
v-model="signup.email"
rounded
outlined
@update:model-value="changeemail()"
maxlength="50"
v-on:keyup.enter="!checkifDisabled ? $refs.carousel.next() : null"
debounce="2000"
:rules="[myRuleEmail]"
:label="$t('reg.email_reg')"
>
<template v-slot:prepend>
<q-icon name="email" />
</template>
</q-input>
<q-input
ref="inputUsername"
v-model="signup.username"
:readonly="
tools.getAskToVerifyReg() &&
!site.confpages.enableRegMultiChoice
"
rounded
outlined
@blur="v$.username.$touch"
@update:model-value="changeusername"
:error="v$.username.$error"
@keydown.space="(event) => event.preventDefault()"
@keyup.enter="
!v$.username.$error ? $refs.inputName.focus() : null
"
maxlength="20"
debounce="500"
:error-message="
tools.errorMsg('username', v$.username) ||
(isalreadyReg ? 'L\'Username è gia stato registrato!' : '')
"
:label="$t('reg.username_reg')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div v-if="show_namesurname">
<q-input
ref="inputUsername"
v-model="signup.username"
:readonly="
tools.getAskToVerifyReg() &&
!site.confpages.enableRegMultiChoice
"
ref="inputName"
v-model="signup.name"
rounded
outlined
@blur="v$.username.$touch"
@update:model-value="changeusername"
:error="v$.username.$error"
@keydown.space="(event) => event.preventDefault()"
@keyup.enter="
!v$.username.$error ? $refs.inputName.focus() : null
"
maxlength="20"
debounce="500"
:error-message="
tools.errorMsg('username', v$.username) ||
(isalreadyReg ? 'L\'Username è gia stato registrato!' : '')
"
:label="$t('reg.username_reg')"
@blur="v$.name.$touch"
:error="v$.name.$error"
maxlength="30"
debounce="1000"
@keyup.enter="$refs.inputSurname.focus()"
:error-message="tools.errorMsg('name', v$.name)"
:label="$t('reg.name_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div v-if="show_namesurname">
<q-input
ref="inputName"
v-model="signup.name"
rounded
outlined
@blur="v$.name.$touch"
:error="v$.name.$error"
maxlength="30"
debounce="1000"
@keyup.enter="$refs.inputSurname.focus()"
:error-message="tools.errorMsg('name', v$.name)"
:label="$t('reg.name_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<q-input
ref="inputSurname"
v-model="signup.surname"
rounded
outlined
:error="v$.surname.$error"
@blur="v$.surname.$touch"
maxlength="30"
debounce="1000"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
:error-message="tools.errorMsg('surname', v$.surname)"
:label="$t('reg.surname_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
</div>
</q-carousel-slide>
<q-carousel-slide name="3">
<div class="cosa_chiedere">{{ $t('reg.scegli_password') }}</div>
<q-input
ref="inputSurname"
v-model="signup.surname"
rounded
outlined
:error="v$.surname.$error"
@blur="v$.surname.$touch"
maxlength="30"
debounce="1000"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
:error-message="tools.errorMsg('surname', v$.surname)"
:label="$t('reg.surname_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<q-input
ref="inputPassword"
v-model="signup.password"
@@ -267,162 +220,397 @@
<q-icon name="vpn_key" />
</template>
</q-input>
</div>
<q-input
ref="inputPassword2"
v-model="signup.repeatPassword"
:type="typePassword"
maxlength="30"
rounded
outlined
@blur="v$.repeatPassword.$touch"
:error="v$.repeatPassword.$error"
:error-message="`${tools.errorMsg(
'repeatpassword',
v$.repeatPassword
)}`"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
:label="$t('reg.repeatPassword')"
>
<template v-slot:append>
<q-btn
tabindex="-1"
:icon="
typePassword === `password`
? `fas fa-eye-slash`
: `fas fa-eye`
"
@click="showPassword"
>
</q-btn>
</template>
<template v-slot:prepend>
<q-icon name="vpn_key" />
</template>
</q-input>
</q-carousel-slide>
<q-carousel-slide name="4">
<q-input
v-if="shownationality"
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>
<!--<vue-tel-input
v-if="showcell"
@country-changed="intcode_change()"
:value="signup.profile.cell"
:placeholder="$t('reg.cell')"
maxlength="20"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>-->
<div class="text-center">
<q-input
ref="inputPassword2"
v-model="signup.repeatPassword"
:type="typePassword"
maxlength="30"
rounded
outlined
@blur="v$.repeatPassword.$touch"
:error="v$.repeatPassword.$error"
:error-message="`${tools.errorMsg(
'repeatpassword',
v$.repeatPassword
)}`"
v-on:keyup.enter="!checkifDisabled ? $refs.carousel.next() : null"
:label="$t('reg.repeatPassword')"
>
<template v-slot:append>
<q-btn
label="Mostra Privacy"
@click="showpolicy = true"
></q-btn>
</div>
<q-dialog v-model="showpolicy">
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title> Privacy Policy </q-toolbar-title>
<q-btn
flat
round
color="white"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section class="inset-shadow">
<PagePolicy
v-if="site.policy"
:owneremail="site.policy.owneremail"
:siteName="site.policy.siteName"
:ownerDataName="site.policy.ownerDataName"
:managerData="site.policy.managerData"
:includeData="site.policy.includeData"
:url="site.policy.url"
:lastdataupdate="site.policy.lastdataupdate"
:country="site.policy.country"
>
</PagePolicy>
</q-card-section>
</q-card>
</q-dialog>
<q-checkbox
v-model="signup.terms"
color="secondary"
@blur="v$.terms.$touch"
:error="v$.terms.$error"
:error-message="`${tools.errorMsg('terms', v$.terms)}`"
:label="$t('reg.terms')"
>
</q-checkbox>
<q-checkbox
v-if="showadultcheck"
v-model="iamadult"
color="secondary"
:label="$t('reg.onlyadult')"
>
</q-checkbox>
<div v-if="showadultcheck">
<br />
</div>
<div class="column">
<q-btn
rounded
size="lg"
color="positive"
@click="submitOk"
:disabled="!allowSubmit()"
:label="$t('reg.submit')"
tabindex="-1"
:icon="
typePassword === `password`
? `fas fa-eye-slash`
: `fas fa-eye`
"
@click="showPassword"
>
</q-btn>
</div>
<br />
<!--
Già registrato?
</template>
<template v-slot:prepend>
<q-icon name="vpn_key" />
</template>
</q-input>
<div class="column">
<q-btn
class="q-ma-sm"
text-color="black"
color="white"
icon="fas fa-home"
label="Accedi"
to="/"
size="sm"
></q-btn>
<br /><br /><br />
-->
</q-carousel-slide>
</q-carousel>
rounded
size="lg"
color="positive"
@click="submitOk"
:disabled="!allowSubmit()"
:label="$t('reg.submit')"
>
</q-btn>
<br>
</div>
</div>
<div v-else>
<q-carousel
v-model="slide"
ref="carousel"
transition-prev="slide-right"
transition-next="slide-left"
animated
swipeable
:class="`shadow-1`"
>
<template v-slot:control>
<q-carousel-control
position="bottom-right"
:offset="[18, 18]"
class="q-gutter-xs"
>
<q-btn
v-if="slide !== '1'"
push
text-color="black"
icon="arrow_left"
label="Indietro"
@click="$refs.carousel.previous()"
/>
<q-btn
v-if="slide !== '4'"
push
color="primary"
icon="arrow_right"
label="Avanti"
:disabled="checkifDisabled"
@click="!checkifDisabled ? $refs.carousel.next() : null"
/>
</q-carousel-control>
</template>
<q-carousel-slide name="1">
<div class="">
<q-input
v-if="
showaportador &&
signup.aportador_solidario !== tools.APORTADOR_NONE
"
ref="inputAportador"
bg-color="lightblue"
:readonly="!!ap_iniziale"
v-model="signup.aportador_solidario"
rounded
outlined
@keyup.enter="
v$.aportador_solidario.$touch &&
!v$.aportador_solidario.$error
? $refs.inputEmail.focus()
: null
"
@blur="v$.aportador_solidario.$touch"
:error="v$.aportador_solidario.$error"
:error-message="
tools.errorMsg(
'aportador_solidario',
v$.aportador_solidario
)
"
maxlength="20"
debounce="1000"
:label="$t('reg.aportador_solidario')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div style="margin-top: 5px"></div>
<q-input
ref="inputEmail"
v-model="signup.email"
rounded
outlined
@update:model-value="changeemail()"
maxlength="50"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
debounce="2000"
:rules="[myRuleEmail]"
:label="$t('reg.email_reg')"
>
<template v-slot:prepend>
<q-icon name="email" />
</template>
</q-input>
</div>
</q-carousel-slide>
<q-carousel-slide name="2">
<div class="cosa_chiedere">{{ $t('reg.scegli_username') }}</div>
<q-input
ref="inputUsername"
v-model="signup.username"
:readonly="
tools.getAskToVerifyReg() &&
!site.confpages.enableRegMultiChoice
"
rounded
outlined
@blur="v$.username.$touch"
@update:model-value="changeusername"
:error="v$.username.$error"
@keydown.space="(event) => event.preventDefault()"
@keyup.enter="
!v$.username.$error ? $refs.inputName.focus() : null
"
maxlength="20"
debounce="500"
:error-message="
tools.errorMsg('username', v$.username) ||
(isalreadyReg ? 'L\'Username è gia stato registrato!' : '')
"
:label="$t('reg.username_reg')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<div v-if="show_namesurname">
<q-input
ref="inputName"
v-model="signup.name"
rounded
outlined
@blur="v$.name.$touch"
:error="v$.name.$error"
maxlength="30"
debounce="1000"
@keyup.enter="$refs.inputSurname.focus()"
:error-message="tools.errorMsg('name', v$.name)"
:label="$t('reg.name_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
<q-input
ref="inputSurname"
v-model="signup.surname"
rounded
outlined
:error="v$.surname.$error"
@blur="v$.surname.$touch"
maxlength="30"
debounce="1000"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
:error-message="tools.errorMsg('surname', v$.surname)"
:label="$t('reg.surname_opt')"
>
<template v-slot:prepend>
<q-icon name="person" />
</template>
</q-input>
</div>
</q-carousel-slide>
<q-carousel-slide name="3">
<div class="cosa_chiedere">{{ $t('reg.scegli_password') }}</div>
<q-input
ref="inputPassword"
v-model="signup.password"
:type="typePassword"
rounded
outlined
@blur="v$.password.$touch"
:error="v$.password.$error"
:error-message="`${tools.errorMsg('password', v$.password)}`"
@keyup.enter="
!v$.password.$error ? $refs.inputPassword2.focus() : null
"
maxlength="30"
debounce="1000"
:label="$t('reg.password_reg')"
>
<template v-slot:append>
<q-btn
tabindex="-1"
:icon="
typePassword === `password`
? `fas fa-eye-slash`
: `fas fa-eye`
"
@click="showPassword"
>
</q-btn>
</template>
<template v-slot:prepend>
<q-icon name="vpn_key" />
</template>
</q-input>
<q-input
ref="inputPassword2"
v-model="signup.repeatPassword"
:type="typePassword"
maxlength="30"
rounded
outlined
@blur="v$.repeatPassword.$touch"
:error="v$.repeatPassword.$error"
:error-message="`${tools.errorMsg(
'repeatpassword',
v$.repeatPassword
)}`"
v-on:keyup.enter="
!checkifDisabled ? $refs.carousel.next() : null
"
:label="$t('reg.repeatPassword')"
>
<template v-slot:append>
<q-btn
tabindex="-1"
:icon="
typePassword === `password`
? `fas fa-eye-slash`
: `fas fa-eye`
"
@click="showPassword"
>
</q-btn>
</template>
<template v-slot:prepend>
<q-icon name="vpn_key" />
</template>
</q-input>
</q-carousel-slide>
<q-carousel-slide name="4">
<q-input
v-if="shownationality"
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>
<!--<vue-tel-input
v-if="showcell"
@country-changed="intcode_change()"
:value="signup.profile.cell"
:placeholder="$t('reg.cell')"
maxlength="20"
:enabledCountryCode="true"
inputClasses="clCell"
wrapperClasses="clCellCode">
</vue-tel-input>-->
<div class="text-center">
<q-btn
label="Mostra Privacy"
@click="showpolicy = true"
></q-btn>
</div>
<q-dialog v-model="showpolicy">
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title> Privacy Policy </q-toolbar-title>
<q-btn
flat
round
color="white"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section class="inset-shadow">
<PagePolicy
v-if="site.policy"
:owneremail="site.policy.owneremail"
:siteName="site.policy.siteName"
:ownerDataName="site.policy.ownerDataName"
:managerData="site.policy.managerData"
:includeData="site.policy.includeData"
:url="site.policy.url"
:lastdataupdate="site.policy.lastdataupdate"
:country="site.policy.country"
>
</PagePolicy>
</q-card-section>
</q-card>
</q-dialog>
<q-checkbox
v-model="signup.terms"
color="secondary"
@blur="v$.terms.$touch"
:error="v$.terms.$error"
:error-message="`${tools.errorMsg('terms', v$.terms)}`"
:label="$t('reg.terms')"
>
</q-checkbox>
<q-checkbox
v-if="showadultcheck"
v-model="iamadult"
color="secondary"
:label="$t('reg.onlyadult')"
>
</q-checkbox>
<div v-if="showadultcheck">
<br />
</div>
<!--
Già registrato?
<q-btn
class="q-ma-sm"
text-color="black"
color="white"
icon="fas fa-home"
label="Accedi"
to="/"
size="sm"
></q-btn>
<br /><br /><br />
-->
</q-carousel-slide>
</q-carousel>
</div>
<div class="row justify-center">
<q-btn-toggle
v-if="!signup.terms"
glossy
v-model="slide"
:options="[