- Finish to fix IOperators

- Fixit Date not change correctly
This commit is contained in:
Paolo Arena
2019-11-01 15:52:58 +01:00
parent 2c62c27e64
commit cdfc32c620
23 changed files with 365 additions and 135 deletions

View File

@@ -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()
}
}
}

View File

@@ -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

View File

@@ -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 }),

View File

@@ -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() {