Cataloghi...
This commit is contained in:
@@ -23,7 +23,7 @@ import globalroutines from '../globalroutines/index'
|
||||
|
||||
export const useCatalogStore = defineStore('CatalogStore', {
|
||||
state: (): ICatalogState => ({
|
||||
catalog: { idapp: '', title: '' }
|
||||
catalogs: [{ idapp: '', title: '' }]
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
|
||||
@@ -29,6 +29,7 @@ export const costanti = {
|
||||
'excludeproductTypes',
|
||||
'misure',
|
||||
'Categoria',
|
||||
'idCollane',
|
||||
'editore',
|
||||
'pdf',
|
||||
'Printable',
|
||||
|
||||
@@ -129,17 +129,17 @@ export const colTableCatalogList = [
|
||||
isadvanced_field: false,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'idCollana',
|
||||
name: 'idCollane',
|
||||
label_trans: 'cataloglist.collane',
|
||||
fieldtype: costanti.FieldType.select,
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'collanas',
|
||||
}),
|
||||
|
||||
AddCol({
|
||||
name: 'idTemplateScheda',
|
||||
label_trans: 'scheda.linkIdTemplate',
|
||||
name: 'idPageAssigned',
|
||||
label_trans: 'cataloglist.idPageAssigned',
|
||||
fieldtype: costanti.FieldType.select,
|
||||
jointable: 'collanas',
|
||||
jointable: 'mypages_id',
|
||||
}),
|
||||
|
||||
AddCol({
|
||||
@@ -150,6 +150,8 @@ export const colTableCatalogList = [
|
||||
field_outtype: costanti.FieldType.object,
|
||||
showWhen: costanti.showWhen.InView_OnlyifExist,
|
||||
}),
|
||||
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html }),
|
||||
|
||||
AddCol({
|
||||
name: 'img_bordata_web',
|
||||
label_trans: 'cataloglist.img_bordata_web',
|
||||
@@ -158,7 +160,6 @@ export const colTableCatalogList = [
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
}),
|
||||
AddCol({ name: 'idTemplateScheda', label_trans: 'scheda.linkIdTemplate', fieldtype: costanti.FieldType.string }),
|
||||
|
||||
AddCol(ModifRec),
|
||||
AddCol(DuplicateRec),
|
||||
@@ -241,7 +242,12 @@ export const colmyScheda = [
|
||||
AddCol({ name: 'editore', label_trans: 'editore' }),
|
||||
AddCol({ name: 'author', label_trans: 'scheda.author' }),
|
||||
AddCol({ name: 'argomenti', label_trans: 'scheda.argomenti' }),
|
||||
AddCol({ name: 'idCollana', label_trans: 'scheda.idCollana' }),
|
||||
AddCol({
|
||||
name: 'idCollane',
|
||||
label_trans: 'products.category',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'collanas',
|
||||
}),
|
||||
AddCol({ name: 'sort_field', label_trans: 'catalogo.sort_field', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'sort_dir', label_trans: 'catalogo.sort_dir', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'arrProdottiSpeciali', label_trans: 'editore' }),
|
||||
@@ -254,7 +260,12 @@ export const colmyelCatalogo = [
|
||||
AddCol({ name: 'pdf_filename', label_trans: 'pdf_filename' }),
|
||||
AddCol({ name: 'editore', label_trans: 'editore' }),
|
||||
AddCol({ name: 'argomenti', label_trans: 'scheda.argomenti' }),
|
||||
AddCol({ name: 'idCollana', label_trans: 'scheda.idCollana' }),
|
||||
AddCol({
|
||||
name: 'idCollane',
|
||||
label_trans: 'products.category',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'collanas',
|
||||
}),
|
||||
AddCol({ name: 'width', label_trans: 'width', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'height', label_trans: 'height', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'optcatalogo.', label_trans: 'catalogo.optcatalogo.', fieldtype: costanti.FieldType.number }),
|
||||
@@ -1067,7 +1078,7 @@ export const colmyUserPeople = [
|
||||
export const colmyUserGroup = [
|
||||
// AddCol({ name: '_id', label_trans: 'reg.id' }),
|
||||
AddCol({
|
||||
name: 'title', label_trans: 'reg.name',
|
||||
name: 'title', label_trans: 'reg.nameorg',
|
||||
field_toduplicate_nospace: 'groupname',
|
||||
required: true, noshowlabel: true, maxlength: 50
|
||||
}),
|
||||
@@ -1860,7 +1871,6 @@ export const colmyBachecas = [
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
|
||||
noshowlabel: true,
|
||||
icon: 'mood',
|
||||
isadvanced_field: true,
|
||||
sortable: false,
|
||||
typeobj: 'checkbox',
|
||||
}),
|
||||
@@ -4195,6 +4205,13 @@ export const fieldsTable = {
|
||||
colkey: 'path',
|
||||
collabel: 'title',
|
||||
},
|
||||
{
|
||||
value: 'mypages_id',
|
||||
label: 'Pagine Web (ID)',
|
||||
columns: colmypage,
|
||||
colkey: '_id',
|
||||
collabel: 'title',
|
||||
},
|
||||
{
|
||||
value: 'products',
|
||||
label: 'Prodotti',
|
||||
@@ -4270,7 +4287,7 @@ export const fieldsTable = {
|
||||
label: 'Collane',
|
||||
columns: colTableCollane,
|
||||
colkey: 'idCollana',
|
||||
collabel: 'descrizione',
|
||||
collabel: 'title',
|
||||
},
|
||||
{
|
||||
value: 'catais',
|
||||
@@ -4948,6 +4965,13 @@ export const fieldsTable = {
|
||||
colkey: '_id',
|
||||
collabel: 'title',
|
||||
},
|
||||
{
|
||||
value: 'schedeopt',
|
||||
label: 'Template Cataloghi',
|
||||
columns: colTableGeneric,
|
||||
colkey: 'value',
|
||||
collabel: 'label',
|
||||
},
|
||||
],
|
||||
|
||||
}
|
||||
|
||||
@@ -7506,9 +7506,9 @@ export const tools = {
|
||||
// console.log('arrimage', arrimage)
|
||||
|
||||
if (shared_consts.TABLES_DIRECTORY_A_PARTE.includes(table)) {
|
||||
return costanti.DIR_UPLOAD + `${table}/` + groupname + '/' + arrimage[0].imagefile
|
||||
return costanti.DIR_UPLOAD + `${table}/` + groupname + '/' + arrimage[0]?.imagefile
|
||||
} else if (shared_consts.TABLES_DIRECTORY_SINGLE_IMG.includes(table)) {
|
||||
return costanti.DIR_UPLOAD + `${table}/` + groupname + '/' + arrimage[0].imagefile
|
||||
return costanti.DIR_UPLOAD + `${table}/` + groupname + '/' + arrimage[0]?.imagefile
|
||||
} else {
|
||||
// console.log('username', username, 'table', table)
|
||||
if (arrimage && arrimage.length > 0) {
|
||||
@@ -7540,7 +7540,7 @@ export const tools = {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (shared_consts.TABLES_WITH_ADMINS.includes(tablesel)) {
|
||||
if (userStore.isAdmin)
|
||||
return true
|
||||
@@ -9317,6 +9317,21 @@ export const tools = {
|
||||
return rec ? rec.strsingolo : ''
|
||||
},
|
||||
|
||||
getMainUrl(fullUrl: string) {
|
||||
try {
|
||||
// Crea un oggetto URL dall'input
|
||||
const url = new URL(fullUrl);
|
||||
|
||||
// Estrai il protocollo (http o https) e l'host (dominio)
|
||||
const mainUrl = `${url.host}`;
|
||||
|
||||
return mainUrl;
|
||||
} catch (error) {
|
||||
console.error("URL non valido:", error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
getGradientByColors(col1: string, col2: string, col3: string): string {
|
||||
let mystr = ''
|
||||
if (col1) {
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@@ -20,15 +20,6 @@ export const useTestStore = defineStore({
|
||||
return (rec.lang === toolsext.getLocale(false) || toolsext.getLocale() === '')
|
||||
},
|
||||
|
||||
prova1: (state: ITest) => (myval: number): boolean => {
|
||||
return (myval > 1)
|
||||
},
|
||||
|
||||
prova2: (): boolean => {
|
||||
// @ts-ignore
|
||||
return this.prova1(2)
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
Reference in New Issue
Block a user