other components... (2)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import axios, {
|
||||
AxiosInstance, AxiosPromise, AxiosResponse, AxiosInterceptorManager,
|
||||
} from 'axios'
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
|
||||
async function sendRequest(url: string, method: string, mydata: any) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
|
||||
@@ -36,47 +35,47 @@ function ReceiveResponsefromServer(tablesync: string, nametab: string, method: s
|
||||
}
|
||||
|
||||
// const algoliaApi = new AlgoliaSearch()
|
||||
export namespace ApiTool {
|
||||
export async function post(path: string, payload?: any) {
|
||||
export const Api = {
|
||||
async post(path: string, payload?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.downloading_server = 1
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('post', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function postFormData(path: string, payload?: any) {
|
||||
async postFormData(path: string, payload?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
globalStore.connData.downloading_server = 1
|
||||
return Request('postFormData', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function get(path: string, payload?: any) {
|
||||
async get(path: string, payload?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.downloading_server = 1
|
||||
globalStore.connData.uploading_server = 0
|
||||
return Request('get', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function put(path: string, payload?: any) {
|
||||
async put(path: string, payload?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('put', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function patch(path: string, payload?: any) {
|
||||
async patch(path: string, payload?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('patch', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function Delete(path: string, payload: any) {
|
||||
async Delete(path: string, payload: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('delete', path, payload)
|
||||
}
|
||||
},
|
||||
|
||||
export async function checkSession({ token, refresh_token }: any) {
|
||||
async checkSession({ token, refresh_token }: any) {
|
||||
return axios.post(process.env.API_URL + Paths.TOKEN_REFRESH, {
|
||||
refresh_token,
|
||||
}, {
|
||||
@@ -84,9 +83,9 @@ export namespace ApiTool {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
export async function SendReq(url: string, method: string, mydata: any, setAuthToken = false): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
async SendReq(url: string, method: string, mydata: any, setAuthToken = false): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
const mydataout = {
|
||||
...mydata,
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
@@ -97,10 +96,11 @@ export namespace ApiTool {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const $router = useRouter()
|
||||
// const $router = useRouter()
|
||||
|
||||
userStore.setServerCode(tools.EMPTY)
|
||||
userStore.setResStatus(0)
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
return new Promise((resolve, reject) => sendRequest(url, method, mydataout)
|
||||
.then((res) => {
|
||||
// console.log('res', res)
|
||||
@@ -121,7 +121,7 @@ export namespace ApiTool {
|
||||
// You probably is connectiong with other page...
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
userStore.setAuth('')
|
||||
$router.push('/signin')
|
||||
// $router.push('/signin')
|
||||
return reject({ code: toolsext.ERR_AUTHENTICATION })
|
||||
}
|
||||
}
|
||||
@@ -141,9 +141,9 @@ export namespace ApiTool {
|
||||
console.log('error', error)
|
||||
return reject(error)
|
||||
}))
|
||||
}
|
||||
},
|
||||
|
||||
export async function syncAlternative(mystrparam: string) {
|
||||
async syncAlternative(mystrparam: string) {
|
||||
// console.log('[ALTERNATIVE Background syncing', mystrparam)
|
||||
|
||||
const multiparams = mystrparam.split('|')
|
||||
@@ -178,7 +178,7 @@ export namespace ApiTool {
|
||||
console.log('----------------------- LEGGO QUALCOSA ', link)
|
||||
|
||||
// Insert/Delete/Update table to the server
|
||||
return SendReq(link, method, rec)
|
||||
return this.SendReq(link, method, rec)
|
||||
.then((ris) => {
|
||||
ReceiveResponsefromServer(tablesync, nametab, method, ris.data)
|
||||
lettoqualcosa = true
|
||||
@@ -216,6 +216,5 @@ export namespace ApiTool {
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
}
|
||||
export default ApiTool
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import { IBookedEvent, ICalendarState, IEvents } from 'model'
|
||||
|
||||
import { serv_constants } from './Modules/serv_constants'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
|
||||
import { serv_constants } from './Modules/serv_constants'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import { ITodo } from '@src/model'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
@@ -7,6 +7,8 @@ import { serv_constants } from '@store/Modules/serv_constants'
|
||||
import { costanti } from '@store/Modules/costanti'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import globalroutines from '../../globalroutines/index'
|
||||
import { useProjectStore } from '@store/Projects'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
|
||||
export function getLinkByTableName(nametable: string) {
|
||||
if (nametable === 'todos') {
|
||||
@@ -42,7 +44,7 @@ export function allTables() {
|
||||
}
|
||||
|
||||
async function updatefromIndexedDbToState(nametab: string) {
|
||||
await globalroutines( 'updatefromIndexedDbToState', nametab, null)
|
||||
await globalroutines('updatefromIndexedDbToState', nametab, null)
|
||||
.then(() => {
|
||||
console.log('updatefromIndexedDbToState! ')
|
||||
return true
|
||||
@@ -53,7 +55,7 @@ async function checkPendingMsg() {
|
||||
// console.log('checkPendingMsg')
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const config = await globalroutines( 'read', 'config', null, '1')
|
||||
const config = await globalroutines('read', 'config', null, '1')
|
||||
// console.log('config', config)
|
||||
|
||||
try {
|
||||
@@ -70,7 +72,8 @@ async function checkPendingMsg() {
|
||||
// ...
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => globalroutines( 'count', 'swmsg')
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
return new Promise((resolve, reject) => globalroutines('count', 'swmsg')
|
||||
.then((count) => {
|
||||
if (count > 0) {
|
||||
return resolve(true)
|
||||
@@ -93,7 +96,7 @@ async function sendSwMsgIfAvailable() {
|
||||
const count = await checkPendingMsg()
|
||||
if (count) {
|
||||
return navigator.serviceWorker.ready
|
||||
.then(() => globalroutines( 'readall', 'swmsg')
|
||||
.then(() => globalroutines('readall', 'swmsg')
|
||||
.then((arr_recmsg) => {
|
||||
if (arr_recmsg.length > 0) {
|
||||
// console.log('---------------------- 2) navigator (2) .serviceWorker.ready')
|
||||
@@ -120,10 +123,11 @@ async function sendSwMsgIfAvailable() {
|
||||
|
||||
export async function waitAndRefreshData() {
|
||||
// ++Todo: conv
|
||||
/* await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: false })
|
||||
return await Todos.actions.dbLoad({ checkPending: false })
|
||||
*/
|
||||
return null
|
||||
const projects = useProjectStore()
|
||||
const todos = useTodoStore()
|
||||
|
||||
await projects.dbLoad({ checkPending: false, onlyiffirsttime: false })
|
||||
return await todos.dbLoad({ checkPending: false })
|
||||
}
|
||||
|
||||
export async function waitAndcheckPendingMsg() {
|
||||
@@ -271,7 +275,7 @@ async function Sync_Execute(cmd: string, tablesync: string, nametab: string, met
|
||||
if (useServiceWorker()) {
|
||||
return navigator.serviceWorker.ready
|
||||
.then((sw) => {
|
||||
globalroutines( 'write', tablesync, item, id)
|
||||
globalroutines('write', tablesync, item, id)
|
||||
.then((ris) => {
|
||||
console.log('ris write:', ris)
|
||||
const sep = '|'
|
||||
@@ -287,7 +291,7 @@ async function Sync_Execute(cmd: string, tablesync: string, nametab: string, met
|
||||
// return sw.sync.register(multiparams)
|
||||
// } else {
|
||||
*/
|
||||
return globalroutines( 'write', 'swmsg', mymsgkey, multiparams)
|
||||
return globalroutines('write', 'swmsg', mymsgkey, multiparams)
|
||||
.then((ris2) => Api.syncAlternative(multiparams))
|
||||
.then(() => {
|
||||
let data = null
|
||||
@@ -431,7 +435,7 @@ export async function table_ModifyRecord(nametable: string, myitem: any, listFie
|
||||
let miorec: any = null
|
||||
if (useServiceWorker()) {
|
||||
// get record from IndexedDb
|
||||
miorec = await globalroutines( 'read', nametable, null, myobjsaved._id)
|
||||
miorec = await globalroutines('read', nametable, null, myobjsaved._id)
|
||||
if (miorec === undefined) {
|
||||
console.log('~~~~~~~~~~~~~~~~~~~~ !!!!!!!!!!!!!!!!!! Record not Found !!!!!! id=', myobjsaved._id)
|
||||
|
||||
@@ -459,7 +463,7 @@ export async function table_ModifyRecord(nametable: string, myitem: any, listFie
|
||||
if (useServiceWorker()) {
|
||||
// 2) Modify on IndexedDb
|
||||
console.log('// 2) Modify on IndexedDb', miorec)
|
||||
return globalroutines( 'write', nametable, miorec)
|
||||
return globalroutines('write', nametable, miorec)
|
||||
.then((ris) => Sync_SaveItem(nametable, 'PATCH', miorec)) // 3) Modify on the Server (call)
|
||||
}
|
||||
return Sync_SaveItem(nametable, 'PATCH', miorec)
|
||||
@@ -474,7 +478,7 @@ export function table_DeleteRecord(nametable: string, myobjtrov: any, id: any) {
|
||||
mymodule.deletemyitem(myobjtrov)
|
||||
|
||||
// 2) Delete from the IndexedDb
|
||||
globalroutines( 'delete', nametable, null, id)
|
||||
globalroutines('delete', nametable, null, id)
|
||||
|
||||
// 3) Delete from the Server (call)
|
||||
Sync_DeleteItem(nametable, myobjtrov, id)
|
||||
@@ -487,7 +491,7 @@ export function table_HideRecord(nametable: string, myobjtrov: any, id: any) {
|
||||
mymodule.deletemyitem(myobjtrov)
|
||||
|
||||
// 2) Delete from the IndexedDb
|
||||
globalroutines( 'delete', nametable, null, id)
|
||||
globalroutines('delete', nametable, null, id)
|
||||
|
||||
// 3) Hide from the Server (call)
|
||||
Sync_DeleteItem(nametable, myobjtrov, id)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
const css = require('@css')
|
||||
import { dom } from 'quasar'
|
||||
|
||||
let TIMER: any = null
|
||||
let TIMEOUT: any = null
|
||||
@@ -15,8 +14,8 @@ export const useProgressBar = defineStore('ProgressBar', {
|
||||
canSuccess: true,
|
||||
duration: 3000,
|
||||
height: '2px',
|
||||
color: css.mainStyle,
|
||||
failedColor: css.red1,
|
||||
color: '#4975BA',
|
||||
failedColor: '#c84242',
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
|
||||
@@ -34,6 +34,7 @@ import { useProjectStore } from '@store/Projects'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useCalendarStore } from '@store/CalendarStore'
|
||||
import { Router } from 'vue-router'
|
||||
|
||||
export interface INotify {
|
||||
color?: string | 'primary'
|
||||
@@ -1672,7 +1673,6 @@ export const tools = {
|
||||
|
||||
visumenu(elem: IListRoutes) { // : IListRoutes
|
||||
|
||||
|
||||
const userStore = useUserStore()
|
||||
let visu = ((elem.onlyAdmin && userStore.isAdmin) || (elem.onlyManager && userStore.isManager)
|
||||
|| (elem.onlySocioResidente && userStore.my.profile.socioresidente)
|
||||
@@ -1695,9 +1695,10 @@ export const tools = {
|
||||
return visu
|
||||
},
|
||||
|
||||
executefunc(myself: any, table: string, func: number, par: IParamDialog) {
|
||||
executefunc(mythisq: any, table: string, func: number, par: IParamDialog, mythis?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
const calendarStore = useCalendarStore()
|
||||
const { t } = useI18n()
|
||||
if (func === lists.MenuAction.DELETE) {
|
||||
// console.log('param1', par.param1)
|
||||
calendarStore.CancelBookingEvent({
|
||||
@@ -1705,11 +1706,13 @@ export const tools = {
|
||||
notify: par.param2 === true ? '1' : '0',
|
||||
}).then((ris: any) => {
|
||||
if (ris) {
|
||||
this.showPositiveNotif(myself.$q, myself.$t('cal.canceledbooking') + ' "' + par.param3 + '"')
|
||||
if (myself.bookEventpage)
|
||||
myself.bookEventpage.show = false
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorbooking'))
|
||||
this.showPositiveNotif(mythisq, t('cal.canceledbooking') + ' "' + par.param3 + '"')
|
||||
//++Todo: Calendar FIX:
|
||||
// if (myself.bookEventpage)
|
||||
// myself.bookEventpage.show = false
|
||||
} else {
|
||||
this.showNegativeNotif(mythisq, t('cal.cancelederrorbooking'))
|
||||
}
|
||||
})
|
||||
} else if (func === lists.MenuAction.DELETE_EVENT) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
@@ -1717,192 +1720,29 @@ export const tools = {
|
||||
if (ris) {
|
||||
// Remove this record from my list
|
||||
calendarStore.eventlist = calendarStore.eventlist.filter((event: IEvents) => (event._id !== par.param1._id))
|
||||
this.showPositiveNotif(myself.$q, myself.$t('cal.canceledevent') + ' "' + par.param1.title + '"')
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorevent'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.DELETE_EXTRALIST) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
globalStore.DeleteRec({ table: toolsext.TABEXTRALIST, id: par.param1._id }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.update_username()
|
||||
this.showPositiveNotif(myself.$q, myself.$t('reg.cancella_invitato') + ' "' + par.param1.name + ' ' + par.param1.surname + '"')
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.DELETE_USERLIST) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
globalStore.DeleteRec({ table: toolsext.TABUSER, id: par.param1._id }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.update_username()
|
||||
this.showPositiveNotif(myself.$q, myself.$t('reg.cancella_invitato') + ' "' + par.param1.name + ' ' + par.param1.surname + '"')
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.ZOOM_GIA_PARTECIPATO) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
const mydatatosave = {
|
||||
id: par.param1._id,
|
||||
ind_order: par.param1.ind_order,
|
||||
myfunc: func,
|
||||
data: par.param2,
|
||||
username: par.param2.username,
|
||||
notifBot: null,
|
||||
}
|
||||
|
||||
// if (par.param2.notifBot)
|
||||
// mydatatosave.notifBot = { un: par.param2.notifBot, txt: par.param3 }
|
||||
|
||||
// myself.EseguiCallServer()
|
||||
|
||||
globalStore.callFunz({ mydata: mydatatosave }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.Callback(func)
|
||||
this.showPositiveNotif(myself.$q, par.param3)
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.REGALA_INVITATO) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
let mydatatosave: IDataToSet = {
|
||||
id: null,
|
||||
username: '',
|
||||
table: '',
|
||||
fieldsvalue: {},
|
||||
notifBot: {},
|
||||
}
|
||||
|
||||
if (!!par.param1.invitante_username) {
|
||||
mydatatosave = {
|
||||
id: par.param1._id,
|
||||
username: par.param1.username,
|
||||
table: toolsext.TABLISTAINGRESSO,
|
||||
fieldsvalue: { invitante_username: par.param2.aportador_solidario },
|
||||
notifBot: {},
|
||||
this.showPositiveNotif(mythisq, t('cal.canceledevent') + ' "' + par.param1.title + '"')
|
||||
} else {
|
||||
this.showNegativeNotif(mythisq, t('cal.cancelederrorevent'))
|
||||
}
|
||||
} else {
|
||||
mydatatosave = {
|
||||
id: par.param1._id,
|
||||
username: '',
|
||||
table: toolsext.TABUSER,
|
||||
fieldsvalue: { aportador_solidario: par.param2.aportador_solidario },
|
||||
notifBot: {},
|
||||
}
|
||||
}
|
||||
|
||||
console.log('** par.param1', par.param1)
|
||||
console.log('** id', par.param1._id)
|
||||
|
||||
if (par.param3) {
|
||||
mydatatosave.notifBot = { un: par.param2.aportador_solidario, txt: par.param3 }
|
||||
}
|
||||
|
||||
globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
console.log('ris saveFieldValue', ris)
|
||||
if (ris) {
|
||||
this.showPositiveNotif(myself.$q, myself.$t('reg.invitato_regalato') + ' "' + par.param1.name + ' ' + par.param1.surname + '"')
|
||||
myself.update_username()
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.REGALA_INVITANTE) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
const mydatatosave: IDataToSet = {
|
||||
id: par.param1,
|
||||
table: toolsext.TABLISTAINGRESSO,
|
||||
fieldsvalue: { invitante_username: par.param2.invitante_username, ind_order_ingr: par.param2.ind_order_ingr },
|
||||
notifBot: null,
|
||||
}
|
||||
|
||||
if (par.param3) {
|
||||
mydatatosave.notifBot = { un: par.param2.invitante_username, txt: par.param3 }
|
||||
}
|
||||
|
||||
globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
console.log('ris saveFieldValue', ris)
|
||||
if (ris) {
|
||||
this.showPositiveNotif(myself.$q, myself.$t('reg.invitante_regalato') + ' "' + par.param2.name + ' ' + par.param2.surname + '"')
|
||||
myself.update_username()
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if ((func === lists.MenuAction.AGGIUNGI_NUOVO_IMBARCO) || (func === lists.MenuAction.CANCELLA_IMBARCO)) {
|
||||
const mydatatosave: IDataToSet = {
|
||||
username: par.param1.username,
|
||||
invitante_username: '',
|
||||
ind_order: -1,
|
||||
num_tess: 0,
|
||||
myfunc: func,
|
||||
data: par.param2,
|
||||
notifBot: null,
|
||||
}
|
||||
|
||||
if (func === lists.MenuAction.CANCELLA_IMBARCO) {
|
||||
mydatatosave.ind_order = par.param1.ind_order
|
||||
mydatatosave.num_tess = par.param1.num_tess
|
||||
mydatatosave.data.id = par.param2.rec._id
|
||||
}
|
||||
if (func === lists.MenuAction.AGGIUNGI_NUOVO_IMBARCO) {
|
||||
mydatatosave.invitante_username = par.param1.invitante_username
|
||||
}
|
||||
|
||||
myself.loading = true
|
||||
|
||||
mydatatosave.notifBot = { un: par.param2, txt: par.param3 }
|
||||
|
||||
globalStore.callFunz({ mydata: mydatatosave }).then((ris) => {
|
||||
myself.loading = false
|
||||
if (ris) {
|
||||
myself.update_username()
|
||||
if (func === lists.MenuAction.AGGIUNGI_NUOVO_IMBARCO)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('steps.sei_stato_aggiunto'))
|
||||
else if (func === lists.MenuAction.CANCELLA_IMBARCO)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('event.deleted'))
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.SOSTITUISCI) {
|
||||
// console.log('param1', par.param1, 'id', par.param1._id)
|
||||
const mydatatosave: IDataToSet = {
|
||||
id: par.param1._id,
|
||||
ind_order: par.param1.ind_order,
|
||||
myfunc: func,
|
||||
data: par.param2,
|
||||
username: par.param2.username,
|
||||
notifBot: null,
|
||||
inviaemail: par.param2.inviaemail,
|
||||
}
|
||||
|
||||
if (par.param2.notifBot)
|
||||
mydatatosave.notifBot = { un: par.param2.notifBot, txt: par.param3 }
|
||||
|
||||
myself.EseguiCallServer()
|
||||
|
||||
globalStore.callFunz({ mydata: mydatatosave }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.update_nave()
|
||||
myself.Callback()
|
||||
this.showPositiveNotif(myself.$q, par.param3 + '\n' + ' e inviato messaggio per aprire la Gift Chat!')
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.DELETE_RECTABLE) {
|
||||
// console.log('param1', par.param1)
|
||||
globalStore.DeleteRec({ table, id: par.param1 }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.ActionAfterYes(func, par.param2, null)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('db.deletedrecord'))
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recdelfailed'))
|
||||
mythis.ActionAfterYes(func, par.param2, null)
|
||||
this.showPositiveNotif(mythisq, t('db.deletedrecord'))
|
||||
} else {
|
||||
this.showNegativeNotif(mythisq, t('db.recdelfailed'))
|
||||
}
|
||||
})
|
||||
} else if (func === lists.MenuAction.DUPLICATE_RECTABLE) {
|
||||
// console.log('param1', par.param1)
|
||||
globalStore.DuplicateRec({ table, id: par.param1 }).then((ris) => {
|
||||
if (ris) {
|
||||
myself.ActionAfterYes(func, par.param2, ris.data)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('db.duplicatedrecord'))
|
||||
mythis.ActionAfterYes(func, par.param2, ris.data)
|
||||
this.showPositiveNotif(mythisq, t('db.duplicatedrecord'))
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recdupfailed'))
|
||||
this.showNegativeNotif(mythisq, t('db.recdupfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.INVIA_MSG_A_DONATORI) {
|
||||
// console.log('param1', par.param1)
|
||||
@@ -1913,28 +1753,10 @@ export const tools = {
|
||||
}).then((ris) => {
|
||||
if (ris) {
|
||||
if (par.param1.inviareale)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('dashboard.msg_donatori_ok'))
|
||||
this.askConfirm(myself.$q, '', ris.strout, translate('dialog.yes'), translate('dialog.no'), this, '', 0, 0, {})
|
||||
this.showPositiveNotif(mythisq, t('dashboard.msg_donatori_ok'))
|
||||
this.askConfirm(mythisq, '', ris.strout, translate('dialog.yes'), translate('dialog.no'), '', 0, 0, {})
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.INVIA_MSG_A_FLOTTA) {
|
||||
// console.log('param1', par.param1)
|
||||
myself.loading = true
|
||||
globalStore.InviaMsgAFlotta({
|
||||
flotta: par.param1,
|
||||
inviareale: par.param2.inviareale,
|
||||
inviaemail: par.param2.inviaemail,
|
||||
tipomsg: par.param3,
|
||||
}).then((ris) => {
|
||||
myself.loading = false
|
||||
if (ris) {
|
||||
if (par.param1.inviareale)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('dashboard.msg_donatori_ok'))
|
||||
this.askConfirm(myself.$q, '', ris.strout, translate('dialog.yes'), translate('dialog.no'), this, '', 0, 0, {})
|
||||
myself.Callback()
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
this.showNegativeNotif(mythisq, t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.INVIA_MSG_A_SINGOLO) {
|
||||
// console.log('param1', par.param1)
|
||||
@@ -1945,9 +1767,9 @@ export const tools = {
|
||||
})
|
||||
.then((ris) => {
|
||||
if (ris) {
|
||||
this.showPositiveNotif(myself.$q, myself.$t('cal.sendmsg_sent'))
|
||||
this.showPositiveNotif(mythisq, t('cal.sendmsg_sent'))
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
this.showNegativeNotif(mythisq, t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.DONO_INVIATO) {
|
||||
const mydatatosave: IDataToSet = {
|
||||
@@ -1968,10 +1790,10 @@ export const tools = {
|
||||
|
||||
globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
if (ris) {
|
||||
myself.ActionAfterYes(func, par.param1, par.param2)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('dashboard.fatto_dono'))
|
||||
mythis.ActionAfterYes(func, par.param1, par.param2)
|
||||
this.showPositiveNotif(mythisq, t('dashboard.fatto_dono'))
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
this.showNegativeNotif(mythisq, t('db.recfailed'))
|
||||
})
|
||||
} else if (func === lists.MenuAction.DONO_RICEVUTO) {
|
||||
const mydatatosave: IDataToSet = {
|
||||
@@ -2007,20 +1829,22 @@ export const tools = {
|
||||
|
||||
globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
if (ris) {
|
||||
myself.ActionAfterYes(func, par.param1, par.param2)
|
||||
let msg = myself.$t('dashboard.ricevuto_dono_ok')
|
||||
mythis.ActionAfterYes(func, par.param1, par.param2)
|
||||
let msg = t('dashboard.ricevuto_dono_ok')
|
||||
if (!!par.param1.annulla) {
|
||||
if (par.param1.annulla)
|
||||
msg = 'Dono Annullato'
|
||||
}
|
||||
this.showPositiveNotif(myself.$q, msg)
|
||||
} else
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
this.showPositiveNotif(mythisq, msg)
|
||||
} else {
|
||||
this.showNegativeNotif(mythisq, t('db.recfailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async saveFieldToServer(myself: any, table: string, id: any, mydata: any, notif = true) {
|
||||
async saveFieldToServer(mythisq: any, table: string, id: any, mydata: any, notif = true) {
|
||||
const { t } = useI18n()
|
||||
const mydatatosave = {
|
||||
id,
|
||||
table,
|
||||
@@ -2030,18 +1854,18 @@ export const tools = {
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
return globalStore.saveFieldValue(mydatatosave).then((ris) => {
|
||||
if (ris) {
|
||||
if (notif)
|
||||
this.showPositiveNotif(myself.$q, myself.$t('db.recupdated'))
|
||||
this.showPositiveNotif(mythisq, t('db.recupdated'))
|
||||
} else {
|
||||
this.showNegativeNotif(myself.$q, myself.$t('db.recfailed'))
|
||||
this.showNegativeNotif(mythisq, t('db.recfailed'))
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
async askConfirm($q: any, mytitle: string, mytext: string, ok: string, cancel: string, myself: any, table: string, funcok: number, funccancel: number, par: IParamDialog) {
|
||||
askConfirm($q: any, mytitle: string, mytext: string, ok: string, cancel: string, table: string, funcok: number, funccancel: number, par: IParamDialog, mythis?: any) {
|
||||
return $q.dialog({
|
||||
message: mytext,
|
||||
html: true,
|
||||
@@ -2054,11 +1878,11 @@ export const tools = {
|
||||
persistent: false,
|
||||
}).onOk(() => {
|
||||
// console.log('OK')
|
||||
this.executefunc(myself, table, funcok, par)
|
||||
this.executefunc($q, table, funcok, par, mythis)
|
||||
return true
|
||||
}).onCancel(() => {
|
||||
// console.log('CANCEL')
|
||||
this.executefunc(myself, table, funccancel, par)
|
||||
this.executefunc($q, table, funccancel, par, mythis)
|
||||
return false
|
||||
})
|
||||
},
|
||||
@@ -2116,7 +1940,7 @@ export const tools = {
|
||||
return true
|
||||
},
|
||||
|
||||
checkLangPassed(mylangpass: string) {
|
||||
checkLangPassed($router: Router, mylangpass: string) {
|
||||
// console.log('checkLangPassed ', mylang)
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -2152,7 +1976,7 @@ export const tools = {
|
||||
mylang = 'it'
|
||||
|
||||
// Metti come default
|
||||
userStore.setlang(mylang)
|
||||
userStore.setlang($router, mylang)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2162,7 +1986,7 @@ export const tools = {
|
||||
}
|
||||
|
||||
if (toolsext.getLocale(true) === '') {
|
||||
userStore.setlang(mylang)
|
||||
userStore.setlang($router, mylang)
|
||||
}
|
||||
|
||||
// console.log('mylang calc : ', mylang)
|
||||
@@ -2721,17 +2545,17 @@ export const tools = {
|
||||
if ('serviceWorker' in navigator) {
|
||||
options = {
|
||||
body: 'You successfully subscribed to our Notification service!',
|
||||
icon: '/statics/icons/app-icon-96x96.png',
|
||||
image: '/statics/images/sf-boat.jpg',
|
||||
icon: '/public/icons/app-icon-96x96.png',
|
||||
image: '/public/images/sf-boat.jpg',
|
||||
dir: 'ltr',
|
||||
lang: 'enUs', // BCP 47,
|
||||
vibrate: [100, 50, 200],
|
||||
badge: '/statics/icons/app-icon-96x96.png',
|
||||
badge: '/public/icons/app-icon-96x96.png',
|
||||
tag: 'confirm-notification',
|
||||
renotify: true, // if it's already sent, will Vibrate anyway
|
||||
actions: [
|
||||
{ action: 'confirm', title: 'Okay', icon: '/statics/icons/app-icon-96x96.png' },
|
||||
{ action: 'cancel', title: 'Cancel', icon: '/statics/icons/app-icon-96x96.png' },
|
||||
{ action: 'confirm', title: 'Okay', icon: '/public/icons/app-icon-96x96.png' },
|
||||
{ action: 'cancel', title: 'Cancel', icon: '/public/icons/app-icon-96x96.png' },
|
||||
],
|
||||
}
|
||||
|
||||
@@ -2764,16 +2588,16 @@ export const tools = {
|
||||
if ('serviceWorker' in navigator) {
|
||||
options = {
|
||||
body: t('notification.subscribed'),
|
||||
icon: '/statics/icons/android-chrome-192x192.png',
|
||||
image: '/statics/images/imglogonotif.png',
|
||||
icon: '/public/icons/android-chrome-192x192.png',
|
||||
image: '/public/images/imglogonotif.png',
|
||||
dir: 'ltr',
|
||||
lang: 'enUs', // BCP 47,
|
||||
vibrate: [100, 50, 200],
|
||||
badge: '/statics/icons/android-chrome-192x192.png',
|
||||
badge: '/public/icons/android-chrome-192x192.png',
|
||||
tag: 'confirm-notification',
|
||||
renotify: true, // if it's already sent, will Vibrate anyway
|
||||
actions: [
|
||||
{ action: 'confirm', title: t('dialog.ok'), icon: '/statics/icons/android-chrome-192x192.png' },
|
||||
{ action: 'confirm', title: t('dialog.ok'), icon: '/public/icons/android-chrome-192x192.png' },
|
||||
// { action: 'cancel', title: 'Cancel', icon: '/statics/icons/android-chrome-192x192.png', }
|
||||
],
|
||||
}
|
||||
@@ -3065,9 +2889,9 @@ export const tools = {
|
||||
|
||||
getimgev(ev: IEvents) {
|
||||
if (!!ev.img_small)
|
||||
return 'statics/' + ev.img_small
|
||||
return 'public/' + ev.img_small
|
||||
else if (!!ev.img)
|
||||
return 'statics/' + ev.img
|
||||
return 'public/' + ev.img
|
||||
else
|
||||
return ''
|
||||
},
|
||||
@@ -3095,7 +2919,7 @@ export const tools = {
|
||||
return mylang
|
||||
},
|
||||
|
||||
setLangAtt(mylang: string) {
|
||||
setLangAtt($router: Router, mylang: string) {
|
||||
console.log('setLangAtt =', mylang)
|
||||
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
|
||||
|
||||
@@ -3111,7 +2935,7 @@ export const tools = {
|
||||
})
|
||||
})
|
||||
|
||||
globalStore.addDynamicPages()
|
||||
globalStore.addDynamicPages($router)
|
||||
|
||||
// this.$q.lang.set(mylang)
|
||||
|
||||
@@ -3128,14 +2952,14 @@ export const tools = {
|
||||
return 'Testo: ' + process.env.LOGO_REG
|
||||
},
|
||||
|
||||
loginOk(mythis: any, ispageLogin: boolean) {
|
||||
loginOk($router: Router, route: any, mythisq: any, ispageLogin: boolean) {
|
||||
// console.log('loginOk')
|
||||
const userStore = useUserStore()
|
||||
|
||||
if (toolsext.getLocale() !== '') {
|
||||
mythis.$i18n.locale = toolsext.getLocale()
|
||||
// mythisq.$i18n.locale = toolsext.getLocale()
|
||||
} else {
|
||||
userStore.setlang(mythis.$i18n.locale)
|
||||
userStore.setlang($router, mythisq.lang.getLocale())
|
||||
} // Set Lang
|
||||
|
||||
if (process.env.DEBUG) {
|
||||
@@ -3144,18 +2968,19 @@ export const tools = {
|
||||
|
||||
globalroutines('loadapp', '')
|
||||
|
||||
this.SignIncheckErrors(mythis, this.OK, ispageLogin)
|
||||
this.SignIncheckErrors(mythisq, $router, route, this.OK, ispageLogin)
|
||||
}
|
||||
,
|
||||
|
||||
loginInCorso(mythis: any) {
|
||||
loginInCorso(mythisq: any) {
|
||||
// console.log('loginInCorso')
|
||||
const { t } = useI18n()
|
||||
|
||||
const msg = mythis.$t('login.incorso')
|
||||
const msg = t('login.incorso')
|
||||
// if (process.env.DEBUG) {
|
||||
// msg += ' ' + process.env.MONGODB_HOST
|
||||
// }
|
||||
mythis.$q.loading.show({ message: msg })
|
||||
mythisq.loading.show({ message: msg })
|
||||
}
|
||||
,
|
||||
|
||||
@@ -3165,18 +2990,20 @@ export const tools = {
|
||||
return arr[0] + '//' + arr[2]
|
||||
},
|
||||
|
||||
SignIncheckErrors(mythis: any, riscode: any, ispageLogin ?: boolean) {
|
||||
SignIncheckErrors(mythisq: any, $router: Router, route: any, riscode: any, ispageLogin ?: boolean) {
|
||||
// console.log('SignIncheckErrors: ', riscode)
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
try {
|
||||
if (riscode === this.OK) {
|
||||
this.showNotif(mythis.$q, mythis.$t('login.completato'), { color: 'positive', icon: 'check' })
|
||||
console.log('mythis.$router.name', mythis.$router.name)
|
||||
this.showNotif(mythisq, t('login.completato'), { color: 'positive', icon: 'check' })
|
||||
console.log('mythis.$router.name', route.name)
|
||||
if (ispageLogin) {
|
||||
if (mythis.$router.name !== '/')
|
||||
mythis.$router.push('/')
|
||||
if (route.name !== '/')
|
||||
$router.push('/')
|
||||
}
|
||||
} else if (riscode === serv_constants.RIS_CODE_LOGIN_ERR) {
|
||||
|
||||
@@ -3188,10 +3015,10 @@ export const tools = {
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
// console.log('HIDE...')
|
||||
mythis.$q.loading.hide()
|
||||
mythisq.loading.hide()
|
||||
}, 500)
|
||||
this.showNotif(mythis.$q, mythis.$t('login.errato'), { color: 'negative', icon: 'notifications' })
|
||||
mythis.iswaitingforRes = false
|
||||
this.showNotif(mythisq, t('login.errato'), { color: 'negative', icon: 'notifications' })
|
||||
// iswaitingforRes = false
|
||||
if (ispageLogin) {
|
||||
globalStore.rightDrawerOpen = true
|
||||
// mythis.$router.push('/signin')
|
||||
@@ -3208,10 +3035,10 @@ export const tools = {
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
// console.log('HIDE...')
|
||||
mythis.$q.loading.hide()
|
||||
mythisq.loading.hide()
|
||||
}, 500)
|
||||
this.showNotif(mythis.$q, mythis.$t('login.subaccount'), { color: 'negative', icon: 'notifications' })
|
||||
mythis.iswaitingforRes = false
|
||||
this.showNotif(mythisq, t('login.subaccount'), { color: 'negative', icon: 'notifications' })
|
||||
// mythis.iswaitingforRes = false
|
||||
if (ispageLogin) {
|
||||
globalStore.rightDrawerOpen = true
|
||||
// mythis.$router.push('/signin')
|
||||
@@ -3219,18 +3046,18 @@ export const tools = {
|
||||
})
|
||||
|
||||
} else if (riscode === toolsext.ERR_SERVERFETCH) {
|
||||
this.showNotif(mythis.$q, mythis.$t('fetch.errore_server'), { color: 'negative', icon: 'notifications' })
|
||||
this.showNotif(mythisq, t('fetch.errore_server'), { color: 'negative', icon: 'notifications' })
|
||||
} else if (riscode === toolsext.ERR_GENERICO) {
|
||||
const msg = mythis.$t('fetch.errore_generico') + userStore.getMsgError(riscode)
|
||||
this.showNotif(mythis.$q, msg, { color: 'negative', icon: 'notifications' })
|
||||
const msg = t('fetch.errore_generico') + userStore.getMsgError(riscode)
|
||||
this.showNotif(mythisq, msg, { color: 'negative', icon: 'notifications' })
|
||||
} else {
|
||||
this.showNotif(mythis.$q, 'Errore num ' + riscode, { color: 'negative', icon: 'notifications' })
|
||||
this.showNotif(mythisq, 'Errore num ' + riscode, { color: 'negative', icon: 'notifications' })
|
||||
}
|
||||
|
||||
if (riscode !== serv_constants.RIS_CODE_LOGIN_ERR) {
|
||||
mythis.iswaitingforRes = false
|
||||
// mythis.iswaitingforRes = false
|
||||
setTimeout(() => {
|
||||
mythis.$q.loading.hide()
|
||||
mythisq.loading.hide()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
@@ -3239,46 +3066,47 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
SignUpcheckErrors(mythis: any, riscode: number, msg: string) {
|
||||
SignUpcheckErrors(mythisq: any, riscode: number, msg: string) {
|
||||
console.log('SignUpcheckErrors', riscode)
|
||||
const endload = true
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
if (riscode === serv_constants.RIS_CODE_EMAIL_ALREADY_EXIST) {
|
||||
this.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_email'))
|
||||
this.showNotif(mythisq, t('reg.err.duplicate_email'))
|
||||
} else if (riscode === serv_constants.RIS_CODE_USER_ALREADY_EXIST) {
|
||||
this.showNegativeNotif(mythis.$q, mythis.$t('reg.err.user_already_exist'))
|
||||
this.showNegativeNotif(mythisq, t('reg.err.user_already_exist'))
|
||||
} else if (riscode === serv_constants.RIS_CODE_USER_EXTRALIST_NOTFOUND) {
|
||||
|
||||
this.showNegativeNotif(mythis.$q, mythis.$t('reg.err.user_extralist_not_found') + ' ' + msg)
|
||||
this.showNegativeNotif(mythisq, t('reg.err.user_extralist_not_found') + ' ' + msg)
|
||||
} else if (riscode === serv_constants.RIS_CODE_USER_NOT_THIS_APORTADOR) {
|
||||
|
||||
this.showNegativeNotif(mythis.$q, mythis.$t('reg.err.user_not_this_aportador') + ' ' + msg)
|
||||
this.showNegativeNotif(mythisq, t('reg.err.user_not_this_aportador') + ' ' + msg)
|
||||
|
||||
} else if (riscode === serv_constants.RIS_CODE_USERNAME_NOT_VALID) {
|
||||
this.showNotif(mythis.$q, mythis.$t('reg.err.username_not_valid'))
|
||||
this.showNotif(mythisq, t('reg.err.username_not_valid'))
|
||||
} else if (riscode === serv_constants.RIS_CODE_USERNAME_ALREADY_EXIST) {
|
||||
this.showNotif(mythis.$q, mythis.$t('reg.err.duplicate_username'))
|
||||
this.showNotif(mythisq, t('reg.err.duplicate_username'))
|
||||
} else if (riscode === toolsext.ERR_SERVERFETCH) {
|
||||
this.showNotif(mythis.$q, mythis.$t('fetch.errore_server'))
|
||||
this.showNotif(mythisq, t('fetch.errore_server'))
|
||||
} else if (riscode === toolsext.ERR_GENERICO) {
|
||||
const msg2 = mythis.$t('fetch.errore_generico') + userStore.getMsgError(riscode)
|
||||
this.showNotif(mythis.$q, msg2)
|
||||
const msg2 = t('fetch.errore_generico') + userStore.getMsgError(riscode)
|
||||
this.showNotif(mythisq, msg2)
|
||||
} else if (riscode === this.OK) {
|
||||
mythis.$router.push('/regok')
|
||||
this.showNotif(mythis.$q, mythis.$t('components.authentication.email_verification.link_sent', { botname: mythis.$t('ws.botname') }), {
|
||||
mythisq.$router.push('/regok')
|
||||
this.showNotif(mythisq, t('components.authentication.email_verification.link_sent', { botname: t('ws.botname') }), {
|
||||
color: 'green',
|
||||
textColor: 'black',
|
||||
})
|
||||
} else if (riscode === serv_constants.RIS_ISCRIZIONE_OK) {
|
||||
mythis.$router.push('/')
|
||||
this.showNotif(mythis.$q, mythis.$t('components.authentication.iscrizione_ok', { botname: mythis.$t('ws.botname') }), {
|
||||
mythisq.$router.push('/')
|
||||
this.showNotif(mythisq, t('components.authentication.iscrizione_ok', { botname: t('ws.botname') }), {
|
||||
color: 'green',
|
||||
textColor: 'black',
|
||||
})
|
||||
} else {
|
||||
this.showNotif(mythis.$q, 'Errore num ' + riscode)
|
||||
this.showNotif(mythisq, 'Errore num ' + riscode)
|
||||
}
|
||||
|
||||
return endload
|
||||
@@ -3306,18 +3134,17 @@ export const tools = {
|
||||
}
|
||||
return s
|
||||
},
|
||||
CancelBookingEvent(mythis: any, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
||||
CancelBookingEvent(mythisq: any, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
||||
console.log('CancelBookingEvent ', eventparam)
|
||||
this.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + this.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE, 0, {
|
||||
this.askConfirm(mythisq, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + this.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), '', lists.MenuAction.DELETE, 0, {
|
||||
param1: bookeventid,
|
||||
param2: notify,
|
||||
param3: eventparam.title,
|
||||
})
|
||||
},
|
||||
CancelEvent(mythis: any, eventparam: IEvents) {
|
||||
CancelEvent(mythisq: any, eventparam: IEvents) {
|
||||
console.log('CancelEvent ', eventparam)
|
||||
const $q = useQuasar()
|
||||
this.askConfirm($q, translate('cal.event'), translate('cal.cancelevent') + ' ' + this.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE_EVENT, 0, {
|
||||
this.askConfirm(mythisq, translate('cal.event'), translate('cal.cancelevent') + ' ' + this.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), '', lists.MenuAction.DELETE_EVENT, 0, {
|
||||
param1: eventparam,
|
||||
param2: true,
|
||||
})
|
||||
@@ -3325,7 +3152,7 @@ export const tools = {
|
||||
AskGiaPartecipatoZoom(mythis: any, user: any) {
|
||||
console.log('AskGiaPartecipatoZoom', user.username)
|
||||
const $q = useQuasar()
|
||||
this.askConfirm($q, translate('steps.zoom_gia_partecipato'), translate('steps.zoom_gia_partecipato'), translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.ZOOM_GIA_PARTECIPATO, 0, {
|
||||
this.askConfirm($q, translate('steps.zoom_gia_partecipato'), translate('steps.zoom_gia_partecipato'), translate('dialog.yes'), translate('dialog.no'), '', lists.MenuAction.ZOOM_GIA_PARTECIPATO, 0, {
|
||||
param1: user,
|
||||
param2: user,
|
||||
param3: 'Confermato',
|
||||
@@ -3334,20 +3161,20 @@ export const tools = {
|
||||
ActionRecTable(mythis: any, action: number, table: string, id: string, item: any, askaction: any) {
|
||||
// console.log('ActionRecTable', id)
|
||||
const $q = useQuasar()
|
||||
return this.askConfirm($q, 'Action', translate(askaction) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, table, action, 0, {
|
||||
return this.askConfirm($q, 'Action', translate(askaction) + '?', translate('dialog.yes'), translate('dialog.no'), table, action, 0, {
|
||||
param1: id,
|
||||
param2: item,
|
||||
})
|
||||
}, this)
|
||||
},
|
||||
|
||||
getheight(mythis: any) {
|
||||
// return height()
|
||||
return mythis.$q.screen.height
|
||||
},
|
||||
getwidth(mythis: any, withright = false, withleft = true): number {
|
||||
getwidth(mythisq: any, withright = false, withleft = true): number {
|
||||
const globalStore = useGlobalStore()
|
||||
// return height()
|
||||
let myw = mythis.$q.screen.width
|
||||
let myw = mythisq.screen.width
|
||||
if (withleft) {
|
||||
if (globalStore.leftDrawerOpen)
|
||||
myw -= 300
|
||||
@@ -3479,8 +3306,12 @@ export const tools = {
|
||||
let mynum = numbercell.replace(/-/g, '')
|
||||
const globalStore = useGlobalStore()
|
||||
const intcode = globalStore.getValueSettingsByKey('INT_CODE', false)
|
||||
if (numbercell.substring(0, 1) !== '+') mynum = intcode + mynum
|
||||
else mynum = mynum.substring(1)
|
||||
if (numbercell) {
|
||||
if (numbercell.substring(0, 1) !== '+') mynum = intcode + mynum
|
||||
else mynum = mynum.substring(1)
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
|
||||
return mynum
|
||||
},
|
||||
@@ -3545,7 +3376,9 @@ export const tools = {
|
||||
return ((now.getMonth() === 11 && now.getDate() > 20) || (now.getMonth() === 0 && now.getDate() < 8))
|
||||
},
|
||||
|
||||
CapitalizeAllWords(str: string) {
|
||||
CapitalizeAllWords(str: string | undefined) {
|
||||
if (str === undefined)
|
||||
return ''
|
||||
const splitStr = str.toLowerCase().split(' ')
|
||||
for (let i = 0; i < splitStr.length; i++) {
|
||||
// You do not need to check if i is larger than splitStr length, as your for does that for you
|
||||
@@ -3586,7 +3419,9 @@ export const tools = {
|
||||
|
||||
return ''
|
||||
} else {
|
||||
console.log('keystr', keystr, 'serv', serv)
|
||||
const ris = globalStore.getValueSettingsByKey(keystr, serv)
|
||||
console.log('...ris', ris)
|
||||
|
||||
if (ris === '')
|
||||
if (def !== undefined)
|
||||
@@ -3654,7 +3489,7 @@ export const tools = {
|
||||
},
|
||||
|
||||
getpath(myvideo: string) {
|
||||
return 'statics/video/' + func_tools.getLocale() + '/' + myvideo
|
||||
return 'public/video/' + func_tools.getLocale() + '/' + myvideo
|
||||
},
|
||||
mygetarrValDb(keystr: string, serv: boolean) {
|
||||
const globalStore = useGlobalStore()
|
||||
@@ -3692,6 +3527,7 @@ export const tools = {
|
||||
if (null === obj || 'object' !== typeof obj) return obj
|
||||
const copy = obj.constructor()
|
||||
for (const attr in obj) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]
|
||||
}
|
||||
return copy
|
||||
@@ -3798,8 +3634,6 @@ export const tools = {
|
||||
return 'Venezuela'
|
||||
} else if (nat === 'CL') {
|
||||
return 'Chile'
|
||||
} else if (nat === 'PL') {
|
||||
return 'Poland'
|
||||
} else if (nat === 'EG') {
|
||||
return 'Egypt'
|
||||
} else if (nat === 'BR') {
|
||||
@@ -3820,8 +3654,6 @@ export const tools = {
|
||||
return 'Nepal'
|
||||
} else if (nat === 'CU') {
|
||||
return 'Cuba'
|
||||
} else if (nat === 'MA') {
|
||||
return 'Morocco'
|
||||
} else if (nat === 'PH') {
|
||||
return 'Philippines'
|
||||
} else if (nat === 'BA') {
|
||||
|
||||
@@ -2,6 +2,9 @@ import { date, useQuasar } from 'quasar'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
// import { useGlobalStore } from '@store/globalStore'
|
||||
import { static_data } from '../../db/static_data'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
import { Router } from 'vue-router'
|
||||
|
||||
export const func_tools = {
|
||||
getLocale(vero ?: boolean): string {
|
||||
@@ -108,8 +111,7 @@ export const toolsext = {
|
||||
if (mylang === 'enUs') return 'en-us'
|
||||
return mylang
|
||||
},
|
||||
setLangAtt(mylang: string) {
|
||||
/** ++Todo: SISTEMARE
|
||||
setLangAtt($router: Router, mylang: string) {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const $q = useQuasar()
|
||||
@@ -122,21 +124,19 @@ export const toolsext = {
|
||||
console.log(' Import dinamically lang =', lang)
|
||||
|
||||
$q.lang.set(this.getlangforQuasar(lang.default))
|
||||
import('../../public/i18n').then(() => {
|
||||
import('../../statics/i18n').then(() => {
|
||||
console.log(' *** MY LANG DOPO=', $q.lang.isoName)
|
||||
})
|
||||
})
|
||||
|
||||
globalStore.addDynamicPages()
|
||||
|
||||
*/
|
||||
globalStore.addDynamicPages($router)
|
||||
|
||||
// this.$q.lang.set(mylang)
|
||||
},
|
||||
|
||||
getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: string, id?: any, idmain?: any): any | undefined {
|
||||
|
||||
/** ++Todo: SISTEMARE
|
||||
const todos = useTodoStore()
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
if (table === 'users') {
|
||||
@@ -147,12 +147,12 @@ export const toolsext = {
|
||||
} else if (keystr) { // @ts-ignore
|
||||
return userStore.my[keystr]
|
||||
}
|
||||
/* } else if (table === 'todos') {
|
||||
} else if (table === 'todos') {
|
||||
// console.log('id', id, 'idmain', idmain)
|
||||
const indcat = Todos.categories.indexOf(idmain)
|
||||
const indcat = todos.categories.indexOf(idmain)
|
||||
console.log('indcat', indcat)
|
||||
if (indcat >= 0) {
|
||||
const myrec = Todos.todos[indcat].find((rec) => rec._id === id)
|
||||
const myrec = todos.todos[indcat].find((rec: any) => rec._id === id)
|
||||
console.log('myrec', myrec)
|
||||
let ris = null
|
||||
if (myrec) {
|
||||
@@ -173,7 +173,6 @@ export const toolsext = {
|
||||
}
|
||||
return ris
|
||||
}
|
||||
*/
|
||||
return ''
|
||||
|
||||
},
|
||||
@@ -188,7 +187,7 @@ export const toolsext = {
|
||||
return ris
|
||||
},
|
||||
|
||||
checkLangPassed(mylangprop: string) {
|
||||
checkLangPassed($router: Router, mylangprop: string) {
|
||||
// console.log('checkLangPassed ', mylang)
|
||||
|
||||
let mylang = mylangprop
|
||||
@@ -226,7 +225,7 @@ export const toolsext = {
|
||||
mylang = 'it'
|
||||
|
||||
// Metti come default
|
||||
userStore.setlang(mylang)
|
||||
userStore.setlang($router, mylang)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +235,7 @@ export const toolsext = {
|
||||
}
|
||||
|
||||
if (this.getLocale(true) === '') {
|
||||
userStore.setlang(mylang)
|
||||
userStore.setlang($router, mylang)
|
||||
}
|
||||
|
||||
// console.log('mylang calc : ', mylang)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState } from 'model'
|
||||
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
|
||||
import { IProject, IProjectsState, IDrag, IMenuList, IAction } from 'model'
|
||||
import { Privacy, TipoVisu } from '@src/model'
|
||||
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import { tools } from './Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { lists } from './Modules/lists'
|
||||
@@ -431,7 +431,7 @@ export const useProjectStore = defineStore({
|
||||
return ris
|
||||
},
|
||||
|
||||
async deleteItem({ idobj }: {idobj: any}) {
|
||||
deleteItem({ idobj }: {idobj: any}) {
|
||||
console.log('deleteItem: KEY = ', idobj)
|
||||
|
||||
const myarr = this.getarrByCategory('')
|
||||
@@ -516,7 +516,7 @@ export const useProjectStore = defineStore({
|
||||
return ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
|
||||
},
|
||||
|
||||
async swapElems(itemdragend: IDrag) {
|
||||
swapElems(itemdragend: IDrag) {
|
||||
console.log('PROJECT swapElems', itemdragend, this.projects)
|
||||
|
||||
const myarr = this.projs_dacompletare(itemdragend.id_proj!, itemdragend.tipoproj!)
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
IAction,
|
||||
} from 'model'
|
||||
|
||||
import Api from '@api'
|
||||
import { Api } from '@api'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { lists } from './Modules/lists'
|
||||
import * as ApiTables from './Modules/ApiTables'
|
||||
@@ -318,7 +318,7 @@ export const useTodoStore = defineStore('Todos', {
|
||||
return ris
|
||||
},
|
||||
|
||||
async deleteItemtodo({ cat, idobj }: { cat: string, idobj: string }) {
|
||||
deleteItemtodo({ cat, idobj }: { cat: string, idobj: string }) {
|
||||
console.log('deleteItemtodo: KEY = ', idobj)
|
||||
|
||||
const myarr = this.gettodosByCategory(cat)
|
||||
@@ -439,7 +439,7 @@ export const useTodoStore = defineStore('Todos', {
|
||||
return ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
|
||||
},
|
||||
|
||||
async swapElems(itemdragend: IDrag) {
|
||||
swapElems(itemdragend: IDrag) {
|
||||
// console.log('TODOS swapElems', itemdragend, this.todos, this.categories)
|
||||
|
||||
const cat = itemdragend.category
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import {
|
||||
ISigninOptions,
|
||||
ISignupOptions, IUserFields, IUserProfile, IUserState,
|
||||
} from '@src/model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import translate from '@src/globalroutines/util'
|
||||
import { ILinkReg, IToken } from '@model/other'
|
||||
import { ICallResult, ILinkReg, IResult, IToken } from '@model/other'
|
||||
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { serv_constants } from '@store/Modules/serv_constants'
|
||||
import Api from './Api'
|
||||
import { Api } from '@api'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
|
||||
import bcrypt from 'bcryptjs'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
import { Router } from 'vue-router'
|
||||
import { useProjectStore } from '@store/Projects'
|
||||
|
||||
export const DefaultUser: IUserFields = {
|
||||
_id: '',
|
||||
@@ -128,10 +135,9 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
getServerCode: (state: IUserState): number => (state.servercode ? state.servercode : 0),
|
||||
getMsg: (state: IUserState): string => (state.msg ? state.msg : ''),
|
||||
|
||||
getNameSurnameByUserId: (state: IUserState) => (userId: string): string => {
|
||||
// @ts-ignore
|
||||
const prova: number = this.getServerCode(state)
|
||||
|
||||
// @ts-ignore
|
||||
const user = this.getUserByUserId(state, userId)
|
||||
@@ -238,6 +244,27 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
},
|
||||
|
||||
async resetpwd(paramquery: any) {
|
||||
|
||||
const mydata = { ...paramquery }
|
||||
|
||||
return bcrypt.hash(mydata.password, bcrypt.genSaltSync(12))
|
||||
.then((hashedPassword: string) => {
|
||||
mydata.repeatPassword = ''
|
||||
mydata.password = String(hashedPassword)
|
||||
|
||||
return Api.SendReq('/updatepwd', 'POST', mydata, true)
|
||||
.then((res) => {
|
||||
return { code: res.data.code, msg: res.data.msg }
|
||||
})
|
||||
.catch((error: Types.AxiosError) => {
|
||||
this.setErrorCatch(error)
|
||||
return { code: this.getServerCode, msg: error.getMsgError() }
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
async setLangServer() {
|
||||
const mydata = {
|
||||
username: this.my.username,
|
||||
@@ -290,7 +317,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return { code: res.data.code, msg: res.data.msg }
|
||||
}).catch((error) => {
|
||||
this.setErrorCatch(error)
|
||||
return this.getServerCode
|
||||
return { code: this.getServerCode, msg: error.getMsgError() }
|
||||
})
|
||||
},
|
||||
|
||||
@@ -402,15 +429,82 @@ export const useUserStore = defineStore('UserStore', {
|
||||
this.usersList = [...usersList]
|
||||
},
|
||||
|
||||
setlang(newstr: string) {
|
||||
setlang($router: Router, newstr: string) {
|
||||
console.log('SETLANG', newstr)
|
||||
this.lang = newstr
|
||||
toolsext.setLangAtt(newstr)
|
||||
toolsext.setLangAtt($router, newstr)
|
||||
localStorage.setItem(toolsext.localStorage.lang, this.lang)
|
||||
},
|
||||
|
||||
async signup(authData: ISignupOptions) {
|
||||
signup(authData: ISignupOptions) {
|
||||
console.log('SIGNUP')
|
||||
const mylang = this.lang
|
||||
console.log('MYLANG: ' + mylang)
|
||||
|
||||
return bcrypt.hash(authData.password!, bcrypt.genSaltSync(12))
|
||||
.then((hashedPassword: string) => {
|
||||
/*
|
||||
const usertosend = {
|
||||
lang: mylang,
|
||||
email: authData.email,
|
||||
password: String(hashedPassword),
|
||||
username: authData.username,
|
||||
name: authData.name,
|
||||
surname: authData.surname
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
*/
|
||||
authData.lang = mylang
|
||||
authData.password = String(hashedPassword)
|
||||
|
||||
this.setServerCode(tools.CALLING)
|
||||
|
||||
return Api.SendReq('/users', 'POST', authData)
|
||||
.then((res) => {
|
||||
|
||||
const newuser = res.data
|
||||
|
||||
// console.log('newuser', newuser)
|
||||
|
||||
this.setServerCode(res.status)
|
||||
|
||||
if (res.status === 200) {
|
||||
if (process.env.DEV) {
|
||||
console.log('USERNAME = ' + newuser.username)
|
||||
console.log('IDUSER= ' + newuser._id)
|
||||
}
|
||||
|
||||
this.authUser(newuser)
|
||||
|
||||
const now = tools.getDateNow()
|
||||
// const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000);
|
||||
const expirationDate = new Date(now.getTime() * 1000)
|
||||
localStorage.setItem(toolsext.localStorage.lang, this.lang)
|
||||
localStorage.setItem(toolsext.localStorage.userId, newuser._id)
|
||||
localStorage.setItem(toolsext.localStorage.username, newuser.username)
|
||||
localStorage.setItem(toolsext.localStorage.name, newuser.name)
|
||||
localStorage.setItem(toolsext.localStorage.surname, newuser.surname)
|
||||
localStorage.setItem(toolsext.localStorage.token, this.x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.expirationDate, expirationDate.toString())
|
||||
localStorage.setItem(toolsext.localStorage.verified_email, String(false))
|
||||
|
||||
// Even if you has registered, you have to SignIn first
|
||||
this.isLogged = false
|
||||
// dispatch('storeUser', authData);
|
||||
// dispatch('setLogoutTimer', myres.data.expiresIn);
|
||||
|
||||
return { code: tools.OK, msg: '' }
|
||||
} else {
|
||||
return { code: toolsext.ERR_GENERICO, msg: '' }
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Err', error)
|
||||
this.setErrorCatch(error)
|
||||
return { code: this.getServerCode, msg: this.getMsg }
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
UpdatePwd(x_auth_token: string) {
|
||||
@@ -442,9 +536,107 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return arrtokens.filter((token: IToken) => token.access !== 'auth')
|
||||
},
|
||||
|
||||
async signin($router: Router, authData: ISigninOptions) {
|
||||
console.log('LOGIN signin')
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
// console.log('MYLANG = ' + this.lang)
|
||||
|
||||
let sub = null
|
||||
|
||||
try {
|
||||
if (static_data.functionality.PWA) {
|
||||
if ('serviceWorker' in navigator) {
|
||||
sub = await navigator.serviceWorker.ready
|
||||
.then((swreg) => {
|
||||
console.log('swreg')
|
||||
sub = swreg.pushManager.getSubscription()
|
||||
return sub
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(' ERROR ')
|
||||
sub = null
|
||||
})
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Err navigator.serviceWorker.ready ... GetSubscription:', e)
|
||||
}
|
||||
|
||||
const options = {
|
||||
title: tools.translate('notification.title_subscribed', [{
|
||||
strin: 'sitename',
|
||||
strout: translate('ws.sitename'),
|
||||
}]),
|
||||
content: translate('notification.subscribed'),
|
||||
openUrl: '/',
|
||||
}
|
||||
|
||||
const usertosend = {
|
||||
username: authData.username.trim(),
|
||||
password: authData.password.trim(),
|
||||
lang: this.lang,
|
||||
subs: sub,
|
||||
options,
|
||||
}
|
||||
|
||||
if (process.env.DEBUG === '1') {
|
||||
console.log(usertosend)
|
||||
}
|
||||
|
||||
this.setServerCode(tools.CALLING)
|
||||
|
||||
let myres: any
|
||||
|
||||
return Api.SendReq('/users/login', 'POST', usertosend, true)
|
||||
.then((res) => {
|
||||
myres = res
|
||||
|
||||
if (myres.status !== 200) {
|
||||
return Promise.reject(toolsext.ERR_GENERICO)
|
||||
}
|
||||
return myres
|
||||
|
||||
}).then((res) => {
|
||||
console.log(' Login res', res)
|
||||
|
||||
if (res.success) {
|
||||
globalStore.SetwasAlreadySubOnDb(res.data.subsExistonDb)
|
||||
|
||||
const myuser: IUserFields = res.data.usertosend
|
||||
if (myuser) {
|
||||
// console.table(myuser)
|
||||
|
||||
this.authUser(myuser)
|
||||
|
||||
this.updateLocalStorage(myuser)
|
||||
|
||||
globalStore.loadSite()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return tools.OK
|
||||
|
||||
}).then((code) => {
|
||||
if (code === tools.OK) {
|
||||
return this.setGlobal($router, true)
|
||||
.then(() => {
|
||||
return code
|
||||
})
|
||||
} else {
|
||||
return code
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.setErrorCatch(error)
|
||||
return this.getServerCode
|
||||
})
|
||||
},
|
||||
|
||||
async logout() {
|
||||
const globalStore = useGlobalStore()
|
||||
const $router = useRouter()
|
||||
// const $router = useRouter()
|
||||
|
||||
console.log('logout')
|
||||
|
||||
@@ -469,23 +661,21 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
await globalStore.clearDataAfterLogout()
|
||||
|
||||
const riscall = await Api.SendReq('/users/me/token', 'DELETE', null)
|
||||
return Api.SendReq('/users/me/token', 'DELETE', null)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
}).then(() => this.clearAuthData()).catch((error) => {
|
||||
this.setErrorCatch(error)
|
||||
return this.getServerCode
|
||||
})
|
||||
|
||||
return riscall
|
||||
|
||||
// $router.push('/signin')
|
||||
},
|
||||
|
||||
async setGlobal(isLogged: boolean) {
|
||||
// console.log('setGlobal', isLogged)
|
||||
async setGlobal($router: Router, isLogged: boolean) {
|
||||
console.log('setGlobal', isLogged)
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
const todos = useTodoStore()
|
||||
const projects = useProjectStore()
|
||||
try {
|
||||
// this.isLogged = true
|
||||
if (isLogged) {
|
||||
@@ -501,15 +691,13 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
this.isLogged = isok && isLogged
|
||||
|
||||
// ++Todo conv if (static_data.ality.ENABLE_TODOS_LOADING)
|
||||
// await Todos.dbLoad({ checkPending: true })
|
||||
if (static_data.functionality.ENABLE_TODOS_LOADING)
|
||||
await todos.dbLoad({ checkPending: true })
|
||||
|
||||
// if (static_data.functionality.ENABLE_PROJECTS_LOADING)
|
||||
// await Projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
|
||||
if (static_data.functionality.ENABLE_PROJECTS_LOADING)
|
||||
await projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
|
||||
|
||||
// console.log('add routes')
|
||||
|
||||
globalStore.addDynamicPages()
|
||||
globalStore.addDynamicPages($router)
|
||||
|
||||
globalStore.finishLoading = true
|
||||
if (tools.isDebug()) console.log('finishLoading', globalStore.finishLoading)
|
||||
@@ -524,7 +712,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
// console.log('setGlobal: END')
|
||||
},
|
||||
|
||||
async autologin_FromLocalStorage() {
|
||||
async autologin_FromLocalStorage($router: Router) {
|
||||
try {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
@@ -569,14 +757,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
verified_email,
|
||||
made_gift,
|
||||
perm,
|
||||
profile: { img, teleg_id },
|
||||
profile: { img, teleg_id, myshares: [] },
|
||||
})
|
||||
|
||||
isLogged = true
|
||||
}
|
||||
}
|
||||
|
||||
return await this.setGlobal(isLogged)
|
||||
return await this.setGlobal($router, isLogged)
|
||||
|
||||
// console.log('autologin _id STATE ', this._id)
|
||||
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {
|
||||
ICfgServer, IColGridTable, IConfig, IDataToSet, IGlobalState, IListRoutes, IParamsQuery, ISettings, StateConnection,
|
||||
ICfgServer,
|
||||
IColGridTable,
|
||||
IConfig,
|
||||
IDataToSet,
|
||||
IGlobalState,
|
||||
IListRoutes,
|
||||
IMyPage,
|
||||
IParamsQuery,
|
||||
ISettings,
|
||||
StateConnection,
|
||||
} from '@model'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { serv_constants } from '@store/Modules/serv_constants'
|
||||
import * as ApiTables from '@src/store/Modules/ApiTables'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Router, useRouter } from 'vue-router'
|
||||
import { cfgrouter } from '@src/router/route-config'
|
||||
import Api from './Api'
|
||||
import { Api } from '@api'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { costanti } from '@costanti'
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
@@ -19,6 +28,8 @@ import globalroutines from '../globalroutines/index'
|
||||
import { useCalendarStore } from '@store/CalendarStore'
|
||||
import urlBase64ToUint8Array from '@src/js/utility'
|
||||
import translate from '@src/globalroutines/util'
|
||||
import { useTodoStore } from '@store/Todos'
|
||||
import { useMessageStore } from './MessageStore'
|
||||
|
||||
|
||||
const stateConnDefault = 'online'
|
||||
@@ -141,23 +152,23 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return (rec.lang === toolsext.getLocale(false) || toolsext.getLocale() === '')
|
||||
},
|
||||
|
||||
getPage: (state: IGlobalState) => (path: string) => state.mypage.find((page) => (`/${page.path}`) === path),
|
||||
getPage: (state: IGlobalState) => (path: string): IMyPage | undefined => state.mypage.find((page) => (`/${page.path}`) === path),
|
||||
|
||||
getmenu: (state: IGlobalState): any => {
|
||||
// console.log('getmenu', cfgrouter.getmenu())
|
||||
/*
|
||||
const mystate = state
|
||||
|
||||
mystate.menulinks = {
|
||||
Dashboard: {
|
||||
routes: cfgrouter.getmenu(),
|
||||
show: true,
|
||||
},
|
||||
}
|
||||
*/
|
||||
const mystate = state
|
||||
|
||||
// return mystate.menulinks
|
||||
cfgrouter.getmenu()
|
||||
mystate.menulinks = {
|
||||
Dashboard: {
|
||||
routes: cfgrouter.getmenu(),
|
||||
show: true,
|
||||
},
|
||||
}
|
||||
|
||||
return mystate.menulinks
|
||||
|
||||
//return cfgrouter.getmenu()
|
||||
},
|
||||
|
||||
getRespByUsername: (state: IGlobalState) => (username: string) => {
|
||||
@@ -169,6 +180,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
let ris = null
|
||||
|
||||
const calendarStore = useCalendarStore()
|
||||
const userStore = useUserStore()
|
||||
const messageStore = useMessageStore()
|
||||
|
||||
if (table === costanti.TABEVENTS)
|
||||
return calendarStore.eventlist
|
||||
@@ -196,22 +209,24 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
else if (table === 'departments') ris = state.departments
|
||||
else if (table === 'sharewithus') ris = state.sharewithus
|
||||
else if (table === 'paymenttypes') ris = state.paymenttypes
|
||||
/* else if (table === 'bookings')
|
||||
else if (table === 'bookings')
|
||||
return calendarStore.bookedevent
|
||||
else if (table === 'users')
|
||||
return userStore.usersList
|
||||
else if (table === 'sendmsgs')
|
||||
return MessageStore.last_msgs
|
||||
return messageStore.last_msgs
|
||||
else if (table === 'settings')
|
||||
return userStore.settings */
|
||||
return state.settings
|
||||
else return ris
|
||||
|
||||
return ris || null
|
||||
return ris
|
||||
},
|
||||
|
||||
getrecSettingsByKey: (state: IGlobalState) => (key: any, serv: any): ISettings | undefined => {
|
||||
if (serv) return state.serv_settings.find((rec) => rec.key === key)
|
||||
return state.settings.find((rec) => rec.key === key)
|
||||
const ris = state.settings.find((rec) => rec.key === key)
|
||||
console.log('getrecSettingsByKey=', ris)
|
||||
return ris
|
||||
},
|
||||
|
||||
getCmdClick: (state: IGlobalState): string => (state.clickcmd ? state.clickcmd : ''),
|
||||
@@ -221,26 +236,16 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return (!!myrec) ? myrec.subject! : ''
|
||||
},
|
||||
|
||||
getValueSettingsByKey: (state: IGlobalState) => (key: any, serv: any): any | undefined => {
|
||||
// @ts-ignore
|
||||
const myrec = this.getrecSettingsByKey(key, serv)
|
||||
},
|
||||
|
||||
if (myrec) {
|
||||
if ((myrec.type === costanti.FieldType.date) || (myrec.type === costanti.FieldType.onlydate)) return myrec.value_date
|
||||
if ((myrec.type === costanti.FieldType.number) || (myrec.type === costanti.FieldType.hours)) return myrec.value_num
|
||||
if (myrec.type === costanti.FieldType.boolean) return myrec.value_bool
|
||||
return myrec.value_str
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
setValueSettingsByKey: (state: IGlobalState) => ({ key, value, serv }: { key: string, value: any, serv: boolean }): any => {
|
||||
actions: {
|
||||
setValueSettingsByKey({ key, value, serv }: {key: string, value: any, serv: boolean}): any {
|
||||
// Update the Server
|
||||
|
||||
// Update in Memory
|
||||
let myrec = null
|
||||
if (serv) myrec = state.serv_settings.find((rec: any) => rec.key === key)
|
||||
else myrec = state.settings.find((rec: any) => rec.key === key)
|
||||
if (serv) myrec = this.serv_settings.find((rec: any) => rec.key === key)
|
||||
else myrec = this.settings.find((rec: any) => rec.key === key)
|
||||
|
||||
if (myrec) {
|
||||
if ((myrec.type === costanti.FieldType.date) || (myrec.type === costanti.FieldType.onlydate)) myrec.value_date = value
|
||||
@@ -252,9 +257,22 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
getValueSettingsByKey(key: any, serv: any): any | undefined {
|
||||
const myrec = this.getrecSettingsByKey(key, serv)
|
||||
console.log('getValueSettingsByKey', myrec, 'key=', key, 'srv=', serv)
|
||||
if (myrec) {
|
||||
if ((myrec.type === costanti.FieldType.date) || (myrec.type === costanti.FieldType.onlydate)) return myrec.value_date
|
||||
if ((myrec.type === costanti.FieldType.number) || (myrec.type === costanti.FieldType.hours)) return myrec.value_num
|
||||
if (myrec.type === costanti.FieldType.boolean) return myrec.value_bool
|
||||
if (myrec.value_str === undefined) {
|
||||
return ''
|
||||
} else {
|
||||
myrec.value_str
|
||||
}
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
actions: {
|
||||
changeCmdClick(value: string) {
|
||||
console.log('changeCmdClick', value)
|
||||
this.clickcmd = value
|
||||
@@ -264,7 +282,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return this.stateConnection === 'online'
|
||||
},
|
||||
|
||||
async addDynamicPages() {
|
||||
addDynamicPages($router: Router) {
|
||||
const arrpagesroute: IListRoutes[] = []
|
||||
|
||||
for (const page of this.mypage) {
|
||||
@@ -298,7 +316,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const last = {
|
||||
active: true,
|
||||
order: 10000,
|
||||
path: '*',
|
||||
path: '/:catchAll(.*)*',
|
||||
materialIcon: 'fas fa-calendar-plus',
|
||||
name: 'otherpages.error404def',
|
||||
component: () => import('@src/root/My404page/My404page.vue'),
|
||||
@@ -326,15 +344,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// Sort array
|
||||
static_data.routes = static_data.routes.sort((a, myb) => a.order - myb.order)
|
||||
|
||||
/*
|
||||
if (tools.sito_online(false)) {
|
||||
router.addRoutes([...arrpagesroute, last])
|
||||
} else {
|
||||
router.addRoutes([sito_offline, last])
|
||||
router.replace('/sito_offline')
|
||||
}
|
||||
// console.log('static_data.routes', static_data.routes)
|
||||
|
||||
*/
|
||||
console.log('$router', $router)
|
||||
|
||||
if (tools.sito_online(false)) {
|
||||
arrpagesroute.forEach(function (route: any) {
|
||||
$router.addRoute(route)
|
||||
})
|
||||
|
||||
$router.addRoute(last)
|
||||
} else {
|
||||
$router.addRoute(sito_offline)
|
||||
$router.addRoute(last)
|
||||
$router.replace('/sito_offline')
|
||||
}
|
||||
},
|
||||
|
||||
setPaoArray_Delete(state: IGlobalState) {
|
||||
@@ -367,20 +391,25 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return globalroutines('write', 'config', { _id: data._id, value: data.value })
|
||||
},
|
||||
|
||||
/*setShowType(state: IGlobalState, showtype: number) {
|
||||
SetwasAlreadySubOnDb(subscrib: boolean) {
|
||||
this.wasAlreadySubOnDb = subscrib
|
||||
},
|
||||
|
||||
setShowType(showtype: number) {
|
||||
const todos = useTodoStore()
|
||||
console.log('setShowType', showtype)
|
||||
const config = Getters.getConfigbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS)
|
||||
const config = this.getConfigbyId(costanti.CONFIG_ID_SHOW_TYPE_TODOS)
|
||||
console.log('config', config)
|
||||
if (config) {
|
||||
config.value = String(showtype)
|
||||
Todos.showtype = parseInt(config.value, 10)
|
||||
todos.showtype = parseInt(config.value, 10)
|
||||
} else {
|
||||
Todos.showtype = showtype
|
||||
todos.showtype = showtype
|
||||
}
|
||||
console.log('Todos.showtype', Todos.showtype)
|
||||
GlobalStore.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
|
||||
console.log('Todos.state.showtype', todos.showtype)
|
||||
this.saveConfig({ _id: costanti.CONFIG_ID_SHOW_TYPE_TODOS, value: String(showtype) })
|
||||
|
||||
},*/
|
||||
},
|
||||
|
||||
UpdateValuesInMemory(mydata: IDataToSet): void {
|
||||
const { id } = mydata
|
||||
@@ -524,9 +553,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
console.log('DeleteSubscriptionToServer: ')
|
||||
|
||||
return Api.SendReq('/subscribe/del', 'DELETE', null)
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
async clearDataAfterLogout() {
|
||||
@@ -560,7 +586,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
await this.deleteSubscriptionToServer()
|
||||
},
|
||||
|
||||
async clearDataAfterLoginOnlyIfActiveConnection() {
|
||||
clearDataAfterLoginOnlyIfActiveConnection() {
|
||||
const prova = 1
|
||||
return prova
|
||||
},
|
||||
@@ -579,7 +605,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
isok = true
|
||||
}
|
||||
|
||||
// ++Todo conv: this.arrConfig = await globalroutines( 'readall', 'config', null)
|
||||
await globalroutines( 'readall', 'config', null)
|
||||
|
||||
return isok
|
||||
},
|
||||
@@ -588,9 +614,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
console.log('saveCfgServerKey dataval', dataval)
|
||||
|
||||
const ris = await Api.SendReq('/admin/updateval', 'POST', { pairval: dataval })
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
async checkUpdates() {
|
||||
@@ -636,7 +659,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async sendPushNotif({ params }: { params: any }) {
|
||||
async sendPushNotif({ params }: {params: any}) {
|
||||
|
||||
return Api.SendReq('/push/send', 'POST', { params })
|
||||
.then((res) => {
|
||||
@@ -697,7 +720,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async saveTable(mydata: object) {
|
||||
async saveTable(mydata: any) {
|
||||
// console.log('saveTable', mydata)
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -723,7 +746,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
.catch((error) => false)
|
||||
},
|
||||
|
||||
async callFunz({ mydata }: { mydata: any }) {
|
||||
async callFunz({ mydata }: {mydata: any}) {
|
||||
// console.log('saveFieldValue', mydata)
|
||||
|
||||
return Api.SendReq('/callfunz', 'PATCH', { data: mydata })
|
||||
@@ -738,7 +761,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async askFunz({ mydata }: { mydata: any }) {
|
||||
async askFunz({ mydata }: {mydata: any}) {
|
||||
// console.log('saveFieldValue', mydata)
|
||||
|
||||
return Api.SendReq('/askfunz', 'PATCH', { data: mydata })
|
||||
@@ -750,7 +773,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async DeleteRec({ table, id }: { table: string, id: string }) {
|
||||
async DeleteRec({ table, id }: {table: string, id: string}) {
|
||||
console.log('DeleteRec', table, id)
|
||||
|
||||
return Api.SendReq('/delrec/' + table + '/' + id, 'DELETE', null)
|
||||
@@ -768,7 +791,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async DeleteFile({ filename }: { filename: string }) {
|
||||
async DeleteFile({ filename }: {filename: string}) {
|
||||
console.log('DeleteFile', filename)
|
||||
|
||||
return Api.SendReq('/delfile', 'DELETE', { filename })
|
||||
@@ -786,7 +809,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async DuplicateRec({ table, id }: { table: string, id: string }) {
|
||||
async DuplicateRec({ table, id }: {table: string, id: string}) {
|
||||
console.log('DuplicateRec', id)
|
||||
|
||||
return Api.SendReq('/duprec/' + table + '/' + id, 'POST', null)
|
||||
@@ -804,7 +827,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async InviaMsgADonatori({ msgobj, navemediatore, tipomsg }: { msgobj: any, navemediatore: any, tipomsg: any }) {
|
||||
async InviaMsgADonatori({ msgobj, navemediatore, tipomsg }: {msgobj: any, navemediatore: any, tipomsg: any}) {
|
||||
console.log('InviaMsgADonatori', msgobj)
|
||||
|
||||
const mydata = {
|
||||
@@ -833,7 +856,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async InviaMsgAFlotta({ flotta, inviareale, inviaemail, tipomsg }: { flotta: any, inviareale: boolean, inviaemail: boolean, tipomsg: any }) {
|
||||
async InviaMsgAFlotta({ flotta, inviareale, inviaemail, tipomsg }: {flotta: any, inviareale: boolean, inviaemail: boolean, tipomsg: any}) {
|
||||
console.log('InviaMsgAFlotta')
|
||||
|
||||
const mydata = {
|
||||
@@ -903,7 +926,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async GetNave({ riga, col, riga1don, col1don, ind_order }: { riga: any, col: any, riga1don: any, col1don: any, ind_order: number }) {
|
||||
async GetNave({ riga, col, riga1don, col1don, ind_order }: {riga: any, col: any, riga1don: any, col1don: any, ind_order: number}) {
|
||||
// console.log('GetNave')
|
||||
|
||||
const mydata = {
|
||||
@@ -930,7 +953,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async GetData({ data }: { data: any }) {
|
||||
async GetData({ data }: {data: any}) {
|
||||
console.log('GetData')
|
||||
|
||||
const mydata = {
|
||||
@@ -953,7 +976,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async GetArrDoniNavi({ ricalcola, showall }: { ricalcola: boolean, showall: boolean }) {
|
||||
async GetArrDoniNavi({ ricalcola, showall }: {ricalcola: boolean, showall: boolean}) {
|
||||
console.log('GetArrDoniNavi')
|
||||
|
||||
const mydata = {
|
||||
@@ -977,7 +1000,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async GetFlotte({ ricalcola, showall }: { ricalcola: boolean, showall: boolean }) {
|
||||
async GetFlotte({ ricalcola, showall }: {ricalcola: boolean, showall: boolean}) {
|
||||
console.log('GetFlotte')
|
||||
|
||||
const mydata = {
|
||||
@@ -1001,7 +1024,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async GetFlotta({ riga, col_prima, col_ultima }: { riga: any, col_prima: any, col_ultima: any }) {
|
||||
async GetFlotta({ riga, col_prima, col_ultima }: {riga: any, col_prima: any, col_ultima: any}) {
|
||||
console.log('GetFlotta')
|
||||
|
||||
const mydata = {
|
||||
@@ -1028,6 +1051,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
async loadSite() {
|
||||
const userStore = useUserStore()
|
||||
const calendarStore = useCalendarStore()
|
||||
// console.log('calendarStore: loadAfterLogin')
|
||||
// Load local data
|
||||
const showall = userStore.isAdmin || userStore.isManager ? '1' : '0'
|
||||
@@ -1038,16 +1062,15 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
return Api.SendReq(`/loadsite/${myuserid}/${process.env.APP_ID}/${process.env.APP_VERSION}`, 'GET', null)
|
||||
.then((res) => {
|
||||
// console.log('____________________________ res', res)
|
||||
console.log('____________________________ res', res)
|
||||
if (res.status === 200) {
|
||||
/* calendarStore.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
|
||||
calendarStore.bookedevent = (res.data.bookedevent) ? res.data.bookedevent : []
|
||||
calendarStore.eventlist = (res.data.eventlist) ? res.data.eventlist : []
|
||||
calendarStore.operators = (res.data.operators) ? res.data.operators : []
|
||||
calendarStore.internalpages = (res.data.internalpages) ? res.data.internalpages : []
|
||||
calendarStore.wheres = (res.data.wheres) ? res.data.wheres : []
|
||||
calendarStore.contribtype = (res.data.contribtype) ? res.data.contribtype : []
|
||||
|
||||
*/
|
||||
this.settings = (res.data.settings) ? [...res.data.settings] : []
|
||||
this.disciplines = (res.data.disciplines) ? [...res.data.disciplines] : []
|
||||
this.paymenttypes = (res.data.paymenttypes) ? [...res.data.paymenttypes] : []
|
||||
@@ -1109,8 +1132,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
getArrStrByValueBinary(mythis: any, col: IColGridTable, val: any) {
|
||||
const arr = this.getArrByValueBinary(mythis, col, val)
|
||||
getArrStrByValueBinary(col: IColGridTable, val: any) {
|
||||
const arr = this.getArrByValueBinary(null, col, val)
|
||||
if (arr.length > 0) return arr.join(' - ')
|
||||
return '[---]'
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@ export const useTestStore = defineStore({
|
||||
},
|
||||
|
||||
actions: {
|
||||
async testProva() {
|
||||
testProva() {
|
||||
let arrpagesroute = null
|
||||
|
||||
arrpagesroute = this.isMyLang({ lang: 'test' })
|
||||
|
||||
Reference in New Issue
Block a user