- Message notify when 'Ask Info' and user is not logged

- Ask Info and Book show message if not logged
- TableField fixed and added some features
This commit is contained in:
Paolo Arena
2019-11-04 20:29:35 +01:00
parent f30e6afd9e
commit b27f7e3cbf
26 changed files with 577 additions and 372 deletions

View File

@@ -27,7 +27,7 @@ export const shared_consts = {
},
fieldsUserToChange() {
return ['username', 'email', 'cell', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline']
return ['username', 'email', 'cell', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'img', 'ipaddr', 'lasttimeonline', 'profile']
}
}

View File

@@ -33,11 +33,12 @@ import { IMessagePage, IMessage, IIdentity, MsgDefault } from '../../model'
import MixinUsers from '../../mixins/mixin-users'
import { CDateTime } from '../CDateTime'
import MixinOperator from '../../mixins/mixin-operator'
import { CMyAvatar } from '../CMyAvatar'
@Component({
mixins: [MixinOperator, MixinUsers],
name: 'CEventsCalendar',
components: { Logo, Footer, CTitle, CImgText, QDateTimeScroller, QDateScroller, CMySelect, CMyEditor, CDateTime }
components: { Logo, Footer, CTitle, CImgText, QDateTimeScroller, QDateScroller, CMySelect, CMyEditor, CDateTime, CMyAvatar }
})
export default class CEventsCalendar extends Vue {
public $q
@@ -442,6 +443,10 @@ export default class CEventsCalendar extends Vue {
if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) {
// Visu right Toolbar to make SignIn
GlobalStore.state.RightDrawerOpen = true
tools.showNeutralNotif(this.$q, this.$t('login.needlogin'))
tools.scrollToTop()
// window.scrollTo(0, 0)
// this.$router.push('/signin')
} else {
console.log('addBookEventMenu')
@@ -461,6 +466,10 @@ export default class CEventsCalendar extends Vue {
if (!UserStore.state.isLogged || !UserStore.state.my.verified_email) {
// Visu right Toolbar to make SignIn
GlobalStore.state.RightDrawerOpen = true
tools.showNeutralNotif(this.$q, this.$t('login.needlogin'))
tools.scrollToTop()
// this.$router.push('/signin')
} else {
console.log('askForInfoEventMenu')

View File

@@ -55,17 +55,13 @@
<!--<span class="cal__teacher-content">{{myevent.teacher}}</span>-->
<span class="cal__teacher-content">
<q-chip>
<q-avatar>
<img :src="getImgTeacherByUsername(myevent.teacher)">
</q-avatar>
<CMyAvatar :myimg="getImgTeacherByUsername(myevent.teacher)"></CMyAvatar>
<span class="cal__teacher-content">{{getTeacherByUsername(myevent.teacher)}}</span>
</q-chip>
<span v-if="getImgTeacherByUsername(myevent.teacher2) && isValidUsername(myevent.teacher2)"
class="margin_avatar2"></span>
<q-chip v-if="getImgTeacherByUsername(myevent.teacher2) && isValidUsername(myevent.teacher2)">
<q-avatar>
<img :src="getImgTeacherByUsername(myevent.teacher2)">
</q-avatar>
<CMyAvatar :myimg="getImgTeacherByUsername(myevent.teacher2)"></CMyAvatar>
<span class="cal__teacher-content">{{getTeacherByUsername(myevent.teacher2)}}</span>
</q-chip>
</span>
@@ -297,6 +293,7 @@
<q-input v-model="bookEventForm.msgbooking" :label="$t('cal.msgbooking')+':'"
type="textarea" debounce="500"
input-class="myinput-area"
>
</q-input>
</q-card-section>
@@ -358,7 +355,8 @@
<q-card class="text-white windowcol">
<q-card-section>
<q-input v-model="askInfoForm.message" :label="$t('cal.msgbooking')+':'"
autofocus debounce="500" type="textarea">
autofocus debounce="500" type="textarea"
input-class="myinput-area">
</q-input>
</q-card-section>
</q-card>
@@ -610,17 +608,13 @@
class="margin_with"></span></span>
<q-chip>
<q-avatar>
<img :src="getImgTeacherByUsername(event.teacher)">
</q-avatar>
<CMyAvatar :myimg="getImgTeacherByUsername(event.teacher)"></CMyAvatar>
<span class="cal__teacher-content">{{getTeacherByUsername(event.teacher)}}</span>
</q-chip>
<span v-if="getImgTeacherByUsername(event.teacher2) && isValidUsername(event.teacher2)"
class="margin_avatar2"></span>
<q-chip v-if="getImgTeacherByUsername(event.teacher2) && isValidUsername(event.teacher2)">
<q-avatar>
<img :src="getImgTeacherByUsername(event.teacher2)">
</q-avatar>
<CMyAvatar :myimg="getImgTeacherByUsername(event.teacher2)"></CMyAvatar>
<span class="cal__teacher-content">{{getTeacherByUsername(event.teacher2)}}</span>
</q-chip>

View File

@@ -11,12 +11,10 @@ import { SingleProject } from '../projects/SingleProject'
import { lists } from '../../store/Modules/lists'
import { IParamsQuery } from '../../model/GlobalStore'
import { fieldsTable } from '../../store/Modules/fieldsTable'
import { CDateTime } from '../CDateTime'
import { CMyToggleList } from '../CMyToggleList'
import { CMyChipList } from '../CMyChipList'
import { CMyPopupEdit } from '../CMyPopupEdit'
@Component({
components: { CDateTime, CMyToggleList, CMyChipList }
components: { CMyPopupEdit }
})
export default class CGridTableRec extends Vue {
@Prop({ required: false }) public prop_mytable: string
@@ -54,7 +52,7 @@ export default class CGridTableRec extends Vue {
public valPrec: string = ''
public separator: 'horizontal'
public filter: string = ''
public filter = undefined
public rowsel: any
public dark: boolean = true
public canEdit: boolean = false
@@ -84,8 +82,16 @@ export default class CGridTableRec extends Vue {
public undoVal() {
console.log('undoVal', 'colsel', this.colsel, 'valprec', this.valPrec, 'this.colkey', this.colkey, 'this.selected', this.rowsel)
console.table(this.serverData)
if (this.colsel)
this.rowsel[this.colsel.field] = this.valPrec
if (this.colsel) {
if (this.colsel.subfield !== '') {
if (this.rowsel[this.colsel.field] === undefined)
this.rowsel[this.colsel.field] = {}
this.rowsel[this.colsel.field][this.colsel.subfield] = this.valPrec
} else {
this.rowsel[this.colsel.field] = this.valPrec
}
}
// this.serverData[this.colsel] = this.valPrec
}
@@ -93,13 +99,29 @@ export default class CGridTableRec extends Vue {
public SaveValue(newVal, valinitial) {
console.log('SaveValue', newVal, 'rowsel', this.rowsel)
// Update value in table memory
if (this.colsel.subfield !== '') {
if (this.rowsel[this.colsel.field] === undefined)
this.rowsel[this.colsel.field] = {}
this.rowsel[this.colsel.field][this.colsel.subfield] = newVal
} else {
this.rowsel[this.colsel.field] = newVal
}
const mydata = {
id: this.idsel,
table: this.mytable,
fieldsvalue: {}
}
mydata.fieldsvalue[this.colsel.field] = newVal
if (this.colsel.subfield !== '') {
if (mydata.fieldsvalue[this.colsel.field] === undefined) {
mydata.fieldsvalue[this.colsel.field] = {}
}
mydata.fieldsvalue[this.colsel.field][this.colsel.subfield] = newVal
} else {
mydata.fieldsvalue[this.colsel.field] = newVal
}
this.valPrec = valinitial
@@ -124,7 +146,7 @@ export default class CGridTableRec extends Vue {
this.colExtra = []
this.mycolumns.forEach((elem) => {
if (elem.field !== tools.NOFIELD)
this.colVisib.push(elem.field)
this.colVisib.push(elem.field + elem.subfield)
if (elem.visible && elem.field === tools.NOFIELD)
this.colExtra.push(elem.name)
@@ -138,7 +160,7 @@ export default class CGridTableRec extends Vue {
}
public onRequest(props) {
console.log('onRequest')
console.log('onRequest', 'filter = ' , this.filter)
const { page, rowsPerPage, rowsNumber, sortBy, descending } = props.pagination
const filter = this.filter
@@ -273,13 +295,6 @@ export default class CGridTableRec extends Vue {
return this.returnedCount
}
public getclassCol(col) {
let mycl = (col.disable || !this.canEdit) ? '' : 'colmodif'
mycl += (col.fieldtype === tools.FieldType.date) ? ' coldate flex flex-container' : ''
return mycl
}
public async createNewRecord() {
this.loading = true
@@ -331,16 +346,19 @@ export default class CGridTableRec extends Vue {
}
public refresh() {
this.serverData = []
console.log('refresh')
// console.log('this.search', this.search)
if (!!this.search && this.search !== '')
this.filter = this.search
else
this.filter = ''
this.filter = undefined
// console.log('this.filter', this.filter)
this.onRequest({
pagination: this.pagination
pagination: this.pagination,
})
}
@@ -373,38 +391,6 @@ export default class CGridTableRec extends Vue {
}
}
public visuValByType(col: IColGridTable, val) {
if (col.fieldtype === tools.FieldType.date) {
if (val === undefined) {
return '[]'
} else {
return tools.getstrDateTime(val)
}
} else if (col.fieldtype === tools.FieldType.boolean) {
return (val) ? this.$t('dialog.yes') : this.$t('dialog.no')
} else if (col.fieldtype === tools.FieldType.binary) {
if (val === undefined)
return '[---]'
else
return fieldsTable.getArrStrByValueBinary(this, col, val)
} else {
if (val === undefined)
return '[]'
else if (val === '') {
return '[]'
} else {
let mystr = tools.firstchars(val, tools.MAX_CHARACTERS)
if (val) {
if (val.length > tools.MAX_CHARACTERS)
mystr += '...'
} else {
return val
}
return mystr
}
}
}
public changeCol(newval) {
tools.setCookie(this.mytable, this.colVisib.join('|'))
}
@@ -420,6 +406,13 @@ export default class CGridTableRec extends Vue {
mytab = this.tablesList.find((rec) => rec.value === this.tablesel)
}
if (mytab === undefined) {
this.tablesel = this.tablesList[0].value
if (this.tablesList) {
mytab = this.tablesList.find((rec) => rec.value === this.tablesel)
}
}
console.log('this.tablesel', this.tablesel, 'mytab', mytab)
if (mytab) {
@@ -428,10 +421,10 @@ export default class CGridTableRec extends Vue {
this.mycolumns = [...mytab.columns]
}
console.log('this.mycolumns')
console.log(this.mycolumns)
console.log('this.tablesList:')
console.table(this.tablesList)
// console.log('this.mycolumns')
// console.log(this.mycolumns)
// console.log('this.tablesList:')
// console.table(this.tablesList)
if (!!this.mycolumns) {
this.mycolumns.forEach((rec: IColGridTable) => {

View File

@@ -20,7 +20,7 @@
<q-tr :props="props">
<q-th
v-for="col in props.cols"
v-if="colVisib.includes(col.field)"
v-if="colVisib.includes(col.field + col.subfield)"
:key="col.name"
:props="props"
class="text-italic text-weight-bold"
@@ -56,8 +56,9 @@
<q-select
v-if="mytable"
v-model="colVisib"
rounded
outlined
multiple
borderless
dense
options-dense
:display-value="$t('grid.columns')"
@@ -90,95 +91,16 @@
</template>
<q-tr v-if="mytable" slot="body" slot-scope="props" :props="props">
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field)">
<div v-if="col.fieldtype === tools.FieldType.date">
<div :class="getclassCol(col)">
<CDateTime
:label="col.label"
class="cursor-pointer"
:valueDate="props.row[col.name]"
:readonly="false"
:dense="true"
:canEdit="canEdit"
@savetoclose="SaveValue"
@show="selItem(props.row, col)"
>
</CDateTime>
</div>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.boolean">
<div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }}
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<q-checkbox v-model="props.row[col.name]" label="">
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colVisib.includes(col.field + col.subfield)">
<CMyPopupEdit :canEdit="canEdit"
:col="col"
:row.sync="props.row"
:field="col.field"
:subfield="col.subfield"
@save="SaveValue"
@show="selItem(props.row, col)">
</q-checkbox>
{{ visuValByType(col, props.row[col.name]) }}
</q-popup-edit>
</div>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.binary">
<div :class="getclassCol(col)">
<CMyChipList
:value="props.row[col.name]"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
:opticon="db_fieldsTable.getIconByTable(col.jointable)"
></CMyChipList>
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<CMyToggleList :label="col.title"
:options="db_fieldsTable.getTableJoinByName(col.jointable)"
:value.sync="props.row[col.name]"
:optval="db_fieldsTable.getKeyByTable(col.jointable)"
:optlab="db_fieldsTable.getLabelByTable(col.jointable)"
>
</CMyToggleList>
</q-popup-edit>
</div>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.string">
<div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }}
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<q-input v-model="props.row[col.name]"
autofocus
>
</q-input>
</q-popup-edit>
</div>
</div>
<div v-else-if="col.fieldtype === tools.FieldType.html">
<div :class="getclassCol(col)">
{{ visuValByType(col, props.row[col.name]) }}
<q-popup-edit v-if="canEdit" v-model="props.row[col.name]" :disable="col.disable"
:title="col.title" buttons
@save="SaveValue" @show="selItem(props.row, col)">
<q-input v-model="props.row[col.name]"
autofocus
@keyup.enter.stop
type="textarea">
</q-input>
</q-popup-edit>
</div>
</div>
</CMyPopupEdit>
</q-td>
<q-td v-for="col in mycolumns" :key="col.name" :props="props" v-if="colExtra.includes(col.name)">
<div v-if="col.action && visCol(col)">

View File

@@ -3,7 +3,6 @@ import { Component, Prop, Watch } from 'vue-property-decorator'
import { tools } from '../../store/Modules/tools'
import { toolsext } from '@src/store/Modules/toolsext'
import { IOperators } from '../../model/GlobalStore'
@Component({
name: 'CMySelect'
@@ -26,14 +25,7 @@ export default class CMySelect extends Vue {
return tools
}
public nothing() {
}
public changeval(newval) {
// console.log('changeval', newval)
// const newvallab = newval[`${this.optval}`]
// this.myvalue = newvallab
this.$emit('update:value', newval)
}

View File

@@ -2,8 +2,9 @@
<div>
<div v-if="useinput">
<q-select
rounded
outlined
:input-class="myclass"
filled
v-model="myvalue"
:use-input="useinput"
input-debounce="0"
@@ -20,8 +21,10 @@
</div>
<div v-else>
<q-select
rounded
outlined
dense
:input-class="myclass"
filled
v-model="myvalue"
:options="options"
:option-value="optval"

View File

@@ -12,6 +12,7 @@ import { static_data } from '@src/db/static_data'
import Quasar from 'quasar'
import { FormNewsletter } from '../FormNewsletter'
import { IUserState } from '../../model'
@Component({
name: 'Footer',
@@ -32,18 +33,25 @@ export default class Footer extends Vue {
}
get TelegramSupport() {
return db_data.TELEGRAM_SUPPORT
return GlobalStore.getters.getValueSettingsByKey('TELEGRAM_SUPPORT')
}
get Whatsapp_Cell() {
return GlobalStore.getters.getValueSettingsByKey('WHATSAPP_CELL')
}
get FBPage() {
return db_data.URL_FACEBOOK
const fb = GlobalStore.getters.getValueSettingsByKey('URL_FACEBOOK')
return fb
}
get InstagramPage() {
return db_data.URL_INSTAGRAM
const insta = GlobalStore.getters.getValueSettingsByKey('URL_INSTAGRAM')
return insta
}
get static_data(){
get static_data() {
return static_data
}
}

View File

@@ -80,6 +80,9 @@
<q-page-scroller position="bottom-right" :scroll-offset="850" :offset="[18, 18]" style="opacity: 0.3">
<q-btn fab icon="keyboard_arrow_up" color="accent"/>
</q-page-scroller>
<q-page-sticky position="bottom-right" :offset="[18, 78]">
<q-btn fab icon="fab fa-whatsapp" color="green" />
</q-page-sticky>
</div>
</template>

View File

@@ -16,13 +16,14 @@ import { static_data } from '../../db/static_data'
import globalroutines from '../../globalroutines'
import MixinUsers from '../../mixins/mixin-users'
import { CMyAvatar } from '../CMyAvatar'
@Component({
name: 'Header',
mixins: [MixinUsers],
components: {
drawer,
messagePopover, CSignIn
messagePopover, CSignIn, CMyAvatar
}
})

View File

@@ -109,9 +109,7 @@
</q-btn>
<q-btn class="q-mx-xs" v-if="static_data.functionality.SHOW_USER_MENU && isLogged" round dense flat
@click="rightDrawerOpen = !rightDrawerOpen">
<q-avatar size="30px">
<img :src="getMyImg">
</q-avatar>
<CMyAvatar :myimg="getMyImg"></CMyAvatar>
</q-btn>
</q-toolbar>
@@ -130,6 +128,7 @@
</q-drawer>
<!-- USER BAR -->
<q-drawer v-if="static_data.functionality.SHOW_USER_MENU" v-model="rightDrawerOpen" side="right" elevated>
<div id="profile">
@@ -138,9 +137,8 @@
</q-img>
<div class="absolute-top bg-transparent text-black center_img" style="margin-top: 10px;">
<q-avatar class="q-mb-sm center_img">
<img :src="`../../` + getMyImg">
</q-avatar>
<CMyAvatar :myimg="getMyImg"></CMyAvatar>
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
dense flat round icon="close" @click="rightDrawerOpen = !rightDrawerOpen">
</q-btn>

View File

@@ -7,6 +7,8 @@ export * from './CBook'
export * from './CMyPage'
export * from './CTitle'
export * from './CMySelect'
export * from './CMyAvatar'
export * from './CMyPopupEdit'
export * from './CMyToggleList'
export * from './CMyChipList'
export * from './CMyEditor'

View File

@@ -53,7 +53,8 @@ export default class MixinUsers extends Vue {
}
get getMyImg() {
return 'statics/' + UserStore.getters.getImgByUsername(UserStore.state.my.username)
const ris = UserStore.getters.getImgByUsername(UserStore.state.my.username)
return (ris !== '') ? 'statics/' + ris : ''
}
get MenuCollapse() {

View File

@@ -26,6 +26,14 @@ export interface ICfgData {
userId?: string
}
export interface ISettings {
key?: string
type?: number
value_str?: string
value_date?: Date,
value_num?: number
}
export interface ITestp1 {
contatore: number
mioarray: ICfgServer[]
@@ -40,6 +48,7 @@ export interface IConfig {
}
export interface IGlobalState {
finishLoading: boolean
conta: number
wasAlreadySubOnDb: boolean
wasAlreadySubscribed: boolean
@@ -60,6 +69,7 @@ export interface IGlobalState {
listatodo: IMenuList[]
arrConfig: IConfig[]
lastaction: IAction
settings: ISettings[],
}
export interface IMenuList {
@@ -217,6 +227,7 @@ export interface IParamsQuery {
export interface IColGridTable {
name: string
subfield?: string
required?: boolean
label?: string
label_trans?: string

View File

@@ -1,16 +1,5 @@
import { IToken } from 'model/other'
export const DefaultUser: IUserFields = {
email: '',
username: '',
name: '',
surname: '',
password: '',
profile: {
img: ''
}
}
const enum ESexType {
None = 0,
Male = 1,

View File

@@ -144,6 +144,7 @@ const msgglobal = {
enter: 'Login',
errato: "Username o password errata. Riprovare",
completato: 'Login effettuato!',
needlogin: 'E\' necessario effettuare il login prima di continuare'
},
reset: {
title_reset_pwd: "Reimposta la tua Password",
@@ -442,6 +443,7 @@ const msgglobal = {
enter: 'Entra',
errato: "Nombre de usuario, correo o contraseña incorrectos. inténtelo de nuevo",
completato: 'Login realizado!',
needlogin: 'Debes iniciar sesión antes de continuar',
},
reset: {
title_reset_pwd: "Restablece tu contraseña",
@@ -737,6 +739,7 @@ const msgglobal = {
enter: 'Entrez',
errato: "Nom d'utilisateur, email ou mot de passe incorrect. réessayer",
completato: 'Connexion faite!',
needlogin: 'Vous devez vous connecter avant de continuer',
},
reset: {
title_reset_pwd: "Réinitialiser votre mot de passe",
@@ -1031,6 +1034,7 @@ const msgglobal = {
enter: 'Login',
errato: "Username or password wrong. Please retry again",
completato: 'Login successfully!',
needlogin: 'You must login before continuing',
},
reset: {
title_reset_pwd: "Reset your Password",
@@ -1327,6 +1331,7 @@ const msgglobal = {
enter: 'Login',
errato: "Username or password wrong. Please retry again",
completato: 'Login successfully!',
needlogin: 'You must login before continuing',
},
reset: {
title_reset_pwd: "Reset your Password",

View File

@@ -34,6 +34,7 @@ getstateConnSaved()
})
const state: IGlobalState = {
finishLoading: false,
conta: 0,
wasAlreadySubscribed: false,
wasAlreadySubOnDb: false,
@@ -66,7 +67,8 @@ const state: IGlobalState = {
table: '',
type: 0,
_id: 0
}
},
settings: []
}
async function getConfig(id) {
@@ -152,6 +154,45 @@ namespace Getters {
return ris
}, 't')
const getListByTable = b.read((state) => (table) => {
if (table === tools.TABEVENTS)
return CalendarStore.state.eventlist
else if (table === 'operators')
return CalendarStore.state.operators
else if (table === 'wheres')
return CalendarStore.state.wheres
else if (table === 'contribtype')
return CalendarStore.state.contribtype
else if (table === 'bookings')
return CalendarStore.state.bookedevent
else if (table === 'users')
return UserStore.state.usersList
else if (table === 'sendmsgs')
return MessageStore.state.last_msgs
else if (table === 'settings')
return UserStore.state.settings
else if (table === 'permissions')
return UserStore.state.permissionsList
else
return null
}, 'getListByTable')
const getValueSettingsByKey = b.read((mystate: IGlobalState) => (key): any => {
const myrec = mystate.settings.find((rec) => rec.key === key)
if (!!myrec) {
if (myrec.type === tools.FieldType.date)
return myrec.value_date
if (myrec.type === tools.FieldType.number)
return myrec.value_num
else
return myrec.value_str
} else {
return ''
}
}, 'getValueSettingsByKey')
export const getters = {
get testpao1_getter_contatore() {
return testpao1_getter_contatore()
@@ -187,6 +228,14 @@ namespace Getters {
return getmenu()
},
get getListByTable() {
return getListByTable()
},
get getValueSettingsByKey() {
return getValueSettingsByKey()
},
get t() {
return t()
},
@@ -270,35 +319,13 @@ namespace Mutations {
}
function getListByTable(table): any[] {
if (table === tools.TABEVENTS)
return CalendarStore.state.eventlist
else if (table === 'operators')
return CalendarStore.state.operators
else if (table === 'wheres')
return CalendarStore.state.wheres
else if (table === 'contribtype')
return CalendarStore.state.contribtype
else if (table === 'bookings')
return CalendarStore.state.bookedevent
else if (table === 'users')
return UserStore.state.usersList
else if (table === 'sendmsgs')
return MessageStore.state.last_msgs
else if (table === 'permissions')
return UserStore.state.permissionsList
else
return null
}
function UpdateValuesInMemory(mystate: IGlobalState, mydata: IDataPass) {
const id = mydata.id
const table = mydata.table
try {
const mylist = getListByTable(table)
const mylist = Getters.getters.getListByTable(table)
const mykey = fieldsTable.getKeyByTable(table)
const myrec = mylist.find((event) => event[mykey] === id)
@@ -653,13 +680,14 @@ namespace Actions {
const myuserid = (UserStore.state.my._id) ? UserStore.state.my._id : '0'
const ris = await Api.SendReq('/loadsite/' + myuserid + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
return await Api.SendReq('/loadsite/' + myuserid + '/' + process.env.APP_ID + '/' + showall, 'GET', null)
.then((res) => {
CalendarStore.state.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
CalendarStore.state.eventlist = (res.data.eventlist) ? res.data.eventlist : []
CalendarStore.state.operators = (res.data.operators) ? res.data.operators : []
CalendarStore.state.wheres = (res.data.wheres) ? res.data.wheres : []
CalendarStore.state.contribtype = (res.data.contribtype) ? res.data.contribtype : []
GlobalStore.state.settings = (res.data.settings) ? [...res.data.settings] : []
})
.catch((error) => {
@@ -668,8 +696,6 @@ namespace Actions {
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
})
return ris
}
export const actions = {

View File

@@ -122,7 +122,7 @@ namespace Actions {
data.datemsg = tools.getDateNow()
data.status = StatusMessage.WaitingToSend
// Options
// data.options = tools.SetBit(data.options, shared_consts.MessageOptions.Notify_ByEmail)
data.options = tools.SetBit(data.options, shared_consts.MessageOptions.Notify_ByEmail)
data.options = tools.SetBit(data.options, shared_consts.MessageOptions.Notify_ByPushNotification)
console.log('DOPO:')

View File

@@ -86,13 +86,13 @@ namespace Getters {
const getImgTeacherByUsername = b.read((mystate: ICalendarState) => (username): string => {
if (username === '')
return 'images/avatar/avatar3_small.png'
return ''
// 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'
return ''
}
}, 'getImgTeacherByUsername')

View File

@@ -20,21 +20,23 @@ import { shared_consts } from '../../common/shared_vuejs'
const bcrypt = require('bcryptjs')
const DefaultUser: IUserFields = {
_id: '',
email: '',
username: '',
name: '',
surname: '',
password: '',
tokens: [],
verified_email: false,
profile: {
img: ''
}
}
// State
const state: IUserState = {
my: {
_id: '',
email: '',
username: '',
name: '',
surname: '',
password: '',
tokens: [],
verified_email: false,
profile: {
img: ''
}
},
my: DefaultUser,
lang: process.env.LANG_DEFAULT,
repeatPassword: '',
categorySel: 'personal',
@@ -143,13 +145,14 @@ namespace Getters {
const getImgByUsername = b.read((mystate: IUserState) => (username): string => {
if (username === '')
return 'images/avatar/avatar3_small.png'
return ''
// Check if is this User!
const myrec = UserStore.getters.getUserByUsername(username)
// console.log('myrec', myrec)
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'
return ''
}
}, 'getImgByUsername')
@@ -192,7 +195,7 @@ namespace Getters {
},
get getUsersList() {
return getUsersList()
}
},
}
}
@@ -613,6 +616,7 @@ namespace Actions {
localStorage.removeItem(tools.localStorage.wasAlreadySubOnDb)
state.isLogged = false
state.my = { ...DefaultUser }
await GlobalStore.actions.clearDataAfterLogout()
@@ -634,7 +638,6 @@ namespace Actions {
async function setGlobal(isLogged: boolean) {
console.log('setGlobal')
// state.isLogged = true
state.isLogged = isLogged
if (isLogged) {
// console.log('state.isLogged', state.isLogged)
@@ -646,12 +649,17 @@ namespace Actions {
const p3 = await GlobalStore.actions.loadAfterLogin()
state.isLogged = isLogged
if (static_data.functionality.ENABLE_TODOS_LOADING)
await Todos.actions.dbLoad({ checkPending: true })
if (static_data.functionality.ENABLE_PROJECTS_LOADING)
await Projects.actions.dbLoad({ checkPending: true, onlyiffirsttime: true })
GlobalStore.state.finishLoading = true
return true
// console.log('setGlobal: END')
}
@@ -698,11 +706,11 @@ namespace Actions {
}
}
await setGlobal(isLogged)
return await setGlobal(isLogged)
// console.log('autologin _id STATE ', state._id)
return true
// return true
} catch (e) {
console.error('ERR autologin ', e.message)
return false

View File

@@ -2,6 +2,7 @@ import { IColGridTable } from '../../model'
import { lists } from './lists'
import { tools } from '@src/store/Modules/tools'
import { shared_consts } from '@src/common/shared_vuejs'
import { GlobalStore } from '@store'
const DeleteRec = {
name: 'deleterec',
@@ -24,6 +25,7 @@ function AddCol(params: IColGridTable) {
label_trans: (params.label_trans === undefined) ? '' : params.label_trans,
align: (params.align === undefined) ? 'left' : params.align,
field: (params.field === undefined) ? params.name : params.field,
subfield: (params.subfield === undefined) ? '' : params.subfield,
sortable: (params.sortable === undefined) ? true : params.sortable,
disable: (params.disable === undefined) ? false : params.disable,
titlepopupedit: (params.titlepopupedit === undefined) ? '' : params.titlepopupedit,
@@ -40,7 +42,7 @@ function AddCol(params: IColGridTable) {
const colTableWhere = [
AddCol({ name: 'code', label_trans: 'where.code' }),
AddCol({ name: 'placename', label_trans: 'cal.where' }),
AddCol({ name: 'placename', label_trans: 'cal.where'} ),
AddCol({ name: 'whereicon', label_trans: 'where.whereicon' }),
AddCol(DeleteRec)
]
@@ -51,6 +53,15 @@ const colcontribtype = [
AddCol(DeleteRec)
]
const colsettings = [
AddCol({ name: 'key', label_trans: 'col.label' }),
AddCol({ name: 'type', label_trans: 'col.type', fieldtype: tools.FieldType.select, jointable: 'fieldstype' }),
AddCol({ name: 'value_str', label_trans: 'col.value', fieldtype: tools.FieldType.string }),
AddCol({ name: 'value_date', label_trans: 'cal.data', fieldtype: tools.FieldType.date }),
AddCol({ name: 'value_num', label_trans: 'cal.num', fieldtype: tools.FieldType.number }),
AddCol(DeleteRec)
]
const colTablePermission = [
AddCol({ name: '_id', label_trans: 'others.value' }),
AddCol({ name: 'label', label_trans: 'proj.longdescr' }),
@@ -86,12 +97,12 @@ const colTableEvents = [
AddCol({ name: 'icon', label_trans: 'event.icon' }),
AddCol({ name: 'img_small', label_trans: 'event.img_small' }),
AddCol({ name: 'img', label_trans: 'event.img' }),
AddCol({ name: 'wherecode', label_trans: 'event.where' }),
AddCol({ name: 'contribtype', label_trans: 'event.contribtype' }),
AddCol({ name: 'wherecode', label_trans: 'event.where', fieldtype: tools.FieldType.select, jointable: 'wheres' }),
AddCol({ name: 'contribtype', label_trans: 'event.contribtype', fieldtype: tools.FieldType.select, jointable: 'contribtype' }),
AddCol({ name: 'price', label_trans: 'event.price' }),
AddCol({ name: 'infoafterprice', label_trans: 'event.infoafterprice' }),
AddCol({ name: 'teacher', label_trans: 'event.teacher' }),
AddCol({ name: 'teacher2', label_trans: 'event.teacher2' }),
AddCol({ name: 'teacher', label_trans: 'event.teacher', fieldtype: tools.FieldType.select, jointable: 'operators' }),
AddCol({ name: 'teacher2', label_trans: 'event.teacher2', fieldtype: tools.FieldType.select, jointable: 'operators' }),
AddCol({ name: 'infoextra', label_trans: 'event.infoextra' }),
AddCol({ name: 'linkpage', label_trans: 'event.linkpage' }),
AddCol({ name: 'linkpdf', label_trans: 'event.linkpdf' }),
@@ -142,15 +153,41 @@ export const fieldsTable = {
}
},
getValueByTable(col: IColGridTable, val) {
if (col.jointable) {
const mylist = this.getTableJoinByName(col.jointable)
const key = this.getKeyByTable(col.jointable)
const collab = this.getLabelByTable(col.jointable)
// console.table(mylist)
// console.log('key=', key, 'collab', collab, 'val', val)
const myris = mylist.find((myrec) => myrec[key] === val)
// console.log('myris', myris)
if (myris) {
return myris[collab]
} else {
return ''
}
} else {
return ''
}
},
getColByTable(table) {
if (table === 'permissions') {
return ['value', 'label']
}
},
getTableJoinByName(table) {
if (table === 'permissions') {
if (table === 'permissions')
return [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher]
}
else if (table === 'fieldstype')
return tools.FieldTypeArr
else
return GlobalStore.getters.getListByTable(table)
},
getrecTableList(mytable) {
return this.tablesList.find((rec) => rec.value === mytable)
@@ -181,14 +218,14 @@ export const fieldsTable = {
value: 'operators',
label: 'Insegnanti',
columns: colTableOperator,
colkey: '_id',
colkey: 'username',
collabel: 'username'
},
{
value: 'wheres',
label: 'Luoghi',
columns: colTableWhere,
colkey: '_id',
colkey: 'code',
collabel: 'placename'
},
{
@@ -212,7 +249,20 @@ export const fieldsTable = {
colkey: 'value',
collabel: 'label',
colicon: 'icon'
}
},
{
value: 'fieldstype',
label: 'Tipi di Campi',
colkey: 'value',
collabel: 'label'
},
{
value: 'settings',
label: 'Impostazioni',
columns: colsettings,
colkey: 'key',
collabel: 'key'
},
],
// IColGridTable
@@ -222,9 +272,9 @@ export const fieldsTable = {
AddCol({ name: 'surname', label_trans: 'reg.surname' }),
AddCol({ name: 'email', label_trans: 'reg.email' }),
AddCol({ name: 'cell', label_trans: 'reg.cell' }),
AddCol({ name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false }),
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 }),
AddCol(DeleteRec),
AddCol({
name: 'copyrec',

View File

@@ -4,6 +4,9 @@ import { costanti } from './costanti'
import { toolsext } from './toolsext'
import { translation } from './translation'
import Quasar, { colors, date, Screen } from 'quasar'
import { scroll } from 'quasar'
const { getScrollTarget, setScrollPosition } = scroll
import {
IBookedEvent,
ICollaborations,
@@ -124,9 +127,22 @@ export const tools = {
date: 2,
string: 4,
binary: 8,
html: 16
html: 16,
select: 32,
number: 64,
typeinrec: 128,
},
FieldTypeArr: [
{ label: 'Boolean', value: 1 },
{ label: 'Date', value: 2 },
{ label: 'String', value: 4 },
{ label: 'Binary', value: 8 },
{ label: 'Html', value: 16 },
{ label: 'Select', value: 32 },
{ label: 'Number', value: 64 }
],
SelectListNumPeople: [
{
id: 1,
@@ -1430,7 +1446,7 @@ export const tools = {
},
showNeutralNotif(q: any, msg) {
tools.showNotif(q, msg, { color: 'warning', icon: 'notifications' })
tools.showNotif(q, msg, { color: 'info', icon: 'notifications' })
},
showNotif(q: any, msg, data ?: INotify | null
@@ -2567,17 +2583,33 @@ export const tools = {
return Cookies.remove(mytok)
},
notshowPwd(payload) {
const mypay = {...payload}
try{
const mypay = { ...payload }
try {
if (!!mypay.password) {
mypay.password = '**********'
}
}catch (e) {
} catch (e) {
console.log('error', e)
}
return mypay
},
scrollToTop() {
const element = document.getElementById('mypage')
this.scrollToElement(element)
},
scrollToElementId(myid) {
const element = document.getElementById(myid)
this.scrollToElement(element)
},
scrollToElement(el) {
const target = getScrollTarget(el)
const offset = el.offsetTop
const duration = 500
console.log('target', target, 'offset', offset, 'duration', duration)
setScrollPosition(target, offset, duration)
}
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {
// return navigator.languages[0]

View File

@@ -9,10 +9,7 @@ import { IChat, IMessage, IUserState, MsgDefault, StatusMessage } from '../../mo
import { Getter } from 'vuex-class'
import { IMsgUsers } from '../../model/MessageStore'
import MixinUsers from '../../mixins/mixin-users'
import { scroll } from 'quasar'
const { getScrollTarget, setScrollPosition } = scroll
import { CMyAvatar } from '../../components/CMyAvatar'
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
@@ -21,7 +18,7 @@ const namespace = 'MessageModule'
@Component({
name: 'Messages',
mixins: [MixinUsers],
components: {}
components: { CMyAvatar }
})
export default class Messages extends Vue {
@@ -81,14 +78,6 @@ export default class Messages extends Vue {
return mystr
}
public scrollToElement(el) {
const target = getScrollTarget(el)
const offset = el.offsetTop
const duration = 1000
// console.log('target', target, 'offset', offset, 'duration', duration)
setScrollPosition(target, offset, duration)
}
public refreshdata(username: string) {
this.loading = true
@@ -103,7 +92,7 @@ export default class Messages extends Vue {
this.loading = false
const element = document.getElementById('last')
this.scrollToElement(element)
tools.scrollToElement(element)
// this.changemsgs('', '')
@@ -224,7 +213,7 @@ export default class Messages extends Vue {
data.status = StatusMessage.Sending
const element = document.getElementById('last')
this.scrollToElement(element)
tools.scrollToElement(element)
if (!ris)
tools.showNegativeNotif(self.$q, self.$t('cal.sendmsg_error'))

View File

@@ -76,9 +76,7 @@
<q-item clickable v-if="!!chatsel.username" @scroll="myonScroll">
<q-item-section avatar>
<q-avatar>
<img :src="getImgByUsername(chatsel.username)">
</q-avatar>
<CMyAvatar :username="chatsel.username"></CMyAvatar>
</q-item-section>
<q-item-section>
@@ -116,9 +114,7 @@
sent
bg-color="blue-2">
<template v-slot:avatar>
<q-avatar size="sm">
<img :src="getMyImg">
</q-avatar>
<CMyAvatar size="sm" :username="Username"></CMyAvatar>
</template>
</q-chat-message>