Cataloghi...

This commit is contained in:
Surya Paolo
2025-02-05 12:13:36 +01:00
parent 979f90f980
commit 2533da3692
20 changed files with 171 additions and 105 deletions

View File

@@ -49,20 +49,6 @@ async function getConfig(id: any) {
return globalroutines('read', 'config', null, id)
}
async function getstateConnSaved() {
const config = await getConfig(costanti.CONFIG_ID_CFG)
// console.log('config', config)
if (config) {
if (config.length > 1) {
const cfgstateconn = config[1]
return cfgstateconn.stateconn
} else {
return 'online'
}
} else {
return 'offline'
}
}
export const useGlobalStore = defineStore('GlobalStore', {
state: (): IGlobalState => ({
@@ -353,6 +339,34 @@ export const useGlobalStore = defineStore('GlobalStore', {
return !!rec ? rec.name + ' ' + rec.surname : ''
},
getSchedeOpt(): any [] {
const arrschede: ISchedaSingola[] = this.myschedas
let arr: any = []
arr.push({ label: '[Nessuna]', value: '' })
if (arrschede) {
arrschede.forEach((recscheda: ISchedaSingola) => {
let pagename = ''
if (recscheda.scheda) {
if (recscheda.idPageOrig) {
const page = this.mypage.find((page) => (`${page._id}`) === recscheda.idPageOrig)
pagename = page ? page.title! : ''
}
if (pagename)
pagename = '[Pag: ' + pagename + '] '
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
arr.push({ label: mylabel, value: recscheda.scheda!._id })
}
});
}
return arr
},
getListByTable: (state: IGlobalState) => (table: string, value2?: any): any => {
let ris: any = []
@@ -384,8 +398,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === toolsext.TABOPZEMAIL) ris = state.opzemail
else if (table === toolsext.TABMAILINGLIST) ris = state.mailinglist
else if (table === toolsext.TABMYPAGE) ris = state.mypage
else if (table === 'mypages_id') ris = state.mypage
else if (table === toolsext.TABMYELEMS) ris = state.myelems
else if (table === toolsext.TABCATALOGS) ris = catalogStore.catalog!
else if (table === toolsext.TABCATALOGS) ris = catalogStore.catalogs!
else if (table === toolsext.TABCALZOOM) ris = state.calzoom
else if (table === 'producers') ris = state.producers
else if (table === 'storehouses') ris = state.storehouses
@@ -451,6 +466,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
return state.catgrps
else if (table === 'collanas')
return Products.collane
else if (table === 'schedeopt')
return state.getSchedeOpt
else if (table === 'provinces')
return state.provinces.filter((rec: IProvince) => (!rec.card) && (rec.prov !== 'ITA') && (rec.prov !== 'EST'))
else if (table === 'cards') {
@@ -1725,7 +1742,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
circuitStore.listcircuits = (res.data.listcircuits) ? res.data.listcircuits : []
circuitStore.listaccounts = (res.data.listaccounts) ? res.data.listaccounts : []
catalogStore.catalog = res.data.catalogs
catalogStore.catalogs = res.data.catalogs
this.settings = (res.data.settings) ? [...res.data.settings] : []
this.disciplines = (res.data.disciplines) ? [...res.data.disciplines] : []
@@ -2456,32 +2473,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
},
SchedeOpt() {
const arrschede: ISchedaSingola[] = this.getMySchede()
let arr: any = []
arr.push({ label: '[Nessuna]', value: '' })
if (arrschede) {
arrschede.forEach((recscheda: ISchedaSingola) => {
let pagename = ''
if (recscheda.scheda) {
if (recscheda.idPageOrig) {
const page = this.getPageById(recscheda.idPageOrig)
pagename = page ? page.title! : ''
}
if (pagename)
pagename = '[Pag: ' + pagename + '] '
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
arr.push({ label: mylabel, value: recscheda.scheda!._id })
}
});
}
return arr
return this.getSchedeOpt
},
}
})