From 0ad4dcff755b965ef3dbb1adacf1e94226a4e64b Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Tue, 11 Feb 2025 18:58:06 +0100 Subject: [PATCH] - Cataloghi aggiornamento... --- .env.production | 16 ++-- quasar.conf.js | 2 +- src/common/shared_vuejs.ts | 28 ++++++ src/components/CCatalogList/CCatalogList.ts | 10 +++ src/components/CCatalogList/CCatalogList.vue | 2 +- src/components/CCatalogoCard/CCatalogoCard.ts | 2 +- .../CContainerCatalogoCard.ts | 2 +- src/components/CGridTableRec/CGridTableRec.ts | 85 ++++++++++--------- src/components/CMyEditElem/CMyEditElem.ts | 1 + src/components/CMyEditElem/CMyEditElem.vue | 12 ++- src/components/CMyElem/CMyElem.vue | 2 + src/components/CMyPopupEdit/CMyPopupEdit.vue | 2 + src/components/CMyRecCatalog/CMyRecCatalog.ts | 11 ++- .../CMyRecCatalog/CMyRecCatalog.vue | 47 +++++----- src/components/CMySlider/CMySlider.vue | 2 +- src/components/CMyText/CMyText.ts | 13 ++- src/components/MyHeader/MyHeader.vue | 2 +- src/model/CatalogStore.ts | 10 ++- src/model/GlobalStore.ts | 1 + src/statics/lang/it.js | 16 +++- src/store/Modules/fieldsTable.ts | 44 +++++++++- src/store/Products.ts | 4 +- src/views/ecommerce/catalogo/catalogo.ts | 57 +++++++++++-- 23 files changed, 272 insertions(+), 99 deletions(-) diff --git a/.env.production b/.env.production index 4660546a..3dfb7e38 100644 --- a/.env.production +++ b/.env.production @@ -1,27 +1,27 @@ APP_VERSION="1.1.21" SERVICE_WORKER_FILE="service-worker.js" -APP_ID="13" +APP_ID="18" DIRECTORY_LOCAL=newfreeplanet -DIRECTORY_SERVER=freeplanet_serverside -SERVERDIR_WEBSITE=riso.app +DIRECTORY_SERVER=/var/www/freeplanet_serverside +SERVERDIR_WEBSITE="/var/www/gruppomacro.app" SERVERPW_WEBSITE=pwdadmin@1AOK -APP_URL="https://riso.app" +APP_URL="https://gruppomacro.app" URL_FACEBOOK="" PROVA_PAOLO="" LANG_DEFAULT="it" PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF" MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T" -MONGODB_HOST="https://www.freeplanet.app:3000" -LOGO_REG='riso-logo-full.png' +MONGODB_HOST="https://api.gruppomacro.app" +LOGO_REG='gruppomacro-logo-full.png' TEST_NAME="" TEST_SURNAME="" TEST_EMAIL="" TEST_USERNAME="" TEST_PASSWORD="" TEST_APORTADOR="------" -PUBLICKEY_PUSH="BNM-cEpTbPVc_ujXf3QOC8ggf7b-X44P44esfJUWqNOFq1XhWCoZJpOi71_cbXC5SnfO9HassQ6OouAYgtBA9Pw" +PUBLICKEY_PUSH="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc" DEBUG="1" TELEGRAM_SUPPORT="" PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a" TEST_CELL="" -VUE_APP_ISTEST=0 +VUE_APP_ISTEST=0 \ No newline at end of file diff --git a/quasar.conf.js b/quasar.conf.js index 795436c5..7adabd4e 100755 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -39,7 +39,7 @@ module.exports = configure((ctx) => ({ // --> boot files are part of "main.js" // https://v2.quasar.dev/quasar-cli/boot-files // boot: ['vue-i18n', 'vue-meta', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'vue-idb', 'dragula', 'guard'], - boot: ['i18n', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'calendar', 'social-sharing', 'timeago'], + boot: ['i18n', 'axios', 'vee-validate', 'myconfig', 'local-storage', 'error-handler', 'globalroutines', 'calendar', 'social-sharing', 'timeago', 'guard'], // https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css css: [ diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 1e0ff408..fb7405f3 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -288,6 +288,34 @@ export const shared_consts = { PARAM_SHOW_PROVINCE: 1, + TABLES_ID_STRING: [ + 'circuits', + 'accounts', + 'movements', + 'mygroups', + ], + + TABLES_ID_NUMBER: [ + 'permissions', + 'levels', + 'adtypes', + 'adtypegoods', + 'statusSkills', + 'sectors', + 'goods', + 'sectorgoods', + 'catgrps', + 'skills', + 'subskills', + 'cities', + 'provinces', + // 'myskills', + // 'mybachecas', + // 'myhosps', + // 'mygoods', + // 'mygroups' + ], + TABLES_MYSKILLS: 'myskills', TABLES_MYBACHECAS: 'mybachecas', TABLES_MYHOSPS: 'myhosps', diff --git a/src/components/CCatalogList/CCatalogList.ts b/src/components/CCatalogList/CCatalogList.ts index 87c1ff65..f0206cf1 100755 --- a/src/components/CCatalogList/CCatalogList.ts +++ b/src/components/CCatalogList/CCatalogList.ts @@ -42,6 +42,16 @@ export default defineComponent({ required: false, default: 0, }, + heightcard: { + type: String, + required: false, + default: '150px', + }, + widthcard: { + type: String, + required: false, + default: '300px', + }, }, components: { CMyFieldDb, CGridTableRec, CTitlePage, diff --git a/src/components/CCatalogList/CCatalogList.vue b/src/components/CCatalogList/CCatalogList.vue index b9db0cf4..c4caa727 100755 --- a/src/components/CCatalogList/CCatalogList.vue +++ b/src/components/CCatalogList/CCatalogList.vue @@ -34,7 +34,7 @@ :prop_showMap="false" :heightcarousel="heightcarousel" @clickButtBar="clickButtBar" - :opt="{rowclass: true, widthcard: $q.screen.gt.xs ? '300px' : '170px', heightcard: $q.screen.gt.xs ? '300px' : '170px'}" + :opt="{rowclass: true, widthcard, heightcard}" > diff --git a/src/components/CCatalogoCard/CCatalogoCard.ts b/src/components/CCatalogoCard/CCatalogoCard.ts index a063efb1..c9afc1f7 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.ts +++ b/src/components/CCatalogoCard/CCatalogoCard.ts @@ -111,7 +111,7 @@ export default defineComponent({ watch(() => props.modelValue, (newVal) => { optcatalogo.value = { ...newVal }; // updateCatalogoPadre() - }, { deep: true }); + }, { deep: false }); function updateCatalogoPadre() { emit('update:modelValue', optcatalogo.value); diff --git a/src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts b/src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts index 7c2ff73d..902279c1 100755 --- a/src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts +++ b/src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts @@ -80,7 +80,7 @@ export default defineComponent({ watch(() => props.modelValue, (newVal) => { optcatalogo.value = { ...newVal }; // updateCatalogoPadre() - }, { deep: true }); + }, { deep: false }); function updateCatalogoPadre() { emit('update:modelValue', optcatalogo.value); diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 79639d0f..2eed4fd4 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -2213,59 +2213,64 @@ export default defineComponent({ const ok = true - let myrec = null - if (newrec) { - myrec = { ...newRecord.value } - } else { - myrec = { ...recModif.value } - } + try { - // mycolumns.value.forEach((col: IColGridTable) => { - let col: IColGridTable + let myrec = null + if (newrec) { + myrec = { ...newRecord.value } + } else { + myrec = { ...recModif.value } + } - let msg = '' + // mycolumns.value.forEach((col: IColGridTable) => { + let col: IColGridTable - for (col of mycolumns.value) { - if (!msg) { - if (col.showonlyif_dipersona) { - const valori = myrec['idStatusSkill'] + let msg = '' - if (valori && (valori.length === 1) && valori.includes(shared_consts.STATUSSKILL_ONLINE)) { - col.required = false - } else { - col.required = true - } + for (col of mycolumns.value) { + if (!msg) { + if (col.showonlyif_dipersona) { + const valori = myrec['idStatusSkill'] - col.visible = col.required - } - if (col.required) { - // console.log('newRecord.value', newRecord.value, newRecord.value[col.name]) - if (tools.isArray(myrec[col.name])) { - if (myrec[col.name].length <= 0) { - msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\'' + if (valori && (valori.length === 1) && valori.includes(shared_consts.STATUSSKILL_ONLINE)) { + col.required = false + } else { + col.required = true } - } else { - if (!myrec[col.name]) { - msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\'' + + col.visible = col.required + } + if (col.required) { + // console.log('newRecord.value', newRecord.value, newRecord.value[col.name]) + if (tools.isArray(myrec[col.name])) { + if (myrec[col.name].length <= 0) { + msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\'' + } + } else { + if (!myrec[col.name]) { + msg = 'Si prega di compilare il campo \'' + getColMissing(myrec) + '\'' + } } } - } - if (!msg && col.maxlength! > 0) { - if (myrec[col.name].length > col.maxlength!) { - msg = t('annunci.maxlength', { name: translate(col.label_trans), maxlength: col.maxlength }) + if (!msg && col.maxlength! > 0 && myrec && myrec[col.name]) { + if ((myrec[col.name].length > col.maxlength!) && (col.fieldtype !== costanti.FieldType.html)) { + msg = t('annunci.maxlength', { name: translate(col.label_trans), maxlength: col.maxlength }) + } } - } - if (!msg && col.minlength! > 0) { - if (myrec[col.name].length < col.minlength!) { - msg = t('annunci.minlength', { name: translate(col.label_trans), minlength: col.minlength }) + if (!msg && col.minlength! > 0 && myrec && myrec[col.name]) { + if ((myrec[col.name].length < col.minlength!) && (col.fieldtype !== costanti.FieldType.html)) { + msg = t('annunci.minlength', { name: translate(col.label_trans), minlength: col.minlength }) + } } } } - } - if (showmsg && msg) { - tools.showNegativeNotif($q, msg, 5000) - return false + if (showmsg && msg) { + tools.showNegativeNotif($q, msg, 5000) + return false + } + } catch (e) { + } return ok diff --git a/src/components/CMyEditElem/CMyEditElem.ts b/src/components/CMyEditElem/CMyEditElem.ts index e9a55382..5d6c46ed 100755 --- a/src/components/CMyEditElem/CMyEditElem.ts +++ b/src/components/CMyEditElem/CMyEditElem.ts @@ -455,6 +455,7 @@ export default defineComponent({ _id: objectId(), idapp: tools.appid()!, isTemplate: false, + isPagIntro: false, show_separatore: true, name: 'Scheda Nuova', dimensioni, diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue index f506ef3a..e3942eb2 100755 --- a/src/components/CMyEditElem/CMyEditElem.vue +++ b/src/components/CMyEditElem/CMyEditElem.vue @@ -217,7 +217,7 @@ + + +
diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index cc5aedb4..b5d2f471 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -1054,6 +1054,7 @@ :canModify="canModify" @update:value="changevalRec" @showandsave="Savedb" + :maxlength="col.maxlength" >
@@ -1125,6 +1126,7 @@ :canModify="canModify" @showandsave="Savedb" @annulla="visueditor = false" + :maxlength="col.maxlength" > diff --git a/src/components/CMyRecCatalog/CMyRecCatalog.ts b/src/components/CMyRecCatalog/CMyRecCatalog.ts index 6c4a7ef1..975f4faf 100755 --- a/src/components/CMyRecCatalog/CMyRecCatalog.ts +++ b/src/components/CMyRecCatalog/CMyRecCatalog.ts @@ -14,7 +14,7 @@ import { useRouter } from 'vue-router' import { useCalendarStore } from '@src/store/CalendarStore' import { useGlobalStore } from '@src/store/globalStore' -import { ICollana, IPublisher } from "@src/model/Products" +import { ICatProd, ICollana, IPublisher } from "@src/model/Products" import { useProducts } from '@src/store/Products' export default defineComponent({ @@ -62,6 +62,7 @@ export default defineComponent({ const statecolor = ref('negative') const apriInfo = ref(false) const collanestr = ref('') + const argomentistr = ref('') const editorestr = ref('') const products = useProducts() @@ -106,6 +107,13 @@ export default defineComponent({ collanestr.value += reccoll.title + ' ' } } + argomentistr.value = '' + if (myrec.value.argomenti) { + for (const arg of myrec.value.argomenti!) { + const recargomento: ICatProd = products.catprods!.find((catprod: ICatProd) => catprod._id === arg) + argomentistr.value += recargomento.name + ' ' + } + } editorestr.value = '' if (myrec.value.editore) { for (const receditore of myrec.value.editore!) { @@ -198,6 +206,7 @@ export default defineComponent({ editorestr, pagina_collegata, esiste_descrintro, + argomentistr, } }, }) diff --git a/src/components/CMyRecCatalog/CMyRecCatalog.vue b/src/components/CMyRecCatalog/CMyRecCatalog.vue index 9b2f8620..d24fa35f 100755 --- a/src/components/CMyRecCatalog/CMyRecCatalog.vue +++ b/src/components/CMyRecCatalog/CMyRecCatalog.vue @@ -4,7 +4,7 @@ v-if="myrec" flat bordered - :style="`width: ` + opt.widthcard + `; height: 540px;`" + :style="`width: ` + opt.widthcard + `; `" >
{{ myrec.title }}
- Referente: + {{$t('cataloglist.referenti')}}: - Collana: + {{t('cataloglist.collane')}}: {{ collanestr }}
+
+ {{$t('cataloglist.argomenti')}}: + {{ argomentistr }} +
- Editore: + {{$t('cataloglist.referenti')}}: {{ editorestr }}
@@ -109,7 +113,7 @@ - +
- + />--> -
@@ -191,7 +189,7 @@ ? myrec.referenti.join(', ') : '[Non Assegnato]' " - label="Referente/i:" + :label="$t('cataloglist.argomenti') + `:`" :color=" myrec.referenti && myrec.referenti.length > 0 ? 'text-blue' @@ -199,8 +197,11 @@ " />
-
- +
+ +
+
+
- {{ label }} {{ modelValue }} + {{ label }} {{ modelValue }}
props.modelValue, (newVal) => { optcatalogo.value = { ...newVal }; - }, { deep: true }); + }, { deep: false }); /*watch(optcatalogo, (newValue) => { emit('update:modelValue', newValue); @@ -125,7 +125,7 @@ export default defineComponent({ if (recscheda.scheda!.isPagIntro) { const catalogStore = useCatalogStore() - const catalog = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage) + const catalog = getCatalogoByMyPage.value if (catalog && catalog.descr_introduttiva) { // Cerca se la descrizione introduttiva è stata impostata testo = catalog.descr_introduttiva @@ -313,6 +313,21 @@ export default defineComponent({ return idCollane } + function getArgomentiDaFiltrare(def_argomenti?: string[]) { + let argomenti: string[] = [] + + // Cerca se nella lista cataloghi c'è la Collana di questa Pagina ! + let trovatocatalogo = getCatalogoByMyPage.value + + if (trovatocatalogo) { + argomenti = trovatocatalogo.argomenti! || [] + } else { + argomenti = def_argomenti || [] + } + + return argomenti + } + function getEditoreDaFiltrare(def_editori?: string[]) { let editore: string[] = [] @@ -361,29 +376,35 @@ export default defineComponent({ if (optcatalogo.value.argomenti) { // ha la priorità questo scelto sul catalogo - arrargomstr = optcatalogo.value.argomenti + arrargomstr = getArgomentiDaFiltrare(optcatalogo.value.argomenti!) } else { catstr = cat.value || '' } + + let filtroArgomenti = arrargomstr || [] + let boolfiltroVuotoArgomenti = (filtroArgomenti.length === 0) + let gasselstr = '' if (cosa.value === shared_consts.PROD.GAS) { gasselstr = idGasSel.value || ''; } let lowerSearchText = (searchtext || '').toLowerCase().trim(); lowerSearchText = lowerSearchText.replace(/[-@:=]/g, ''); - if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoCollane && boolfiltroVuotoEditore && boolfiltroVuotoCollana && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) { + if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoArgomenti && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoCollane && boolfiltroVuotoEditore && boolfiltroVuotoCollana && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) { } else { arrprod = arrprod.filter((product: IProduct) => { if (product && product.productInfo) { let lowerName = (product.productInfo.name || '').toLowerCase(); - let hasCategoria = !catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr)); + let hasCategoria = false let hasArgomentiCat = true if (arrargomstr && arrargomstr.length > 0) { hasArgomentiCat = (product.productInfo.idCatProds || []).some(idCat => arrargomstr.includes(idCat)) hasCategoria = true + } else { + hasCategoria = (!catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr))) ? true : false } let hasAuthor = !filtroAuthor || (filtroAuthor && (product.productInfo.idAuthors || []).includes(filtroAuthor)); @@ -463,7 +484,6 @@ export default defineComponent({ if (myschedatocopy) { myschedatocopy.scheda._id = origScheda.scheda?._id myschedatocopy.scheda.isTemplate = false - myschedatocopy.scheda.isPagIntro = false myschedatocopy.scheda.name = precname myschedatocopy.scheda.linkIdTemplate = linkIdTemplate @@ -491,6 +511,7 @@ export default defineComponent({ } } + console.log(' FINE - populateDataWithlinkIdTemplate') } @@ -522,7 +543,7 @@ export default defineComponent({ if (optcatalogo.value.argomenti) { // ha la priorità questo scelto sul catalogo - arrargomstr = optcatalogo.value.argomenti + arrargomstr = getArgomentiDaFiltrare(optcatalogo.value.argomenti!) } else { catstr = cat.value || '' } @@ -541,11 +562,13 @@ export default defineComponent({ let lowerName = (product.productInfo.name || '').toLowerCase(); let lowerCode = (product.productInfo.code || '').toLowerCase(); - let hasCategoria = !catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr)); + let hasCategoria = false let hasArgomentiCat = true if (arrargomstr && arrargomstr.length > 0) { hasArgomentiCat = (product.productInfo.idCatProds || []).some(idCat => arrargomstr.includes(idCat)) hasCategoria = true + } else { + hasCategoria = (!catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr))) ? true : false } let hasAuthor = !filtroAuthor || (filtroAuthor && (product.productInfo.idAuthors || []).includes(filtroAuthor)); @@ -673,7 +696,7 @@ export default defineComponent({ } function generatearrProdToViewSorted() { - // console.log('generatearrProdToViewSorted', arrProducts.value) + console.log('generatearrProdToViewSorted...') try { @@ -686,6 +709,8 @@ export default defineComponent({ let indprod = 0 let indprodGenerale = 0 + let indtotale = 0 + for (const recscheda of optcatalogo.value.arrSchede!) { if (recscheda && recscheda.scheda) { let schedePerRiga = recscheda.scheda.numschede_perRiga || 1 @@ -739,16 +764,28 @@ export default defineComponent({ recscheda.arrProdToShow[pagina][riga][col] = result.myrec indadded++ + indtotale++ // console.log('indadded', indadded) + if (optcatalogo.value.maxnumlibri! > 0) { + if (indtotale > optcatalogo.value.maxnumlibri!) + return + + } else { + if (indtotale > 200) + return + } + } } } + if (recscheda.numPagineMax! > 0) { if (pagina + 1 >= recscheda.numPagineMax!) break; // fine pagine } + } // console.log('*** arrProdToShow', recscheda.arrProdToShow) @@ -757,6 +794,8 @@ export default defineComponent({ // console.log('Fine Generazione') } + console.log(' FINE - generatearrProdToViewSorted !') + } catch (e) { console.error('Err', e) }