- ++Booking List
- ++Delete a Booking also for the Admin.
This commit is contained in:
@@ -26,6 +26,7 @@ import { costanti } from '@src/store/Modules/costanti'
|
||||
import router from '@router'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
import translate from '@src/globalroutines/util'
|
||||
import { lists } from '../../store/Modules/lists'
|
||||
|
||||
@Component({
|
||||
name: 'CEventsCalendar',
|
||||
@@ -339,10 +340,6 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public isCssColor(color) {
|
||||
return !!color && !!color.match(/^(#|(rgb|hsl)a?\()/)
|
||||
}
|
||||
|
||||
public showEvent(eventparam: IEvents) {
|
||||
// console.log('showEvent - INIZIO')
|
||||
this.myevent = eventparam
|
||||
@@ -357,22 +354,6 @@ export default class CEventsCalendar extends Vue {
|
||||
return endTime
|
||||
}
|
||||
|
||||
public displayClasses(eventparam) {
|
||||
return {
|
||||
[`bg-${eventparam.bgcolor}`]: !this.isCssColor(eventparam.bgcolor),
|
||||
'text-white': !this.isCssColor(eventparam.bgcolor)
|
||||
}
|
||||
}
|
||||
|
||||
public displayStyles(eventparam) {
|
||||
const s = { color: '' }
|
||||
if (this.isCssColor(eventparam.bgcolor)) {
|
||||
s['background-color'] = eventparam.bgcolor
|
||||
s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white'
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
public onDateChanged(mydate) {
|
||||
this.calendarView = 'day'
|
||||
}
|
||||
@@ -412,13 +393,14 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
|
||||
public addBookEventMenu(eventparam) {
|
||||
if (!UserStore.state.isLogged) {
|
||||
if (!UserStore.state.isLogged || !UserStore.state.verified_email) {
|
||||
this.$router.push('/signin')
|
||||
} else {
|
||||
console.log('addBookEventMenu')
|
||||
this.resetForm()
|
||||
this.myevent = eventparam
|
||||
this.bookEventForm.msgbooking = translate('cal.bookingtextdefault') + ' ' + tools.gettextevent(this.myevent)
|
||||
// this.bookEventForm.msgbooking = translate('cal.bookingtextdefault') + ' ' + tools.gettextevent(this.myevent)
|
||||
this.bookEventForm.msgbooking = ''
|
||||
this.bookEventForm.numpeople = 1
|
||||
this.bookEventpage.state = EState.Creating
|
||||
|
||||
@@ -567,6 +549,7 @@ export default class CEventsCalendar extends Vue {
|
||||
console.log('bookedevent', bookedevent)
|
||||
|
||||
if (bookedevent) {
|
||||
this.bookEventForm._id = bookedevent._id
|
||||
this.bookEventForm.numpeople = bookedevent.numpeople
|
||||
this.bookEventForm.infoevent = bookedevent.infoevent
|
||||
this.bookEventForm.msgbooking = bookedevent.msgbooking
|
||||
@@ -581,7 +564,12 @@ export default class CEventsCalendar extends Vue {
|
||||
|
||||
get hasModifiedBooking() {
|
||||
return (this.bookEventpage.bookedevent.numpeople !== this.bookEventForm.numpeople) ||
|
||||
(this.bookEventpage.bookedevent.msgbooking !== this.bookEventForm.msgbooking)
|
||||
(this.bookEventpage.bookedevent.msgbooking !== this.bookEventForm.msgbooking) ||
|
||||
(this.bookEventpage.bookedevent.booked !== this.bookEventForm.booked)
|
||||
}
|
||||
|
||||
public sendMsg(myevent: IEvents) {
|
||||
// ..
|
||||
}
|
||||
|
||||
public saveBookEvent(myevent: IEvents) {
|
||||
@@ -593,7 +581,7 @@ export default class CEventsCalendar extends Vue {
|
||||
// close the dialog
|
||||
self.bookEventpage.show = false
|
||||
|
||||
self.bookEventForm.booked = true
|
||||
// self.bookEventForm.booked = self.bookEventForm.bookedcheck
|
||||
|
||||
const data: IBookedEvent = {
|
||||
id_bookedevent: myevent._id,
|
||||
@@ -722,11 +710,6 @@ export default class CEventsCalendar extends Vue {
|
||||
return await CalendarStore.actions.BookEvent(eventparam)
|
||||
}
|
||||
|
||||
public async CancelBookingEvent(eventparam: IEvents) {
|
||||
console.log('CancelBookingEvent ', eventparam._id)
|
||||
tools.askConfirm(this.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), this, costanti.FuncDialog.CANCEL_BOOKING, 0, { param1: eventparam })
|
||||
}
|
||||
|
||||
public isAlreadyBooked(eventparam: IEvents) {
|
||||
return CalendarStore.getters.findEventBooked(eventparam, true)
|
||||
}
|
||||
@@ -738,7 +721,7 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
|
||||
public badgeClasses(eventparam, type) {
|
||||
const cssColor = this.isCssColor(eventparam.bgcolor)
|
||||
const cssColor = tools.isCssColor(eventparam.bgcolor)
|
||||
const isHeader = type === 'header'
|
||||
return {
|
||||
[`text-white bg-${eventparam.bgcolor}`]: !cssColor,
|
||||
@@ -751,7 +734,7 @@ export default class CEventsCalendar extends Vue {
|
||||
public badgeStyles(eventparam, type, timeStartPos, timeDurationHeight) {
|
||||
const s = { color: '', top: '', height: '' }
|
||||
|
||||
if (this.isCssColor(eventparam.bgcolor)) {
|
||||
if (tools.isCssColor(eventparam.bgcolor)) {
|
||||
s['background-color'] = eventparam.bgcolor
|
||||
s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white'
|
||||
}
|
||||
@@ -859,10 +842,19 @@ export default class CEventsCalendar extends Vue {
|
||||
return EState
|
||||
}
|
||||
|
||||
public getTitleBtnBooking() {
|
||||
if (this.bookEventpage.state === EState.Creating)
|
||||
return translate('dialog.book')
|
||||
else
|
||||
return translate('dialog.update')
|
||||
get checkseinviaMsg() {
|
||||
return (this.bookEventpage.state === EState.Creating) && (!this.bookEventForm.booked)
|
||||
}
|
||||
|
||||
get getTitleBtnBooking() {
|
||||
if (this.bookEventpage.state === EState.Creating) {
|
||||
return this.$t('dialog.book')
|
||||
} else {
|
||||
return this.$t('dialog.update')
|
||||
}
|
||||
}
|
||||
|
||||
get mythis() {
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ $t('
|
||||
<!-- display an myevent -->
|
||||
<q-dialog v-model="displayEvent">
|
||||
<q-card v-if="myevent">
|
||||
<q-toolbar :class="displayClasses(myevent)"
|
||||
:style="displayStyles(myevent) + ` min-width: `+ tools.myheight_dialog() + `px;`">
|
||||
<q-toolbar :class="tools.displayClasses(myevent)"
|
||||
:style="tools.displayStyles(myevent) + ` min-width: `+ tools.myheight_dialog() + `px;`">
|
||||
<q-toolbar-title>
|
||||
{{ $t('cal.event') }}
|
||||
</q-toolbar-title>
|
||||
@@ -83,7 +83,7 @@ $t('
|
||||
</div>
|
||||
<p v-if="myevent.linkpdf" style="margin-top: 10px; text-align: center">
|
||||
<q-btn size="md" type="a" :href="`../../statics/` + myevent.linkpdf"
|
||||
target="_blank" rounded color="primary" icon="info" label="Vedi Info">
|
||||
target="_blank" rounded color="primary" icon="info" :label="$t('cal.showinfo')">
|
||||
</q-btn>
|
||||
</p>
|
||||
</div>
|
||||
@@ -224,7 +224,7 @@ $t('
|
||||
<q-card v-if="bookEventpage.show" :style="`min-width: `+ tools.myheight_dialog() + `px;`">
|
||||
<q-toolbar class="bg-primary text-white">
|
||||
<q-toolbar-title>
|
||||
Book Event
|
||||
{{$t('cal.booking')}}
|
||||
</q-toolbar-title>
|
||||
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
|
||||
</q-toolbar>
|
||||
@@ -250,32 +250,27 @@ $t('
|
||||
<span v-if="myevent.time" class="cal__hours">
|
||||
-
|
||||
<span class="cal__hours-title">{{$t('cal.hours')}}: </span>
|
||||
<span class="cal__hours-content">{{$t('cal.starttime')}} {{ myevent.time }} {{$t('cal.endtime')}}: {{
|
||||
<span class="cal__hours-content"><span v-if="!tools.isMobile()">{{$t('cal.starttime')}} </span>{{ myevent.time }} <span v-if="!tools.isMobile()">{{$t('cal.endtime')}} </span><span v-else> - </span> {{
|
||||
getEndTime(myevent) }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="q-pa-sm">
|
||||
<q-card
|
||||
class="text-white windowcol">
|
||||
<!--<q-card-section>-->
|
||||
<!--<div class="text-h6"></div>-->
|
||||
<!--<div class="text-subtitle2">by John Doe</div>-->
|
||||
<!--</q-card-section>-->
|
||||
|
||||
<div class="q-pa-xs">
|
||||
<q-card class="text-white windowcol">
|
||||
<q-card-section>
|
||||
<q-input v-model="bookEventForm.msgbooking" :label="$t('cal.msgbooking')"
|
||||
autogrow>
|
||||
<q-checkbox :disable="(bookEventpage.bookedevent && bookEventpage.bookedevent.booked) || (bookEventpage.bookedevent === undefined)" style="color: black;" v-model="bookEventForm.booked" :label="$t('cal.bookingtextdefault')" color="green">
|
||||
</q-checkbox>
|
||||
|
||||
</q-input>
|
||||
|
||||
<div class="q-gutter-md centermydiv" style="max-width: 150px; margin-top:10px;">
|
||||
<div v-if="bookEventForm.booked" class="q-gutter-md centermydiv" style="max-width: 150px; margin-top:10px;">
|
||||
<q-select
|
||||
rounded outlined v-model="bookEventForm.numpeople"
|
||||
:options="tools.SelectListNumPeople"
|
||||
:label="$t('cal.selnumpeople')" emit-value map-options>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<q-input v-model="bookEventForm.msgbooking" :label="$t('cal.msgbooking')+':'" autogrow>
|
||||
</q-input>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
@@ -284,16 +279,19 @@ $t('
|
||||
|
||||
<p v-if="myevent.linkpdf" style="margin-top: 10px; text-align: center">
|
||||
<q-btn size="md" type="a" :href="`../../statics/` + myevent.linkpdf"
|
||||
target="_blank" rounded color="primary" icon="info" label="Vedi Info">
|
||||
target="_blank" rounded color="primary" icon="info" :label="$t('cal.showinfo')">
|
||||
</q-btn>
|
||||
</p>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-actions align="right">
|
||||
<q-btn v-if="bookEventpage.state === EState.Modifying" flat :label="$t('cal.cancelbooking')"
|
||||
color="negative" @click="CancelBookingEvent(myevent)"></q-btn>
|
||||
<q-btn flat :label="getTitleBtnBooking()" color="primary" @click="saveBookEvent(myevent)"
|
||||
color="negative" @click="tools.CancelBookingEvent(mythis, myevent, bookEventForm._id, true)"></q-btn>
|
||||
<q-btn v-if="checkseinviaMsg" flat :label="$t('dialog.sendmsg')" color="primary" @click="sendMsg(myevent)"></q-btn>
|
||||
<q-btn v-else flat :label="getTitleBtnBooking" color="primary" @click="saveBookEvent(myevent)"
|
||||
:disable="!(bookEventpage.state === EState.Creating || hasModifiedBooking)"></q-btn>
|
||||
|
||||
|
||||
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
@@ -543,7 +541,7 @@ $t('
|
||||
<span v-if="event.linkpdf" class="">
|
||||
<q-btn size="md" type="a" :href="`../../statics/` + event.linkpdf"
|
||||
target="_blank" rounded color="primary" icon="info"
|
||||
label="Vedi Info">
|
||||
:label="$t('cal.showinfo')">
|
||||
|
||||
</q-btn>
|
||||
</span>
|
||||
|
||||
@@ -151,7 +151,7 @@ export default class CSignIn extends Vue {
|
||||
// console.log('ERROR Subscription = ' + e)
|
||||
// })
|
||||
} else {
|
||||
this.$emit('checkErrors', riscode)
|
||||
this.$emit('SignIncheckErrors', riscode)
|
||||
}
|
||||
|
||||
this.iswaitingforRes = false
|
||||
@@ -160,7 +160,7 @@ export default class CSignIn extends Vue {
|
||||
.catch((error) => {
|
||||
// console.log('ERROR SIGNIN = ' + error)
|
||||
|
||||
this.$emit('checkErrors', error)
|
||||
this.$emit('SignIncheckErrors', error)
|
||||
})
|
||||
// console.log(' END submit')
|
||||
}
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
:disable="$v.$error || iswaitingforRes">{{$t('login.enter')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
<div align="center" style="margin-top:10px;">
|
||||
<q-btn flat rounded size="lg" color="primary" to="/signup">{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -295,3 +295,4 @@ canvas {
|
||||
margin: 1px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,6 +350,10 @@ export default class Header extends Vue {
|
||||
return UserStore.state.isLogged
|
||||
}
|
||||
|
||||
get isVerified() {
|
||||
return UserStore.state.verified_email
|
||||
}
|
||||
|
||||
public loginOk() {
|
||||
tools.loginOk(this, false)
|
||||
}
|
||||
@@ -359,7 +363,7 @@ export default class Header extends Vue {
|
||||
}
|
||||
|
||||
public checkErrors(riscode) {
|
||||
tools.checkErrors(this, riscode)
|
||||
tools.SignIncheckErrors(this, riscode)
|
||||
}
|
||||
|
||||
public showNotif(msgcode) {
|
||||
@@ -369,4 +373,9 @@ export default class Header extends Vue {
|
||||
public mythis() {
|
||||
return this
|
||||
}
|
||||
|
||||
public clickregister() {
|
||||
this.right = false
|
||||
this.$router.replace('/signup')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,32 +132,36 @@
|
||||
<div id="profile">
|
||||
<q-img class="absolute-top" src="../../statics/images/landing_first_section.png"
|
||||
style="height: 150px">
|
||||
<div class="absolute-bottom bg-transparent text-black center_img">
|
||||
</q-img>
|
||||
<div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;">
|
||||
|
||||
<q-avatar class="q-mb-sm center_img">
|
||||
<img src="../../statics/images/avatar-1.svg">
|
||||
</q-avatar>
|
||||
<q-btn class="absolute-top-right" style="margin-top: 9px; margin-right: 12px; color: white;"
|
||||
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
|
||||
dense flat round icon="close" @click="right = !right">
|
||||
</q-btn>
|
||||
<div v-if="Username" class="text-weight-bold text-user">{{ Username }} - {{ myName }}</div>
|
||||
<div v-else class="text-italic">
|
||||
<div v-if="isLogged" class="text-weight-bold text-user">{{ Username }} - {{ myName }}</div>
|
||||
<div v-else class="text-user text-italic bg-red">
|
||||
{{ $t('user.loggati') }}
|
||||
</div>
|
||||
|
||||
<div v-if="isLogged && !isVerified" class="text-verified">{{
|
||||
$t('components.authentication.email_verification.verify_email') }}
|
||||
</div>
|
||||
|
||||
<!--<span class="text-white" v-if="Verificato"> {{$t('reg.verificato')}} </span>-->
|
||||
<!--<span class="text-white background-red" v-else> {{$t('reg.non_verificato')}} </span>-->
|
||||
|
||||
<div v-if="Username" id="user-actions">
|
||||
<div v-if="isLogged" id="user-actions" class="text-center">
|
||||
<q-btn round color="primary" icon="person"></q-btn>
|
||||
<q-btn round color="warning" icon="lock"></q-btn>
|
||||
<q-btn round color="secondary" icon="exit_to_app" @click='logoutHandler'></q-btn>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</q-img>
|
||||
<div style="margin-top:120px;"></div>
|
||||
<div v-show="!Username">
|
||||
<div v-show="!isLogged">
|
||||
<div class="q-ma-md" style="">
|
||||
<CSignIn :mythis="mythis"
|
||||
@loginOk="loginOk"
|
||||
|
||||
@@ -10,6 +10,7 @@ export * from './CImgText'
|
||||
export * from './CImgTitle'
|
||||
export * from './CPreloadImages'
|
||||
export * from './CSignIn'
|
||||
export * from './CSignUp'
|
||||
export * from './CEventsCalendar'
|
||||
export * from './CDate'
|
||||
export * from './BannerCookies'
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
}
|
||||
|
||||
#profile {
|
||||
height: 130px;
|
||||
background-color: #009688;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,5 +64,4 @@ export default class MenuOne extends Vue {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export interface IEvents {
|
||||
}
|
||||
|
||||
export interface IBookedEvent {
|
||||
_id?: any
|
||||
userId: any
|
||||
id_bookedevent?: any
|
||||
numpeople: number
|
||||
infoevent: string
|
||||
|
||||
@@ -200,3 +200,4 @@ export interface IFunctionality {
|
||||
SHOW_ONLY_POLICY?: boolean
|
||||
BOOKING_EVENTS?: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -31,4 +31,12 @@ export interface IUserState {
|
||||
x_auth_token?: string
|
||||
isLogged?: boolean
|
||||
isAdmin?: boolean
|
||||
usersList?: IUserList[]
|
||||
}
|
||||
|
||||
export interface IUserList {
|
||||
userId: string
|
||||
username: string
|
||||
name?: string
|
||||
surname?: string
|
||||
}
|
||||
|
||||
@@ -2,6 +2,15 @@ import msg_website from '../db/i18n_website'
|
||||
|
||||
const msgglobal = {
|
||||
it: {
|
||||
otherpages: {
|
||||
admin : {
|
||||
menu: 'Amministrazione',
|
||||
eventlist: 'Lista Prenotazioni',
|
||||
},
|
||||
},
|
||||
sendmsg: {
|
||||
write: 'scrive'
|
||||
},
|
||||
dialog: {
|
||||
ok: 'Ok',
|
||||
yes: 'Si',
|
||||
@@ -11,6 +20,7 @@ const msgglobal = {
|
||||
update: 'Aggiorna',
|
||||
today: 'Oggi',
|
||||
book: 'Prenota',
|
||||
sendmsg: 'Invia Msg',
|
||||
msg: {
|
||||
titledeleteTask: 'Elimina Task',
|
||||
deleteTask: "Vuoi Eliminare {mytodo}?"
|
||||
@@ -179,6 +189,7 @@ const msgglobal = {
|
||||
enterEndDateTime: 'Data e Ora Fine Evento',
|
||||
selnumpeople: 'Partecipanti',
|
||||
msgbooking: 'Messaggio da inviare',
|
||||
showinfo: 'Vedi Info',
|
||||
bookingtextdefault: 'Mi prenoto all\'evento',
|
||||
bookingtextdefault_of: 'di'
|
||||
},
|
||||
@@ -200,6 +211,15 @@ const msgglobal = {
|
||||
cookies: 'Usiamo i Cookie per una migliore prestazione web.'
|
||||
},
|
||||
es: {
|
||||
otherpages: {
|
||||
admin : {
|
||||
menu: 'Administración',
|
||||
eventlist: 'Lista Reserva',
|
||||
},
|
||||
},
|
||||
sendmsg: {
|
||||
write: 'escribe'
|
||||
},
|
||||
dialog: {
|
||||
ok: 'Vale',
|
||||
yes: 'Sí',
|
||||
@@ -209,6 +229,7 @@ const msgglobal = {
|
||||
update: 'Actualiza',
|
||||
today: 'Hoy',
|
||||
book: 'Reserva',
|
||||
sendmsg: 'Envia Mensaje',
|
||||
msg: {
|
||||
titledeleteTask: 'Borrar Tarea',
|
||||
deleteTask: 'Quieres borrar {mytodo}?'
|
||||
@@ -371,6 +392,7 @@ const msgglobal = {
|
||||
enterEndDateTime: 'Fecha y hora del evento final',
|
||||
selnumpeople: 'Partecipantes',
|
||||
msgbooking: 'Mensaje para enviar',
|
||||
showinfo: 'Ver Info',
|
||||
bookingtextdefault: 'Reservo el evento',
|
||||
bookingtextdefault_of: 'de',
|
||||
},
|
||||
@@ -392,6 +414,15 @@ const msgglobal = {
|
||||
cookies: 'Utilizamos cookies para un mejor rendimiento web.'
|
||||
},
|
||||
fr: {
|
||||
otherpages: {
|
||||
admin : {
|
||||
menu: 'Administration',
|
||||
eventlist: 'Liste de Réservation',
|
||||
},
|
||||
},
|
||||
sendmsg: {
|
||||
write: 'écrit'
|
||||
},
|
||||
dialog: {
|
||||
ok: 'Bien',
|
||||
yes: 'Oui',
|
||||
@@ -401,6 +432,7 @@ const msgglobal = {
|
||||
cancel: 'annuler',
|
||||
today: 'Aujourd\'hui',
|
||||
book: 'Réserve',
|
||||
sendmsg: 'Envoyer Msg',
|
||||
msg: {
|
||||
titledeleteTask: 'Supprimer la tâche',
|
||||
deleteTask: 'Voulez-vous supprimer {mytodo}?'
|
||||
@@ -562,6 +594,7 @@ const msgglobal = {
|
||||
enterEndDateTime: 'Date et heure de l\'événement final',
|
||||
selnumpeople: 'Participants',
|
||||
msgbooking: 'Message à envoyer',
|
||||
showinfo: 'Voir Info',
|
||||
bookingtextdefault: 'Je réserve l\'événement',
|
||||
bookingtextdefault_of: 'du',
|
||||
},
|
||||
@@ -583,6 +616,15 @@ const msgglobal = {
|
||||
cookies: 'Nous utilisons des cookies pour améliorer les performances Web.'
|
||||
},
|
||||
enUs: {
|
||||
otherpages: {
|
||||
admin : {
|
||||
menu: 'Administration',
|
||||
eventlist: 'Booking List',
|
||||
},
|
||||
},
|
||||
sendmsg: {
|
||||
write: 'write'
|
||||
},
|
||||
dialog: {
|
||||
ok: 'Ok',
|
||||
yes: 'Yes',
|
||||
@@ -592,6 +634,7 @@ const msgglobal = {
|
||||
cancel: 'Cancel',
|
||||
today: 'Today',
|
||||
book: 'Book',
|
||||
sendmsg: 'Send Msg',
|
||||
msg: {
|
||||
titledeleteTask: 'Delete Task',
|
||||
deleteTask: 'Delete Task {mytodo}?'
|
||||
@@ -752,6 +795,7 @@ const msgglobal = {
|
||||
enterEndDateTime: 'Event end date and time',
|
||||
selnumpeople: 'Participants',
|
||||
msgbooking: 'Message to send',
|
||||
showinfo: 'Show Info',
|
||||
bookingtextdefault: 'I book the event',
|
||||
bookingtextdefault_of: 'of',
|
||||
},
|
||||
@@ -773,6 +817,15 @@ const msgglobal = {
|
||||
cookies: 'We use cookies for better web performance.'
|
||||
},
|
||||
de: {
|
||||
otherpages: {
|
||||
admin : {
|
||||
menu: 'Administration',
|
||||
eventlist: 'Booking List',
|
||||
},
|
||||
},
|
||||
sendmsg: {
|
||||
write: 'write'
|
||||
},
|
||||
dialog: {
|
||||
ok: 'Ok',
|
||||
yes: 'Yes',
|
||||
@@ -782,6 +835,7 @@ const msgglobal = {
|
||||
cancel: 'Cancel',
|
||||
today: 'Today',
|
||||
book: 'Book',
|
||||
sendmsg: 'Send Msg',
|
||||
msg: {
|
||||
titledeleteTask: 'Delete Task',
|
||||
deleteTask: 'Delete Task {mytodo}?'
|
||||
@@ -944,6 +998,7 @@ const msgglobal = {
|
||||
enterEndDateTime: 'Event end date and time',
|
||||
selnumpeople: 'Participants',
|
||||
msgbooking: 'Message to send',
|
||||
showinfo: 'Show Info',
|
||||
bookingtextdefault: 'I book the event',
|
||||
bookingtextdefault_of: 'of',
|
||||
},
|
||||
|
||||
@@ -71,7 +71,7 @@ export namespace ApiTool {
|
||||
idapp: process.env.APP_ID
|
||||
}
|
||||
|
||||
// console.log('mydata', mydata)
|
||||
console.log('mydata', mydata)
|
||||
|
||||
UserStore.mutations.setServerCode(tools.EMPTY)
|
||||
UserStore.mutations.setResStatus(0)
|
||||
|
||||
@@ -10,6 +10,7 @@ import translate from '../../../../globalroutines/util'
|
||||
import * as Types from '../../../Api/ApiTypes'
|
||||
import { db_data } from '@src/db/db_data'
|
||||
import { UserStore } from '@store'
|
||||
import { lists } from '@src/store/Modules/lists'
|
||||
|
||||
// State
|
||||
const state: ICalendarState = {
|
||||
@@ -49,9 +50,27 @@ namespace Getters {
|
||||
return mystate.bookedevent.find((bookedevent) => (bookedevent.id_bookedevent === myevent._id) && ((isconfirmed && bookedevent.booked) || (!isconfirmed)))
|
||||
}, 'findEventBooked')
|
||||
|
||||
const getNumParticipants = b.read((mystate: ICalendarState) => (myevent: IEvents) => {
|
||||
const myarr = mystate.bookedevent.filter((bookedevent) => (bookedevent.id_bookedevent === myevent._id) && (bookedevent.booked))
|
||||
if (myarr)
|
||||
return myarr.reduce((sum, bookedevent) => sum + bookedevent.numpeople, 0)
|
||||
else
|
||||
return 0
|
||||
}, 'getNumParticipants')
|
||||
|
||||
const getEventsBookedByIdEvent = b.read((mystate: ICalendarState) => (idevent) => {
|
||||
return mystate.bookedevent.filter((bookedevent) => (bookedevent.id_bookedevent === idevent) && (bookedevent.booked))
|
||||
}, 'getEventsBookedByIdEvent')
|
||||
|
||||
export const getters = {
|
||||
get findEventBooked() {
|
||||
return findEventBooked()
|
||||
},
|
||||
get getNumParticipants() {
|
||||
return getNumParticipants()
|
||||
},
|
||||
get getEventsBookedByIdEvent() {
|
||||
return getEventsBookedByIdEvent()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +105,9 @@ namespace Actions {
|
||||
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/booking/' + UserStore.state.userId + '/' + process.env.APP_ID, 'GET', null)
|
||||
const showall = UserStore.state.isAdmin ? '1' : '0'
|
||||
|
||||
ris = await Api.SendReq('/booking/' + UserStore.state.userId + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
|
||||
.then((res) => {
|
||||
if (res.data.bookedevent) {
|
||||
state.bookedevent = res.data.bookedevent
|
||||
@@ -106,6 +127,7 @@ namespace Actions {
|
||||
|
||||
function getparambyevent(bookevent) {
|
||||
return {
|
||||
_id: bookevent._id,
|
||||
id_bookedevent: bookevent.id_bookedevent,
|
||||
infoevent: bookevent.infoevent,
|
||||
numpeople: bookevent.numpeople,
|
||||
@@ -113,7 +135,7 @@ namespace Actions {
|
||||
datebooked: bookevent.datebooked,
|
||||
userId: UserStore.state.userId,
|
||||
booked: bookevent.booked,
|
||||
modified: bookevent.modified,
|
||||
modified: bookevent.modified
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +148,7 @@ namespace Actions {
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
||||
bookevent._id = res.data.id
|
||||
if (bookevent.modified) {
|
||||
|
||||
const foundIndex = state.bookedevent.findIndex((x) => x.id_bookedevent === bookevent.id_bookedevent)
|
||||
@@ -147,20 +170,16 @@ namespace Actions {
|
||||
|
||||
}
|
||||
|
||||
async function CancelBookingEvent(context, event: IEvents) {
|
||||
console.log('CALSTORE: CancelBookingEvent', event)
|
||||
async function CancelBookingEvent(context, { ideventbook, notify }) {
|
||||
console.log('CALSTORE: CancelBookingEvent', ideventbook, notify)
|
||||
|
||||
const myeventtoCancel = state.bookedevent.find((eventbooked) => (eventbooked.id_bookedevent === event._id))
|
||||
|
||||
const param = getparambyevent(myeventtoCancel)
|
||||
param.booked = false // Cancel Booking
|
||||
|
||||
return await Api.SendReq('/booking', 'POST', param)
|
||||
return await Api.SendReq('/booking/' + ideventbook + '/' + notify + '/' + process.env.APP_ID, 'DELETE', null)
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
||||
|
||||
state.bookedevent = state.bookedevent.filter((eventbooked) => (eventbooked.id_bookedevent !== event._id))
|
||||
// Remove this record from my list
|
||||
state.bookedevent = state.bookedevent.filter((eventbooked) => (eventbooked._id !== ideventbook))
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -173,8 +192,6 @@ namespace Actions {
|
||||
// UserStore.mutations.setErrorCatch(error)
|
||||
return false
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Api from '@api'
|
||||
import { ISignupOptions, ISigninOptions, IUserState } from 'model'
|
||||
import { ISignupOptions, ISigninOptions, IUserState, IUserList } from 'model'
|
||||
import { ILinkReg, IResult, IIdToken, IToken } from 'model/other'
|
||||
import { storeBuilder } from './Store/Store'
|
||||
import router from '@router'
|
||||
@@ -11,6 +11,7 @@ import { GlobalStore, UserStore, Todos, Projects, BookingStore, CalendarStore }
|
||||
import globalroutines from './../../globalroutines/index'
|
||||
|
||||
import { static_data } from '@src/db/static_data'
|
||||
import { db_data } from '@src/db/db_data'
|
||||
|
||||
import translate from './../../globalroutines/util'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
@@ -33,7 +34,8 @@ const state: IUserState = {
|
||||
servercode: 0,
|
||||
x_auth_token: '',
|
||||
isLogged: false,
|
||||
isAdmin: false
|
||||
isAdmin: false,
|
||||
usersList: []
|
||||
}
|
||||
|
||||
const b = storeBuilder.module<IUserState>('UserModule', state)
|
||||
@@ -81,6 +83,14 @@ namespace Getters {
|
||||
return state.servercode
|
||||
}, 'getServerCode')
|
||||
|
||||
const getNameSurnameByUserId = b.read((state: IUserState) => (userId: string) => {
|
||||
const user = UserStore.getters.getUserByUserId(userId)
|
||||
if (user)
|
||||
return user.name + ' ' + user.surname
|
||||
else
|
||||
return '(' + userId + ')'
|
||||
}, 'getNameSurnameByUserId')
|
||||
|
||||
const IsMyFriend = b.read((state) => (userIdOwner) => {
|
||||
// ++TODO Check if userIdOwner is my friend
|
||||
// userIdOwner is my friend ?
|
||||
@@ -93,6 +103,10 @@ namespace Getters {
|
||||
return true
|
||||
}, 'IsMyGroup')
|
||||
|
||||
const getUserByUserId = b.read((mystate: IUserState) => (userId): IUserState => {
|
||||
return mystate.usersList.find((item) => item.userId === userId)
|
||||
}, 'getUserByUserId')
|
||||
|
||||
export const getters = {
|
||||
get isUserInvalid() {
|
||||
return isUserInvalid()
|
||||
@@ -114,6 +128,12 @@ namespace Getters {
|
||||
},
|
||||
get IsMyGroup() {
|
||||
return IsMyGroup()
|
||||
},
|
||||
get getNameSurnameByUserId() {
|
||||
return getNameSurnameByUserId()
|
||||
},
|
||||
get getUserByUserId() {
|
||||
return getUserByUserId()
|
||||
}
|
||||
// get fullName() { return fullName();},
|
||||
}
|
||||
@@ -138,8 +158,10 @@ namespace Mutations {
|
||||
state.tokens.push({ access: 'auth', token: state.x_auth_token, data_login: tools.getDateNow() })
|
||||
|
||||
// ++Todo: Settings Users Admin
|
||||
if (state.username === 'paoloar77') {
|
||||
if (db_data.adminUsers.includes(state.username)) {
|
||||
state.isAdmin = true
|
||||
} else {
|
||||
state.isAdmin = false
|
||||
}
|
||||
|
||||
// console.log('state.tokens', state.tokens)
|
||||
@@ -389,7 +411,9 @@ namespace Actions {
|
||||
localStorage.setItem(tools.localStorage.token, state.x_auth_token)
|
||||
localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString())
|
||||
localStorage.setItem(tools.localStorage.verified_email, String(false))
|
||||
state.isLogged = true
|
||||
|
||||
// Even if you has registered, you have to SignIn first
|
||||
state.isLogged = false
|
||||
// dispatch('storeUser', authData);
|
||||
// dispatch('setLogoutTimer', myres.data.expiresIn);
|
||||
|
||||
|
||||
@@ -3,8 +3,18 @@ import globalroutines from './../../globalroutines/index'
|
||||
import { costanti } from './costanti'
|
||||
import { toolsext } from './toolsext'
|
||||
import { translation } from './translation'
|
||||
import Quasar, { date, Screen } from 'quasar'
|
||||
import { ICollaborations, IListRoutes, IMenuList, IParamDialog, IProject, ITodo, Privacy } from '@src/model'
|
||||
import Quasar, { colors, date, Screen } from 'quasar'
|
||||
import {
|
||||
IBookedEvent,
|
||||
ICollaborations,
|
||||
IEvents,
|
||||
IListRoutes,
|
||||
IMenuList,
|
||||
IParamDialog,
|
||||
IProject,
|
||||
ITodo,
|
||||
Privacy
|
||||
} from '@src/model'
|
||||
import * as ApiTables from '@src/store/Modules/ApiTables'
|
||||
import translate from '@src/globalroutines/util'
|
||||
import { RouteNames } from '@src/router/route-names'
|
||||
@@ -1302,12 +1312,13 @@ export const tools = {
|
||||
return result
|
||||
},
|
||||
|
||||
executefunc(myself: any, myfunc: number, par: IParamDialog) {
|
||||
if (myfunc === costanti.FuncDialog.CANCEL_BOOKING) {
|
||||
console.log(' ENTRATO ! CancelBookingEvent ')
|
||||
CalendarStore.actions.CancelBookingEvent(par.param1).then((ris) => {
|
||||
executefunc(myself: any, func: number, par: IParamDialog) {
|
||||
if (func === lists.MenuAction.DELETE) {
|
||||
console.log('param1', par.param1)
|
||||
CalendarStore.actions.CancelBookingEvent({ideventbook: par.param1, notify: par.param2 === true ? '1' : '0'}).then((ris) => {
|
||||
if (ris) {
|
||||
tools.showPositiveNotif(myself.$q, myself.$t('cal.canceledbooking') + ' "' + par.param1.title + '"')
|
||||
if (myself.bookEventpage)
|
||||
myself.bookEventpage.show = false
|
||||
} else
|
||||
tools.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorbooking'))
|
||||
@@ -2078,7 +2089,7 @@ export const tools = {
|
||||
|
||||
return msg
|
||||
},
|
||||
gettextevent(myevent) {
|
||||
gettextevent(myevent: IEvents) {
|
||||
return '"' + myevent.title + '" (' + func_tools.getDateStr(myevent.date) + ') - ' + myevent.time
|
||||
},
|
||||
|
||||
@@ -2126,7 +2137,7 @@ export const tools = {
|
||||
|
||||
globalroutines(mythis, 'loadapp', '')
|
||||
|
||||
tools.checkErrors(mythis, tools.OK, ispageLogin)
|
||||
tools.SignIncheckErrors(mythis, tools.OK, ispageLogin)
|
||||
},
|
||||
|
||||
loginInCorso(mythis) {
|
||||
@@ -2139,8 +2150,8 @@ export const tools = {
|
||||
mythis.$q.loading.show({ message: msg })
|
||||
},
|
||||
|
||||
checkErrors(mythis, riscode, ispageLogin?: boolean) {
|
||||
// console.log('checkErrors: ', riscode)
|
||||
SignIncheckErrors(mythis, riscode, ispageLogin?: boolean) {
|
||||
// console.log('SignIncheckErrors: ', riscode)
|
||||
try {
|
||||
if (riscode === tools.OK) {
|
||||
tools.showNotif(mythis.$q, mythis.$t('login.completato'), { color: 'positive', icon: 'check' })
|
||||
@@ -2185,8 +2196,51 @@ export const tools = {
|
||||
} finally {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
|
||||
SignUpcheckErrors(mythis, riscode: number) {
|
||||
console.log('SignUpcheckErrors', riscode)
|
||||
if (riscode === tools.DUPLICATE_EMAIL_ID) {
|
||||
tools.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_email'))
|
||||
} else if (riscode === tools.DUPLICATE_USERNAME_ID) {
|
||||
tools.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_username'))
|
||||
} else if (riscode === tools.ERR_SERVERFETCH) {
|
||||
tools.showNotif(mythis.$q, mythis.$t('fetch.errore_server'))
|
||||
} else if (riscode === tools.ERR_GENERICO) {
|
||||
const msg = mythis.$t('fetch.errore_generico') + UserStore.mutations.getMsgError(riscode)
|
||||
tools.showNotif(mythis.$q, msg)
|
||||
} else if (riscode === tools.OK) {
|
||||
mythis.$router.push('/signin')
|
||||
tools.showNotif(mythis.$q, mythis.$t('components.authentication.email_verification.link_sent'), {
|
||||
color: 'warning',
|
||||
textColor: 'black'
|
||||
})
|
||||
} else {
|
||||
tools.showNotif(mythis.$q, 'Errore num ' + riscode)
|
||||
}
|
||||
|
||||
},
|
||||
isCssColor(color) {
|
||||
return !!color && !!color.match(/^(#|(rgb|hsl)a?\()/)
|
||||
},
|
||||
displayClasses(eventparam) {
|
||||
return {
|
||||
[`bg-${eventparam.bgcolor}`]: !tools.isCssColor(eventparam.bgcolor),
|
||||
'text-white': !tools.isCssColor(eventparam.bgcolor)
|
||||
}
|
||||
},
|
||||
displayStyles(eventparam) {
|
||||
const s = { color: '' }
|
||||
if (tools.isCssColor(eventparam.bgcolor)) {
|
||||
s['background-color'] = eventparam.bgcolor
|
||||
s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white'
|
||||
}
|
||||
return s
|
||||
},
|
||||
CancelBookingEvent(mythis, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
||||
console.log('CancelBookingEvent ', eventparam)
|
||||
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, lists.MenuAction.DELETE, 0, { param1: bookeventid, param2: notify })
|
||||
}
|
||||
|
||||
// getLocale() {
|
||||
// if (navigator.languages && navigator.languages.length > 0) {
|
||||
|
||||
@@ -38,6 +38,21 @@ export const func_tools = {
|
||||
return DateFormatter.format(date)
|
||||
}
|
||||
return mydate
|
||||
},
|
||||
|
||||
getDateTimeShortStr(mydate) {
|
||||
const DateFormatter = new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
day: 'numeric',
|
||||
month: 'short'
|
||||
// timeZone: 'UTC'
|
||||
})
|
||||
if (DateFormatter) {
|
||||
const date = new Date(mydate)
|
||||
return DateFormatter.format(date)
|
||||
}
|
||||
return mydate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class Signin extends Vue {
|
||||
}
|
||||
|
||||
public checkErrors(riscode) {
|
||||
tools.checkErrors(this, riscode, true)
|
||||
tools.SignIncheckErrors(this, riscode, true)
|
||||
}
|
||||
|
||||
public showNotif(msgcode) {
|
||||
|
||||
@@ -3,174 +3,13 @@ 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 } from 'model'
|
||||
import { validations, TSignup } from './signup-validate'
|
||||
|
||||
import { validationMixin } from 'vuelidate'
|
||||
|
||||
import { Logo } from '../../../components/logo'
|
||||
|
||||
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
||||
import { CSignUp } from '../../../components/CSignUp'
|
||||
|
||||
@Component({
|
||||
mixins: [validationMixin],
|
||||
validations,
|
||||
components: { Logo }
|
||||
components: { CSignUp }
|
||||
})
|
||||
|
||||
export default class Signup extends Vue {
|
||||
public $v
|
||||
public $q
|
||||
public $t: any
|
||||
|
||||
public duplicate_email: boolean = false
|
||||
public duplicate_username: boolean = false
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
public created() {
|
||||
this.$v.$reset()
|
||||
}
|
||||
|
||||
public mounted() {
|
||||
}
|
||||
|
||||
get allowSubmit() {
|
||||
|
||||
const error = this.$v.$error || this.$v.$invalid
|
||||
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 '' }
|
||||
if (item.$params.email && !item.email) { return this.$t('reg.err.email') }
|
||||
|
||||
if (cosa === 'repeatpassword') {
|
||||
if (!item.sameAsPassword) {
|
||||
return this.$t('reg.err.sameaspassword')
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.required) { return this.$t('reg.err.required') }
|
||||
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 === 'name') || (cosa === 'surname')) {
|
||||
// console.log(item);
|
||||
|
||||
}
|
||||
|
||||
if (!item.complexity) { return this.$t('reg.err.complexity') }
|
||||
if (!item.minLength) { return this.$t('reg.err.atleast') + ` ${item.$params.minLength.min} ` + this.$t('reg.err.char') }
|
||||
if (!item.maxLength) { return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char') }
|
||||
return ''
|
||||
} catch (error) {
|
||||
// console.log("ERR : " + error);
|
||||
}
|
||||
}
|
||||
|
||||
public checkErrors(riscode: number) {
|
||||
console.log('checkErrors', riscode)
|
||||
if (riscode === tools.DUPLICATE_EMAIL_ID) {
|
||||
tools.showNotif(this.$q, this.$t('reg.err.duplicate_email'))
|
||||
} else if (riscode === tools.DUPLICATE_USERNAME_ID) {
|
||||
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()
|
||||
|
||||
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.$q.loading.show({ message: this.$t('reg.incorso') })
|
||||
|
||||
console.log(this.signup)
|
||||
UserStore.actions.signup(this.signup)
|
||||
.then((riscode) => {
|
||||
this.checkErrors(riscode)
|
||||
this.$q.loading.hide()
|
||||
}).catch((error) => {
|
||||
console.log('ERROR = ' + error)
|
||||
this.$q.loading.hide()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,139 +1,8 @@
|
||||
<template>
|
||||
<q-page padding class="signup">
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<logo></logo>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
|
||||
|
||||
<div class="q-gutter-xs">
|
||||
<q-input
|
||||
v-model="signup.email"
|
||||
rounded outlined
|
||||
@blur="$v.signup.email.$touch"
|
||||
:error="$v.signup.email.$error"
|
||||
:error-message="errorMsg('email', $v.signup.email)"
|
||||
bottom-slots
|
||||
debounce="1000"
|
||||
:label="$t('reg.email')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<q-input
|
||||
v-model="signup.username"
|
||||
rounded outlined
|
||||
@blur="$v.signup.username.$touch"
|
||||
:error="$v.signup.username.$error"
|
||||
bottom-slots
|
||||
debounce="1000"
|
||||
:error-message="errorMsg('username', $v.signup.username)"
|
||||
:label="$t('reg.username')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="person"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<q-input
|
||||
v-model="signup.name"
|
||||
rounded outlined
|
||||
@blur="$v.signup.name.$touch"
|
||||
:error="$v.signup.name.$error"
|
||||
bottom-slots
|
||||
debounce="1000"
|
||||
: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"
|
||||
bottom-slots
|
||||
debounce="1000"
|
||||
:error-message="errorMsg('surname', $v.signup.surname)"
|
||||
:label="$t('reg.surname')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="person"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<q-input
|
||||
v-model="signup.password"
|
||||
type="password"
|
||||
rounded outlined
|
||||
@blur="$v.signup.password.$touch"
|
||||
:error="$v.signup.password.$error"
|
||||
:error-message="`${errorMsg('password', $v.signup.password)}`"
|
||||
bottom-slots
|
||||
:label="$t('reg.password')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="vpn_key"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<q-input
|
||||
v-model="signup.repeatPassword"
|
||||
type="password"
|
||||
rounded outlined
|
||||
@blur="$v.signup.repeatPassword.$touch"
|
||||
:error="$v.signup.repeatPassword.$error"
|
||||
:error-message="`${errorMsg('repeatpassword', $v.signup.repeatPassword)}`"
|
||||
bottom-slots
|
||||
:label="$t('reg.repeatPassword')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="vpn_key"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<!--:hint="$t('reg.tips.repeatpassword')"-->
|
||||
|
||||
<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)}`"
|
||||
:label="$t('reg.terms')">
|
||||
|
||||
</q-checkbox>
|
||||
<br>
|
||||
|
||||
<div class="wrapper">
|
||||
<q-btn rounded size="lg" color="positive" @click="submitOk" :disabled='!allowSubmit'>
|
||||
{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div align="center">
|
||||
<q-btn rounded size="lg" color="primary" @click="submitOk" :disable="">{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
-->
|
||||
<CSignUp>
|
||||
|
||||
</CSignUp>
|
||||
</q-page>
|
||||
|
||||
</template>
|
||||
|
||||
21
yarn.lock
21
yarn.lock
@@ -1101,10 +1101,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@positron/stack-trace/-/stack-trace-1.0.0.tgz#14fcc712a530038ef9be1ce6952315a839f466a8"
|
||||
integrity sha1-FPzHEqUwA475vhzmlSMVqDn0Zqg=
|
||||
|
||||
"@quasar/app@^1.1.4":
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@quasar/app/-/app-1.1.4.tgz#2f4a04d4bf3c242388c78d189ceaca174a0ebfe1"
|
||||
integrity sha512-jAzRi+rFVN6VPHCTlCcpH4ui6KHqA6pOPHqSdKnncYkkXGxqDwFumnTFjQfV1Iz5/+a0x3056y3i6n8QOFZ6Og==
|
||||
"@quasar/app@^1.1.2":
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@quasar/app/-/app-1.2.1.tgz#2cc23ed9230106ffc1605cc01de43395bff21405"
|
||||
integrity sha512-cJaq56iTrIf0n1jjov2IRGCkjEA66iq+gPF7y1UAHr38s699pNPLugblvdqoFAa20ogDw/VtlrHOuQBcHoZSqQ==
|
||||
dependencies:
|
||||
"@quasar/babel-preset-app" "1.1.6"
|
||||
"@quasar/fastclick" "1.1.4"
|
||||
@@ -1205,6 +1205,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@quasar/fastclick/-/fastclick-1.1.4.tgz#21ed3e9a4387dcb43022a08af4ef08a5f1abf159"
|
||||
integrity sha512-i9wbyV4iT+v4KhtHJynUFhH5LiEPvAEgSnwMqPN4hf/8uRe82nDl5qP5agrp2el1h0HzyBpbvHaW7NB0BPrtvA==
|
||||
|
||||
"@quasar/quasar-app-extension-colorize@^1.0.0-alpha.1":
|
||||
version "1.0.0-alpha.1"
|
||||
resolved "https://registry.yarnpkg.com/@quasar/quasar-app-extension-colorize/-/quasar-app-extension-colorize-1.0.0-alpha.1.tgz#55c8645c2b1d621f13264832f5a258d0114b4368"
|
||||
integrity sha512-udmfCeDHFDO60bDrXCM+LihxZjUenFkAsYJP3MNRTIh/sUeLJdmzwEvZRlzrGMymJBlZhgL+C/arAn+su1Kyyg==
|
||||
|
||||
"@quasar/quasar-app-extension-typescript@^1.0.0-alpha.11":
|
||||
version "1.0.0-beta.1"
|
||||
resolved "https://registry.yarnpkg.com/@quasar/quasar-app-extension-typescript/-/quasar-app-extension-typescript-1.0.0-beta.1.tgz#945aa301b51ac6e7e7766a6e7cceb736c289f7fb"
|
||||
@@ -11874,10 +11879,10 @@ quasar-extras@^2.0.8:
|
||||
resolved "https://registry.yarnpkg.com/quasar-extras/-/quasar-extras-2.0.9.tgz#f3274f8cd8e054a76d0b52a2410ccf0cdfb197fd"
|
||||
integrity sha512-ifwaaop0GNuxlcD7Ams0X3f7S49es+2NlR/fI4YAMAOW70ZxTkD4QkAFsVhk7dNPcpPodSOTKAWDOPaO+MqsBg==
|
||||
|
||||
quasar@^1.1.7:
|
||||
version "1.1.7"
|
||||
resolved "https://registry.yarnpkg.com/quasar/-/quasar-1.1.7.tgz#68803a898a2a34c3c0b8d9ea30d40298c4a8c976"
|
||||
integrity sha512-MNL3vSnz2fbc0OVXldJd9dxD5hRPvlKF4HZ4GWJ6u7uFDnbXUaeqUb0Sc3zwFhT1ozKRtJg/rcVsF2hSbOrixQ==
|
||||
quasar@^1.1.6:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/quasar/-/quasar-1.2.1.tgz#83117f5b17adcc7c08526b9aadc4ca7c2ab21287"
|
||||
integrity sha512-7PbX8HecdrDzpG9zcZk5PSuPRFicU6b07N9Dk0uk5N+2LNGEFGBwIuQnLeDpq03Xdv98Q6GpTTZNaWpXdYBZcg==
|
||||
|
||||
query-string@^4.1.0:
|
||||
version "4.3.4"
|
||||
|
||||
Reference in New Issue
Block a user