Step 1: Creating page Messages: userlist last messages + a page for all the messages received and sent.

- Added CMyEditor and CMySelect to the git committ.
This commit is contained in:
Paolo Arena
2019-10-26 02:21:14 +02:00
parent 33a239698c
commit 878ae96813
31 changed files with 802 additions and 115 deletions

View File

@@ -13,7 +13,7 @@ import { costanti } from '@src/store/Modules/costanti'
import { tools } from '@src/store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import * as ApiTables from '@src/store/Modules/ApiTables'
import { CalendarStore, GlobalStore, Projects, Todos, UserStore } from '@store'
import { CalendarStore, GlobalStore, MessageStore, Projects, Todos, UserStore } from '@store'
import messages from '../../statics/i18n'
import globalroutines from './../../globalroutines/index'
@@ -283,7 +283,7 @@ namespace Mutations {
else if (table === 'users')
return UserStore.state.usersList
else if (table === 'sendmsgs')
return UserStore.state.msgs
return MessageStore.state.last_msgs
else
return null
@@ -535,11 +535,11 @@ namespace Actions {
UserStore.mutations.setusersList(res.data.usersList)
}
if (res.data.msgs) {
UserStore.state.msgs = [...res.data.msgs]
if (res.data.last_msgs) {
MessageStore.state.last_msgs = [...res.data.last_msgs]
}
console.log('UserStore.state.msgs', UserStore.state.msgs)
// console.log('MessageStore.state.last_msgs', MessageStore.state.last_msgs)
// console.log('********** res', 'state.todos', state.todos, 'checkPending', checkPending)
// After Login will store into the indexedDb...

View File

@@ -17,7 +17,6 @@ import translate from './../../globalroutines/util'
import * as Types from '@src/store/Api/ApiTypes'
import { ICalendarState, ICfgServer } from '@src/model'
import { shared_consts } from '../../common/shared_vuejs'
import { IMessage } from '@src/model/Calendar'
const bcrypt = require('bcryptjs')
@@ -42,7 +41,6 @@ const state: IUserState = {
isAdmin: false,
isManager: false,
usersList: [],
msgs: [],
countusers: 0
}
@@ -142,7 +140,6 @@ namespace Getters {
const getImgByUsername = b.read((mystate: IUserState) => (username): string => {
// Check if is this User!
const myrec = UserStore.getters.getUserByUsername(username)
console.log('getImgByUsername', username, myrec)
if (myrec && !!myrec.img) {
return myrec.img
} else {
@@ -150,17 +147,6 @@ namespace Getters {
}
}, 'getImgByUsername')
const getlasts_messages = b.read((mystate: IUserState) => () => {
const ctrec = (mystate.msgs) ? mystate.msgs.slice(0, 5) : []
// const ctrec = (mystate.msgs) ? mystate.msgs.slice().reverse().slice(0, 5) : []
return (ctrec)
}, 'getlasts_messages')
const getnumMsgUnread = b.read((mystate: IUserState) => () => {
return mystate.msgs.filter((msg) => !msg.read).length
}, 'getnumMsgUnread')
export const getters = {
get isUserInvalid() {
return isUserInvalid()
@@ -200,14 +186,7 @@ namespace Getters {
},
get getUsersList() {
return getUsersList()
},
get getlasts_messages() {
return getlasts_messages()
},
get getnumMsgUnread() {
return getnumMsgUnread()
}
// get fullName() { return fullName();},
}
}
@@ -720,28 +699,6 @@ namespace Actions {
}
}
async function SendMsgEvent(context, msg: IMessage) {
console.log('SendMsgEvent', msg)
return await Api.SendReq('/sendmsg', 'POST', msg)
.then((res) => {
console.log('res', res)
if (res.status === 200) {
if (res.data.code === serv_constants.RIS_CODE_OK) {
msg._id = res.data.id
state.msgs.push(msg)
return true
}
}
return false
})
.catch((error) => {
console.error(error)
return false
})
}
/*
async function refreshUserInfos(){
let {token, refresh_token} = JWT.fetch();
@@ -765,7 +722,6 @@ namespace Actions {
resetpwd: b.dispatch(resetpwd),
signin: b.dispatch(signin),
signup: b.dispatch(signup),
SendMsgEvent: b.dispatch(SendMsgEvent),
vreg: b.dispatch(vreg)
}

View File

@@ -1,6 +1,7 @@
export {storeBuilder} from './Store/Store'
export {default as GlobalStore} from './GlobalStore'
export {default as UserStore} from './UserStore'
export {default as MessageStore} from './MessageStore'
export {default as Todos} from './Todos'
export {default as Projects} from './Projects'
export {default as CalendarStore} from './Store/calendar/CalendarStore'

View File

@@ -1,5 +1,6 @@
export const serv_constants = {
RIS_CODE_TODO_CREATING_NOTMYUSER: -1001,
RIS_CODE_NOT_MY_USERNAME: -1010,
RIS_CODE_ERR: -99,
RIS_CODE_EMAIL_ALREADY_VERIFIED: -5,

View File

@@ -26,6 +26,9 @@ import { func_tools } from '@src/store/Modules/toolsext'
import { serv_constants } from '@src/store/Modules/serv_constants'
import { shared_consts } from '@src/common/shared_vuejs'
import { dom } from 'quasar'
const { height, width } = dom
export interface INotify {
color?: string | 'primary'
textColor?: string
@@ -1737,8 +1740,11 @@ export const tools = {
,
getstrYYMMDDDateTime(mytimestamp) {
return date.formatDate(mytimestamp, 'YYYY-MM-DD HH:mm')
}
,
},
getstrYYMMDDDateTimeAll(mytimestamp) {
return date.formatDate(mytimestamp, 'YYYY-MM-DD HH:mm:ss')
},
// mystrdate "26.04.2013"
convertstrtoDate(mystrdate
@@ -1801,8 +1807,11 @@ export const tools = {
,
getTimestampsNow() {
return new Date().valueOf()
}
,
},
gettimestampByDate(mydate) {
return mydate.toString()
},
isMainProject(idproj) {
return idproj === process.env.PROJECT_ID_MAIN
@@ -2456,8 +2465,14 @@ export const tools = {
}
return record
})
}
,
},
getheight(mythis) {
// return height()
return mythis.$q.screen.height
},
getLastDateReadReset() {
return new Date(1999, 1, 1, 0, 0, 0)
},
isBitActive(bit, whattofind) {
return ((bit & whattofind) === whattofind)