diff --git a/src/components/CEventsCalendar/CEventsCalendar.ts b/src/components/CEventsCalendar/CEventsCalendar.ts index ed7d793..b6049ec 100644 --- a/src/components/CEventsCalendar/CEventsCalendar.ts +++ b/src/components/CEventsCalendar/CEventsCalendar.ts @@ -501,14 +501,16 @@ export default class CEventsCalendar extends Vue { tools.CancelEvent(this, eventparam) } - public duplicateEvent(eventparam) { - GlobalStore.actions.DuplicateRec({ table: tools.TABEVENTS, id: eventparam._id }).then((rec) => { - rec.dateTimeStart = new Date() - rec.dateTimeEnd = new Date() - CalendarStore.state.eventlist.push(rec) - this.editEvent(rec) + public duplicateEvent(eventparam, numgg, numev: number = 1 ) { + for (let i = 0; i < numev; ++i) { + GlobalStore.actions.DuplicateRec({ table: tools.TABEVENTS, id: eventparam._id }).then((rec) => { + rec.dateTimeStart = tools.addDays(new Date(rec.dateTimeStart), numgg * (i + 1)) + rec.dateTimeEnd = tools.addDays(new Date(rec.dateTimeEnd), numgg * (i + 1)) + CalendarStore.state.eventlist.push(rec) + this.editEvent(rec) - }) + }) + } // tools.ActionRecTable(this, lists.MenuAction.DUPLICATE_RECTABLE, tools.TABEVENTS, eventparam._id, eventparam, 'db.duplicatedrecord') } diff --git a/src/components/CEventsCalendar/CEventsCalendar.vue b/src/components/CEventsCalendar/CEventsCalendar.vue index d29e556..dcd65f3 100644 --- a/src/components/CEventsCalendar/CEventsCalendar.vue +++ b/src/components/CEventsCalendar/CEventsCalendar.vue @@ -10,8 +10,23 @@ {{ $t('cal.event') }} - + + + + + Tra 1 Settimana + + + Tra 2 Settimane + + + 4 Eventi ogni Settimana + + + + - - + + + + Tra 1 Settimana + + + Tra 2 Settimane + + + 4 Eventi ogni Settimana + + + + + - diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index cd60ff5..eb7cbb3 100644 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -50,7 +50,7 @@ export default class CGridTableRec extends Vue { public spinner_visible: boolean = false public idsel: string = '' - public colsel: IColGridTable = {name: ''} + public colsel: IColGridTable = { name: '' } public valPrec: string = '' public separator: 'horizontal' @@ -118,6 +118,7 @@ export default class CGridTableRec extends Vue { } public updatedcol() { + console.log('updatedcol') if (this.mycolumns) { this.colVisib = [] this.colExtra = [] @@ -137,6 +138,7 @@ export default class CGridTableRec extends Vue { } public onRequest(props) { + console.log('onRequest') const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination const filter = this.filter @@ -314,20 +316,29 @@ export default class CGridTableRec extends Vue { public mounted() { - this.canEdit = tools.getCookie(tools.CAN_EDIT) === 'true' + this.canEdit = tools.getCookie(tools.CAN_EDIT, this.canEdit) === 'true' - this.tablesel = tools.getCookie('tablesel') + this.tablesel = tools.getCookie('tablesel', this.tablesel) + if (this.tablesel === '') { + if (!!this.tablesList) + this.tablesel = this.tablesList[0].value + else + this.tablesel = this.mytable + } this.changeTable(false) } public refresh() { - if (this.search !== '') + // console.log('this.search', this.search) + if (!!this.search && this.search !== '') this.filter = this.search else this.filter = '' + // console.log('this.filter', this.filter) + this.onRequest({ pagination: this.pagination }) @@ -409,7 +420,7 @@ export default class CGridTableRec extends Vue { mytab = this.tablesList.find((rec) => rec.value === this.tablesel) } - console.log('this.tablesel', this.tablesel) + console.log('this.tablesel', this.tablesel, 'mytab', mytab) if (mytab) { this.mytitle = mytab.label @@ -417,10 +428,17 @@ export default class CGridTableRec extends Vue { this.mycolumns = [...mytab.columns] } - this.mycolumns.forEach((rec: IColGridTable) => { - if (rec.label_trans) - rec.label = this.$t(rec.label_trans) - }) + console.log('this.mycolumns') + console.log(this.mycolumns) + console.log('this.tablesList:') + console.table(this.tablesList) + + if (!!this.mycolumns) { + this.mycolumns.forEach((rec: IColGridTable) => { + if (rec.label_trans) + rec.label = this.$t(rec.label_trans) + }) + } if (mytab) { this.mytable = mytab.value @@ -431,7 +449,7 @@ export default class CGridTableRec extends Vue { this.updatedcol() if (!!this.mytable) { - const myselcol = tools.getCookie(this.mytable) + const myselcol = tools.getCookie(this.mytable, '') if (!!myselcol && myselcol.length > 0) { this.colVisib = myselcol.split('|') } diff --git a/src/store/Api/Instance.ts b/src/store/Api/Instance.ts index fd8a4f2..cec05e5 100644 --- a/src/store/Api/Instance.ts +++ b/src/store/Api/Instance.ts @@ -51,7 +51,7 @@ export const removeAuthHeaders = () => { async function Request(type: string, path: string, payload: any): Promise { let ricevuto = false try { - console.log('Axios Request', path, type, payload) + console.log('Axios Request', path, type, tools.notshowPwd(payload)) let response: AxiosResponse if (type === 'post' || type === 'put' || type === 'patch') { response = await axiosInstance[type](path, payload, { diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts index 4aa1a3f..aa6472a 100644 --- a/src/store/Modules/UserStore.ts +++ b/src/store/Modules/UserStore.ts @@ -199,15 +199,15 @@ namespace Getters { namespace Mutations { function authUser(mystate: IUserState, data: IUserFields) { - mystate.my = {...data} + mystate.my = { ...data } mystate.isAdmin = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Admin.value) mystate.isManager = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Manager.value) mystate.isTeacher = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Teacher.value) // console.log('authUser', 'state.isAdmin', mystate.isAdmin) - console.table(mystate) - console.table(data) + // console.table(mystate) + // console.table(data) // if (data.my.verified_email) { // mystate.my.verified_email = data.my.verified_email @@ -564,7 +564,10 @@ namespace Actions { localStorage.setItem(tools.localStorage.name, myuser.name) localStorage.setItem(tools.localStorage.surname, myuser.surname) localStorage.setItem(tools.localStorage.perm, String(myuser.perm) || '') - localStorage.setItem(tools.localStorage.img, String(myuser.profile.img) || '') + if (myuser.profile !== undefined) + localStorage.setItem(tools.localStorage.img, (!!myuser.profile.img) ? String(myuser.profile.img) || '' : '') + else + localStorage.setItem(tools.localStorage.img, '') localStorage.setItem(tools.localStorage.token, state.x_auth_token) localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString()) localStorage.setItem(tools.localStorage.isLogged, String(true)) diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index db46692..de8061c 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -1719,7 +1719,7 @@ export const tools = { } else { mystr = `${tools.getstrDate(myevent.dateTimeStart)} ${mythis.$t('cal.starttime')} ${ tools.getstrTime(myevent.dateTimeStart) } - ${ mythis.$t('cal.endtime')}: ${ tools.getstrTime(myevent.dateTimeEnd) }` + ${ mythis.$t('cal.endtime')} ${ tools.getstrTime(myevent.dateTimeEnd) }` } } else { mystr = `${tools.getstrDate(myevent.dateTimeStart)} @@ -1783,10 +1783,7 @@ export const tools = { }, // mystrdate "26.04.2013" - convertstrtoDate(mystrdate - : - string - ) { + convertstrtoDate(mystrdate: string) { if (mystrdate.length < 10) { return null } @@ -2552,10 +2549,14 @@ export const tools = { else return 'primary' }, - getCookie(mytok) { + getCookie(mytok, oldval?) { const ris = Cookies.get(mytok) - console.log('getToken', ris) - return ris + console.log('getCookie', ris) + if (!!ris) { + return ris + } else { + return oldval + } }, setCookie(mytok, value: string) { @@ -2564,6 +2565,17 @@ export const tools = { removeCookie(mytok) { return Cookies.remove(mytok) + }, + notshowPwd(payload) { + const mypay = {...payload} + try{ + if (!!mypay.password) { + mypay.password = '**********' + } + }catch (e) { + console.log('error', e) + } + return mypay } // getLocale() {