Start Booking Events

This commit is contained in:
Paolo Arena
2019-09-23 21:06:42 +02:00
parent 3ed8c7116b
commit e42ca08c8f
16 changed files with 103 additions and 35 deletions

View File

@@ -1 +0,0 @@
cfg_freeplanet.app/

View File

@@ -25,6 +25,7 @@ import { Screen } from 'quasar'
}) })
export default class CImgText extends Vue { export default class CImgText extends Vue {
@Prop({ required: false, default: '' }) public src: string @Prop({ required: false, default: '' }) public src: string
@Prop({ required: false, default: '' }) public src2: string
@Prop({ required: false, default: 'myclimg' }) public class1: string @Prop({ required: false, default: 'myclimg' }) public class1: string
@Prop({ required: false, default: '' }) public style1: string @Prop({ required: false, default: '' }) public style1: string
} }

View File

@@ -4,6 +4,7 @@
<div class="row items-start q-col-gutter-xs imgtext"> <div class="row items-start q-col-gutter-xs imgtext">
<div class="imgtext__img"> <div class="imgtext__img">
<img v-if="src" :src="src" class="myclimg" :style="style1"> <img v-if="src" :src="src" class="myclimg" :style="style1">
<img v-if="src2" :src="src2" class="myclimg" :style="style1">
<div class="section_text"> <div class="section_text">
<slot></slot> <slot></slot>
</div> </div>

View File

@@ -10,7 +10,7 @@
<!--</span>--> <!--</span>-->
<FormNewsletter v-if="static_data.SHOW_NEWSLETTER" :idwebsite="tools.appid()" <FormNewsletter v-if="static_data.functionality.SHOW_NEWSLETTER" :idwebsite="tools.appid()"
:locale="tools.getLocale()"> :locale="tools.getLocale()">
</FormNewsletter> </FormNewsletter>
@@ -52,7 +52,7 @@
</div> </div>
<p class="text-center"> <p class="text-center">
<router-link v-if="static_data.SHOW_ONLY_POLICY" to="/policy"><span class="footer_link">{{$t('privacy_policy')}}</span></router-link> <router-link v-if="static_data.functionality.SHOW_ONLY_POLICY" to="/policy"><span class="footer_link">{{$t('privacy_policy')}}</span></router-link>
</p> </p>
</div> </div>

View File

@@ -41,7 +41,7 @@
</q-input> </q-input>
<router-link to="/policy"><span class="news_link">$t('newsletter.acceptlicense')</span></router-link> <router-link to="/policy"><span class="news_link">{{$t('privacy_policy')}}</span></router-link>
<q-toggle dark v-model="accept" :label="$t('newsletter.acceptlicense')"/> <q-toggle dark v-model="accept" :label="$t('newsletter.acceptlicense')"/>

View File

@@ -68,12 +68,12 @@ export default class Header extends Vue {
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// QUASAR Example using event to open drawer from another component or page // QUASAR Example using myevent to open drawer from another component or page
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// (1) This code is inside layout file that have a drawer // (1) This code is inside layout file that have a drawer
// if this.leftDrawerOpen is true, drawer is displayed // if this.leftDrawerOpen is true, drawer is displayed
// (2) Listen for an event in created // (2) Listen for an myevent in created
/* created(){ /* created(){
this.$root.$on("openLeftDrawer", this.openLeftDrawercb); this.$root.$on("openLeftDrawer", this.openLeftDrawercb);
}, },
@@ -85,7 +85,7 @@ export default class Header extends Vue {
} }
} }
// (4) In another component or page, emit the event! // (4) In another component or page, emit the myevent!
// Call the method when clicking button etc. // Call the method when clicking button etc.
methods: { methods: {
openLeftDrawer() { openLeftDrawer() {
@@ -160,7 +160,7 @@ export default class Header extends Vue {
const color = (value === 'online') ? 'positive' : 'warning' const color = (value === 'online') ? 'positive' : 'warning'
if (this.static_data.SHOW_IF_IS_SERVER_CONNECTION) { if (this.static_data.functionality.SHOW_IF_IS_SERVER_CONNECTION) {
if (!!oldValue) { if (!!oldValue) {
tools.showNotif(this.$q, this.$t('connection') + ` ${value}`, { tools.showNotif(this.$q, this.$t('connection') + ` ${value}`, {

View File

@@ -58,7 +58,7 @@
--> -->
<q-btn <q-btn
v-if="!isonline && static_data.SHOW_IF_IS_SERVER_CONNECTION" v-if="!isonline && static_data.functionality.SHOW_IF_IS_SERVER_CONNECTION"
flat flat
dense dense
round round
@@ -102,7 +102,7 @@
<label>{{ $t('msg.hello') }}</label> <span v-model="prova"></span> ! <label>{{ $t('msg.hello') }}</label> <span v-model="prova"></span> !
</div>--> </div>-->
<q-btn v-if="static_data.SHOW_USER_MENU" dense flat round icon="menu" @click="right = !right"> <q-btn v-if="static_data.functionality.SHOW_USER_MENU" dense flat round icon="menu" @click="right = !right">
</q-btn> </q-btn>
</q-toolbar> </q-toolbar>
@@ -121,7 +121,7 @@
</q-drawer> </q-drawer>
<q-drawer v-if="static_data.SHOW_USER_MENU" v-model="right" side="right" overlay bordered> <q-drawer v-if="static_data.functionality.SHOW_USER_MENU" v-model="right" side="right" overlay bordered>
<div id="profile"> <div id="profile">
<q-img class="absolute-top" src="../../statics/images/landing_first_section.png" <q-img class="absolute-top" src="../../statics/images/landing_first_section.png"
style="height: 150px"> style="height: 150px">

View File

@@ -1,5 +1,6 @@
export interface IEvents { export interface IEvents {
_id?: any
time?: string time?: string
duration?: number duration?: number
duration2?: number duration2?: number
@@ -18,9 +19,19 @@ export interface IEvents {
avatar2?: string avatar2?: string
infoextra?: string infoextra?: string
linkpdf?: string linkpdf?: string
nobookable?: boolean
}
export interface IBookedEvent {
id_bookedevent: any
numpeople: number
} }
export interface ICalendarState { export interface ICalendarState {
editable: boolean
eventlist: IEvents[]
bookedevent: IBookedEvent[]
// ---------------
titlebarHeight: number titlebarHeight: number
locale: string, locale: string,
maxDays: number, maxDays: number,

View File

@@ -166,6 +166,7 @@ export interface IColl {
date: string date: string
subtitle?: IAllLang subtitle?: IAllLang
img: string img: string
img2?: string
linkagg?: string linkagg?: string
linkagg_type?: number linkagg_type?: number
width?: number width?: number
@@ -176,3 +177,13 @@ export interface ICollaborations {
withwhom_title: IAllLang withwhom_title: IAllLang
list: IColl[] list: IColl[]
} }
export interface IFunctionality {
SHOW_USER_MENU?: boolean
SHOW_IF_IS_SERVER_CONNECTION?: boolean
ENABLE_TODOS_LOADING?: boolean
ENABLE_PROJECTS_LOADING?: boolean
SHOW_NEWSLETTER?: boolean
SHOW_ONLY_POLICY?: boolean
EVENTS_CAN_BOOKING?: false
}

View File

@@ -1,3 +1,5 @@
import { IBookingState } from '@src/model/BookingStore'
export * from './UserStore' export * from './UserStore'
export * from './GlobalStore' export * from './GlobalStore'
export * from './signin-option' export * from './signin-option'
@@ -11,3 +13,4 @@ export * from './Projects'
export * from './Calendar' export * from './Calendar'
export * from './Estimate' export * from './Estimate'
export * from './BookingStore'

View File

@@ -151,6 +151,9 @@ const msgglobal = {
themebgcolor: 'Tema Colore Sfondo' themebgcolor: 'Tema Colore Sfondo'
}, },
cal: { cal: {
booked: 'Prenotato',
booking: 'Prenota Evento',
cancelbooking: 'Cancella Prenotazione',
event: 'Evento', event: 'Evento',
starttime: 'Dalle', starttime: 'Dalle',
endtime: 'alle', endtime: 'alle',
@@ -327,6 +330,9 @@ const msgglobal = {
themebgcolor: 'Tema Colores Fondo' themebgcolor: 'Tema Colores Fondo'
}, },
cal: { cal: {
booked: 'Reservado',
booking: 'Reserva Evento',
cancelbooking: 'Cancelar Reserva',
event: 'Evento', event: 'Evento',
starttime: 'Inicio', starttime: 'Inicio',
endtime: 'fin', endtime: 'fin',
@@ -502,6 +508,9 @@ const msgglobal = {
themebgcolor: 'Tema Colores Fondo' themebgcolor: 'Tema Colores Fondo'
}, },
cal: { cal: {
booked: 'Réservé',
booking: 'Réserver l\'événement',
cancelbooking: 'Annuler la réservation',
event: 'événement', event: 'événement',
starttime: 'Accueil', starttime: 'Accueil',
endtime: 'fin', endtime: 'fin',
@@ -676,6 +685,9 @@ const msgglobal = {
themebgcolor: 'Theme Color Background' themebgcolor: 'Theme Color Background'
}, },
cal: { cal: {
booked: 'Booked',
booking: 'Book the Event',
cancelbooking: 'Cancel Reservation',
event: 'Event', event: 'Event',
starttime: 'From', starttime: 'From',
endtime: 'to', endtime: 'to',
@@ -687,7 +699,7 @@ const msgglobal = {
enterdate: 'Enter date', enterdate: 'Enter date',
details: 'Details', details: 'Details',
infoextra: 'Extra Info DateTime', infoextra: 'Extra Info DateTime',
alldayevent: 'All-Day event', alldayevent: 'All-Day myevent',
eventstartdatetime: 'Event start date and time', eventstartdatetime: 'Event start date and time',
enterEndDateTime: 'Event end date and time' enterEndDateTime: 'Event end date and time'
}, },
@@ -852,6 +864,9 @@ const msgglobal = {
themebgcolor: 'Theme Color Background' themebgcolor: 'Theme Color Background'
}, },
cal: { cal: {
booked: 'Booked',
booking: 'Book the Event',
cancelbooking: 'Cancel Reservation',
event: 'Event', event: 'Event',
starttime: 'From', starttime: 'From',
endtime: 'to', endtime: 'to',
@@ -863,7 +878,7 @@ const msgglobal = {
enterdate: 'Enter date', enterdate: 'Enter date',
details: 'Details', details: 'Details',
infoextra: 'Extra Info DateTime', infoextra: 'Extra Info DateTime',
alldayevent: 'All-Day event', alldayevent: 'All-Day myevent',
eventstartdatetime: 'Event start date and time', eventstartdatetime: 'Event start date and time',
enterEndDateTime: 'Event end date and time' enterEndDateTime: 'Event end date and time'
}, },

View File

@@ -274,7 +274,7 @@ namespace Actions {
async function dbLoad(context, { checkPending, onlyiffirsttime }) { async function dbLoad(context, { checkPending, onlyiffirsttime }) {
if (!static_data.ENABLE_PROJECTS_LOADING) if (!static_data.functionality.ENABLE_PROJECTS_LOADING)
return null return null
if (onlyiffirsttime) { if (onlyiffirsttime) {
@@ -442,7 +442,6 @@ namespace Actions {
modify: b.dispatch(modify), modify: b.dispatch(modify),
ActionCutPaste: b.dispatch(ActionCutPaste) ActionCutPaste: b.dispatch(ActionCutPaste)
} }
} }
// Module // Module

View File

@@ -1,5 +1,5 @@
import Api from '@api' import Api from '@api'
import { ICalendarState } from 'model' import { ICalendarState, IEvents } from 'model'
import { ILinkReg, IResult, IIdToken, IToken } from 'model/other' import { ILinkReg, IResult, IIdToken, IToken } from 'model/other'
import { storeBuilder } from '../Store' import { storeBuilder } from '../Store'
@@ -8,9 +8,14 @@ import { tools } from '../../tools'
import translate from '../../../../globalroutines/util' import translate from '../../../../globalroutines/util'
import * as Types from '../../../Api/ApiTypes' import * as Types from '../../../Api/ApiTypes'
import { db_data } from '@src/db/db_data'
// State // State
const state: ICalendarState = { const state: ICalendarState = {
editable: false,
eventlist: [],
bookedevent: [],
// ---------------
titlebarHeight: 0, titlebarHeight: 0,
locale: 'it-IT', locale: 'it-IT',
maxDays: 1, maxDays: 1,
@@ -39,19 +44,15 @@ const stateGetter = b.state()
namespace Getters { namespace Getters {
// const lang = b.read((state) => { const findEventBooked = b.read((mystate) => (myevent: IEvents) => {
// if (state.lang !== '') { return mystate.bookedevent.find((bookedevent) => bookedevent.id_bookedevent === myevent._id)
// return state.lang }, 'findEventBooked')
// } else {
// return process.env.LANG_DEFAULT export const getters = {
// } get findEventBooked() {
// }, 'lang') return findEventBooked()
// }
// export const getters = { }
// get lang() {
// return lang()
// },
// }
} }
@@ -67,6 +68,29 @@ namespace Mutations {
} }
namespace Actions { namespace Actions {
async function loadAfterLogin(context) {
// Load local data
state.editable = db_data.userdata.calendar_editable
state.eventlist = db_data.events
state.bookedevent = db_data.userdata.bookedevent
}
async function BookEvent(context, event: IEvents) {
console.log('BookEvent', event)
state.bookedevent.push({id_bookedevent: event._id, numpeople: 1})
}
async function CancelBookingEvent(context, event: IEvents) {
console.log('CancelBookingEvent', event)
state.bookedevent = state.bookedevent.filter((eventbooked) => (eventbooked.id_bookedevent !== event._id) )
}
export const actions = {
loadAfterLogin: b.dispatch(loadAfterLogin),
BookEvent: b.dispatch(BookEvent),
CancelBookingEvent: b.dispatch(CancelBookingEvent)
}
// async function resetpwd(context, paramquery: ICalendarState) { // async function resetpwd(context, paramquery: ICalendarState) {
// } // }
@@ -80,9 +104,9 @@ namespace Actions {
const CalendarModule = { const CalendarModule = {
get state() { get state() {
return stateGetter() return stateGetter()
} },
// actions: Actions.actions, actions: Actions.actions,
// getters: Getters.getters, getters: Getters.getters
// mutations: Mutations.mutations // mutations: Mutations.mutations
} }

View File

@@ -253,7 +253,7 @@ namespace Actions {
async function dbLoad(context, { checkPending }) { async function dbLoad(context, { checkPending }) {
if (!static_data.ENABLE_PROJECTS_LOADING) if (!static_data.functionality.ENABLE_PROJECTS_LOADING)
return null return null
console.log('dbLoad', nametable, checkPending, 'userid=', UserStore.state.userId) console.log('dbLoad', nametable, checkPending, 'userid=', UserStore.state.userId)

View File

@@ -7,7 +7,7 @@ import router from '@router'
import { serv_constants } from '../Modules/serv_constants' import { serv_constants } from '../Modules/serv_constants'
import { tools } from '../Modules/tools' import { tools } from '../Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext' import { toolsext } from '@src/store/Modules/toolsext'
import { GlobalStore, UserStore, Todos, Projects } from '@store' import { GlobalStore, UserStore, Todos, Projects, BookingStore, CalendarStore } from '@store'
import globalroutines from './../../globalroutines/index' import globalroutines from './../../globalroutines/index'
import translate from './../../globalroutines/util' import translate from './../../globalroutines/util'
@@ -221,7 +221,6 @@ namespace Mutations {
setErrorCatch: b.commit(setErrorCatch), setErrorCatch: b.commit(setErrorCatch),
getMsgError: b.commit(getMsgError) getMsgError: b.commit(getMsgError)
} }
} }
namespace Actions { namespace Actions {
@@ -512,6 +511,7 @@ namespace Actions {
} }
async function setGlobal(isLogged: boolean) { async function setGlobal(isLogged: boolean) {
// console.log('setGlobal')
// state.isLogged = true // state.isLogged = true
state.isLogged = isLogged state.isLogged = isLogged
if (isLogged) { if (isLogged) {
@@ -522,6 +522,9 @@ namespace Actions {
GlobalStore.actions.checkUpdates() GlobalStore.actions.checkUpdates()
} }
const p = await BookingStore.actions.loadAfterLogin()
const p2 = await CalendarStore.actions.loadAfterLogin()
return await GlobalStore.actions.loadAfterLogin() return await GlobalStore.actions.loadAfterLogin()
.then(() => { .then(() => {
return Todos.actions.dbLoad({ checkPending: true }) return Todos.actions.dbLoad({ checkPending: true })

View File

@@ -1,5 +1,6 @@
export {storeBuilder} from './Store/Store' export {storeBuilder} from './Store/Store'
export {default as GlobalStore} from './GlobalStore' export {default as GlobalStore} from './GlobalStore'
export {default as BookingStore} from './BookingStore'
export {default as UserStore} from './UserStore' export {default as UserStore} from './UserStore'
export {default as Todos} from './Todos' export {default as Todos} from './Todos'
export {default as Projects} from './Projects' export {default as Projects} from './Projects'