other components...
This commit is contained in:
@@ -9,48 +9,41 @@ import { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { IDataPass } from '@model'
|
||||
import { shared_consts } from '../common/shared_vuejs'
|
||||
import { tools } from '../store/Modules/tools'
|
||||
import { func_tools } from '../store/Modules/toolsext'
|
||||
import { costanti } from '@costanti'
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
|
||||
// You can declare a mixin as the same style as components.
|
||||
export const MixinBase = {
|
||||
created() {
|
||||
|
||||
},
|
||||
mythis() {
|
||||
return this
|
||||
},
|
||||
|
||||
showNotif(msg: string) {
|
||||
export default function () {
|
||||
function showNotif(msg: string) {
|
||||
const $q = useQuasar()
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
|
||||
tools.showNotif($q, t(msg))
|
||||
},
|
||||
}
|
||||
|
||||
db_fieldsTable() {
|
||||
// return fieldsTable
|
||||
},
|
||||
function db_fieldsTable() {
|
||||
return fieldsTable
|
||||
}
|
||||
|
||||
getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any) {
|
||||
function getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any) {
|
||||
console.log('getValDb')
|
||||
return toolsext.getValDb(keystr, serv, def, table, subkey, id, idmain)
|
||||
},
|
||||
}
|
||||
|
||||
getValDbLang(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any) {
|
||||
|
||||
function getValDbLang(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any) {
|
||||
let ris = toolsext.getValDb(`${keystr}_${toolsext.getLocale()}`, serv, def, table, subkey)
|
||||
if (ris === def) ris = toolsext.getValDb(`${keystr}_it`, serv, def, table, subkey)
|
||||
return ris
|
||||
},
|
||||
}
|
||||
|
||||
async setValDb(key: string, value: any, type: any, serv: boolean, table?: string, subkey?: string, id?: any) {
|
||||
async function setValDb(key: string, value: any, type: any, serv: boolean, table?: string, subkey?: string, id?: any) {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
const { t } = useI18n()
|
||||
|
||||
// console.log('setValDb', key, value, serv, table, subkey)
|
||||
let mydatatosave: IDataPass | null = null
|
||||
@@ -166,9 +159,9 @@ export const MixinBase = {
|
||||
// Undo...
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
getarrValDb(keystr: string, serv: boolean) {
|
||||
function getarrValDb(keystr: string, serv: boolean) {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const myval = globalStore.getValueSettingsByKey(keystr, serv)
|
||||
@@ -184,6 +177,14 @@ export const MixinBase = {
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
showNotif,
|
||||
db_fieldsTable,
|
||||
getValDb,
|
||||
getValDbLang,
|
||||
setValDb,
|
||||
getarrValDb,
|
||||
}
|
||||
}
|
||||
|
||||
46
src/mixins/mixin-operator.ts
Executable file
46
src/mixins/mixin-operator.ts
Executable file
@@ -0,0 +1,46 @@
|
||||
import { useCalendarStore } from '@store/CalendarStore'
|
||||
|
||||
export default function () {
|
||||
function isEstate(){
|
||||
const now = new Date()
|
||||
return (now.getMonth() === 5) || (now.getMonth() === 6) || (now.getMonth() === 7) || (now.getMonth() === 8)
|
||||
}
|
||||
|
||||
function isEstateRiprenderanno(){
|
||||
const now = new Date()
|
||||
return (now.getMonth() === 9)
|
||||
}
|
||||
|
||||
function getOperators() {
|
||||
const calendarStore = useCalendarStore()
|
||||
return calendarStore.operators
|
||||
}
|
||||
|
||||
function getOperatorByUsername(username: string) {
|
||||
const calendarStore = useCalendarStore()
|
||||
return calendarStore.getOperatorByUsername(username)
|
||||
}
|
||||
|
||||
function getImgTeacherByUsername(username: string) {
|
||||
const calendarStore = useCalendarStore()
|
||||
return 'statics/images/' + calendarStore.getImgTeacherByUsername(username)
|
||||
}
|
||||
|
||||
function getTeacherByUsername(username: string) {
|
||||
const op = getOperatorByUsername(username)
|
||||
if (!!op) {
|
||||
return op.name + ' ' + op.surname
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
isEstate,
|
||||
isEstateRiprenderanno,
|
||||
getOperators,
|
||||
getOperatorByUsername,
|
||||
getImgTeacherByUsername,
|
||||
getTeacherByUsername,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user