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

@@ -1045,6 +1045,7 @@
@save="SaveValue" @save="SaveValue"
@show="selItem(props.row, col)" @show="selItem(props.row, col)"
@showandsave="showandsave" @showandsave="showandsave"
:dense="true"
> >
</CMyPopupEdit> </CMyPopupEdit>
</div> </div>
@@ -1195,6 +1196,7 @@
@save="SaveValue" @save="SaveValue"
@show="selItem(props.row, col)" @show="selItem(props.row, col)"
@showandsave="showandsave" @showandsave="showandsave"
:dense="true"
> >
</CMyPopupEdit> </CMyPopupEdit>
</div> </div>
@@ -1390,6 +1392,7 @@
@showandsave="showandsave" @showandsave="showandsave"
@annulla="annulla" @annulla="annulla"
@update_col="update_col" @update_col="update_col"
:dense="true"
> >
</CMyPopupEdit> </CMyPopupEdit>
</div> </div>
@@ -1507,7 +1510,7 @@
size="md" size="md"
dense dense
:icon="!showfilteradv ? 'fas fa-arrow-down' : 'fas fa-arrow-up'" :icon="!showfilteradv ? 'fas fa-arrow-down' : 'fas fa-arrow-up'"
:label="!showfilteradv ? $t('grid.advanced_filters') : $t('grid.hide_advanced_filters')" :label="!showfilteradv ? $t('grid.show_campi_avanzati') : $t('grid.hide_campi_avanzati')"
@click="showfilteradv = !showfilteradv" @click="showfilteradv = !showfilteradv"
></q-btn> ></q-btn>
</div> </div>

View File

@@ -787,7 +787,10 @@ export default defineComponent({
modifElem() modifElem()
} }
function updateSizeHeight(value: any) { function updateSizeHeight(value: any) {
myel.value.heightimg = value; // Aggiorna widthimg con il nuovo valore if (value)
myel.value.heightimg = value; // Aggiorna widthimg con il nuovo valore
else
myel.value.heightimg = ''
modifElem() modifElem()
} }
@@ -1079,6 +1082,7 @@ export default defineComponent({
modifElemAndSchede, modifElemAndSchede,
exportPage, exportPage,
importPage, importPage,
globalStore,
} }
}, },

View File

@@ -7,7 +7,7 @@
(!myel.active ? ` clEditNotActive` : ``) (!myel.active ? ` clEditNotActive` : ``)
" "
> >
<div v-if="!!myel.type"> <div v-if="myel && myel.type">
<div class="row justify-evenly q-gutter-sm"> <div class="row justify-evenly q-gutter-sm">
<q-btn <q-btn
class="q-ma-sm" class="q-ma-sm"
@@ -1508,15 +1508,16 @@
v-if="enableEdit" v-if="enableEdit"
rounded rounded
outlined outlined
v-model="myel.catalogo.idCollana" v-model="myel.catalogo.idCollane"
:options="Products.collane" :options="Products.collane"
@update:model-value="modifElem" @update:model-value="modifElem"
label="Collana" label="Collane"
style="width: 300px" style="width: 300px"
multiple
emit-value emit-value
map-options map-options
option-value="idCollana" option-value="idCollana"
option-label="descrizione" option-label="title"
> >
</q-select> </q-select>
</div> </div>

View File

@@ -95,7 +95,7 @@ export default defineComponent({
const myelemVoid = ref({ _id: objectId(), active: true, type: shared_consts.ELEMTYPE.TEXT, container: '...', path: mypathin.value } as IMyElem) const myelemVoid = ref({ _id: objectId(), active: true, type: shared_consts.ELEMTYPE.TEXT, container: '...', path: mypathin.value } as IMyElem)
const selElem = ref(globalStore.selElem) const selElem = ref(<IMyElem|null>globalStore.selElem)
const site = ref(globalStore.site) const site = ref(globalStore.site)
const onloading = ref(false) const onloading = ref(false)
@@ -166,7 +166,7 @@ export default defineComponent({
visuEditor.value = false visuEditor.value = false
} }
function selElemClick(myelem: IMyElem) { function selElemClick(myelem: IMyElem) {
// console.log('mypageelem selElemClick', myelem) console.log('mypageelem selElemClick', myelem)
selElem.value = {} selElem.value = {}
selElem.value = myelem selElem.value = myelem

View File

@@ -322,9 +322,9 @@
:label=" :label="
col.visulabel col.visulabel
? $t(col.label_trans) ? $t(col.label_trans)
: addstrrequired + visulabel : (visulabel
? $t(col.label_trans) ? addstrrequired + $t(col.label_trans)
: '' : '')
" "
type="number" type="number"
autofocus autofocus
@@ -672,7 +672,7 @@
col.label col.label
? addstrrequired + col.label ? addstrrequired + col.label
: col.label_trans : col.label_trans
? addstrrequired + $t(col.label_trans) ? (addstrrequired + $t(col.label_trans))
: '' : ''
" "
:class="{ 'cursor-pointer': canEdit }" :class="{ 'cursor-pointer': canEdit }"
@@ -697,7 +697,7 @@
</div> </div>
<div v-else-if="col.fieldtype === costanti.FieldType.onlydate"> <div v-else-if="col.fieldtype === costanti.FieldType.onlydate">
<CDateTime <CDateTime
:label="col.label ? addstrrequired + col.label : addstrrequired + $t(col.label_trans)" :label="col.label ? (addstrrequired + col.label) : (addstrrequired + $t(col.label_trans))"
:class="{ 'cursor-pointer': canEdit }" :class="{ 'cursor-pointer': canEdit }"
:valueDate="myvalue" :valueDate="myvalue"
v-model:value="myvalue" v-model:value="myvalue"
@@ -1197,7 +1197,7 @@
:maxlength="col.maxlength ? col.maxlength : undefined" :maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined" :minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value" v-model="scope.value"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : ''" :label="col.visulabel ? (addstrrequired + $t(col.label_trans)) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted" :autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop @keyup.enter.stop
autofocus autofocus
@@ -1219,8 +1219,8 @@
:label=" :label="
col.visulabel col.visulabel
? $t(col.label_trans) ? $t(col.label_trans)
: addstrrequired + visulabel : visulabel
? addstrrequired + col.label ? (addstrrequired + col.label)
: '' : ''
" "
> >
@@ -1495,10 +1495,10 @@
<CDateTime <CDateTime
:label=" :label="
col.label col.label
? addstrrequired + col.label ? (addstrrequired + col.label)
: col.label_trans : (col.label_trans
? addstrrequired + $t(col.label_trans) ? (addstrrequired + $t(col.label_trans))
: '' : '')
" "
:class="{ 'cursor-pointer': canEdit }" :class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue" v-model:value="myvalue"
@@ -1513,7 +1513,7 @@
</div> </div>
<div v-else-if="col.fieldtype === costanti.FieldType.onlydate"> <div v-else-if="col.fieldtype === costanti.FieldType.onlydate">
<CDateTime <CDateTime
:label="col.label ? addstrrequired + col.label : addstrrequired + $t(col.label_trans)" :label="col.label ? addstrrequired + col.label : (addstrrequired + $t(col.label_trans))"
:class="{ 'cursor-pointer': canEdit }" :class="{ 'cursor-pointer': canEdit }"
:valueDate="myvalue" :valueDate="myvalue"
v-model:value="myvalue" v-model:value="myvalue"
@@ -1554,7 +1554,7 @@
:maxlength="col.maxlength ? col.maxlength : undefined" :maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined" :minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value" v-model="scope.value"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : ''" :label="col.visulabel ? (addstrrequired + $t(col.label_trans)) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted" :autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop @keyup.enter.stop
autofocus autofocus

View File

@@ -27,7 +27,7 @@
<q-item> <q-item>
<q-item-section side v-if="tools.canModifyThisRec(myrec, table) || editOn"> <q-item-section side v-if="tools.canModifyThisRec(myrec, table) || editOn">
<q-item-label> <q-item-label>
<q-btn rounded dense icon="fas fa-pencil-alt"> <q-btn rounded dense icon="fas fa-pencil-alt" color="blue">
<q-menu> <q-menu>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item <q-item

View File

@@ -588,7 +588,7 @@ export default defineComponent({
valori.value = myarr.filter((v: any) => { valori.value = myarr.filter((v: any) => {
let mioval = tools.getRecordByField(optlab, v) let mioval = tools.getRecordByField(optlab, v)
if (mioval) if (mioval)
return mioval.toLowerCase().indexOf(mystr) > -1 return mioval?.toLowerCase().indexOf(mystr) > -1
else else
return false return false
@@ -698,7 +698,7 @@ export default defineComponent({
// Se esiste già, non crearlo // Se esiste già, non crearlo
const esiste = optionsreal.value.find((rec: any) => { const esiste = optionsreal.value.find((rec: any) => {
// console.log('rec[fieldval]',rec[fieldval], value.toLowerCase()) // console.log('rec[fieldval]',rec[fieldval], value.toLowerCase())
return rec[fieldval].toLowerCase() === value.toLowerCase() && (rec[props.filter_field] === props.value_extra) return rec[fieldval]?.toLowerCase() === value.toLowerCase() && (rec[props.filter_field] === props.value_extra)
}) })
console.log('esiste', esiste) console.log('esiste', esiste)
if (!esiste || (esiste && esiste.length === 0)) { if (!esiste || (esiste && esiste.length === 0)) {

View File

@@ -19,7 +19,6 @@ import { CMyFieldDb } from '@/components/CMyFieldDb'
import { CSelectUserActive } from '@/components/CSelectUserActive' import { CSelectUserActive } from '@/components/CSelectUserActive'
import { toolsext } from '@store/Modules/toolsext' import { toolsext } from '@store/Modules/toolsext'
import { useGlobalStore } from '@store/globalStore' import { useGlobalStore } from '@store/globalStore'
import { useTestStore } from '@store/testStore'
import { useUserStore } from '@store/UserStore' import { useUserStore } from '@store/UserStore'
import { useProducts } from '@store/Products' import { useProducts } from '@store/Products'
@@ -70,7 +69,6 @@ export default defineComponent({
const userStore = useUserStore() const userStore = useUserStore()
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
const products = useProducts() const products = useProducts()
const testStore = useTestStore()
const notifStore = useNotifStore() const notifStore = useNotifStore()
const { getnumItemsCart } = MixinUsers() const { getnumItemsCart } = MixinUsers()

View File

@@ -1,3 +1,4 @@
import { ICollana } from "./Products"
export interface FotoCatalogo { export interface FotoCatalogo {
imagefile: string imagefile: string
@@ -15,9 +16,10 @@ export interface ICatalog {
active?: boolean active?: boolean
title: string title: string
foto_collana?: FotoCatalogo, foto_collana?: FotoCatalogo,
idCollana?: string idCollane?: number[]
collana_info?: ICollana
descr_introduttiva?: string descr_introduttiva?: string
idTemplateScheda?: string idPageAssigned?: string
referenti?: string[] referenti?: string[]
img_bordata_web?: FotoCatalogo, img_bordata_web?: FotoCatalogo,
img_bordata_stampa?: FotoCatalogo, img_bordata_stampa?: FotoCatalogo,
@@ -32,5 +34,5 @@ export interface ICatalog {
} }
export interface ICatalogState { export interface ICatalogState {
catalog?: ICatalog catalogs?: ICatalog[]
} }

View File

@@ -799,7 +799,7 @@ export interface IMyScheda {
excludeproductTypes?: number[] excludeproductTypes?: number[]
editore?: string[] editore?: string[]
argomenti?: string[] argomenti?: string[]
collana?: string idCollane?: number[]
author?: string author?: string
sort_field?: string sort_field?: string
sort_dir?: number sort_dir?: number
@@ -826,7 +826,7 @@ export interface IOptCatalogo {
Categoria?: string[] Categoria?: string[]
editore?: string[] editore?: string[]
argomenti?: string[] argomenti?: string[]
collana?: string idCollane?: number[]
sort_field?: string sort_field?: string
sort_dir?: number sort_dir?: number
pdf?: boolean pdf?: boolean

View File

@@ -34,7 +34,7 @@ export interface IProductInfo {
checkout_link?: string checkout_link?: string
idAuthors?: string[] idAuthors?: string[]
authors?: string[] authors?: string[]
idCollana?: string idCollana?: number
collana?: ICollana collana?: ICollana
collezione?: string collezione?: string
idPublisher?: string idPublisher?: string
@@ -223,8 +223,7 @@ export interface ICatProd {
export interface ICollana { export interface ICollana {
_id?: any _id?: any
idCollana: number, idCollana: number,
descrizione: string, title: string,
descrizione_estesa?: string,
} }
export interface ICatAI { export interface ICatAI {

View File

@@ -539,6 +539,7 @@ const msg_it = {
ritessitura: 'RITESSITURA', ritessitura: 'RITESSITURA',
}, },
reg: { reg: {
nameorg: 'Nome Organizzazione',
version: 'Versione', version: 'Versione',
socio: 'Socio', socio: 'Socio',
socioresidente: 'Residente', socioresidente: 'Residente',
@@ -2013,6 +2014,8 @@ const msg_it = {
referenti: 'Referenti', referenti: 'Referenti',
img_bordata_web: 'Foto Bordo per Web', img_bordata_web: 'Foto Bordo per Web',
collane: 'Collane', collane: 'Collane',
idPageAssigned: 'Pagina Assegnata',
descr_introduttiva: 'Descrizione Introduttiva',
} }
}, },

View File

@@ -23,7 +23,7 @@ import globalroutines from '../globalroutines/index'
export const useCatalogStore = defineStore('CatalogStore', { export const useCatalogStore = defineStore('CatalogStore', {
state: (): ICatalogState => ({ state: (): ICatalogState => ({
catalog: { idapp: '', title: '' } catalogs: [{ idapp: '', title: '' }]
}), }),
getters: {}, getters: {},

View File

@@ -29,6 +29,7 @@ export const costanti = {
'excludeproductTypes', 'excludeproductTypes',
'misure', 'misure',
'Categoria', 'Categoria',
'idCollane',
'editore', 'editore',
'pdf', 'pdf',
'Printable', 'Printable',

View File

@@ -129,17 +129,17 @@ export const colTableCatalogList = [
isadvanced_field: false, isadvanced_field: false,
}), }),
AddCol({ AddCol({
name: 'idCollana', name: 'idCollane',
label_trans: 'cataloglist.collane', label_trans: 'cataloglist.collane',
fieldtype: costanti.FieldType.select, fieldtype: costanti.FieldType.multiselect,
jointable: 'collanas', jointable: 'collanas',
}), }),
AddCol({ AddCol({
name: 'idTemplateScheda', name: 'idPageAssigned',
label_trans: 'scheda.linkIdTemplate', label_trans: 'cataloglist.idPageAssigned',
fieldtype: costanti.FieldType.select, fieldtype: costanti.FieldType.select,
jointable: 'collanas', jointable: 'mypages_id',
}), }),
AddCol({ AddCol({
@@ -150,6 +150,8 @@ export const colTableCatalogList = [
field_outtype: costanti.FieldType.object, field_outtype: costanti.FieldType.object,
showWhen: costanti.showWhen.InView_OnlyifExist, showWhen: costanti.showWhen.InView_OnlyifExist,
}), }),
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html }),
AddCol({ AddCol({
name: 'img_bordata_web', name: 'img_bordata_web',
label_trans: 'cataloglist.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, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
isadvanced_field: false, isadvanced_field: false,
}), }),
AddCol({ name: 'idTemplateScheda', label_trans: 'scheda.linkIdTemplate', fieldtype: costanti.FieldType.string }),
AddCol(ModifRec), AddCol(ModifRec),
AddCol(DuplicateRec), AddCol(DuplicateRec),
@@ -241,7 +242,12 @@ export const colmyScheda = [
AddCol({ name: 'editore', label_trans: 'editore' }), AddCol({ name: 'editore', label_trans: 'editore' }),
AddCol({ name: 'author', label_trans: 'scheda.author' }), AddCol({ name: 'author', label_trans: 'scheda.author' }),
AddCol({ name: 'argomenti', label_trans: 'scheda.argomenti' }), 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_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: 'sort_dir', label_trans: 'catalogo.sort_dir', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'arrProdottiSpeciali', label_trans: 'editore' }), AddCol({ name: 'arrProdottiSpeciali', label_trans: 'editore' }),
@@ -254,7 +260,12 @@ export const colmyelCatalogo = [
AddCol({ name: 'pdf_filename', label_trans: 'pdf_filename' }), AddCol({ name: 'pdf_filename', label_trans: 'pdf_filename' }),
AddCol({ name: 'editore', label_trans: 'editore' }), AddCol({ name: 'editore', label_trans: 'editore' }),
AddCol({ name: 'argomenti', label_trans: 'scheda.argomenti' }), 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: 'width', label_trans: 'width', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'height', label_trans: 'height', 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 }), AddCol({ name: 'optcatalogo.', label_trans: 'catalogo.optcatalogo.', fieldtype: costanti.FieldType.number }),
@@ -1067,7 +1078,7 @@ export const colmyUserPeople = [
export const colmyUserGroup = [ export const colmyUserGroup = [
// AddCol({ name: '_id', label_trans: 'reg.id' }), // AddCol({ name: '_id', label_trans: 'reg.id' }),
AddCol({ AddCol({
name: 'title', label_trans: 'reg.name', name: 'title', label_trans: 'reg.nameorg',
field_toduplicate_nospace: 'groupname', field_toduplicate_nospace: 'groupname',
required: true, noshowlabel: true, maxlength: 50 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, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true, noshowlabel: true,
icon: 'mood', icon: 'mood',
isadvanced_field: true,
sortable: false, sortable: false,
typeobj: 'checkbox', typeobj: 'checkbox',
}), }),
@@ -4195,6 +4205,13 @@ export const fieldsTable = {
colkey: 'path', colkey: 'path',
collabel: 'title', collabel: 'title',
}, },
{
value: 'mypages_id',
label: 'Pagine Web (ID)',
columns: colmypage,
colkey: '_id',
collabel: 'title',
},
{ {
value: 'products', value: 'products',
label: 'Prodotti', label: 'Prodotti',
@@ -4270,7 +4287,7 @@ export const fieldsTable = {
label: 'Collane', label: 'Collane',
columns: colTableCollane, columns: colTableCollane,
colkey: 'idCollana', colkey: 'idCollana',
collabel: 'descrizione', collabel: 'title',
}, },
{ {
value: 'catais', value: 'catais',
@@ -4948,6 +4965,13 @@ export const fieldsTable = {
colkey: '_id', colkey: '_id',
collabel: 'title', collabel: 'title',
}, },
{
value: 'schedeopt',
label: 'Template Cataloghi',
columns: colTableGeneric,
colkey: 'value',
collabel: 'label',
},
], ],
} }

View File

@@ -7506,9 +7506,9 @@ export const tools = {
// console.log('arrimage', arrimage) // console.log('arrimage', arrimage)
if (shared_consts.TABLES_DIRECTORY_A_PARTE.includes(table)) { 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)) { } 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 { } else {
// console.log('username', username, 'table', table) // console.log('username', username, 'table', table)
if (arrimage && arrimage.length > 0) { if (arrimage && arrimage.length > 0) {
@@ -9317,6 +9317,21 @@ export const tools = {
return rec ? rec.strsingolo : '' 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 { getGradientByColors(col1: string, col2: string, col3: string): string {
let mystr = '' let mystr = ''
if (col1) { if (col1) {

View File

@@ -49,20 +49,6 @@ async function getConfig(id: any) {
return globalroutines('read', 'config', null, id) 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', { export const useGlobalStore = defineStore('GlobalStore', {
state: (): IGlobalState => ({ state: (): IGlobalState => ({
@@ -353,6 +339,34 @@ export const useGlobalStore = defineStore('GlobalStore', {
return !!rec ? rec.name + ' ' + rec.surname : '' 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 => { getListByTable: (state: IGlobalState) => (table: string, value2?: any): any => {
let ris: 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.TABOPZEMAIL) ris = state.opzemail
else if (table === toolsext.TABMAILINGLIST) ris = state.mailinglist else if (table === toolsext.TABMAILINGLIST) ris = state.mailinglist
else if (table === toolsext.TABMYPAGE) ris = state.mypage 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.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 === toolsext.TABCALZOOM) ris = state.calzoom
else if (table === 'producers') ris = state.producers else if (table === 'producers') ris = state.producers
else if (table === 'storehouses') ris = state.storehouses else if (table === 'storehouses') ris = state.storehouses
@@ -451,6 +466,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
return state.catgrps return state.catgrps
else if (table === 'collanas') else if (table === 'collanas')
return Products.collane return Products.collane
else if (table === 'schedeopt')
return state.getSchedeOpt
else if (table === 'provinces') else if (table === 'provinces')
return state.provinces.filter((rec: IProvince) => (!rec.card) && (rec.prov !== 'ITA') && (rec.prov !== 'EST')) return state.provinces.filter((rec: IProvince) => (!rec.card) && (rec.prov !== 'ITA') && (rec.prov !== 'EST'))
else if (table === 'cards') { else if (table === 'cards') {
@@ -1725,7 +1742,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
circuitStore.listcircuits = (res.data.listcircuits) ? res.data.listcircuits : [] circuitStore.listcircuits = (res.data.listcircuits) ? res.data.listcircuits : []
circuitStore.listaccounts = (res.data.listaccounts) ? res.data.listaccounts : [] 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.settings = (res.data.settings) ? [...res.data.settings] : []
this.disciplines = (res.data.disciplines) ? [...res.data.disciplines] : [] this.disciplines = (res.data.disciplines) ? [...res.data.disciplines] : []
@@ -2456,32 +2473,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
SchedeOpt() { SchedeOpt() {
const arrschede: ISchedaSingola[] = this.getMySchede() return this.getSchedeOpt
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
}, },
} }
}) })

View File

@@ -20,15 +20,6 @@ export const useTestStore = defineStore({
return (rec.lang === toolsext.getLocale(false) || toolsext.getLocale() === '') 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: { actions: {

View File

@@ -14,10 +14,11 @@ import { CProductCard } from '@src/components/CProductCard'
import { CMySelect } from '@src/components/CMySelect' import { CMySelect } from '@src/components/CMySelect'
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard' import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard'
import { CSelectUserActive } from '@src/components/CSelectUserActive' import { CSelectUserActive } from '@src/components/CSelectUserActive'
import { IOptCatalogo, IDimensioni, IFilterCatalogo, IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList } from 'model' import { IOptCatalogo, IDimensioni, IFilterCatalogo, IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog } from 'model'
import { fieldsTable } from '@store/Modules/fieldsTable' import { fieldsTable } from '@store/Modules/fieldsTable'
import { useCatalogStore } from '@src/store/CatalogStore'
export default defineComponent({ export default defineComponent({
name: 'Catalogo', name: 'Catalogo',
@@ -208,6 +209,23 @@ export default defineComponent({
return lista && lista.value && lista.value.hasOwnProperty('name') ? lista.value.name : '' return lista && lista.value && lista.value.hasOwnProperty('name') ? lista.value.name : ''
} }
function getIdCollaneDaFiltrare() {
let idCollane: number[] = []
const catalogStore = useCatalogStore()
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
let trovato = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned)
if (trovato) {
} else {
idCollane = optcatalogo.value.idCollane! || []
}
return idCollane
}
function calcArrProducts() { function calcArrProducts() {
// console.log('calcArrProducts') // console.log('calcArrProducts')
@@ -228,7 +246,10 @@ export default defineComponent({
let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0 let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0
let filtroPublishers = optcatalogo.value.editore || [] let filtroPublishers = optcatalogo.value.editore || []
let filtroCollane = getIdCollaneDaFiltrare()
let boolfiltroVuotoEditore = (filtroPublishers.length === 0) let boolfiltroVuotoEditore = (filtroPublishers.length === 0)
let boolfiltroVuotoCollane = (filtroCollane.length === 0)
//console.log('filtroVersione', filtroProductTypes) //console.log('filtroVersione', filtroProductTypes)
@@ -247,7 +268,7 @@ export default defineComponent({
} }
let lowerSearchText = (searchtext || '').toLowerCase().trim(); let lowerSearchText = (searchtext || '').toLowerCase().trim();
lowerSearchText = lowerSearchText.replace(/[-@:=]/g, ''); lowerSearchText = lowerSearchText.replace(/[-@:=]/g, '');
if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoEditore && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) { if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoCollane && boolfiltroVuotoEditore && boolfiltroVuotoCollana && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) {
} else { } else {
@@ -265,6 +286,7 @@ export default defineComponent({
let hasProductTypes = true let hasProductTypes = true
let hasPublished = true let hasPublished = true
let hasCollana = true
let hasExcludeProductTypes = false let hasExcludeProductTypes = false
//++AddCATALOGO_FIELDS //++AddCATALOGO_FIELDS
@@ -276,6 +298,9 @@ export default defineComponent({
if (optcatalogo.value && !boolfiltroVuotoEditore) { if (optcatalogo.value && !boolfiltroVuotoEditore) {
hasPublished = !optcatalogo.value.editore || (optcatalogo.value.editore && optcatalogo.value.editore.includes(product.productInfo.idPublisher!)) hasPublished = !optcatalogo.value.editore || (optcatalogo.value.editore && optcatalogo.value.editore.includes(product.productInfo.idPublisher!))
} }
if (optcatalogo.value && !boolfiltroVuotoCollane) {
hasCollana = !optcatalogo.value.idCollane || (optcatalogo.value.idCollane && optcatalogo.value.idCollane.includes(product.productInfo.idCollana!))
}
if (optcatalogo.value && !boolfiltroVuotoExcludeProductTypes) { if (optcatalogo.value && !boolfiltroVuotoExcludeProductTypes) {
// check if productInfo.productTypes array exclude some item in optcatalogo.value.ProductTypes array // check if productInfo.productTypes array exclude some item in optcatalogo.value.ProductTypes array
@@ -294,7 +319,7 @@ export default defineComponent({
// Check if all words in lowerSearchText are present in lowerName // Check if all words in lowerSearchText are present in lowerName
let allWordsPresent = lowerSearchText.split(/\s+/).every(word => new RegExp(`\\b${word}\\b`, 'i').test(lowerName)); let allWordsPresent = lowerSearchText.split(/\s+/).every(word => new RegExp(`\\b${word}\\b`, 'i').test(lowerName));
return (codeMatch.test(product.productInfo.code || '') || allWordsPresent) && hasCategoria && hasArgomentiCat && hasAuthor && productgassel && hasProductTypes && hasPublished && !hasExcludeProductTypes; return (codeMatch.test(product.productInfo.code || '') || allWordsPresent) && hasCategoria && hasCollana && hasArgomentiCat && hasAuthor && productgassel && hasProductTypes && hasPublished && !hasExcludeProductTypes;
} else { } else {
console.error('product or product.productInfo is null'); console.error('product or product.productInfo is null');
return false; return false;
@@ -378,7 +403,9 @@ export default defineComponent({
let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0 let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0
let filtroPublishers = scheda.editore || [] let filtroPublishers = scheda.editore || []
let filtroCollane = getIdCollaneDaFiltrare()
let boolfiltroVuotoEditore = (filtroPublishers.length === 0) let boolfiltroVuotoEditore = (filtroPublishers.length === 0)
let boolfiltroVuotoCollane = (filtroCollane.length === 0)
//console.log('filtroVersione', filtroProductTypes) //console.log('filtroVersione', filtroProductTypes)
@@ -429,6 +456,7 @@ export default defineComponent({
let hasProductTypes = true let hasProductTypes = true
let hasPublished = true let hasPublished = true
let hasCollane = true
let hasExcludeProductTypes = false let hasExcludeProductTypes = false
if (!boolfiltroVuotoProductTypes) { if (!boolfiltroVuotoProductTypes) {
@@ -439,12 +467,16 @@ export default defineComponent({
hasPublished = !scheda.editore || (scheda.editore && scheda.editore.includes(product.productInfo.idPublisher!)) hasPublished = !scheda.editore || (scheda.editore && scheda.editore.includes(product.productInfo.idPublisher!))
} }
if (optcatalogo.value && !boolfiltroVuotoCollane) {
hasCollane = !optcatalogo.value.idCollane || (optcatalogo.value.idCollane && optcatalogo.value.idCollane.includes(product.productInfo.idCollana!))
}
if (!boolfiltroVuotoExcludeProductTypes) { if (!boolfiltroVuotoExcludeProductTypes) {
// check if productInfo.productTypes array exclude some item in scheda.ProductTypes array // check if productInfo.productTypes array exclude some item in scheda.ProductTypes array
hasExcludeProductTypes = !scheda.excludeproductTypes || (scheda.excludeproductTypes && (product.productInfo.productTypes || []).every((item: any) => scheda.excludeproductTypes!.includes(item))) hasExcludeProductTypes = !scheda.excludeproductTypes || (scheda.excludeproductTypes && (product.productInfo.productTypes || []).every((item: any) => scheda.excludeproductTypes!.includes(item)))
} }
return searchMatch && hasCategoria && hasArgomentiCat && hasAuthor && hasProductTypes && hasPublished && !hasExcludeProductTypes; return searchMatch && hasCategoria && hasArgomentiCat && hasAuthor && hasProductTypes && hasPublished && hasCollane && !hasExcludeProductTypes;
} else { } else {
console.error('product or product.productInfo is null'); console.error('product or product.productInfo is null');
return false; return false;

View File

@@ -250,7 +250,7 @@
type="a" type="a"
size="md" size="md"
rounded rounded
:label="$t('reg.website')" :label="$t('reg.website') + ' ' + tools.getMainUrl(getLinkWebSite())"
:href="getLinkWebSite()" :href="getLinkWebSite()"
target="__blank" target="__blank"
></q-btn> ></q-btn>