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