- Load Events

- Edit Events
- When a field is updated: undate also memory list record

- Duplicate Event
This commit is contained in:
Paolo Arena
2019-10-20 22:44:18 +02:00
parent b8ec241b37
commit 9656b14cd0
11 changed files with 348 additions and 75 deletions

View File

@@ -349,7 +349,7 @@ export default class CEventsCalendar extends Vue {
} }
public getEndTime(eventparam) { public getEndTime(eventparam) {
let endTime = new Date(eventparam.date + ' ' + eventparam.time + ':00') let endTime = new Date(eventparam.date)
endTime = date.addToDate(endTime, { minutes: eventparam.dur }) endTime = date.addToDate(endTime, { minutes: eventparam.dur })
endTime = date.formatDate(endTime, 'HH:mm') endTime = date.formatDate(endTime, 'HH:mm')
return endTime return endTime
@@ -421,8 +421,8 @@ export default class CEventsCalendar extends Vue {
this.resetForm() this.resetForm()
this.contextDay = { ...eventparam } this.contextDay = { ...eventparam }
let timestamp let timestamp
if (eventparam.time) { if (eventparam.withtime) {
timestamp = eventparam.date + ' ' + eventparam.time timestamp = eventparam.date
const startTime = new Date(timestamp) const startTime = new Date(timestamp)
const endTime = date.addToDate(startTime, { minutes: eventparam.dur }) const endTime = date.addToDate(startTime, { minutes: eventparam.dur })
this.eventForm.dateTimeStart = this.formatDate(startTime) + ' ' + this.formatTime(startTime) // endTime.toString() this.eventForm.dateTimeStart = this.formatDate(startTime) + ' ' + this.formatTime(startTime) // endTime.toString()
@@ -431,7 +431,7 @@ export default class CEventsCalendar extends Vue {
timestamp = eventparam.date timestamp = eventparam.date
this.eventForm.dateTimeStart = timestamp this.eventForm.dateTimeStart = timestamp
} }
this.eventForm.allDay = !eventparam.time this.eventForm.allDay = !eventparam.withtime
this.eventForm.bgcolor = eventparam.bgcolor this.eventForm.bgcolor = eventparam.bgcolor
this.eventForm.icon = eventparam.icon this.eventForm.icon = eventparam.icon
this.eventForm.title = eventparam.title this.eventForm.title = eventparam.title
@@ -515,7 +515,7 @@ export default class CEventsCalendar extends Vue {
// an add // an add
} }
const data: IEvents = { const data: IEvents = {
time: '', withtime: false,
dur: 0, dur: 0,
dur2: 0, dur2: 0,
title: form.title, title: form.title,
@@ -526,7 +526,7 @@ export default class CEventsCalendar extends Vue {
} }
if (form.allDay === false) { if (form.allDay === false) {
// get time into separate var // get time into separate var
data.time = String(form.dateTimeStart).slice(11, 16) // data.time = String(form.dateTimeStart).slice(11, 16)
data.dur = self.getDuration(form.dateTimeStart, form.dateTimeEnd, 'minutes') data.dur = self.getDuration(form.dateTimeStart, form.dateTimeEnd, 'minutes')
} }
if (update === true) { if (update === true) {
@@ -685,7 +685,8 @@ export default class CEventsCalendar extends Vue {
return this.draggedEvent.date !== day.date return this.draggedEvent.date !== day.date
} else if (type === 'interval') { } else if (type === 'interval') {
stopAndPrevent(ev) stopAndPrevent(ev)
return this.draggedEvent.date !== day.date && this.draggedEvent.time !== day.time // return this.draggedEvent.date !== day.date && this.draggedEvent.time !== day.time
return this.draggedEvent.date !== day.date
} }
} }
@@ -697,7 +698,7 @@ export default class CEventsCalendar extends Vue {
this.draggedEvent.side = void 0 this.draggedEvent.side = void 0
} else if (type === 'interval') { } else if (type === 'interval') {
this.draggedEvent.date = day.date this.draggedEvent.date = day.date
this.draggedEvent.time = day.time // this.draggedEvent.time = day.time
this.draggedEvent.side = void 0 this.draggedEvent.side = void 0
} }
} }
@@ -724,6 +725,16 @@ export default class CEventsCalendar extends Vue {
return this.dateFormatter.format(mydate) return this.dateFormatter.format(mydate)
} }
public getTeacherName(teacherusername) {
const op = CalendarStore.state.operators.find((myop) => myop.username === teacherusername)
return (op) ? `${op.name} ${op.surname}` : ''
}
public getTeacherImg(teacherusername) {
const op = CalendarStore.state.operators.find((myop) => myop.username === teacherusername)
return (op) ? op.img : 'avatar/noimage.png'
}
public badgeClasses(eventparam, type) { public badgeClasses(eventparam, type) {
const cssColor = tools.isCssColor(eventparam.bgcolor) const cssColor = tools.isCssColor(eventparam.bgcolor)
const isHeader = type === 'header' const isHeader = type === 'header'
@@ -743,7 +754,7 @@ export default class CEventsCalendar extends Vue {
s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white' s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white'
} }
if (timeStartPos) { if (timeStartPos) {
s.top = timeStartPos(eventparam.time) + 'px' s.top = timeStartPos(tools.getstrTime(eventparam.date)) + 'px'
} }
if (timeDurationHeight) { if (timeDurationHeight) {
s.height = timeDurationHeight(eventparam.dur) + 'px' s.height = timeDurationHeight(eventparam.dur) + 'px'
@@ -786,7 +797,8 @@ export default class CEventsCalendar extends Vue {
for (let i = 0; i < CalendarStore.state.eventlist.length; ++i) { for (let i = 0; i < CalendarStore.state.eventlist.length; ++i) {
// console.log(' ciclo i = ', i, CalendarStore.state.eventlist[i]) // console.log(' ciclo i = ', i, CalendarStore.state.eventlist[i])
const dateEvent = new Date(CalendarStore.state.eventlist[i].date + ' 00:00:00') // const dateEvent = new Date(CalendarStore.state.eventlist[i].date + ' 00:00:00')
const dateEvent = new Date(CalendarStore.state.eventlist[i].date)
if (dateEvent >= datenow) { if (dateEvent >= datenow) {
eventsloc.push(CalendarStore.state.eventlist[i]) eventsloc.push(CalendarStore.state.eventlist[i])
@@ -802,14 +814,15 @@ export default class CEventsCalendar extends Vue {
for (let i = 0; i < CalendarStore.state.eventlist.length; ++i) { for (let i = 0; i < CalendarStore.state.eventlist.length; ++i) {
let added = false let added = false
// console.log(' ciclo i = ', i, CalendarStore.state.eventlist[i]) // console.log(' ciclo i = ', i, CalendarStore.state.eventlist[i])
if (CalendarStore.state.eventlist[i].date === dt) { if (tools.getstrYYMMDDDate(CalendarStore.state.eventlist[i].date) === dt) {
if (CalendarStore.state.eventlist[i].time) { // if (CalendarStore.state.eventlist[i].time) {
if (eventsloc.length > 0) { if (eventsloc.length > 0) {
// check for overlapping times // check for overlapping times
const startTime = new Date(CalendarStore.state.eventlist[i].date + ' ' + CalendarStore.state.eventlist[i].time) // const startTime = new Date(CalendarStore.state.eventlist[i].date + ' ' + CalendarStore.state.eventlist[i].time)
const startTime = new Date(CalendarStore.state.eventlist[i].date)
const endTime = date.addToDate(startTime, { minutes: CalendarStore.state.eventlist[i].dur }) const endTime = date.addToDate(startTime, { minutes: CalendarStore.state.eventlist[i].dur })
for (let j = 0; j < eventsloc.length; ++j) { for (let j = 0; j < eventsloc.length; ++j) {
const startTime2 = new Date(eventsloc[j].date + ' ' + eventsloc[j].time) const startTime2 = new Date(eventsloc[j].date)
const endTime2 = date.addToDate(startTime2, { minutes: eventsloc[j].dur2 }) const endTime2 = date.addToDate(startTime2, { minutes: eventsloc[j].dur2 })
if (date.isBetweenDates(startTime, startTime2, endTime2) || date.isBetweenDates(endTime, startTime2, endTime2)) { if (date.isBetweenDates(startTime, startTime2, endTime2) || date.isBetweenDates(endTime, startTime2, endTime2)) {
eventsloc[j].side = 'left' eventsloc[j].side = 'left'
@@ -820,14 +833,15 @@ export default class CEventsCalendar extends Vue {
} }
} }
} }
} // }
if (!added) { if (!added) {
// CalendarStore.state.eventlist[i].side = void 0 // CalendarStore.state.eventlist[i].side = void 0
eventsloc.push(CalendarStore.state.eventlist[i]) eventsloc.push(CalendarStore.state.eventlist[i])
} }
} else if (CalendarStore.state.eventlist[i].days) { } else if (CalendarStore.state.eventlist[i].days) {
// check for overlapping dates // check for overlapping dates
const startDate = new Date(CalendarStore.state.eventlist[i].date + ' 00:00:00') // const startDate = new Date(CalendarStore.state.eventlist[i].date + ' 00:00:00')
const startDate = new Date(CalendarStore.state.eventlist[i].date)
const endDate = date.addToDate(startDate, { days: CalendarStore.state.eventlist[i].days }) const endDate = date.addToDate(startDate, { days: CalendarStore.state.eventlist[i].days })
if (date.isBetweenDates(dt, startDate, endDate)) { if (date.isBetweenDates(dt, startDate, endDate)) {
eventsloc.push(CalendarStore.state.eventlist[i]) eventsloc.push(CalendarStore.state.eventlist[i])
@@ -866,7 +880,8 @@ export default class CEventsCalendar extends Vue {
// check if event is in the past // check if event is in the past
const datenow = tools.addDays(tools.getDateNow(), -1) const datenow = tools.addDays(tools.getDateNow(), -1)
let dateEvent = new Date(myevent.date + ' 00:00:00') // let dateEvent = new Date(myevent.date + ' 00:00:00')
let dateEvent = new Date(myevent.date)
if (myevent.days) { if (myevent.days) {
dateEvent = tools.addDays(dateEvent, myevent.days) dateEvent = tools.addDays(dateEvent, myevent.days)

View File

@@ -32,16 +32,16 @@
<span class="cal__teacher-content"> <span class="cal__teacher-content">
<q-chip> <q-chip>
<q-avatar> <q-avatar>
<img :src="`../../statics/images/avatar/` + myevent.avatar"> <img :src="`../../statics/images/` + getTeacherImg(myevent.teacher)">
</q-avatar> </q-avatar>
<span class="cal__teacher-content">{{myevent.teacher}}</span> <span class="cal__teacher-content">{{getTeacherName(myevent.teacher)}}</span>
</q-chip> </q-chip>
<span v-if="myevent.avatar2 && myevent.teacher2" class="margin_avatar2"></span> <span v-if="getTeacherImg(myevent.teacher2) && myevent.teacher2" class="margin_avatar2"></span>
<q-chip v-if="myevent.avatar2 && myevent.teacher2"> <q-chip v-if="getTeacherImg(myevent.teacher2) && myevent.teacher2">
<q-avatar> <q-avatar>
<img :src="`../../statics/images/avatar/` + myevent.avatar2"> <img :src="`../../statics/images/` + getTeacherImg(myevent.teacher2)">
</q-avatar> </q-avatar>
<span class="cal__teacher-content">{{myevent.teacher2}}</span> <span class="cal__teacher-content">{{getTeacherName(myevent.teacher2)}}</span>
</q-chip> </q-chip>
</span> </span>
</div> </div>
@@ -68,10 +68,10 @@
<span class="cal__hours-content">{{ myevent.infoextra }} </span> <span class="cal__hours-content">{{ myevent.infoextra }} </span>
</span> </span>
<span v-else> <span v-else>
<span v-if="myevent.time" class="cal__hours"> <span v-if="myevent.withtime" class="cal__hours">
- -
<span class="cal__hours-title">{{$t('cal.hours')}}: </span> <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">{{$t('cal.starttime')}} {{ tools.getstrTime(myevent.date) }} {{$t('cal.endtime')}}: {{
getEndTime(myevent) }}</span> getEndTime(myevent) }}</span>
</span> </span>
</span> </span>
@@ -242,10 +242,10 @@
<span class="cal__hours-content">{{ myevent.infoextra }} </span> <span class="cal__hours-content">{{ myevent.infoextra }} </span>
</span> </span>
<span v-else> <span v-else>
<span v-if="myevent.time" class="cal__hours"> <span v-if="myevent.withtime" class="cal__hours">
- -
<span class="cal__hours-title">{{$t('cal.hours')}}: </span> <span class="cal__hours-title">{{$t('cal.hours')}}: </span>
<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> {{ <span class="cal__hours-content"><span v-if="!tools.isMobile()">{{$t('cal.starttime')}} </span>{{ tools.getstrTime(myevent.date) }} <span v-if="!tools.isMobile()">{{$t('cal.endtime')}} </span><span v-else> - </span> {{
getEndTime(myevent) }}</span> getEndTime(myevent) }}</span>
</span> </span>
</span> </span>
@@ -386,7 +386,7 @@
<div class="row justify-center"> <div class="row justify-center">
<template v-for="(event, index) in eventsMap[date]"> <template v-for="(event, index) in eventsMap[date]">
<q-badge <q-badge
v-if="!event.time" v-if="!event.withtime"
:key="index" :key="index"
style="width: 100%; cursor: pointer;" style="width: 100%; cursor: pointer;"
class="ellipsis" class="ellipsis"
@@ -416,7 +416,7 @@
<template #day-body="{ date, timeStartPos, timeDurationHeight }"> <template #day-body="{ date, timeStartPos, timeDurationHeight }">
<template v-for="(event, index) in getEvents(date)"> <template v-for="(event, index) in getEvents(date)">
<q-badge <q-badge
v-if="event.time" v-if="event.withtime"
:key="index" :key="index"
class="my-event justify-center ellipsis" class="my-event justify-center ellipsis"
:class="badgeClasses(event, 'body')" :class="badgeClasses(event, 'body')"
@@ -463,7 +463,7 @@
<div v-else> <div v-else>
<div v-if="event.date" class="listaev__date"> <div v-if="event.date" class="listaev__date">
{{func_tools.getDateStr(event.date)}} {{func_tools.getDateStr(event.date)}}
<span v-if="event.time" class="cal__hours-content"> - {{ event.time }} <span <span v-if="event.withtime" class="cal__hours-content"> - {{ tools.getstrTime(event.date) }} <span
v-if="event.dur">- {{ getEndTime(event) }}</span></span> v-if="event.dur">- {{ getEndTime(event) }}</span></span>
<span v-if="event.days > 1"><br/>{{func_tools.getDateStr(tools.addDays(event.date, event.days - 1))}}</span> <span v-if="event.days > 1"><br/>{{func_tools.getDateStr(tools.addDays(event.date, event.days - 1))}}</span>
</div> </div>
@@ -506,16 +506,16 @@
<q-chip> <q-chip>
<q-avatar> <q-avatar>
<img :src="`../../statics/images/avatar/` + event.avatar"> <img :src="`../../statics/images/` + getTeacherImg(event.teacher)">
</q-avatar> </q-avatar>
<span class="cal__teacher-content">{{event.teacher}}</span> <span class="cal__teacher-content">{{getTeacherName(event.teacher)}}</span>
</q-chip> </q-chip>
<span v-if="event.avatar2" class="margin_avatar2"></span> <span v-if="getTeacherImg(event.teacher2)" class="margin_avatar2"></span>
<q-chip v-if="event.avatar2 && event.teacher2"> <q-chip v-if="getTeacherImg(event.teacher2) && event.teacher2">
<q-avatar> <q-avatar>
<img :src="`../../statics/images/avatar/` + event.avatar2"> <img :src="`../../statics/images/` + getTeacherImg(event.teacher2)">
</q-avatar> </q-avatar>
<span class="cal__teacher-content">{{event.teacher2}}</span> <span class="cal__teacher-content">{{getTeacherName(event.teacher2)}}</span>
</q-chip> </q-chip>
<span v-if="event.where" class=""> <span v-if="event.where" class="">

View File

@@ -125,10 +125,10 @@ export default class CGridTableRec extends Vue {
this.colVisib = [] this.colVisib = []
this.colExtra = [] this.colExtra = []
this.mycolumns.forEach((elem) => { this.mycolumns.forEach((elem) => {
if (elem.field !== '') if (elem.field !== tools.NOFIELD)
this.colVisib.push(elem.field) this.colVisib.push(elem.field)
if (elem.visible && elem.field === '') if (elem.visible && elem.field === tools.NOFIELD)
this.colExtra.push(elem.name) this.colExtra.push(elem.name)
}) })
@@ -298,9 +298,9 @@ export default class CGridTableRec extends Vue {
// Save on Server // Save on Server
GlobalStore.actions.saveFieldValue(mydata).then((esito) => { GlobalStore.actions.saveFieldValue(mydata).then((esito) => {
if (esito) if (esito) {
tools.showPositiveNotif(this.$q, this.$t('db.recupdated')) tools.showPositiveNotif(this.$q, this.$t('db.recupdated'))
else { } else {
tools.showNegativeNotif(this.$q, this.$t('db.recfailed')) tools.showNegativeNotif(this.$q, this.$t('db.recfailed'))
this.undoVal() this.undoVal()
} }
@@ -325,10 +325,13 @@ export default class CGridTableRec extends Vue {
} }
} }
public ActionAfterYes(action, item) { public ActionAfterYes(action, item, data) {
if (action === lists.MenuAction.DELETE_RECTABLE) { if (action === lists.MenuAction.DELETE_RECTABLE) {
if (this.serverData.length > 0) if (this.serverData.length > 0)
this.serverData.splice(this.serverData.indexOf(item), 1) this.serverData.splice(this.serverData.indexOf(item), 1)
} else if (action === lists.MenuAction.DUPLICATE_RECTABLE) {
// Add record duplicated
this.serverData.push(data)
} }
} }
@@ -345,7 +348,7 @@ export default class CGridTableRec extends Vue {
} }
public visuValByType(col, val) { public visuValByType(col, val) {
if (col.isdate) { if (col.fieldtype === 'date') {
if (val === undefined) { if (val === undefined) {
return '[]' return '[]'
} else { } else {
@@ -369,7 +372,7 @@ export default class CGridTableRec extends Vue {
let mytab = null let mytab = null
if (this.tablesList) { if (this.tablesList) {
if (!this.tablesel) { if (!this.tablesel) {
this.tablesel = this.tablesList[0].value this.tablesel = this.tablesList[1].value
} }
mytab = this.tablesList.find((rec) => rec.value === this.tablesel) mytab = this.tablesList.find((rec) => rec.value === this.tablesel)

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="q-pa-sm"> <div class="q-pa-sm">
<q-table <q-table
:data="serverData" :data="serverData"
:columns="mycolumns" :columns="mycolumns"
@@ -83,8 +84,8 @@
<q-tr v-if="mytable" slot="body" slot-scope="props" :props="props"> <q-tr v-if="mytable" slot="body" slot-scope="props" :props="props">
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field)"> <q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field)">
<div v-if="col.isdate"> <div v-if="col.fieldtype === 'date'">
<div style="max-width: 250px"> <div style="max-width: 250px; min-width: 200px">
<q-input dense v-model="props.row[col.name]"> <q-input dense v-model="props.row[col.name]">
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="event" class="cursor-pointer"> <q-icon name="event" class="cursor-pointer">
@@ -117,6 +118,9 @@
</q-input> </q-input>
</div> </div>
</div> </div>
<div v-if="col.fieldtype === 'boolean'">
<q-checkbox v-model="props.row[col.name])" label="" />
</div>
<div v-else> <div v-else>
<div :class="getclassCol(col)"> <div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }} {{ visuValByType(col, props.row[col.name]) }}

View File

@@ -5,7 +5,7 @@ export interface IEvents {
short_tit?: string short_tit?: string
title?: string title?: string
details?: string details?: string
time?: string withtime?: boolean
dur?: number dur?: number
dur2?: number dur2?: number
date?: string date?: string
@@ -18,8 +18,6 @@ export interface IEvents {
contribtype?: number contribtype?: number
teacher?: string // teacherid teacher?: string // teacherid
teacher2?: string // teacherid2 teacher2?: string // teacherid2
avatar?: string
avatar2?: string
infoextra?: string infoextra?: string
linkpage?: string linkpage?: string
linkpdf?: string linkpdf?: string
@@ -42,6 +40,21 @@ export interface IBookedEvent {
booked: boolean booked: boolean
} }
export interface IOperators {
username: string
name: string
surname: string
email: string
cell: string
webpage?: string
img: string
skype?: string
days_working?: string
facebook?: string
disciplines?: string
offers?: string
}
export enum EState { export enum EState {
None, Creating, Modifying None, Creating, Modifying
} }
@@ -56,6 +69,7 @@ export interface ICalendarState {
editable: boolean editable: boolean
eventlist: IEvents[] eventlist: IEvents[]
bookedevent: IBookedEvent[] bookedevent: IBookedEvent[]
operators: IOperators[]
// --------------- // ---------------
titlebarHeight: number titlebarHeight: number
locale: string, locale: string,

View File

@@ -227,7 +227,7 @@ export interface IColGridTable {
icon?: string icon?: string
action?: any action?: any
foredit?: boolean foredit?: boolean
isdate?: boolean fieldtype?: string
visuonlyEditVal?: boolean visuonlyEditVal?: boolean
} }
@@ -237,3 +237,9 @@ export interface ITableRec {
columns: IColGridTable[] columns: IColGridTable[]
colkey: string colkey: string
} }
export interface IDataPass {
id: string
table: string
fieldsvalue: object
}

View File

@@ -32,7 +32,7 @@ const msgglobal = {
update: 'Aggiorna', update: 'Aggiorna',
today: 'Oggi', today: 'Oggi',
book: 'Prenota', book: 'Prenota',
sendmsg: 'Invia Msg', sendmsg: 'Invia solo un Msg',
msg: { msg: {
titledeleteTask: 'Elimina Task', titledeleteTask: 'Elimina Task',
deleteTask: "Vuoi Eliminare {mytodo}?" deleteTask: "Vuoi Eliminare {mytodo}?"
@@ -48,6 +48,8 @@ const msgglobal = {
deletetherecord: 'Eliminare il Record?', deletetherecord: 'Eliminare il Record?',
deletedrecord: 'Record Cancellato', deletedrecord: 'Record Cancellato',
recdelfailed: 'Errore durante la cancellazione del Record', recdelfailed: 'Errore durante la cancellazione del Record',
duplicatedrecord: 'Record Duplicato',
recdupfailed: 'Errore durante la duplicazione del Record',
}, },
components: { components: {
authentication: { authentication: {
@@ -221,6 +223,34 @@ const msgglobal = {
teachertitle: 'Insegnante', teachertitle: 'Insegnante',
peoplebooked: 'Prenotaz.', peoplebooked: 'Prenotaz.',
}, },
event: {
_id: 'id',
typol: 'Typology',
short_tit: 'Titolo Breve',
title: 'Titolo',
details: 'Dettagli',
withtime: 'Con Tempo',
dur: 'durata (min)',
dur2: 'durata2 (min)',
date: 'Data',
bgcolor: 'Colore Sfondo',
days: 'Giorni',
icon: 'Icona',
img: 'Nomefile Immagine',
where: 'Dove',
contribtype: 'Tipo Contributo',
teacher: 'Insegnante', // teacherid
teacher2: 'Insegnante2', // teacherid2
infoextra: 'InfoExtra',
linkpage: 'WebSite',
linkpdf: 'Link ad un PDF',
nobookable: 'No Prenotabile',
news: 'Novità',
dupId: 'Id Duplicato',
canceled: 'Cancellato',
deleted: 'Eliminato',
duplicate: 'Duplica'
},
newsletter: { newsletter: {
title: 'Desideri ricevere la nostra Newsletter?', title: 'Desideri ricevere la nostra Newsletter?',
name: 'Il tuo Nome', name: 'Il tuo Nome',
@@ -233,7 +263,7 @@ const msgglobal = {
typesomething: 'Compilare correttamente il campo', typesomething: 'Compilare correttamente il campo',
acceptlicense: 'Accetto la licenza e i termini', acceptlicense: 'Accetto la licenza e i termini',
license: 'Devi prima accettare la licenza e i termini', license: 'Devi prima accettare la licenza e i termini',
submitted: 'Iscritto' submitted: 'Iscritto',
}, },
privacy_policy:'Privacy Policy', privacy_policy:'Privacy Policy',
cookies: 'Usiamo i Cookie per una migliore prestazione web.' cookies: 'Usiamo i Cookie per una migliore prestazione web.'
@@ -269,7 +299,7 @@ const msgglobal = {
update: 'Actualiza', update: 'Actualiza',
today: 'Hoy', today: 'Hoy',
book: 'Reserva', book: 'Reserva',
sendmsg: 'Envia Mensaje', sendmsg: 'Envia solo Mensaje',
msg: { msg: {
titledeleteTask: 'Borrar Tarea', titledeleteTask: 'Borrar Tarea',
deleteTask: 'Quieres borrar {mytodo}?' deleteTask: 'Quieres borrar {mytodo}?'
@@ -285,6 +315,8 @@ const msgglobal = {
deletetherecord: '¿Eliminar el registro?', deletetherecord: '¿Eliminar el registro?',
deletedrecord: 'Registro cancelado', deletedrecord: 'Registro cancelado',
recdelfailed: 'Error durante la eliminación del registro', recdelfailed: 'Error durante la eliminación del registro',
duplicatedrecord: 'Registro Duplicado',
recdupfailed: 'Error durante la duplicación de registros',
}, },
components: { components: {
authentication: { authentication: {
@@ -452,6 +484,34 @@ const msgglobal = {
teachertitle: 'Maestro', teachertitle: 'Maestro',
peoplebooked: 'Reserv.', peoplebooked: 'Reserv.',
}, },
event: {
_id: 'id',
typol: 'Typology',
short_tit: 'Título Corto',
title: 'Título',
details: 'Detalles',
withtime: 'Con Tiempo',
dur: 'duración (min)',
dur2: 'duración2 (min)',
date: 'Fecha',
bgcolor: 'Color de fondo',
days: 'Días',
icon: 'Icono',
img: 'Nombre Imagen',
where: 'Dónde',
contribtype: 'Tipo de Contribución',
teacher: 'Profesor', // teacherid
teacher2: 'Profesor2', // teacherid2
infoextra: 'InfoExtra',
linkpage: 'Sitio WEb',
linkpdf: 'Enlace ad un PDF',
nobookable: 'No Reservable',
news: 'Novedad',
dupId: 'Id Duplicado',
canceled: 'Cancelado',
deleted: 'Eliminado',
duplicate: 'Duplica',
},
newsletter: { newsletter: {
title: '¿Desea recibir nuestro boletín informativo?', title: '¿Desea recibir nuestro boletín informativo?',
name: 'Tu Nombre', name: 'Tu Nombre',
@@ -500,7 +560,7 @@ const msgglobal = {
cancel: 'annuler', cancel: 'annuler',
today: 'Aujourd\'hui', today: 'Aujourd\'hui',
book: 'Réserve', book: 'Réserve',
sendmsg: 'Envoyer Msg', sendmsg: 'envoyer seul un msg',
msg: { msg: {
titledeleteTask: 'Supprimer la tâche', titledeleteTask: 'Supprimer la tâche',
deleteTask: 'Voulez-vous supprimer {mytodo}?' deleteTask: 'Voulez-vous supprimer {mytodo}?'
@@ -516,6 +576,8 @@ const msgglobal = {
deletetherecord: 'Supprimer l\'enregistrement?', deletetherecord: 'Supprimer l\'enregistrement?',
deletedrecord: 'Enregistrement annulé', deletedrecord: 'Enregistrement annulé',
recdelfailed: 'Erreur lors de la suppression de l\'enregistrement', recdelfailed: 'Erreur lors de la suppression de l\'enregistrement',
duplicatedrecord: 'Enregistrement en double',
recdupfailed: 'Erreur lors de la duplication des enregistrements',
}, },
components: { components: {
authentication: { authentication: {
@@ -682,6 +744,34 @@ const msgglobal = {
teachertitle: 'Professeur', teachertitle: 'Professeur',
peoplebooked: 'Réserv.', peoplebooked: 'Réserv.',
}, },
event: {
_id: 'id',
typol: 'Typologie',
short_tit: 'Titre abrégé\'',
title: 'Titre',
details: 'Détails',
withtime: 'avec le temps',
dur: 'durée (min)',
dur2: 'durée2 (min)',
date: 'Date',
bgcolor: 'Couleur de fond',
days: 'Journées',
icon: 'Icône',
img: 'Image du nom de fichier',
where: 'Où',
contribtype: 'Type de contribution',
teacher: 'Enseignant', // teacherid
teacher2: 'Enseignant2', // teacherid2
infoextra: 'Extra Info',
linkpage: 'Site Web',
linkpdf: 'Lien vers un PDF',
nobookable: 'non réservable',
news: 'Nouvelles',
dupId: 'Id Double',
canceled: 'Annulé',
deleted: 'Supprimé',
duplicate: 'Duplique'
},
newsletter: { newsletter: {
title: 'Souhaitez-vous recevoir notre newsletter?', title: 'Souhaitez-vous recevoir notre newsletter?',
name: 'Ton nom', name: 'Ton nom',
@@ -730,7 +820,7 @@ const msgglobal = {
cancel: 'Cancel', cancel: 'Cancel',
today: 'Today', today: 'Today',
book: 'Book', book: 'Book',
sendmsg: 'Send Msg', sendmsg: 'Send only a Msg',
msg: { msg: {
titledeleteTask: 'Delete Task', titledeleteTask: 'Delete Task',
deleteTask: 'Delete Task {mytodo}?' deleteTask: 'Delete Task {mytodo}?'
@@ -746,6 +836,8 @@ const msgglobal = {
deletetherecord: 'Delete the Record?', deletetherecord: 'Delete the Record?',
deletedrecord: 'Record Deleted', deletedrecord: 'Record Deleted',
recdelfailed: 'Error during deletion of the Record', recdelfailed: 'Error during deletion of the Record',
duplicatedrecord: 'Duplicate Record',
recdupfailed: 'Error during record duplication',
}, },
components: { components: {
authentication: { authentication: {
@@ -911,6 +1003,34 @@ const msgglobal = {
teachertitle: 'Teacher', teachertitle: 'Teacher',
peoplebooked: 'Booked', peoplebooked: 'Booked',
}, },
event: {
_id: 'id',
typol: 'Typology',
short_tit: 'Short Title',
title: 'Title',
details: 'Details',
withtime: 'With Time',
dur: 'Duration (min)',
dur2: 'Duration2 (min)',
date: 'Date',
bgcolor: 'Background color',
days: 'Days',
icon: 'Icon',
img: 'Nomefile Img',
where: 'Qhere',
contribtype: 'Contribute Type',
teacher: 'Teacher', // teacherid
teacher2: 'Teacher2', // teacherid2
infoextra: 'Extra Info',
linkpage: 'WebSite',
linkpdf: 'PDF Link',
nobookable: 'No Bookable',
news: 'News',
dupId: 'Id Duplicate',
canceled: 'Canceled',
deleted: 'Deleted',
duplicate: 'Duplicate'
},
newsletter: { newsletter: {
title: 'Would you like to receive our Newsletter?', title: 'Would you like to receive our Newsletter?',
name: 'Your name', name: 'Your name',
@@ -959,7 +1079,7 @@ const msgglobal = {
cancel: 'Cancel', cancel: 'Cancel',
today: 'Today', today: 'Today',
book: 'Book', book: 'Book',
sendmsg: 'Send Msg', sendmsg: 'Send only a Msg',
msg: { msg: {
titledeleteTask: 'Delete Task', titledeleteTask: 'Delete Task',
deleteTask: 'Delete Task {mytodo}?' deleteTask: 'Delete Task {mytodo}?'
@@ -975,6 +1095,8 @@ const msgglobal = {
deletetherecord: 'Delete the Record?', deletetherecord: 'Delete the Record?',
deletedrecord: 'Record Deleted', deletedrecord: 'Record Deleted',
recdelfailed: 'Error during deletion of the Record', recdelfailed: 'Error during deletion of the Record',
duplicatedrecord: 'Duplicate Record',
recdupfailed: 'Error during record duplication',
}, },
components: { components: {
authentication: { authentication: {
@@ -1142,6 +1264,34 @@ const msgglobal = {
teachertitle: 'Teacher', teachertitle: 'Teacher',
peoplebooked: 'Booked', peoplebooked: 'Booked',
}, },
event: {
_id: 'id',
typol: 'Typology',
short_tit: 'Short Title',
title: 'Title',
details: 'Details',
withtime: 'With Time',
dur: 'Duration (min)',
dur2: 'Duration2 (min)',
date: 'Date',
bgcolor: 'Background color',
days: 'Days',
icon: 'Icon',
img: 'Nomefile Img',
where: 'Qhere',
contribtype: 'Contribute Type',
teacher: 'Teacher', // teacherid
teacher2: 'Teacher2', // teacherid2
infoextra: 'Extra Info',
linkpage: 'WebSite',
linkpdf: 'PDF Link',
nobookable: 'No Bookable',
news: 'News',
dupId: 'Id Duplicate',
canceled: 'Canceled',
deleted: 'Deleted',
duplicate: 'Duplicate'
},
newsletter: { newsletter: {
title: 'Would you like to receive our Newsletter?', title: 'Would you like to receive our Newsletter?',
name: 'Your name', name: 'Your name',

View File

@@ -13,15 +13,16 @@ import { costanti } from '@src/store/Modules/costanti'
import { tools } from '@src/store/Modules/tools' import { tools } from '@src/store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext' import { toolsext } from '@src/store/Modules/toolsext'
import * as ApiTables from '@src/store/Modules/ApiTables' import * as ApiTables from '@src/store/Modules/ApiTables'
import { GlobalStore, Projects, Todos, UserStore } from '@store' import { CalendarStore, GlobalStore, Projects, Todos, UserStore } from '@store'
import messages from '../../statics/i18n' import messages from '../../statics/i18n'
import globalroutines from './../../globalroutines/index' import globalroutines from './../../globalroutines/index'
import { cfgrouter } from '../../router/route-config' import { cfgrouter } from '../../router/route-config'
import { static_data } from '@src/db/static_data' import { static_data } from '@src/db/static_data'
import { IParamsQuery } from '@src/model/GlobalStore' import { IDataPass, IParamsQuery } from '@src/model/GlobalStore'
import { serv_constants } from '@src/store/Modules/serv_constants' import { serv_constants } from '@src/store/Modules/serv_constants'
import { IUserState } from '@src/model' import { IUserState } from '@src/model'
import { Calendar } from 'element-ui'
// import { static_data } from '@src/db/static_data' // import { static_data } from '@src/db/static_data'
let stateConnDefault = 'online' let stateConnDefault = 'online'
@@ -268,6 +269,41 @@ namespace Mutations {
} }
function getListByTable(table): any[] {
if (table === 'events')
return CalendarStore.state.eventlist
else if (table === 'operators')
return CalendarStore.state.operators
else if (table === 'bookings')
return CalendarStore.state.bookedevent
else if (table === 'users')
return UserStore.state.usersList
else
return null
}
function UpdateValuesInMemory(mystate: IGlobalState, mydata: IDataPass) {
const id = mydata.id
const table = mydata.table
try {
const mylist = getListByTable(table)
const myrec = mylist.find((event) => event._id === id)
// console.log('myrec', myrec)
if (myrec) {
for (const [key, value] of Object.entries(mydata.fieldsvalue)) {
console.log('key', value, myrec[key])
myrec[key] = value
}
}
} catch (e) {
console.error(e)
}
}
export const mutations = { export const mutations = {
setConta: b.commit(setConta), setConta: b.commit(setConta),
setleftDrawerOpen: b.commit(setleftDrawerOpen), setleftDrawerOpen: b.commit(setleftDrawerOpen),
@@ -278,7 +314,8 @@ namespace Mutations {
setPaoArray: b.commit(setPaoArray), setPaoArray: b.commit(setPaoArray),
setPaoArray_Delete: b.commit(setPaoArray_Delete), setPaoArray_Delete: b.commit(setPaoArray_Delete),
NewArray: b.commit(NewArray), NewArray: b.commit(NewArray),
setShowType: b.commit(setShowType) setShowType: b.commit(setShowType),
UpdateValuesInMemory: b.commit(UpdateValuesInMemory)
} }
} }
@@ -533,14 +570,15 @@ namespace Actions {
}) })
} }
async function saveFieldValue(context, mydata: object) { async function saveFieldValue(context, mydata: IDataPass) {
console.log('saveFieldValue', mydata) console.log('saveFieldValue', mydata)
return await Api.SendReq(`/chval`, 'PATCH', { data: mydata }) return await Api.SendReq(`/chval`, 'PATCH', { data: mydata })
.then((res) => { .then((res) => {
if (res) if (res) {
Mutations.mutations.UpdateValuesInMemory(mydata)
return (res.data.code === serv_constants.RIS_CODE_OK) return (res.data.code === serv_constants.RIS_CODE_OK)
else } else
return false return false
}) })
.catch((error) => { .catch((error) => {
@@ -566,6 +604,24 @@ namespace Actions {
}) })
} }
async function DuplicateRec(context, { table, id }) {
console.log('DuplicateRec', id)
return await Api.SendReq('/duprec/' + table + '/' + id, 'POST', null)
.then((res) => {
if (res.status === 200) {
if (res.data.code === serv_constants.RIS_CODE_OK) {
return res.data.record
}
}
return null
})
.catch((error) => {
console.error(error)
return null
})
}
export const actions = { export const actions = {
setConta: b.dispatch(setConta), setConta: b.dispatch(setConta),
createPushSubscription: b.dispatch(createPushSubscription), createPushSubscription: b.dispatch(createPushSubscription),
@@ -578,7 +634,8 @@ namespace Actions {
saveFieldValue: b.dispatch(saveFieldValue), saveFieldValue: b.dispatch(saveFieldValue),
loadTable: b.dispatch(loadTable), loadTable: b.dispatch(loadTable),
saveTable: b.dispatch(saveTable), saveTable: b.dispatch(saveTable),
DeleteRec: b.dispatch(DeleteRec) DeleteRec: b.dispatch(DeleteRec),
DuplicateRec: b.dispatch(DuplicateRec)
} }
} }

View File

@@ -17,6 +17,7 @@ const state: ICalendarState = {
editable: false, editable: false,
eventlist: [], eventlist: [],
bookedevent: [], bookedevent: [],
operators: [],
// --------------- // ---------------
titlebarHeight: 0, titlebarHeight: 0,
locale: 'it-IT', locale: 'it-IT',
@@ -92,7 +93,7 @@ namespace Actions {
// console.log('CalendarStore: loadAfterLogin') // console.log('CalendarStore: loadAfterLogin')
// Load local data // Load local data
state.editable = db_data.userdata.calendar_editable state.editable = db_data.userdata.calendar_editable
state.eventlist = db_data.events // state.eventlist = db_data.events
// state.bookedevent = db_data.userdata.bookedevent // state.bookedevent = db_data.userdata.bookedevent
if (UserStore.getters.isUserInvalid) { if (UserStore.getters.isUserInvalid) {
@@ -109,11 +110,10 @@ namespace Actions {
ris = await Api.SendReq('/booking/' + UserStore.state.userId + '/' + process.env.APP_ID + '/' + showall, 'GET', null) ris = await Api.SendReq('/booking/' + UserStore.state.userId + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
.then((res) => { .then((res) => {
if (res.data.bookedevent) { state.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
state.bookedevent = res.data.bookedevent state.eventlist = (res.data.eventlist) ? res.data.eventlist : []
} else { state.operators = (res.data.operators) ? res.data.operators : []
state.bookedevent = []
}
}) })
.catch((error) => { .catch((error) => {
console.log('error dbLoad', error) console.log('error dbLoad', error)

View File

@@ -16,6 +16,7 @@ export const lists = {
THEMEBG: 211, THEMEBG: 211,
DELETE_RECTABLE: 300, DELETE_RECTABLE: 300,
DUPLICATE_RECTABLE: 310,
CAN_EDIT_TABLE: 400, CAN_EDIT_TABLE: 400,
SHOW_PREV_REC: 401, SHOW_PREV_REC: 401,

View File

@@ -45,6 +45,8 @@ export const tools = {
DUPLICATE_EMAIL_ID: 11000, DUPLICATE_EMAIL_ID: 11000,
DUPLICATE_USERNAME_ID: 11100, DUPLICATE_USERNAME_ID: 11100,
NOFIELD: 'nofield',
TYPE_AUDIO: 1, TYPE_AUDIO: 1,
NUMSEC_CHECKUPDATE: 20000, NUMSEC_CHECKUPDATE: 20000,
@@ -1333,11 +1335,20 @@ export const tools = {
console.log('param1', par.param1) console.log('param1', par.param1)
GlobalStore.actions.DeleteRec({ table, id: par.param1 }).then((ris) => { GlobalStore.actions.DeleteRec({ table, id: par.param1 }).then((ris) => {
if (ris) { if (ris) {
myself.ActionAfterYes(func, par.param2) myself.ActionAfterYes(func, par.param2, null)
tools.showPositiveNotif(myself.$q, myself.$t('db.deletedrecord')) tools.showPositiveNotif(myself.$q, myself.$t('db.deletedrecord'))
} else } else
tools.showNegativeNotif(myself.$q, myself.$t('db.recdelfailed')) tools.showNegativeNotif(myself.$q, myself.$t('db.recdelfailed'))
}) })
} else if (func === lists.MenuAction.DUPLICATE_RECTABLE) {
console.log('param1', par.param1)
GlobalStore.actions.DuplicateRec({ table, id: par.param1 }).then((ris) => {
if (ris) {
myself.ActionAfterYes(func, par.param2, ris.data)
tools.showPositiveNotif(myself.$q, myself.$t('db.duplicatedrecord'))
} else
tools.showNegativeNotif(myself.$q, myself.$t('db.recdupfailed'))
})
} }
}, },
@@ -1551,7 +1562,7 @@ export const tools = {
} }
} }
let i = 0 // let i2 = 0
while (sortedList.length < linkedList.length) { while (sortedList.length < linkedList.length) {
// get the item with a previous item ID referencing the current item // get the item with a previous item ID referencing the current item
const nextItem = linkedList[map.get(currentId)] const nextItem = linkedList[map.get(currentId)]
@@ -1561,7 +1572,7 @@ export const tools = {
sortedList.push(nextItem) sortedList.push(nextItem)
// tools.logelemprj('FATTO:' + i, nextItem) // tools.logelemprj('FATTO:' + i, nextItem)
currentId = String(nextItem._id) currentId = String(nextItem._id)
i++ // i2++
} }
if (sortedList.length < linkedList.length) { if (sortedList.length < linkedList.length) {
@@ -1628,10 +1639,18 @@ export const tools = {
return '' return ''
}, },
getstrTime(mytimestamp) {
// console.log('getstrDate', mytimestamp)
if (!!mytimestamp)
return date.formatDate(mytimestamp, 'HH:mm')
else
return ''
},
getstrDateTime(mytimestamp) { getstrDateTime(mytimestamp) {
// console.log('getstrDate', mytimestamp) // console.log('getstrDate', mytimestamp)
if (!!mytimestamp) if (!!mytimestamp)
return date.formatDate(mytimestamp, 'DD/MM/YYYY HH:MM') return date.formatDate(mytimestamp, 'DD/MM/YYYY HH:mm')
else else
return '' return ''
}, },
@@ -1683,8 +1702,11 @@ export const tools = {
return '' return ''
} }
try { try {
return value.substring(0, numchars) + '...' let mycar = value.substring(0, numchars)
}catch (e) { if (value.length > numchars)
mycar += '...'
return mycar
} catch (e) {
return value return value
} }
}, },
@@ -2121,7 +2143,8 @@ export const tools = {
return msg return msg
}, },
gettextevent(myevent: IEvents) { gettextevent(myevent: IEvents) {
return '"' + myevent.title + '" (' + func_tools.getDateStr(myevent.date) + ') - ' + myevent.time // return '"' + myevent.title + '" (' + func_tools.getDateStr(myevent.date) + ') - ' + myevent.time
return '"' + myevent.title + '" (' + tools.getstrDateTime(myevent.date)
}, },
setLangAtt(mylang) { setLangAtt(mylang) {