- Enable Edit Event into dialog form ... (and save to the db)
- Event: enabled drag and drop (date) - Q-Select components in every table field external: Where, Operators, etc... - CMyEditor: Add HTML Editor to the details field ! - Added button Color for change font color to the text. - Complete insert Events Site
This commit is contained in:
@@ -276,6 +276,8 @@ namespace Mutations {
|
||||
return CalendarStore.state.operators
|
||||
else if (table === 'wheres')
|
||||
return CalendarStore.state.wheres
|
||||
else if (table === 'contribtype')
|
||||
return CalendarStore.state.contribtype
|
||||
else if (table === 'bookings')
|
||||
return CalendarStore.state.bookedevent
|
||||
else if (table === 'users')
|
||||
@@ -493,6 +495,8 @@ namespace Actions {
|
||||
// console.log('loadAfterLogin')
|
||||
actions.clearDataAfterLoginOnlyIfActiveConnection()
|
||||
|
||||
await Actions.actions.loadSite()
|
||||
|
||||
state.arrConfig = await globalroutines(null, 'readall', 'config', null)
|
||||
}
|
||||
|
||||
@@ -624,10 +628,39 @@ namespace Actions {
|
||||
})
|
||||
}
|
||||
|
||||
async function loadSite(context) {
|
||||
// console.log('CalendarStore: loadAfterLogin')
|
||||
// Load local data
|
||||
CalendarStore.state.editable = UserStore.state.isAdmin || UserStore.state.isManager
|
||||
|
||||
const showall = UserStore.state.isAdmin || UserStore.state.isManager ? '1' : '0'
|
||||
|
||||
const myuserid = (UserStore.state.userId) ? UserStore.state.userId : '0'
|
||||
|
||||
const ris = await Api.SendReq('/loadsite/' + myuserid + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
|
||||
.then((res) => {
|
||||
CalendarStore.state.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
|
||||
CalendarStore.state.eventlist = (res.data.eventlist) ? res.data.eventlist : []
|
||||
CalendarStore.state.operators = (res.data.operators) ? res.data.operators : []
|
||||
CalendarStore.state.wheres = (res.data.wheres) ? res.data.wheres : []
|
||||
CalendarStore.state.contribtype = (res.data.contribtype) ? res.data.contribtype : []
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error dbLoad', error)
|
||||
// UserStore.mutations.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
|
||||
})
|
||||
|
||||
return ris
|
||||
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
setConta: b.dispatch(setConta),
|
||||
createPushSubscription: b.dispatch(createPushSubscription),
|
||||
loadAfterLogin: b.dispatch(loadAfterLogin),
|
||||
loadSite: b.dispatch(loadSite),
|
||||
clearDataAfterLogout: b.dispatch(clearDataAfterLogout),
|
||||
clearDataAfterLoginOnlyIfActiveConnection: b.dispatch(clearDataAfterLoginOnlyIfActiveConnection),
|
||||
prova: b.dispatch(prova),
|
||||
|
||||
@@ -19,6 +19,7 @@ const state: ICalendarState = {
|
||||
bookedevent: [],
|
||||
operators: [],
|
||||
wheres: [],
|
||||
contribtype: [],
|
||||
// ---------------
|
||||
titlebarHeight: 0,
|
||||
locale: 'it-IT',
|
||||
@@ -82,6 +83,23 @@ namespace Getters {
|
||||
|
||||
}, 'getWhereRec')
|
||||
|
||||
const getContribtypeRec = b.read((mystate: ICalendarState) => (id) => {
|
||||
const ctrec = mystate.contribtype.find((mycontr) => mycontr._id === id)
|
||||
return (ctrec)
|
||||
|
||||
}, 'getContribtypeRec')
|
||||
|
||||
const getContribtypeById = b.read((mystate: ICalendarState) => (id) => {
|
||||
const ctrec = mystate.contribtype.find((mycontr) => mycontr._id === id)
|
||||
return (ctrec) ? ctrec.label : ''
|
||||
|
||||
}, 'getContribtypeById')
|
||||
const getContribtypeRecByLabel = b.read((mystate: ICalendarState) => (label) => {
|
||||
const ctrec = mystate.contribtype.find((mycontr) => mycontr.label === label)
|
||||
return (ctrec)
|
||||
|
||||
}, 'getContribtypeRecByLabel')
|
||||
|
||||
export const getters = {
|
||||
get findEventBooked() {
|
||||
return findEventBooked()
|
||||
@@ -98,6 +116,15 @@ namespace Getters {
|
||||
get getWhereRec() {
|
||||
return getWhereRec()
|
||||
},
|
||||
get getContribtypeRec() {
|
||||
return getContribtypeRec()
|
||||
},
|
||||
get getContribtypeById() {
|
||||
return getContribtypeById()
|
||||
},
|
||||
get getContribtypeRecByLabel() {
|
||||
return getContribtypeRecByLabel()
|
||||
},
|
||||
get getTeacherName() {
|
||||
return getTeacherName()
|
||||
}
|
||||
@@ -117,40 +144,6 @@ namespace Mutations {
|
||||
}
|
||||
|
||||
namespace Actions {
|
||||
async function loadAfterLogin(context) {
|
||||
// console.log('CalendarStore: loadAfterLogin')
|
||||
// Load local data
|
||||
state.editable = UserStore.state.isAdmin || UserStore.state.isManager
|
||||
|
||||
if (UserStore.getters.isUserInvalid) {
|
||||
state.bookedevent = []
|
||||
return false
|
||||
}
|
||||
|
||||
// Load local data
|
||||
// console.log('CALENDAR loadAfterLogin', 'userid=', UserStore.state.userId)
|
||||
|
||||
let ris = null
|
||||
|
||||
const showall = UserStore.state.isAdmin || UserStore.state.isManager ? '1' : '0'
|
||||
|
||||
ris = await Api.SendReq('/booking/' + UserStore.state.userId + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
|
||||
.then((res) => {
|
||||
state.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
|
||||
state.eventlist = (res.data.eventlist) ? res.data.eventlist : []
|
||||
state.operators = (res.data.operators) ? res.data.operators : []
|
||||
state.wheres = (res.data.wheres) ? res.data.wheres : []
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error dbLoad', error)
|
||||
// UserStore.mutations.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
|
||||
})
|
||||
|
||||
return ris
|
||||
|
||||
}
|
||||
|
||||
function getparambyevent(bookevent) {
|
||||
return {
|
||||
@@ -222,7 +215,6 @@ namespace Actions {
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
loadAfterLogin: b.dispatch(loadAfterLogin),
|
||||
BookEvent: b.dispatch(BookEvent),
|
||||
CancelBookingEvent: b.dispatch(CancelBookingEvent)
|
||||
}
|
||||
|
||||
@@ -621,8 +621,6 @@ namespace Actions {
|
||||
GlobalStore.actions.checkUpdates()
|
||||
}
|
||||
|
||||
const p2 = await CalendarStore.actions.loadAfterLogin()
|
||||
|
||||
const p3 = await GlobalStore.actions.loadAfterLogin()
|
||||
|
||||
if (static_data.functionality.ENABLE_TODOS_LOADING)
|
||||
|
||||
@@ -1628,8 +1628,17 @@ export const tools = {
|
||||
} else {
|
||||
return 'red'
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
hasManyDays(mydatestart, mydateend) {
|
||||
if (mydateend)
|
||||
return tools.getstrDate(mydatestart) !== tools.getstrDate(mydateend)
|
||||
else
|
||||
return false
|
||||
},
|
||||
|
||||
isManager() {
|
||||
return UserStore.state.isManager
|
||||
},
|
||||
|
||||
getstrDate(mytimestamp) {
|
||||
// console.log('getstrDate', mytimestamp)
|
||||
@@ -1654,6 +1663,14 @@ export const tools = {
|
||||
else
|
||||
return ''
|
||||
},
|
||||
|
||||
getstrDateEmailTime(mythis, mytimestamp) {
|
||||
// console.log('getstrDate', mytimestamp)
|
||||
if (!!mytimestamp)
|
||||
return date.formatDate(mytimestamp, 'DD/MM/YYYY') + ' ' + mythis.$t('starttime') + ' ' + date.formatDate(mytimestamp, 'HH:mm')
|
||||
else
|
||||
return ''
|
||||
},
|
||||
getstrMMMDate(mytimestamp) {
|
||||
// console.log('getstrDate', mytimestamp)
|
||||
if (!!mytimestamp)
|
||||
@@ -1927,7 +1944,7 @@ export const tools = {
|
||||
|
||||
myheight_dialog() {
|
||||
if (Screen.width < 400) {
|
||||
return '350'
|
||||
return '337'
|
||||
} else if (Screen.width < 600) {
|
||||
return '400'
|
||||
} else {
|
||||
@@ -2033,6 +2050,10 @@ export const tools = {
|
||||
return date.addToDate(mydate, { days })
|
||||
},
|
||||
|
||||
addMinutes(mydate, minutes) {
|
||||
return date.addToDate(mydate, { minutes })
|
||||
},
|
||||
|
||||
gettitlemain(datamain: ITimeLineMain) {
|
||||
if (datamain.titlemain[toolsext.getLocale()])
|
||||
return datamain.titlemain[toolsext.getLocale()]
|
||||
@@ -2144,9 +2165,9 @@ export const tools = {
|
||||
|
||||
return msg
|
||||
},
|
||||
gettextevent(myevent: IEvents) {
|
||||
gettextevent(mythis, myevent: IEvents) {
|
||||
// return '"' + myevent.title + '" (' + func_tools.getDateStr(myevent.date) + ') - ' + myevent.time
|
||||
return '"' + myevent.title + '" (' + tools.getstrDateTime(myevent.dateTimeStart)
|
||||
return '"' + myevent.title + '" (' + tools.getstrDateEmailTime(mythis, myevent.dateTimeStart) + ')'
|
||||
},
|
||||
|
||||
setLangAtt(mylang) {
|
||||
@@ -2282,21 +2303,21 @@ export const tools = {
|
||||
},
|
||||
displayClasses(eventparam) {
|
||||
return {
|
||||
[`bg-${eventparam.bgcolor}`]: !tools.isCssColor(eventparam.bgcolor),
|
||||
// [`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['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, {
|
||||
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(mythis, eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE, 0, {
|
||||
param1: bookeventid,
|
||||
param2: notify
|
||||
})
|
||||
@@ -2308,6 +2329,25 @@ export const tools = {
|
||||
param2: item
|
||||
})
|
||||
},
|
||||
|
||||
async createNewRecord(mythis, table, data) {
|
||||
|
||||
const mydata = {
|
||||
table,
|
||||
data
|
||||
}
|
||||
|
||||
return await GlobalStore.actions.saveTable(mydata)
|
||||
.then((record) => {
|
||||
if (record) {
|
||||
tools.showPositiveNotif(mythis.$q, mythis.$t('db.recupdated'))
|
||||
} else {
|
||||
tools.showNegativeNotif(mythis.$q, mythis.$t('db.recfailed'))
|
||||
}
|
||||
return record
|
||||
})
|
||||
},
|
||||
|
||||
isBitActive(bit, whattofind) {
|
||||
return ((bit & whattofind) === whattofind)
|
||||
}
|
||||
|
||||
@@ -34,18 +34,17 @@ export const func_tools = {
|
||||
year: 'numeric'
|
||||
// timeZone: 'UTC'
|
||||
})
|
||||
if (DateFormatter) {
|
||||
const date1 = new Date(mydate)
|
||||
return DateFormatter.format(date1)
|
||||
try {
|
||||
console.log('mydate', mydate, DateFormatter)
|
||||
if (DateFormatter) {
|
||||
const date1 = new Date(mydate)
|
||||
return DateFormatter.format(date1)
|
||||
}
|
||||
return mydate
|
||||
}catch (e) {
|
||||
return ''
|
||||
}
|
||||
return mydate
|
||||
},
|
||||
|
||||
hasManyDays(mydatestart, mydateend) {
|
||||
if (mydateend)
|
||||
return this.getDateStr(mydatestart) !== this.getDateStr(mydateend)
|
||||
else
|
||||
return false
|
||||
},
|
||||
|
||||
getMinutesDuration(mydatestart, mydateend) {
|
||||
|
||||
Reference in New Issue
Block a user