diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index edccfd1..a307c52 100644 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -27,7 +27,7 @@ export const shared_consts = { }, fieldsUserToChange() { - return ['username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline'] + return ['username', 'email', 'cell', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline'] } } diff --git a/src/components/CBook/CBook.ts b/src/components/CBook/CBook.ts index e6c180a..49244d1 100644 --- a/src/components/CBook/CBook.ts +++ b/src/components/CBook/CBook.ts @@ -3,7 +3,7 @@ import { Component, Prop, Watch } from 'vue-property-decorator' import { tools } from '../../store/Modules/tools' import { toolsext } from '@src/store/Modules/toolsext' -import { IPerson } from '../../model/GlobalStore' +import { IOperators } from '../../model/GlobalStore' @Component({ name: 'CBook', @@ -21,7 +21,7 @@ export default class CBook extends Vue { this.tab = 'two' } - @Prop({ required: true }) public op: IPerson + @Prop({ required: true }) public op: IOperators get tools() { return tools @@ -35,9 +35,9 @@ export default class CBook extends Vue { index: 0, tab: '', name: '', - sub1: '', + qualification: '', sub2: '', - sub3: '', + certifications: '', img: '', cell: '', email: '', diff --git a/src/components/CBook/CBook.vue b/src/components/CBook/CBook.vue index c99babb..f290c2e 100644 --- a/src/components/CBook/CBook.vue +++ b/src/components/CBook/CBook.vue @@ -3,7 +3,7 @@
{{myop.name}}
-
{{myop.sub1}}
+
{{myop.qualification}}
@@ -16,8 +16,8 @@ -
{{myop.sub2}}
-
{{myop.sub3}}
+
{{myop.disciplines}}
+
{{myop.certifications}}
{{myop.cell}} @@ -33,7 +33,7 @@ - + diff --git a/src/components/CCard/CCard.ts b/src/components/CCard/CCard.ts index a6a937b..5ff151e 100644 --- a/src/components/CCard/CCard.ts +++ b/src/components/CCard/CCard.ts @@ -3,7 +3,7 @@ import { Component, Prop, Watch } from 'vue-property-decorator' import { tools } from '../../store/Modules/tools' import { toolsext } from '@src/store/Modules/toolsext' -import { IPerson } from '../../model/GlobalStore' +import { IOperators } from '../../model/GlobalStore' @Component({ name: 'CCard', @@ -16,28 +16,28 @@ import { IPerson } from '../../model/GlobalStore' export default class CCard extends Vue { @Prop({ required: true, default: 'one' }) public tab + @Prop({ required: true }) public op: IOperators public clicca() { this.tab = 'two' } - @Prop({ required: true }) public op: IPerson - get tools() { return tools } - get myop() { + get myop(): IOperators { if (!!this.op) { return this.op } else { return { - index: 0, tab: '', + username: '', name: '', - sub1: '', - sub2: '', - sub3: '', + surname: '', + qualification: '', + disciplines: '', + certifications: '', img: '', cell: '', email: '', diff --git a/src/components/CCard/CCard.vue b/src/components/CCard/CCard.vue index bbf1959..bbf18b6 100644 --- a/src/components/CCard/CCard.vue +++ b/src/components/CCard/CCard.vue @@ -1,9 +1,9 @@ @@ -512,21 +512,33 @@ -

+

+ @click="selectEvent(event)" + class="text-left padding_cell listaev__tdimg listaev__img cursor-pointer" + :style="getStyleByEvent(event)"> {{$t('cal.booked')}} + + + + + + {{$t('event.news')}} -

+
+
@@ -568,16 +580,17 @@ - + - {{getUserByUsername(event.teacher)}} + {{getTeacherByUsername(event.teacher)}} - - + + - + - {{getUserByUsername(event.teacher2)}} + {{getTeacherByUsername(event.teacher2)}} diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 66a543d..cd60ff5 100644 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -21,7 +21,7 @@ import { CMyChipList } from '../CMyChipList' export default class CGridTableRec extends Vue { @Prop({ required: false }) public prop_mytable: string @Prop({ required: true }) public prop_mytitle: string - @Prop({ required: false, default: [] }) public prop_mycolumns: any[] + @Prop({ required: false, default: null }) public prop_mycolumns: any[] @Prop({ required: false, default: '' }) public prop_colkey: string @Prop({ required: false, default: '' }) public nodataLabel: string @Prop({ required: false, default: '' }) public noresultLabel: string @@ -57,17 +57,13 @@ export default class CGridTableRec extends Vue { public filter: string = '' public rowsel: any public dark: boolean = true - public funcActivated = [] + public canEdit: boolean = false public returnedData public returnedCount public colVisib: any[] = [] public colExtra: any[] = [] - get canEdit() { - return this.funcActivated.includes(lists.MenuAction.CAN_EDIT_TABLE) - } - get lists() { return lists } @@ -79,7 +75,7 @@ export default class CGridTableRec extends Vue { } public selItem(item, col: IColGridTable) { - // console.log('item', item) + console.log('selItem', item) this.rowsel = item this.idsel = item._id this.colsel = col @@ -317,6 +313,11 @@ export default class CGridTableRec extends Vue { } public mounted() { + + this.canEdit = tools.getCookie(tools.CAN_EDIT) === 'true' + + this.tablesel = tools.getCookie('tablesel') + this.changeTable(false) } @@ -382,25 +383,34 @@ export default class CGridTableRec extends Vue { return '[]' } else { let mystr = tools.firstchars(val, tools.MAX_CHARACTERS) - if (val.length > tools.MAX_CHARACTERS) - mystr += '...' + if (val) { + if (val.length > tools.MAX_CHARACTERS) + mystr += '...' + } else { + return val + } return mystr } } } + public changeCol(newval) { + tools.setCookie(this.mytable, this.colVisib.join('|')) + } + public changeTable(mysel) { - // console.log('changeTable') + if (this.tablesel === undefined || this.tablesel === '') + return + + console.log('changeTable mysel=', mysel, 'tablesel', this.tablesel) let mytab = null if (this.tablesList) { - if (!this.tablesel) { - this.tablesel = this.tablesList[1].value - } - mytab = this.tablesList.find((rec) => rec.value === this.tablesel) } + console.log('this.tablesel', this.tablesel) + if (mytab) { this.mytitle = mytab.label this.colkey = mytab.colkey @@ -416,7 +426,17 @@ export default class CGridTableRec extends Vue { this.mytable = mytab.value } + tools.setCookie('tablesel', this.tablesel) + this.updatedcol() + + if (!!this.mytable) { + const myselcol = tools.getCookie(this.mytable) + if (!!myselcol && myselcol.length > 0) { + this.colVisib = myselcol.split('|') + } + } + this.refresh() } @@ -429,8 +449,11 @@ export default class CGridTableRec extends Vue { } public doSearch() { - this.refresh() } + public changefuncAct(newval) { + tools.setCookie(tools.CAN_EDIT, newval) + } + } diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 01c7eef..0949aff 100644 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -35,13 +35,14 @@ - + - + + style="min-width: 150px" + @input="changeCol"> @@ -94,7 +96,8 @@
-
+
{{ visuValByType(col, props.row[col.name]) }} - + + + + + +
+
+
+
+ {{ visuValByType(col, props.row[col.name]) }} + + + +
diff --git a/src/components/CMySelect/CMySelect.ts b/src/components/CMySelect/CMySelect.ts index e11cbdc..f81c79a 100644 --- a/src/components/CMySelect/CMySelect.ts +++ b/src/components/CMySelect/CMySelect.ts @@ -3,7 +3,7 @@ import { Component, Prop, Watch } from 'vue-property-decorator' import { tools } from '../../store/Modules/tools' import { toolsext } from '@src/store/Modules/toolsext' -import { IPerson } from '../../model/GlobalStore' +import { IOperators } from '../../model/GlobalStore' @Component({ name: 'CMySelect' diff --git a/src/mixins/mixin-users.ts b/src/mixins/mixin-users.ts index 81ba2f5..520f321 100644 --- a/src/mixins/mixin-users.ts +++ b/src/mixins/mixin-users.ts @@ -1,7 +1,6 @@ import Vue from 'vue' import { GlobalStore, UserStore, MessageStore } from '../store/Modules' - import Component from 'vue-class-component' import { func_tools } from '../store/Modules/toolsext' import { tools } from '../store/Modules/tools' diff --git a/src/model/Calendar.ts b/src/model/Calendar.ts index 103e567..a20aae8 100644 --- a/src/model/Calendar.ts +++ b/src/model/Calendar.ts @@ -1,3 +1,4 @@ +import { IOperators } from '@src/model/GlobalStore' export interface IEvents { _id?: any @@ -41,18 +42,6 @@ export interface IBookedEvent { booked: boolean } -export interface IOperators { - username: string - cell: string - webpage?: string - img: string - skype?: string - days_working?: string - facebook?: string - disciplines?: string - offers?: string -} - export interface IWheres { code: string placename: string @@ -75,7 +64,6 @@ export interface IBookedEventPage { state: EState } - export interface ICalendarState { editable: boolean eventlist: IEvents[] diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 20cb59f..e72a7e4 100644 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -98,21 +98,22 @@ export interface IListRoutes { separator?: boolean } -export interface IPerson { - index?: number - tab?: string +export interface IOperators { + username: string name: string - sub1: string - sub2?: string - sub3?: string - img: string - cell?: string + surname: string email?: string + qualification?: string + disciplines?: string + certifications?: string + img?: string + cell?: string paginaweb?: string paginafb?: string intro?: string info?: string vario?: string + tab?: string } export interface IPreloadImages { diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index 8a34cb0..bed0679 100644 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -5,7 +5,23 @@ export const DefaultUser: IUserFields = { username: '', name: '', surname: '', - password: '' + password: '', + profile: { + img: '' + } +} + +const enum ESexType { + None = 0, + Male = 1, + Female = 2 +} + +export interface IUserProfile { + img?: string + cell?: string + dateofbirth?: Date + sex?: ESexType } export interface IUserFields { @@ -17,10 +33,10 @@ export interface IUserFields { password?: string ipaddr?: string perm?: number - img?: string verified_email?: boolean tokens?: IToken[] lasttimeonline?: Date + profile?: IUserProfile } /* diff --git a/src/statics/i18n.js b/src/statics/i18n.js index 3884974..494fe50 100644 --- a/src/statics/i18n.js +++ b/src/statics/i18n.js @@ -91,7 +91,7 @@ const msgglobal = { incorso: 'Registrazione in corso...', richiesto: 'Campo Richiesto', email: 'Email', - cell: 'Móvil', + cell: 'Telefono', img: 'Immagine', date_reg: 'Data Reg.', perm: 'Permessi', @@ -128,6 +128,16 @@ const msgglobal = { } }, + op: { + qualification: 'Qualifica', + disciplines: 'Discipline', + certifications: 'Certificazioni', + intro: 'Introduzione', + info: 'Biografia', + webpage: 'Pagina Web', + days_working: 'Giorni Lavorativi', + facebook: 'Pagina Facebook', + }, login: { page_title: 'Login', incorso: 'Login in corso', @@ -253,7 +263,8 @@ const msgglobal = { short_tit: 'Titolo Breve', title: 'Titolo', details: 'Dettagli', - date: 'Data', + dateTimeStart: 'Data Inizio', + dateTimeEnd: 'Data Fine', bgcolor: 'Colore Sfondo', days: 'Giorni', icon: 'Icona', @@ -385,7 +396,7 @@ const msgglobal = { incorso: 'Registro en curso...', richiesto: 'Campo requerido', email: 'Email', - cell: 'Telefono', + cell: 'Móvil', img: 'File image', date_reg: 'Fecha Reg.', perm: 'Permisos', @@ -415,6 +426,16 @@ const msgglobal = { sameaspassword: 'Las contraseñas deben ser idénticas', } }, + op: { + qualification: 'Calificación', + disciplines: 'Disciplinas', + certifications: 'Certificaciones', + intro: 'Introducción', + info: 'Biografia', + webpage: 'Página web', + days_working: 'Días laborables', + facebook: 'Página de Facebook', + }, login: { page_title: 'Login', incorso: 'Login en curso', @@ -538,7 +559,8 @@ const msgglobal = { short_tit: 'Título Corto', title: 'Título', details: 'Detalles', - date: 'Fecha', + dateTimeStart: 'Fecha de Inicio', + dateTimeEnd: 'Fecha Final', bgcolor: 'Color de fondo', days: 'Días', icon: 'Icono', @@ -699,6 +721,16 @@ const msgglobal = { sameaspassword: 'Les mots de passe doivent être identiques', } }, + op: { + qualification: 'Qualification', + disciplines: 'Disciplines', + certifications: 'Certifications', + intro: 'Introduction', + info: 'Biographie', + webpage: 'Page Web', + days_working: 'Jours ouvrés', + facebook: 'Page Facebook', + }, login: { page_title: 'Login', incorso: 'Connexion en cours', @@ -822,7 +854,8 @@ const msgglobal = { short_tit: 'Titre abrégé\'', title: 'Titre', details: 'Détails', - date: 'Date', + dateTimeStart: 'Data Initiale', + dateTimeEnd: 'Date de fin', bgcolor: 'Couleur de fond', days: 'Journées', icon: 'Icône', @@ -983,6 +1016,16 @@ const msgglobal = { sameaspassword: 'Passwords must be identical', } }, + op: { + qualification: 'Qualification', + disciplines: 'Disciplines', + certifications: 'Certifications', + intro: 'Introduction', + info: 'Biography', + webpage: 'Web Page', + days_working: 'Working Days', + facebook: 'Facebook Page', + }, login: { incorso: 'Login...', enter: 'Login', @@ -1105,7 +1148,8 @@ const msgglobal = { short_tit: 'Short Title', title: 'Title', details: 'Details', - date: 'Date', + dateTimeStart: 'Date Start', + dateTimeEnd: 'Date End', bgcolor: 'Background color', days: 'Days', icon: 'Icon', @@ -1267,6 +1311,16 @@ const msgglobal = { sameaspassword: 'Passwords must be identical', } }, + op: { + qualification: 'Qualification', + disciplines: 'Disciplines', + certifications: 'Certifications', + intro: 'Introduction', + info: 'Biography', + webpage: 'Web Page', + days_working: 'Working Days', + facebook: 'Facebook Page', + }, login: { page_title: 'Login', incorso: 'Login...', @@ -1390,7 +1444,8 @@ const msgglobal = { short_tit: 'Short Title', title: 'Title', details: 'Details', - date: 'Date', + dateTimeStart: 'Date Start', + dateTimeEnd: 'Date End', bgcolor: 'Background color', days: 'Days', icon: 'Icon', diff --git a/src/store/Modules/Store/calendar/CalendarStore.ts b/src/store/Modules/Store/calendar/CalendarStore.ts index daf64d3..fd71582 100644 --- a/src/store/Modules/Store/calendar/CalendarStore.ts +++ b/src/store/Modules/Store/calendar/CalendarStore.ts @@ -9,8 +9,9 @@ import { tools } from '../../tools' import translate from '../../../../globalroutines/util' import * as Types from '../../../Api/ApiTypes' import { db_data } from '@src/db/db_data' -import { GlobalStore, UserStore } from '@store' +import { CalendarStore, GlobalStore, UserStore } from '@store' import { lists } from '@src/store/Modules/lists' +import { IUserState } from '@src/model' // State const state: ICalendarState = { @@ -77,6 +78,24 @@ namespace Getters { }, 'getContribtypeRec') + const getOperatorByUsername = b.read((mystate: ICalendarState) => (username) => { + const ctrec = mystate.operators.find((rec) => rec.username === username) + return (ctrec) + + }, 'getOperatorByUsername') + + const getImgTeacherByUsername = b.read((mystate: ICalendarState) => (username): string => { + if (username === '') + return 'images/avatar/avatar3_small.png' + // Check if is this User! + const myop = CalendarStore.getters.getOperatorByUsername(username) + if (myop && !!myop.img && myop.img !== '' && myop.img !== 'undefined') { + return myop.img + } else { + return 'images/avatar/avatar3_small.png' + } + }, 'getImgTeacherByUsername') + const getContribtypeById = b.read((mystate: ICalendarState) => (id) => { const ctrec = mystate.contribtype.find((mycontr) => mycontr._id === id) return (ctrec) ? ctrec.label : '' @@ -109,6 +128,12 @@ namespace Getters { }, get getContribtypeRecByLabel() { return getContribtypeRecByLabel() + }, + get getOperatorByUsername() { + return getOperatorByUsername() + }, + get getImgTeacherByUsername() { + return getImgTeacherByUsername() } } } diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts index e0502b2..4aa1a3f 100644 --- a/src/store/Modules/UserStore.ts +++ b/src/store/Modules/UserStore.ts @@ -30,7 +30,10 @@ const state: IUserState = { surname: '', password: '', tokens: [], - verified_email: false + verified_email: false, + profile: { + img: '' + } }, lang: process.env.LANG_DEFAULT, repeatPassword: '', @@ -143,8 +146,8 @@ namespace Getters { return 'images/avatar/avatar3_small.png' // Check if is this User! const myrec = UserStore.getters.getUserByUsername(username) - if (myrec && !!myrec.img && myrec.img !== '' && myrec.img !== 'undefined') { - return myrec.img + if (myrec && myrec.profile && !!myrec.profile.img && myrec.profile.img !== '' && myrec.profile.img !== 'undefined') { + return myrec.profile.img } else { return 'images/avatar/avatar3_small.png' } @@ -561,7 +564,7 @@ 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.img) || '') + localStorage.setItem(tools.localStorage.img, String(myuser.profile.img) || '') localStorage.setItem(tools.localStorage.token, state.x_auth_token) localStorage.setItem(tools.localStorage.expirationDate, expirationDate.toString()) localStorage.setItem(tools.localStorage.isLogged, String(true)) @@ -685,7 +688,7 @@ namespace Actions { surname, verified_email, perm, - img + profile: { img } }) isLogged = true diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index 1b2e3e9..f248fc0 100644 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -59,12 +59,19 @@ const colTablePermission = [ const colTableOperator = [ AddCol({ name: 'username', label_trans: 'reg.username' }), - // AddCol({ name: 'name', label_trans: 'reg.name' }), - // AddCol({ name: 'surname', label_trans: 'reg.surname' }), - // AddCol({ name: 'webpage', label_trans: 'reg.webpage' }), - // AddCol({ name: 'email', label_trans: 'reg.email' }), - // AddCol({ name: 'cell', label_trans: 'reg.cell' }), - // AddCol({ name: 'img', label_trans: 'reg.img' }), + AddCol({ name: 'name', label_trans: 'reg.name' }), + AddCol({ name: 'surname', label_trans: 'reg.surname' }), + AddCol({ name: 'email', label_trans: 'reg.email' }), + AddCol({ name: 'img', label_trans: 'event.img' }), + AddCol({ name: 'cell', label_trans: 'reg.cell' }), + AddCol({ name: 'qualification', label_trans: 'op.qualification' }), + AddCol({ name: 'disciplines', label_trans: 'op.disciplines' }), + AddCol({ name: 'certifications', label_trans: 'op.certifications' }), + AddCol({ name: 'intro', label_trans: 'op.intro' , fieldtype: tools.FieldType.html }), + AddCol({ name: 'info', label_trans: 'op.info', fieldtype: tools.FieldType.html }), + AddCol({ name: 'webpage', label_trans: 'op.webpage' }), + AddCol({ name: 'days_working', label_trans: 'op.days_working' }), + AddCol({ name: 'facebook', label_trans: 'op.facebook' }), AddCol(DeleteRec)] const colTableEvents = [ @@ -74,7 +81,7 @@ const colTableEvents = [ AddCol({ name: 'title', label_trans: 'event.title' }), AddCol({ name: 'details', label_trans: 'event.details' }), AddCol({ name: 'dateTimeStart', label_trans: 'event.dateTimeStart', fieldtype: tools.FieldType.date }), - AddCol({ name: 'dateTimeEnd', label_trans: 'event.dateTimeEnd' }), + AddCol({ name: 'dateTimeEnd', label_trans: 'event.dateTimeEnd', fieldtype: tools.FieldType.date }), AddCol({ name: 'bgcolor', label_trans: 'event.bgcolor' }), AddCol({ name: 'icon', label_trans: 'event.icon' }), AddCol({ name: 'img_small', label_trans: 'event.img_small' }), @@ -214,6 +221,7 @@ export const fieldsTable = { AddCol({ name: 'name', label_trans: 'reg.name' }), AddCol({ name: 'surname', label_trans: 'reg.surname' }), AddCol({ name: 'email', label_trans: 'reg.email' }), + AddCol({ name: 'cell', label_trans: 'reg.cell' }), AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: tools.FieldType.date }), AddCol({ name: 'perm', label_trans: 'reg.perm', fieldtype: tools.FieldType.binary, jointable: 'permissions' }), AddCol({ name: 'img', label_trans: 'reg.img', sortable: false }), diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 1c6efaa..db46692 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -30,6 +30,10 @@ import { dom } from 'quasar' const { height, width } = dom +import Cookies from 'js-cookie' + +const TokenKey = 'Admin-Token' + export interface INotify { color?: string | 'primary' textColor?: string @@ -37,6 +41,8 @@ export interface INotify { } export const tools = { + CAN_EDIT: 'q-ce', + listBestColor: [ 'blue', 'green', @@ -117,7 +123,8 @@ export const tools = { boolean: 1, date: 2, string: 4, - binary: 8 + binary: 8, + html: 16 }, SelectListNumPeople: [ @@ -2544,6 +2551,19 @@ export const tools = { return this.listBestColor[index] else return 'primary' + }, + getCookie(mytok) { + const ris = Cookies.get(mytok) + console.log('getToken', ris) + return ris + }, + + setCookie(mytok, value: string) { + return Cookies.set(mytok, value) + }, + + removeCookie(mytok) { + return Cookies.remove(mytok) } // getLocale() { diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 3c0906f..8d0e6d6 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -2,14 +2,14 @@ import Cookies from 'js-cookie' const TokenKey = 'Admin-Token' -export function getToken() { +export function getCookie() { return Cookies.get(TokenKey) } -export function setToken(token: string) { +export function setCookie(token: string) { return Cookies.set(TokenKey, token) } -export function removeToken() { +export function removeCookie() { return Cookies.remove(TokenKey) }