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 {
@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: '' }) public style1: string
}

View File

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

View File

@@ -10,7 +10,7 @@
<!--</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()">
</FormNewsletter>
@@ -52,7 +52,7 @@
</div>
<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>
</div>

View File

@@ -41,7 +41,7 @@
</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')"/>

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
// if this.leftDrawerOpen is true, drawer is displayed
// (2) Listen for an event in created
// (2) Listen for an myevent in created
/* created(){
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.
methods: {
openLeftDrawer() {
@@ -160,7 +160,7 @@ export default class Header extends Vue {
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) {
tools.showNotif(this.$q, this.$t('connection') + ` ${value}`, {

View File

@@ -58,7 +58,7 @@
-->
<q-btn
v-if="!isonline && static_data.SHOW_IF_IS_SERVER_CONNECTION"
v-if="!isonline && static_data.functionality.SHOW_IF_IS_SERVER_CONNECTION"
flat
dense
round
@@ -102,7 +102,7 @@
<label>{{ $t('msg.hello') }}</label> <span v-model="prova"></span> !
</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-toolbar>
@@ -121,7 +121,7 @@
</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">
<q-img class="absolute-top" src="../../statics/images/landing_first_section.png"
style="height: 150px">

View File

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

View File

@@ -166,6 +166,7 @@ export interface IColl {
date: string
subtitle?: IAllLang
img: string
img2?: string
linkagg?: string
linkagg_type?: number
width?: number
@@ -176,3 +177,13 @@ export interface ICollaborations {
withwhom_title: IAllLang
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 './GlobalStore'
export * from './signin-option'
@@ -11,3 +13,4 @@ export * from './Projects'
export * from './Calendar'
export * from './Estimate'
export * from './BookingStore'

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
import Api from '@api'
import { ICalendarState } from 'model'
import { ICalendarState, IEvents } from 'model'
import { ILinkReg, IResult, IIdToken, IToken } from 'model/other'
import { storeBuilder } from '../Store'
@@ -8,9 +8,14 @@ import { tools } from '../../tools'
import translate from '../../../../globalroutines/util'
import * as Types from '../../../Api/ApiTypes'
import { db_data } from '@src/db/db_data'
// State
const state: ICalendarState = {
editable: false,
eventlist: [],
bookedevent: [],
// ---------------
titlebarHeight: 0,
locale: 'it-IT',
maxDays: 1,
@@ -39,19 +44,15 @@ const stateGetter = b.state()
namespace Getters {
// const lang = b.read((state) => {
// if (state.lang !== '') {
// return state.lang
// } else {
// return process.env.LANG_DEFAULT
// }
// }, 'lang')
//
// export const getters = {
// get lang() {
// return lang()
// },
// }
const findEventBooked = b.read((mystate) => (myevent: IEvents) => {
return mystate.bookedevent.find((bookedevent) => bookedevent.id_bookedevent === myevent._id)
}, 'findEventBooked')
export const getters = {
get findEventBooked() {
return findEventBooked()
}
}
}
@@ -67,6 +68,29 @@ namespace Mutations {
}
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) {
// }
@@ -80,9 +104,9 @@ namespace Actions {
const CalendarModule = {
get state() {
return stateGetter()
}
// actions: Actions.actions,
// getters: Getters.getters,
},
actions: Actions.actions,
getters: Getters.getters
// mutations: Mutations.mutations
}

View File

@@ -253,7 +253,7 @@ namespace Actions {
async function dbLoad(context, { checkPending }) {
if (!static_data.ENABLE_PROJECTS_LOADING)
if (!static_data.functionality.ENABLE_PROJECTS_LOADING)
return null
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 { tools } from '../Modules/tools'
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 translate from './../../globalroutines/util'
@@ -221,7 +221,6 @@ namespace Mutations {
setErrorCatch: b.commit(setErrorCatch),
getMsgError: b.commit(getMsgError)
}
}
namespace Actions {
@@ -512,6 +511,7 @@ namespace Actions {
}
async function setGlobal(isLogged: boolean) {
// console.log('setGlobal')
// state.isLogged = true
state.isLogged = isLogged
if (isLogged) {
@@ -522,6 +522,9 @@ namespace Actions {
GlobalStore.actions.checkUpdates()
}
const p = await BookingStore.actions.loadAfterLogin()
const p2 = await CalendarStore.actions.loadAfterLogin()
return await GlobalStore.actions.loadAfterLogin()
.then(() => {
return Todos.actions.dbLoad({ checkPending: true })

View File

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