diff --git a/.env b/.env
index 5178f56a..04a311bd 100755
--- a/.env
+++ b/.env
@@ -1,6 +1,6 @@
-VITE_APP_VERSION="1.2.39"
+VITE_APP_VERSION="1.2.40"
VITE_LANG_DEFAULT="it"
VITE_PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
-VITE_SERVICE_WORKER_FILE="sw-1.2.39.js"
+VITE_SERVICE_WORKER_FILE="sw-1.2.40.js"
VITE_PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a"
VITE_VUE_ROUTER_MODE="history"
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 80b67816..cf597aa8 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -13,5 +13,8 @@
"typescript.tsdk": "node_modules/typescript/lib",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[typescript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
\ No newline at end of file
diff --git a/index.html b/index.html
index 0e6d4ba7..fe6dc868 100755
--- a/index.html
+++ b/index.html
@@ -10,7 +10,7 @@
-
+
diff --git a/package.json b/package.json
index 6e1bc420..747d3085 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gruppomacro",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "Gruppo Macro",
"productName": "Gruppo Macro",
"author": "Surya",
@@ -9,20 +9,20 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "PORT=8089 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8089 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
- "buildspa": "APP_VERSION='1.2.39' quasar build -m spa",
+ "buildspa": "APP_VERSION='1.2.40' quasar build -m spa",
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
@@ -52,13 +52,16 @@
"echarts": "5.6.0",
"eslint-plugin-n": "^17.16.2",
"eslint-plugin-quasar": "^1.1.0",
+ "file-saver": "^2.0.5",
"graphql": "^16.10.0",
"graphql-tag": "^2.12.6",
"gsap": "^3.12.7",
+ "html2canvas": "^1.4.1",
"html2pdf.js": "^0.10.3",
"jquery": "^3.7.1",
"js-cookie": "^3.0.5",
"jsbarcode": "^3.11.6",
+ "jspdf": "^3.0.1",
"leaflet": "^1.9.4",
"leaflet-routing-machine": "^3.2.12",
"leaflet.markercluster": "^1.5.3",
@@ -66,6 +69,7 @@
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
+ "pdf-lib": "^1.17.1",
"pinia": "^3.0.1",
"qrcode-vue3": "^1.7.1",
"quasar": "^2.18.1",
diff --git a/scripts/_ALL_SITES/comunitanuovomondo.app/package.json b/scripts/_ALL_SITES/comunitanuovomondo.app/package.json
index a5a13139..0db60c3d 100755
--- a/scripts/_ALL_SITES/comunitanuovomondo.app/package.json
+++ b/scripts/_ALL_SITES/comunitanuovomondo.app/package.json
@@ -1,6 +1,6 @@
{
"name": "cnm",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "Comunita Nuovo Mondo",
"productName": "ComunitaNuovoMondo",
"author": "Surya",
@@ -9,7 +9,7 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "PORT=8083 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8083 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
"buildpwa": "NODE_ENV=production quasar build -m pwa",
@@ -21,8 +21,8 @@
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
diff --git a/scripts/_ALL_SITES/freeplanet.app/package.json b/scripts/_ALL_SITES/freeplanet.app/package.json
index 9f8dcb02..efa993d3 100755
--- a/scripts/_ALL_SITES/freeplanet.app/package.json
+++ b/scripts/_ALL_SITES/freeplanet.app/package.json
@@ -1,6 +1,6 @@
{
"name": "freeplanet",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "freeplanet",
"productName": "freeplanet",
"author": "Surya",
@@ -9,11 +9,11 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "PORT=8087 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8087 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
"buildspa": "quasar build -m spa",
@@ -21,8 +21,8 @@
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8097 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8097 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
diff --git a/scripts/_ALL_SITES/gruppomacro.app/package.json b/scripts/_ALL_SITES/gruppomacro.app/package.json
index 6e1bc420..7f4719da 100755
--- a/scripts/_ALL_SITES/gruppomacro.app/package.json
+++ b/scripts/_ALL_SITES/gruppomacro.app/package.json
@@ -1,6 +1,6 @@
{
"name": "gruppomacro",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "Gruppo Macro",
"productName": "Gruppo Macro",
"author": "Surya",
@@ -9,20 +9,20 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "PORT=8089 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8089 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
- "buildspa": "APP_VERSION='1.2.39' quasar build -m spa",
+ "buildspa": "APP_VERSION='1.2.40' quasar build -m spa",
"lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"",
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
diff --git a/scripts/_ALL_SITES/kolibrilab.it/package.json b/scripts/_ALL_SITES/kolibrilab.it/package.json
index 1ba6b22f..4d066ae2 100755
--- a/scripts/_ALL_SITES/kolibrilab.it/package.json
+++ b/scripts/_ALL_SITES/kolibrilab.it/package.json
@@ -1,6 +1,6 @@
{
"name": "kolibrilab",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "kolibrilab",
"productName": "kolibrilab",
"author": "Surya Paolo",
@@ -8,11 +8,11 @@
"keywords": [],
"license": "MIT",
"scripts": {
- "dev": "PORT=8083 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8083 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
"buildspa": "quasar build -m spa",
@@ -20,8 +20,8 @@
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint --ext .ts,.vue --ignore-path .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.40' quasar dev",
"spanorefresh": "NODE_ENV=development NODE_OPTIONS=--max_old_space_size=4096 DEBUG=v8:* quasar dev -m spa",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js"
diff --git a/scripts/_ALL_SITES/piuchebuono.app/package.json b/scripts/_ALL_SITES/piuchebuono.app/package.json
index d1c61d49..b15fdfb8 100755
--- a/scripts/_ALL_SITES/piuchebuono.app/package.json
+++ b/scripts/_ALL_SITES/piuchebuono.app/package.json
@@ -1,6 +1,6 @@
{
"name": "piuchebuono",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "PiuCheBuono",
"productName": "PiuCheBuono",
"author": "Surya",
@@ -9,11 +9,11 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "PORT=8085 APP_VERSION='1.2.39' quasar dev",
+ "dev": "PORT=8085 APP_VERSION='1.2.40' quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
"buildspa": "quasar build -m spa",
@@ -21,8 +21,8 @@
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
diff --git a/scripts/_ALL_SITES/riso.app/package.json b/scripts/_ALL_SITES/riso.app/package.json
index dfe5d448..65dc8d53 100755
--- a/scripts/_ALL_SITES/riso.app/package.json
+++ b/scripts/_ALL_SITES/riso.app/package.json
@@ -1,6 +1,6 @@
{
"name": "riso",
- "version": "1.2.39",
+ "version": "1.2.40",
"description": "Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.",
"productName": "Riso",
"author": "Surya",
@@ -9,11 +9,11 @@
"license": "MIT",
"type": "module",
"scripts": {
- "dev": "APP_VERSION='1.2.39' PORT=8084 quasar dev",
+ "dev": "APP_VERSION='1.2.40' PORT=8084 quasar dev",
"dev_noCheck": "SKIP_TSC=true quasar dev",
"build": "quasar build",
- "buildpwa": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
- "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.39' quasar build -m pwa",
+ "buildpwa": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
+ "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.40' quasar build -m pwa",
"type-check": "vue-tsc --noEmit",
"type-check:watch": "vue-tsc --noEmit --watch",
"buildspa": "quasar build -m spa",
@@ -21,8 +21,8 @@
"lintfile": "eslint --ext .js,.ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"lintfileNoJS": "eslint --ext .ts,.vue --ignore-path .gitignore ./ > file.out.txt",
"fix": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\" --ignore-pattern .gitignore ./ --fix > file.out.txt",
- "pwa": "NODE_ENV=development PORT=8094 APP_VERSION='1.2.39' quasar dev -m pwa",
- "spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.39' quasar dev",
+ "pwa": "NODE_ENV=development PORT=8094 APP_VERSION='1.2.40' quasar dev -m pwa",
+ "spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.40' quasar dev",
"debug": "quasar dev --mode debug",
"test": "echo \"No test specified\" && exit 0",
"generate-sw": "workbox generateSW workbox-config.js",
diff --git a/src-pwa/custom-service-worker.js b/src-pwa/custom-service-worker.js
index 2f82443a..70450738 100755
--- a/src-pwa/custom-service-worker.js
+++ b/src-pwa/custom-service-worker.js
@@ -3,7 +3,7 @@
/* global workbox */
/* global cfgenv */
-const VITE_APP_VERSION = "1.2.39";
+const VITE_APP_VERSION = "1.2.40";
// Costanti di configurazione
const DYNAMIC_CACHE = 'dynamic-cache-v2';
diff --git a/src/components/CCatalogList/CCatalogList.vue b/src/components/CCatalogList/CCatalogList.vue
index b45e1259..25d1ff6f 100755
--- a/src/components/CCatalogList/CCatalogList.vue
+++ b/src/components/CCatalogList/CCatalogList.vue
@@ -21,7 +21,7 @@
:finder="finder"
labelElemFind="trovati"
:choose_visutype="visuType"
- :butt_modif_new="tools.isAdmin()"
+ :butt_modif_new="!tools.isUtente()"
:noresultLabel="t('grid.nosearchfound')"
:arrfilters="arrfilterand"
:filtercustom="filtercustom"
diff --git a/src/components/CCatalogoCard/CCatalogoCard.vue b/src/components/CCatalogoCard/CCatalogoCard.vue
index 778e935e..c663a742 100755
--- a/src/components/CCatalogoCard/CCatalogoCard.vue
+++ b/src/components/CCatalogoCard/CCatalogoCard.vue
@@ -97,9 +97,9 @@
@click="click_opendetail()"
/>
-
+
diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts
index 28a1e0e2..f3cd5599 100755
--- a/src/components/CGridTableRec/CGridTableRec.ts
+++ b/src/components/CGridTableRec/CGridTableRec.ts
@@ -2606,16 +2606,17 @@ export default defineComponent({
// console.log('row', serverData.value)
// console.log('mycolumns.value', mycolumns.value)
// naive encoding to csv format
- const content = [mycolumns.value.map((col: any) => wrapCsvValue(col.label))].concat(
- serverData.value.map((row: any) => mycolumns.value.map((col: any) => wrapCsvValue(
- typeof col.field === 'function'
+ const headers = mycolumns.value.map((col: any) => wrapCsvValue(col.label));
+ const rows = serverData.value.map((row: any) =>
+ mycolumns.value.map((col: any) => {
+ const value = typeof col.field === 'function'
? col.field(row)
- : tools.getValue(row, col.field, col.subfield),
- col.format,
- row,
- col
- )).join(','))
- ).join('\r\n')
+ : tools.getValue(row, col.field, col.subfield);
+ return wrapCsvValue(value, col.format, row, col);
+ }).join('|')
+ );
+
+ const content = [headers.join('|'), ...rows].join('\r\n');
const status = exportFile(
'export-' + mytable.value + '_' + tools.getstrYYMMDDHHMMDateTime(tools.getDateNow()) + '.csv',
diff --git a/src/components/CGridTableUser/CGridTableUser.ts b/src/components/CGridTableUser/CGridTableUser.ts
index 5cae01e8..8e5f17bb 100755
--- a/src/components/CGridTableUser/CGridTableUser.ts
+++ b/src/components/CGridTableUser/CGridTableUser.ts
@@ -2264,7 +2264,7 @@ export default defineComponent({
col.format,
row,
col
- )).join(','))
+ )).join('|'))
).join('\r\n')
const status = exportFile(
diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue
index 2996222d..c730863d 100755
--- a/src/components/CMyEditElem/CMyEditElem.vue
+++ b/src/components/CMyEditElem/CMyEditElem.vue
@@ -1595,6 +1595,14 @@
@update:model-value="modifElem"
>
+
+
+ :showMap="false" :prop_modif="tools.isAdmin()" :enableExport="true">
diff --git a/src/components/CMyRecCatalog/CMyRecCatalog.vue b/src/components/CMyRecCatalog/CMyRecCatalog.vue
index 6464239d..7fdedfe8 100755
--- a/src/components/CMyRecCatalog/CMyRecCatalog.vue
+++ b/src/components/CMyRecCatalog/CMyRecCatalog.vue
@@ -2,7 +2,7 @@
props.lista_prodotti,
@@ -167,6 +138,36 @@ export default defineComponent({
{ name: "actions", label: "Azioni", field: "", align: "center", visu: costanti.VISUCAMPI.PER_EDITORE, noexp: true, notsortable: true },
];
+ async function mounted() {
+ console.log('mounted CProductTable')
+ loading.value = true
+
+ optionscatalogo.value = {
+ maxlength: props.scheda?.testo_bottom?.maxlength
+ }
+
+ const savedColumns = tools.getCookie("selColCat_2");
+ if (savedColumns) {
+ selectedColumns.value = savedColumns;
+ }
+
+ const savedSortAttribute = tools.getCookie("sortAttr");
+ if (savedSortAttribute && props.optcatalogo.showListaArgomenti) {
+ if (isColumnVisible(savedSortAttribute)) {
+ sortAttribute.value = savedSortAttribute;
+
+ const savedSortDir = tools.getCookie("sortDir");
+ if (savedSortDir) {
+ sortDirection.value = savedSortDir;
+ }
+
+ }
+ }
+
+ loading.value = false
+ }
+
+
function getFieldValue(element: any, field: any): any {
if (!element)
return ''
diff --git a/src/components/CSearchProduct/CSearchProduct.ts b/src/components/CSearchProduct/CSearchProduct.ts
index e7c963b7..cfa6cbe8 100755
--- a/src/components/CSearchProduct/CSearchProduct.ts
+++ b/src/components/CSearchProduct/CSearchProduct.ts
@@ -249,7 +249,7 @@ export default defineComponent({
}
function collabel(rec: any) {
- console.log('Record:', rec)
+
let label = ''
if (rec && rec.productInfo) {
if (productStore.isNovitaById(rec.productInfo.date_pub))
diff --git a/src/css/app.scss b/src/css/app.scss
index cc55bc27..9ed95cfc 100755
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -2563,4 +2563,8 @@ body.body--dark {
.mybadge {
border-radius: 10px !important;
text-shadow: .05rem .05rem .15rem #878787;
+}
+
+.no-print {
+ display: none !important;
}
\ No newline at end of file
diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts
index 10094968..6f8c453f 100755
--- a/src/model/GlobalStore.ts
+++ b/src/model/GlobalStore.ts
@@ -893,6 +893,7 @@ export interface IOptCatalogo {
indebug?: boolean
maxnumlibri?: number
showListaArgomenti?: boolean
+ showListaCollane?: boolean
generazionePDFInCorso?: boolean
first_page?: IDimensioni
diff --git a/src/model/Products.ts b/src/model/Products.ts
index b7b359cb..5c9a6fe6 100755
--- a/src/model/Products.ts
+++ b/src/model/Products.ts
@@ -256,7 +256,7 @@ export interface ICatPrTotali {
}
export interface ICollaneTotali {
_id: string,
- name: string,
+ title: string,
quanti?: number,
}
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index 296fc8ad..5224d3e5 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -9,7 +9,7 @@ const msg_it = {
guida_passopasso: 'Guida Passo Passo',
},
export: {
- csv: 'Esporta Movimenti',
+ csv: 'Esporta Lista',
},
grid: {
show_campi_avanzati: 'Visualizza campi aggiuntivi',
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 588e70a8..7fa472e1 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -102,6 +102,7 @@ export const tools = {
COOK_MAP_CENTER_LONG: 'MAP_LONG',
COOK_MAP_ZOOM: 'MAP_Z',
COOK_CATEGORIA: 'CATEG',
+ COOK_COLLANA: 'COLL',
COOK_MAPBOUNDS: 'MAP-B',
COOK_LAST_PROD_SEARCH: 'LPR',
diff --git a/src/store/Products.ts b/src/store/Products.ts
index b2d60fff..da2bfa41 100755
--- a/src/store/Products.ts
+++ b/src/store/Products.ts
@@ -129,6 +129,10 @@ export const useProducts = defineStore('Products', {
},
+ getCollane: (state: IProductsState) => (): ICollana[] => {
+ return state.collane
+ },
+
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
return product?.arrvariazioni?.[0]?.quantita > 1
},
@@ -365,7 +369,7 @@ export const useProducts = defineStore('Products', {
},
getTotaliProdottiByIdCollana: (state: IProductsState) => (idCollana: string): number => {
- const myfirstcat = state.collanetotali!.find((rec: ICollaneTotali) => rec._id === idCollana)
+ const myfirstcat = state.collane.find((rec: ICollaneTotali) => rec._id === idCollana)
if (myfirstcat) {
return myfirstcat.quanti!
@@ -1759,6 +1763,8 @@ export const useProducts = defineStore('Products', {
let arr: any = []
+ const globalStore = useGlobalStore()
+
arr.push({ label: '[Nessuna]', value: '' })
if (arrschede) {
@@ -1766,7 +1772,8 @@ export const useProducts = defineStore('Products', {
let pagename = ''
if (recscheda.scheda) {
if (recscheda.idPageOrig) {
- const page = this.mypage?.find((page) => (`${page._id}`) === recscheda.idPageOrig)
+ const page = globalStore.getPageById(recscheda.idPageOrig)
+ // const page = this.mypage?.find((page) => (`${page._id}`) === recscheda.idPageOrig)
pagename = page ? page.title! : ''
}
if (pagename)
diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts
index d871f285..67e209b5 100644
--- a/src/store/globalStore.ts
+++ b/src/store/globalStore.ts
@@ -2525,7 +2525,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
- async convertPdf(pdfFile: any, width: string, height: string, compressione: string) {
+ async convertPdf(pdfFile: any, width: string, height: string, compressione: string, dir_out: string, file_out: string) {
try {
if (!pdfFile) {
@@ -2542,6 +2542,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
formData.append('width', width); // Dimensione del PDF in cm
formData.append('height', height); // Dimensione del PDF in cm
formData.append('compressione', compressione);
+ formData.append('dir_out', dir_out);
+ formData.append('file_out', file_out);
+ formData.append('idapp', tools.getEnv('VITE_APP_ID'));
const response = await this.execConvertPDF(formData)
diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts
index 5c11c335..939060c4 100755
--- a/src/views/ecommerce/catalogo/catalogo.ts
+++ b/src/views/ecommerce/catalogo/catalogo.ts
@@ -1,51 +1,61 @@
import type { PropType } from 'vue';
-import { defineComponent, onMounted, ref, watch, computed, onBeforeUnmount, nextTick } from 'vue'
-import { tools } from '@tools'
-import { useUserStore } from '@store/UserStore'
-import { useRouter } from 'vue-router'
-import { useGlobalStore } from '@store/globalStore'
-import { useProducts } from '@store/Products'
-import { useI18n } from 'vue-i18n'
-import { toolsext } from '@store/Modules/toolsext'
-import { useQuasar } from 'quasar'
-import { costanti } from '@costanti'
+import { defineComponent, onMounted, ref, watch, computed, onBeforeUnmount, nextTick } from 'vue';
+import { tools } from '@tools';
+import { useUserStore } from '@store/UserStore';
+import { useRouter } from 'vue-router';
+import { useGlobalStore } from '@store/globalStore';
+import { useProducts } from '@store/Products';
+import { useI18n } from 'vue-i18n';
+import { toolsext } from '@store/Modules/toolsext';
+import { useQuasar } from 'quasar';
+import { costanti } from '@costanti';
-import { shared_consts } from '@src/common/shared_vuejs'
-import { CProductCard } from '@src/components/CProductCard'
+import { shared_consts } from '@src/common/shared_vuejs';
+import { CProductCard } from '@src/components/CProductCard';
-import { CMyDialog } from '@src/components/CMyDialog'
-import { CMySelect } from '@src/components/CMySelect'
-import { CMyValueDb } from '@src/components/CMyValueDb'
-import { CProductTable } from '@src/components/CProductTable'
-import { CSearchProduct } from '@src/components/CSearchProduct'
-import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard'
-import { CSelectUserActive } from '@src/components/CSelectUserActive'
-
-import html2pdf from 'html2pdf.js'
+import { CMyDialog } from '@src/components/CMyDialog';
+import { CMySelect } from '@src/components/CMySelect';
+import { CMyValueDb } from '@src/components/CMyValueDb';
+import { CProductTable } from '@src/components/CProductTable';
+import { CSearchProduct } from '@src/components/CSearchProduct';
+import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard';
+import { CSelectUserActive } from '@src/components/CSelectUserActive';
+import html2pdf from 'html2pdf.js';
+import { PDFDocument } from 'pdf-lib';
+import { saveAs } from 'file-saver';
import type {
- IOptCatalogo, IDimensioni, IFilterCatalogo,
- IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg,
+ IOptCatalogo,
+ IDimensioni,
+ IFilterCatalogo,
+ IMyScheda,
+ IProdView,
+ IProduct,
+ ISchedaSingola,
+ ISearchList,
+ ICatalog,
+ IImg,
IText,
ICollana,
IOptRigenera,
IOpAndOr,
} from 'model';
-import {
- IMyPage,
+import { IMyPage } from 'model';
-} from 'model'
-
-
-import { fieldsTable } from '@store/Modules/fieldsTable'
-import { useCatalogStore } from '@src/store/CatalogStore'
+import { fieldsTable } from '@store/Modules/fieldsTable';
+import { useCatalogStore } from '@src/store/CatalogStore';
export default defineComponent({
name: 'Catalogo',
components: {
- CContainerCatalogoCard, CProductCard,
- CSelectUserActive, CMySelect, CProductTable, CSearchProduct, CMyDialog,
+ CContainerCatalogoCard,
+ CProductCard,
+ CSelectUserActive,
+ CMySelect,
+ CProductTable,
+ CSearchProduct,
+ CMyDialog,
CMyValueDb,
},
emits: ['update:modelValue', 'updateCatalogo'],
@@ -61,30 +71,35 @@ export default defineComponent({
},
},
setup(props, { emit }) {
- const userStore = useUserStore()
- const globalStore = useGlobalStore()
- const productStore = useProducts()
- const router = useRouter()
- const $q = useQuasar()
- const { t } = useI18n()
+ const userStore = useUserStore();
+ const globalStore = useGlobalStore();
+ const productStore = useProducts();
+ const router = useRouter();
+ const $q = useQuasar();
+ const { t } = useI18n();
- const rigeneraLibri = ref(false)
+ const rigeneraLibri = ref(false);
- const search = ref('')
- const optauthors = ref([])
+ const search = ref('');
+ const optauthors = ref([]);
const pdfContent = ref(null);
- const addnewProd = ref(false)
+ const addnewProd = ref(false);
+
+ const widthpdf = ref('8.88');
+ const heightpdf = ref('12.31');
+ const compressionepdf = ref('prepress');
const optDisp = ref([
{ label: 'Tutti', value: costanti.DISP.TUTTI },
{ label: 'Disponibili', value: costanti.DISP.DISPONIBILI },
- { label: 'Esauriti', value: costanti.DISP.ESAURITI }])
+ { label: 'Esauriti', value: costanti.DISP.ESAURITI },
+ ]);
const optRigeneraModalita = ref([
{ label: 'Sovrascrivi', value: costanti.RIGENERAMOD.SOVRASCRIVI },
{ label: 'Aggiungi solo', value: costanti.RIGENERAMOD.AGGIUNGI_SOLO },
- ])
+ ]);
const optStato = ref([
{ label: 'Tutti', value: costanti.STATO.TUTTI },
@@ -92,27 +107,52 @@ export default defineComponent({
{ label: 'Prossima Uscita', value: costanti.STATO.SOLO_PROSSIMA_USCITA },
{ label: 'Prevendita', value: costanti.STATO.PREVENDITA },
{ label: 'Non Vendibile', value: costanti.STATO.NON_VENDIBILE },
- ])
+ ]);
- const generatinglist = ref(false)
+ const generatinglist = ref(false);
- const optrigenera = ref({ visibilitaDisp: costanti.DISP.DISPONIBILI, stato: costanti.STATO.IN_COMMERCIO, rig_mod: costanti.RIGENERAMOD.SOVRASCRIVI })
+ const optrigenera = ref({
+ visibilitaDisp: costanti.DISP.DISPONIBILI,
+ stato: costanti.STATO.IN_COMMERCIO,
+ rig_mod: costanti.RIGENERAMOD.SOVRASCRIVI,
+ });
const optcatalogo = ref({ ...props.modelValue });
- const getPdfFilename = () => {
- let myfilename = (optcatalogo.value.pdf_filename ?? 'catalogo_completo')
+ const lista_prodotti = computed(() => {
+ const arr = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage);
+ return arr?.lista_prodotti;
+ });
- const catalog = getCatalogoByMyPage.value
+ const ispageCatalogata = computed(() => {
+ return !!getCatalogoByMyPage.value;
+ });
+
+ const filtroStrApplicato = computed(() => {
+ return optcatalogo.value.showListaArgomenti
+ ? 'un Argomento'
+ : optcatalogo.value.showListaCollane
+ ? 'una Collana'
+ : false;
+ });
+
+ const showListaFiltrata = computed(() => {
+ return optcatalogo.value.showListaArgomenti ? true : optcatalogo.value.showListaCollane ? true : false;
+ });
+
+ const getPdfFilename = () => {
+ let myfilename = optcatalogo.value.pdf_filename ?? 'catalogo_completo';
+
+ const catalog = getCatalogoByMyPage.value;
if (catalog) {
- myfilename = productStore.getPathByPage(catalog.idPageAssigned)
+ myfilename = productStore.getPathByPage(catalog.idPageAssigned);
}
- return myfilename
- }
+ return myfilename;
+ };
function updateCatalogoPadre() {
- console.log('catalogo.ts PADRE')
+ console.log('catalogo.ts PADRE');
emit('update:modelValue', optcatalogo.value);
//emit('updateCatalogo', optcatalogo.value);
}
@@ -120,24 +160,31 @@ export default defineComponent({
// Metodo per aggiornare optcatalogo
const updateOptCatalogo = (key: K, value: IOptCatalogo[K]) => {
optcatalogo.value[key] = value;
- updateCatalogoPadre()
- }
+ updateCatalogoPadre();
+ };
// Utile anche per sincronizzare con le modifiche ricevute da props
- watch(() => props.modelValue, (newVal) => {
- optcatalogo.value = { ...newVal };
- }, { deep: false });
+ watch(
+ () => props.modelValue,
+ (newVal) => {
+ optcatalogo.value = { ...newVal };
+ },
+ { deep: false }
+ );
- watch(optrigenera.value, (newVal) => {
- tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_DISP', newVal.visibilitaDisp);
- tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_STATO', newVal.stato);
- tools.setCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'RIG_MOD', newVal.rig_mod);
- if (showListaArgomenti.value)
- calcArrProducts()
- }, { deep: true });
+ watch(
+ optrigenera.value,
+ (newVal) => {
+ tools.setCookie((showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_DISP', newVal.visibilitaDisp);
+ tools.setCookie((showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_STATO', newVal.stato);
+ tools.setCookie((showListaFiltrata.value ? 'INC_ES_' : '') + 'RIG_MOD', newVal.rig_mod);
+ if (showListaFiltrata.value) calcArrProducts();
+ },
+ { deep: true }
+ );
const getCatalogoByMyPage = computed(() => {
- return catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
- })
+ return catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage);
+ });
/*watch(optcatalogo, (newValue) => {
emit('update:modelValue', newValue);
@@ -147,75 +194,74 @@ export default defineComponent({
author: '',
publisher: '',
type: '',
- ageGroup: ''
- })
+ ageGroup: '',
+ });
- const cosa = ref(0)
- const cat = ref('')
- const idGasSel = ref('')
- const loadpage = ref(false)
- const show_hide = ref(false)
+ const cosa = ref(0);
+ const cat = ref('');
+ const collana = ref('');
+ const idGasSel = ref('');
+ const loadpage = ref(false);
+ const show_hide = ref(false);
- const mycolumns = ref([])
+ const mycolumns = ref([]);
- const catalogStore = useCatalogStore()
+ const catalogStore = useCatalogStore();
- const tabvisu = ref('categorie')
- const tabcatalogo = ref('lista')
+ const tabvisu = ref('categorie');
+ const tabcatalogo = ref('lista');
- const searchList = ref([] as ISearchList[])
+ const searchList = ref([] as ISearchList[]);
- const arrProducts = ref([])
- const arrProdToView = ref([])
+ const arrProducts = ref([]);
+ const arrProdToView = ref([]);
- const numRecLoaded = ref(0)
+ const numRecLoaded = ref(0);
// Create a ref for the component to fix
const componentToFixRef = ref(null);
const isFixed = ref(false);
- watch(() => tabcatalogo.value, () => {
- tools.setCookie('TAB_CAT', tabcatalogo.value)
- })
+ watch(
+ () => tabcatalogo.value,
+ () => {
+ tools.setCookie('TAB_CAT', tabcatalogo.value);
+ }
+ );
const labelcombo = computed(() => (item: any) => {
- let lab = item.label
- if (item.showcount)
- lab += ' (' + valoriopt.value(item, false, false).length + ')'
- return lab
- })
+ let lab = item.label;
+ if (item.showcount) lab += ' (' + valoriopt.value(item, false, false).length + ')';
+ return lab;
+ });
const arrLoaded = computed(() => {
- if (arrProducts.value && numRecLoaded.value)
- return arrProducts.value.slice(0, numRecLoaded.value)
+ if (arrProducts.value && numRecLoaded.value) return arrProducts.value.slice(0, numRecLoaded.value);
else {
- return []
+ return [];
}
- })
+ });
const getTestoIntroduttivo = computed(() => (recscheda: ISchedaSingola) => {
-
- let testo = recscheda.scheda!.dimensioni.pagina?.testo_up?.contenuto
+ let testo = recscheda.scheda!.dimensioni.pagina?.testo_up?.contenuto;
if (recscheda.scheda!.isPagIntro) {
-
- const catalogStore = useCatalogStore()
- const catalog = getCatalogoByMyPage.value
+ const catalogStore = useCatalogStore();
+ const catalog = getCatalogoByMyPage.value;
if (catalog && catalog.descr_introduttiva) {
// Cerca se la descrizione introduttiva è stata impostata
- testo = catalog.descr_introduttiva
- let clcol = ''
+ testo = catalog.descr_introduttiva;
+ let clcol = '';
if (catalog?.pagina_introduttiva_sfondo_nero) {
- clcol = `text-white`
+ clcol = `text-white`;
}
- testo = `` + testo + ``
+ testo = `` + testo + ``;
}
}
- return testo
-
- })
+ return testo;
+ });
function getTextSostituito(testo: IText) {
const replacements = {
@@ -228,148 +274,166 @@ export default defineComponent({
result = result.replace(new RegExp(key, 'g'), value);
}
- return result
+ return result;
}
const getTitoloPagina = computed(() => (product: IProduct, recscheda: ISchedaSingola) => {
+ let testo = getTextSostituito(recscheda.scheda!.dimensioni.pagina?.testo_title);
- let testo = getTextSostituito(recscheda.scheda!.dimensioni.pagina?.testo_title)
+ const catalog = getCatalogoByMyPage.value;
- const catalog = getCatalogoByMyPage.value
-
- let clcol = ''
+ let clcol = '';
if (catalog?.pagina_introduttiva_sfondo_nero) {
- clcol = `text-white`
+ clcol = `text-white`;
}
- testo = `` + testo + ``
-
- return testo
-
- })
-
- const lista_prodotti = computed(() => {
- const arr = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
- return arr?.lista_prodotti
- })
-
- const ispageCatalogata = computed(() => {
- return !!getCatalogoByMyPage.value
- })
-
- const showListaArgomenti = computed(() => {
- return optcatalogo.value.showListaArgomenti
- })
+ testo = `` + testo + ``;
+ return testo;
+ });
// Register the scroll event on component mount
const handleScroll = () => {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
// Set a threshold value based on how much scroll is needed to fix the components
- const threshold = 300
+ const threshold = 300;
// Update the isFixed ref based on the scroll position
isFixed.value = scrollTop > threshold;
};
- watch(() => cat.value, (newval, oldval) => {
+ watch(
+ () => cat.value,
+ (newval, oldval) => {
+ if (showListaFiltrata.value) {
+ if (loadpage.value) {
+ tools.setCookie(getKeyCatAtLoad(), cat.value.toString());
+ filter.value.author = ''; // disattivo il filtro autore
+ resetSearch();
- if (showListaArgomenti.value) {
- if (loadpage.value) {
- tools.setCookie(getKeyCatAtLoad(), cat.value.toString())
- filter.value.author = '' // disattivo il filtro autore
- resetSearch()
-
- calcArrProducts()
+ calcArrProducts();
+ }
}
}
- })
+ );
+ watch(
+ () => collana.value,
+ (newval, oldval) => {
+ if (showListaFiltrata.value) {
+ if (loadpage.value) {
+ tools.setCookie(getKeyCollanaAtLoad(), collana.value.toString());
+ filter.value.author = ''; // disattivo il filtro autore
+ resetSearch();
- watch(() => idGasSel.value, (newval, oldval) => {
- calcArrProducts()
- })
-
- watch(() => getSearchText(), (newval, oldval) => {
- calcArrProducts()
- if (tools.scrollTop() > 300) {
- tools.scrollToTopValue(300)
- }
- })
- watch(() => filter.value.author, (newval, oldval) => {
-
- // Se filtroAuthor attivato, allora evito il filtro per Categoria
- if (filter.value.author) {
- cat.value = '' // disattivo il filtro categoria
- if (loadpage.value)
- tools.setCookie(getKeyCatAtLoad(), '')
- resetSearch()
- }
-
- calcArrProducts()
- if (tools.scrollTop() > 300) {
- tools.scrollToTopValue(300)
- }
- })
-
- watch(() => filter.value.sort_field, (newval, oldval) => {
-
- calcArrProducts()
- if (tools.scrollTop() > 300) {
- tools.scrollToTopValue(300)
- }
- })
- watch(() => filter.value.sort_dir, (newval, oldval) => {
-
- calcArrProducts()
- if (tools.scrollTop() > 300) {
- tools.scrollToTopValue(300)
- }
- })
-
- watch(() => cosa.value, (newval, oldval) => {
- if (oldval !== 0) {
- tools.setCookie(tools.COOK_COSA_PRODOTTI, cosa.value.toString())
- if (cosa.value !== shared_consts.PROD.TUTTI) {
- cat.value = ''
- if (loadpage.value)
- tools.setCookie(getKeyCatAtLoad(), '')
+ calcArrProducts();
+ }
}
- calcArrProducts()
}
- })
+ );
- watch(() => optcatalogo.value.aggiorna, (newval, oldval) => {
- console.log('Aggiorna array...')
- generatearrProdToViewSorted()
- })
+ watch(
+ () => idGasSel.value,
+ (newval, oldval) => {
+ calcArrProducts();
+ }
+ );
+
+ watch(
+ () => getSearchText(),
+ (newval, oldval) => {
+ calcArrProducts();
+ if (tools.scrollTop() > 300) {
+ tools.scrollToTopValue(300);
+ }
+ }
+ );
+ watch(
+ () => filter.value.author,
+ (newval, oldval) => {
+ // Se filtroAuthor attivato, allora evito il filtro per Categoria
+ if (filter.value.author) {
+ cat.value = ''; // disattivo il filtro categoria
+ collana.value = '';
+ if (loadpage.value) tools.setCookie(getKeyCatAtLoad(), '');
+ resetSearch();
+ }
+
+ calcArrProducts();
+ if (tools.scrollTop() > 300) {
+ tools.scrollToTopValue(300);
+ }
+ }
+ );
+
+ watch(
+ () => filter.value.sort_field,
+ (newval, oldval) => {
+ calcArrProducts();
+ if (tools.scrollTop() > 300) {
+ tools.scrollToTopValue(300);
+ }
+ }
+ );
+ watch(
+ () => filter.value.sort_dir,
+ (newval, oldval) => {
+ calcArrProducts();
+ if (tools.scrollTop() > 300) {
+ tools.scrollToTopValue(300);
+ }
+ }
+ );
+
+ watch(
+ () => cosa.value,
+ (newval, oldval) => {
+ if (oldval !== 0) {
+ tools.setCookie(tools.COOK_COSA_PRODOTTI, cosa.value.toString());
+ if (cosa.value !== shared_consts.PROD.TUTTI) {
+ cat.value = '';
+ collana.value = '';
+ if (loadpage.value) tools.setCookie(getKeyCatAtLoad(), '');
+ }
+ calcArrProducts();
+ }
+ }
+ );
+
+ watch(
+ () => optcatalogo.value.aggiorna,
+ (newval, oldval) => {
+ console.log('Aggiorna array...');
+ generatearrProdToViewSorted();
+ }
+ );
function resetSearch() {
- const mialista = getSearchList()
+ const mialista = getSearchList();
if (mialista && mialista.value && tools.existProp(mialista.value, 'name')) {
- mialista.value = null
+ mialista.value = null;
}
- search.value = ''
+ search.value = '';
}
function getSearchList() {
- const mylist = searchList.value.find((rec: any) => rec.table === 'products' && rec.key === 'titolo')
+ const mylist = searchList.value.find((rec: any) => rec.table === 'products' && rec.key === 'titolo');
- return mylist
+ return mylist;
}
function getSearchText(): string {
- const lista = getSearchList()
- return lista && lista.value && tools.existProp(lista.value, 'name') ? lista.value.name : ''
+ const lista = getSearchList();
+ return lista && lista.value && tools.existProp(lista.value, 'name') ? lista.value.name : '';
}
function getTitoloCatalogo(): string {
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- return trovatocatalogo ? trovatocatalogo.title : 'Catalogo'
+ return trovatocatalogo ? trovatocatalogo.title : 'Catalogo';
}
function getReferentiCatalogo(): string {
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
if (trovatocatalogo && trovatocatalogo.referenti && trovatocatalogo.referenti.length > 0) {
return trovatocatalogo.referenti.join(', ');
@@ -379,159 +443,161 @@ export default defineComponent({
}
function getImgIntroCatalogo(scheda: IMyScheda): IImg {
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- let imagefile = ''
- let fit = 'contain'
+ let imagefile = '';
+ let fit = 'contain';
if (trovatocatalogo && scheda.isPagIntro) {
- const recimg = trovatocatalogo.img_intro
+ const recimg = trovatocatalogo.img_intro;
if (recimg) {
- imagefile = recimg.imagefile!
- fit = recimg.fit! || 'contain'
- imagefile = imagefile ? `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})` : ''
+ imagefile = recimg.imagefile!;
+ fit = recimg.fit! || 'contain';
+ imagefile = imagefile
+ ? `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})`
+ : '';
}
}
- return { imagefile, fit }
+ return { imagefile, fit };
}
function getSfondoImgCatalogo(scheda?: IMyScheda | null, mypage?: IDimensioni): IImg {
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- let imagefile = ''
- let fit = 'contain'
+ let imagefile = '';
+ let fit = 'contain';
if (trovatocatalogo) {
// Cerca prima se c'è un Immagine Introduttiva
- const recimgintro = getImgIntroCatalogo(scheda)
+ const recimgintro = getImgIntroCatalogo(scheda);
if (recimgintro.imagefile) {
- imagefile = recimgintro.imagefile!
- fit = recimgintro.fit! || 'contain'
+ imagefile = recimgintro.imagefile!;
+ fit = recimgintro.fit! || 'contain';
}
// Poi cerca se c'è l'immagine di sfondo
- const recimg = trovatocatalogo.img_bordata!
+ const recimg = trovatocatalogo.img_bordata!;
if (!imagefile && recimg) {
- imagefile = recimg.imagefile!
- fit = recimg.fit! || 'contain'
- imagefile = imagefile ? `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})` : ''
+ imagefile = recimg.imagefile!;
+ fit = recimg.fit! || 'contain';
+ imagefile = imagefile
+ ? `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})`
+ : '';
}
-
}
if (!imagefile) {
- let myimg = costanti.CATALOGHI.PAG_SFONDO_DEFAULT
+ let myimg = costanti.CATALOGHI.PAG_SFONDO_DEFAULT;
if (scheda.isPagIntro) {
- myimg = costanti.CATALOGHI.PAG_INTRO_DEFAULT
+ myimg = costanti.CATALOGHI.PAG_INTRO_DEFAULT;
}
// Se non c'è un immagine di sfondo, allora prende quella di default
- imagefile = `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + myimg})`
+ imagefile = `url(${tools.getDirUpload() + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + myimg})`;
}
if (!imagefile && scheda) {
- imagefile = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.imagefile
- imagefile = imagefile ? `url(${tools.getDirUpload() + costanti.DIR_SCHEDA + imagefile})` : ''
- fit = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.fit
+ imagefile = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.imagefile;
+ imagefile = imagefile ? `url(${tools.getDirUpload() + costanti.DIR_SCHEDA + imagefile})` : '';
+ fit = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.fit;
}
if (!imagefile && mypage) {
- imagefile = mypage.imgsfondo!.imagefile!
- imagefile = imagefile ? `url(${tools.getDirUpload() + costanti.DIR_CATALOGO + imagefile})` : ''
- fit = mypage.imgsfondo!.fit!
+ imagefile = mypage.imgsfondo!.imagefile!;
+ imagefile = imagefile ? `url(${tools.getDirUpload() + costanti.DIR_CATALOGO + imagefile})` : '';
+ fit = mypage.imgsfondo!.fit!;
}
- return { imagefile, fit }
+ return { imagefile, fit };
}
function getIdCollaneDaFiltrare(def_idCollane?: string[]) {
- let idCollane: string[] = []
+ let idCollane: string[] = [];
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
if (trovatocatalogo) {
- idCollane = trovatocatalogo.idCollane! || []
+ idCollane = trovatocatalogo.idCollane! || [];
} else {
- idCollane = def_idCollane || []
+ idCollane = def_idCollane || [];
}
- return idCollane
+ return idCollane;
}
function getArgomentiDaFiltrare(def_argomenti?: string[]) {
- let argomenti: string[] = []
+ let argomenti: string[] = [];
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
if (trovatocatalogo) {
- argomenti = trovatocatalogo.argomenti! || []
+ argomenti = trovatocatalogo.argomenti! || [];
} else {
if (def_argomenti && def_argomenti.length > 0) {
- argomenti = def_argomenti
+ argomenti = def_argomenti;
} else {
- argomenti = []
+ argomenti = [];
}
}
- return argomenti
+ return argomenti;
}
function getidTipoFormatoDaFiltrare(def_idTipoFormato?: number[]) {
- let idTipoFormato: number[] = []
+ let idTipoFormato: number[] = [];
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
if (trovatocatalogo) {
- idTipoFormato = trovatocatalogo.idTipoFormato! || []
+ idTipoFormato = trovatocatalogo.idTipoFormato! || [];
} else {
if (def_idTipoFormato && def_idTipoFormato.length > 0) {
- idTipoFormato = def_idTipoFormato
+ idTipoFormato = def_idTipoFormato;
} else {
- idTipoFormato = []
+ idTipoFormato = [];
}
}
- return idTipoFormato
+ return idTipoFormato;
}
function getEditoreDaFiltrare(def_editori?: string[]) {
- let editore: string[] = []
+ let editore: string[] = [];
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
if (trovatocatalogo) {
- editore = trovatocatalogo.editore! || []
+ editore = trovatocatalogo.editore! || [];
} else {
- editore = def_editori || []
+ editore = def_editori || [];
}
- return editore
+ return editore;
}
-
-
function populateDataWithlinkIdTemplate() {
// console.log('populateDataWithlinkIdTemplate')
if (optcatalogo.value) {
-
for (const recscheda of optcatalogo.value.arrSchede!) {
if (recscheda.scheda?.linkIdTemplate) {
// ricopia da Template:
- const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda, optcatalogo.value)
+ const myscheda = globalStore.sovrascriviSchedaFromTemplate(
+ recscheda.scheda?.linkIdTemplate,
+ recscheda,
+ optcatalogo.value
+ );
if (myscheda) {
- recscheda.scheda = { ...myscheda }
+ recscheda.scheda = { ...myscheda };
}
-
}
}
}
// console.log(' FINE - populateDataWithlinkIdTemplate')
}
-
function filterProducts(
products: IProduct[],
searchtext: string | string[],
@@ -545,14 +611,25 @@ export default defineComponent({
arrargomstr: any[],
op_andor: IOpAndOr,
catstr: string,
+ collanastr: string,
gasselstr: string,
cosaValue: any,
sortField?: string,
sortDir?: number
): IProduct[] {
const lowerSearchTexts = Array.isArray(searchtext)
- ? searchtext.map((text: string) => text.toLowerCase().trim().replace(/[-@:=]/g, ''))
- : [searchtext.toLowerCase().trim().replace(/[-@:=]/g, '')];
+ ? searchtext.map((text: string) =>
+ text
+ .toLowerCase()
+ .trim()
+ .replace(/[-@:=]/g, '')
+ )
+ : [
+ searchtext
+ .toLowerCase()
+ .trim()
+ .replace(/[-@:=]/g, ''),
+ ];
const boolfiltroVuotoProductTypes =
filtroProductTypes.length === 0 || (filtroProductTypes.length === 1 && filtroProductTypes[0] === 0);
@@ -565,13 +642,21 @@ export default defineComponent({
const se_tutti_veri = op_andor.condition_andor === costanti.OP_ANDOR.OP_AND;
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- if (boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoidTipologie && boolfiltroVuotoidTipoFormato && boolfiltroVuotoEditore && boolfiltroVuotoCollane && boolfiltroVuotoArgomenti
- && (catstr === '' )
+ if (
+ boolfiltroVuotoProductTypes &&
+ boolfiltroVuotoExcludeProductTypes &&
+ boolfiltroVuotoidTipologie &&
+ boolfiltroVuotoidTipoFormato &&
+ boolfiltroVuotoEditore &&
+ boolfiltroVuotoCollane &&
+ boolfiltroVuotoArgomenti &&
+ catstr === '' &&
+ collanastr === ''
) {
// Nessun filtro selezionato, pertanto non mostrare niente!
- return []
+ return [];
}
const arrris = products
@@ -585,25 +670,36 @@ export default defineComponent({
//if (!productStore.isPubblicato(product.productInfo))
// return false
- if (!(optrigenera.value.visibilitaDisp === costanti.DISP.TUTTI ||
- (optrigenera.value.visibilitaDisp === costanti.DISP.ESAURITI && productStore.isEsaurito(product)) ||
- (optrigenera.value.visibilitaDisp === costanti.DISP.DISPONIBILI && (productStore.isDisponibile(product) || productStore.isPrevendita(product.productInfo))))) {
+ if (
+ !(
+ optrigenera.value.visibilitaDisp === costanti.DISP.TUTTI ||
+ (optrigenera.value.visibilitaDisp === costanti.DISP.ESAURITI && productStore.isEsaurito(product)) ||
+ (optrigenera.value.visibilitaDisp === costanti.DISP.DISPONIBILI &&
+ (productStore.isDisponibile(product) || productStore.isPrevendita(product.productInfo)))
+ )
+ ) {
return false;
}
- if (!(optrigenera.value.stato === costanti.STATO.TUTTI ||
- (optrigenera.value.stato === costanti.STATO.IN_COMMERCIO && productStore.isPubblicato(product.productInfo)) ||
- (optrigenera.value.stato === costanti.STATO.SOLO_PROSSIMA_USCITA && productStore.isProssimaUscita(product.productInfo)) ||
- (optrigenera.value.stato === costanti.STATO.PREVENDITA && productStore.isPrevendita(product.productInfo)) ||
- (optrigenera.value.stato === costanti.STATO.NON_VENDIBILE && productStore.isNonVendibile(product.productInfo))
-
- )) {
+ if (
+ !(
+ optrigenera.value.stato === costanti.STATO.TUTTI ||
+ (optrigenera.value.stato === costanti.STATO.IN_COMMERCIO &&
+ productStore.isPubblicato(product.productInfo)) ||
+ (optrigenera.value.stato === costanti.STATO.SOLO_PROSSIMA_USCITA &&
+ productStore.isProssimaUscita(product.productInfo)) ||
+ (optrigenera.value.stato === costanti.STATO.PREVENDITA &&
+ productStore.isPrevendita(product.productInfo)) ||
+ (optrigenera.value.stato === costanti.STATO.NON_VENDIBILE &&
+ productStore.isNonVendibile(product.productInfo))
+ )
+ ) {
return false;
}
const lowerName = (product.productInfo.name || '').toLowerCase();
const lowerCode = (product.productInfo.code || '').toLowerCase();
- const boolfiltroVuotoCat = product.productInfo.idCatProds?.length === 0
+ const boolfiltroVuotoCat = product.productInfo.idCatProds?.length === 0;
// Filtri per argomenti e categorie
let hasCategoria = se_tutti_veri;
@@ -612,25 +708,37 @@ export default defineComponent({
hasArgomentiCat = (product.productInfo.idCatProds || []).some((idCat: any) => arrargomstr.includes(idCat));
hasCategoria = se_tutti_veri;
} else {
- if (!optcatalogo.value.showListaArgomenti) {
-
- } else {
+ if (optcatalogo.value.showListaArgomenti) {
const isCatVuoto = boolfiltroVuotoCat || (product.productInfo.idCatProds || []).length === 0;
const isCatSenzaArgomento = catstr === costanti.NO_CATEGORY;
const isCatCorretto = !catstr || (product.productInfo.idCatProds || []).includes(catstr);
- hasCategoria = (isCatSenzaArgomento && isCatVuoto)
- ? true
- : isCatCorretto;
+ hasCategoria = isCatSenzaArgomento && isCatVuoto ? true : isCatCorretto;
- hasArgomentiCat = boolfiltroVuotoArgomenti
- ? se_tutti_veri
- : hasArgomentiCat
+ hasArgomentiCat = boolfiltroVuotoArgomenti ? se_tutti_veri : hasArgomentiCat;
}
}
- /*hasArgomentiCat = boolfiltroVuotoArgomenti
+ let hasCollana = se_tutti_veri;
+ let hasCollanaStr = se_tutti_veri;
+ if (idCollane && idCollane.length > 0) {
+ hasCollanaStr = idCollane.includes(product.productInfo.idCollana);
+ hasCollana = se_tutti_veri;
+ } else {
+ if (optcatalogo.value.showListaCollane) {
+ const isCollanaVuoto = boolfiltroVuotoCollane || (product.productInfo.idCollana || []).length === 0;
+ const isCollanaSenzaColl = collanastr === costanti.NO_CATEGORY;
+ const isCollanaCorretto = !collanastr || product.productInfo.idCollana === collanastr;
+ hasCollana = isCollanaSenzaColl && isCollanaVuoto ? true : isCollanaCorretto;
+
+ hasCollanaStr = boolfiltroVuotoCollane ? se_tutti_veri : hasCollanaStr;
+ }
+ }
+ // Filtri per collana
+ /*
+ const hasCollana = boolfiltroVuotoCollane
? se_tutti_veri
- : hasArgomentiCat*/
+ : (idCollane || []).includes(product.productInfo.idCollana);
+*/
// Filtri per autore
const hasAuthor = !filtroAuthor || (product.productInfo.idAuthors || []).includes(filtroAuthor);
@@ -658,60 +766,56 @@ export default defineComponent({
? se_tutti_veri
: editore.includes(product.productInfo.idPublisher);
- // Filtri per collana
- const hasCollana = boolfiltroVuotoCollane
- ? se_tutti_veri
- : (idCollane || []).includes(product.productInfo.idCollana)
-
// Filtri per GAS
- const productgassel = !gasselstr || (cosaValue === shared_consts.PROD.GAS && product.idGasordine === gasselstr);
+ const productgassel =
+ !gasselstr || (cosaValue === shared_consts.PROD.GAS && product.idGasordine === gasselstr);
// Filtri per testo di ricerca
- const searchMatch = lowerSearchTexts.length === 0 || lowerSearchTexts.some((searchTerm: string) => {
- const codeMatch = new RegExp(`\\b${searchTerm}\\b`, 'i').test(lowerCode);
- const allWordsPresent = searchTerm.split(/\s+/).every((word: string) =>
- new RegExp(`\\b${word}\\b`, 'i').test(lowerName)
- );
- return codeMatch || allWordsPresent;
- });
+ const searchMatch =
+ lowerSearchTexts.length === 0 ||
+ lowerSearchTexts.some((searchTerm: string) => {
+ const codeMatch = new RegExp(`\\b${searchTerm}\\b`, 'i').test(lowerCode);
+ const allWordsPresent = searchTerm
+ .split(/\s+/)
+ .every((word: string) => new RegExp(`\\b${word}\\b`, 'i').test(lowerName));
+ return codeMatch || allWordsPresent;
+ });
// Funzione che valuta un gruppo in base a OP_AND o OP_OR
// Raccolgo tutti i gruppi attivi
- const filtri = [hasArgomentiCat, hasCategoria, hasCollana, hasPublished];
+ const filtri = [hasArgomentiCat, hasCategoria, hasCollana, hasCollanaStr, hasPublished];
// Decido se combinare in AND o OR sulla base della scelta globale
- let risult = searchMatch && hasAuthor && productgassel && hasidTipologie && hasidTipoFormato
+ let risult = searchMatch && hasAuthor && productgassel && hasidTipologie && hasidTipoFormato;
if (op_andor.condition_andor === costanti.OP_ANDOR.OP_AND) {
risult = risult && filtri.every(Boolean); // Tutti i gruppi devono essere veri
} else {
- risult = risult && filtri.some(Boolean)
+ risult = risult && filtri.some(Boolean);
}
- return risult
+ return risult;
// && !hasExcludeProductTypes
-
})
- .sort((a, b) => getProductsSorted([a, b], sortField, sortDir)[0] === a ? -1 : 1);
+ .sort((a, b) => (getProductsSorted([a, b], sortField, sortDir)[0] === a ? -1 : 1));
- console.log(' sortField=' + sortField)
- console.log(' sortDir=' + sortDir)
- console.log(' Filtro=' + arrargomstr)
- console.log(' idCollane=' + idCollane)
- console.log('PRODOTTI FILTRATI:', arrris.length)
+ console.log(' sortField=' + sortField);
+ console.log(' sortDir=' + sortDir);
+ console.log(' Filtro=' + arrargomstr);
+ console.log(' idCollane=' + idCollane);
+ console.log('PRODOTTI FILTRATI:', arrris.length);
- return arrris
+ return arrris;
}
async function calcArrProducts(generalista?: boolean) {
- console.log('calcArrProducts (generalista=' + generalista + ')')
+ console.log('calcArrProducts (generalista=' + generalista + ')');
- if (!loadpage.value)
- return
+ if (!loadpage.value) return;
- generatinglist.value = true
+ generatinglist.value = true;
const searchtext = getSearchText();
let arrprod = [];
@@ -724,21 +828,25 @@ export default defineComponent({
const filtroPublishers = editore || [];
const idCollane = getIdCollaneDaFiltrare(optcatalogo.value.idCollane);
const filtroCollane = idCollane || [];
- const arrargomstr = optcatalogo.value.argomenti && optcatalogo.value.argomenti.length > 0
- ? getArgomentiDaFiltrare(optcatalogo.value.argomenti)
- : getArgomentiDaFiltrare(cat.value ? [cat.value] : []);
+
+ const arrargomstr =
+ optcatalogo.value.argomenti && optcatalogo.value.argomenti.length > 0
+ ? getArgomentiDaFiltrare(optcatalogo.value.argomenti)
+ : getArgomentiDaFiltrare(cat.value ? [cat.value] : []);
+
const catstr = cat.value || '';
+ const collanastr = collana.value || '';
+
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
- let salva = false
+ let salva = false;
// Se nel catalogo è stato già generato, allora gli passo quello.
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- if (editore)
- console.log('FILTRO editore', editore)
+ if (editore) console.log('FILTRO editore', editore);
- if (optcatalogo.value.showListaArgomenti) {
- generalista = true
+ if (showListaFiltrata.value) {
+ generalista = true;
}
/*if (trovatocatalogo?.lista_prodotti.length === 0) {
@@ -746,13 +854,14 @@ export default defineComponent({
}*/
let op_andor: IOpAndOr = {
- condition_andor: trovatocatalogo?.condition_andor !== undefined ? trovatocatalogo.condition_andor : costanti.OP_ANDOR.OP_AND,
- }
+ condition_andor:
+ trovatocatalogo?.condition_andor !== undefined ? trovatocatalogo.condition_andor : costanti.OP_ANDOR.OP_AND,
+ };
- if (!generalista && (trovatocatalogo?.lista_prodotti.length > 0)) {
- arrprod = trovatocatalogo?.lista_prodotti
+ if (!generalista && trovatocatalogo?.lista_prodotti.length > 0) {
+ arrprod = trovatocatalogo?.lista_prodotti;
} else {
- arrprod = productStore.getProducts(cosa.value)
+ arrprod = productStore.getProducts(cosa.value);
arrprod = filterProducts(
arrprod,
searchtext,
@@ -766,13 +875,14 @@ export default defineComponent({
arrargomstr,
op_andor,
catstr,
+ collanastr,
gasselstr,
cosa.value,
filter.value.sort_field,
- filter.value.sort_dir,
+ filter.value.sort_dir
);
- salva = true
+ salva = true;
}
arrProducts.value = arrprod;
@@ -782,67 +892,67 @@ export default defineComponent({
populateDataWithlinkIdTemplate();
// Ordina la lista
- generatearrProdToViewSorted(!generalista, salva, !optcatalogo.value.showListaArgomenti);
+ generatearrProdToViewSorted(!generalista, salva, !showListaFiltrata.value);
loaddata();
if (generalista) {
- const catalog = getCatalogoByMyPage.value
- if (catalog && !optcatalogo.value.showListaArgomenti) {
- catalog.data_lista_generata = tools.getDateNow()
- catalog.username_lista_generata = userStore.my.username
- await saveCatalog()
+ const catalog = getCatalogoByMyPage.value;
+ if (catalog && !showListaFiltrata.value) {
+ catalog.data_lista_generata = tools.getDateNow();
+ catalog.username_lista_generata = userStore.my.username;
+ await saveCatalog();
}
}
- console.log('***** FINE calcArrPROD')
+ console.log('***** FINE calcArrPROD');
- generatinglist.value = false
- rigeneraLibri.value = false
+ generatinglist.value = false;
+ rigeneraLibri.value = false;
}
async function saveCatalog() {
- const catalog = getCatalogoByMyPage.value
+ const catalog = getCatalogoByMyPage.value;
const mydata = {
table: 'catalogs',
- data: catalog
- }
+ data: catalog,
+ };
- await globalStore.saveTable(mydata)
+ await globalStore.saveTable(mydata);
}
function generaListaLibri() {
// chiedi prima "Sei sicuro di rigenerare il catalogo?"
- let risposta_si = false
+ let risposta_si = false;
- let msg = 'Sicuri di RIGENERARE Sovrascrivendo questa lista di libri ?'
+ let msg = 'Sicuri di RIGENERARE Sovrascrivendo questa lista di libri ?';
if (optrigenera.value.rig_mod == costanti.RIGENERAMOD.AGGIUNGI_SOLO) {
- msg = 'Aggiungere i libri di questa nuova generazione ?'
+ msg = 'Aggiungere i libri di questa nuova generazione ?';
}
$q.dialog({
title: 'Rigenera lista',
message: msg,
cancel: true,
- persistent: false
+ persistent: false,
}).onOk(() => {
- calcArrProducts(true)
- })
+ calcArrProducts(true);
+ });
}
function reSortList() {
- let risposta_si = false
+ let risposta_si = false;
- let msg = 'Sicuri di Riordinare questa lista ?'
+ let msg = 'Sicuri di Riordinare questa lista ?';
$q.dialog({
title: 'Riordina lista',
message: msg,
cancel: true,
- persistent: false
+ persistent: false,
}).onOk(() => {
- calcArrProducts(false)
- })
+ calcArrProducts(false);
+ });
}
function arraysEqual(arr1, arr2) {
@@ -855,8 +965,7 @@ export default defineComponent({
}
function checkIfFiltriDiversi(scheda: IMyScheda, schedaprec: IMyScheda) {
- if (schedaprec === null)
- return true
+ if (schedaprec === null) return true;
const isDifferent =
!arraysEqual(scheda.productTypes, schedaprec?.productTypes) ||
@@ -864,11 +973,8 @@ export default defineComponent({
!arraysEqual(scheda.idTipologie, schedaprec?.idTipologie) ||
!arraysEqual(scheda.idTipoFormato, schedaprec?.idTipoFormato) ||
!arraysEqual(scheda.editore, schedaprec?.editore) ||
- !arraysEqual(scheda.idCollane, schedaprec?.idCollane)
- ;
-
+ !arraysEqual(scheda.idCollane, schedaprec?.idCollane);
return isDifferent;
-
}
function getProductsFilteredByScheda(scheda: IMyScheda): IProduct[] {
@@ -883,22 +989,24 @@ export default defineComponent({
const filtroPublishers = editore || [];
const idCollane = getIdCollaneDaFiltrare(scheda.idCollane);
const filtroCollane = idCollane || [];
- const arrargomstr = optcatalogo.value.argomenti && optcatalogo.value.argomenti.length > 0
- ? getArgomentiDaFiltrare(optcatalogo.value.argomenti)
- : [];
+ const arrargomstr =
+ optcatalogo.value.argomenti && optcatalogo.value.argomenti.length > 0
+ ? getArgomentiDaFiltrare(optcatalogo.value.argomenti)
+ : [];
const catstr = cat.value || '';
+ const collanastr = collana.value || '';
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
let op_andor: IOpAndOr = {
condition_andor: trovatocatalogo?.condition_andor ?? costanti.OP_ANDOR.OP_AND,
- }
+ };
if (trovatocatalogo?.lista_prodotti.length > 0) {
- arrprod = trovatocatalogo?.lista_prodotti
+ arrprod = trovatocatalogo?.lista_prodotti;
} else {
- arrprod = productStore.getProducts(cosa.value)
+ arrprod = productStore.getProducts(cosa.value);
arrprod = filterProducts(
arrprod,
@@ -913,6 +1021,7 @@ export default defineComponent({
arrargomstr,
op_andor,
catstr,
+ collanastr,
gasselstr,
cosa.value,
scheda?.sort_field,
@@ -932,12 +1041,9 @@ export default defineComponent({
*/
function getProductsSorted(arrprod: IProduct[], sort_field: string, sort_dir: number): IProduct[] {
if (sort_field) {
-
// console.log('--- Primi 10 elementi INIZIALI:');
arrprod.slice(0, 15).forEach((product, index) => {
- console.log(
- `${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`
- );
+ console.log(`${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`);
});
// Crea una copia dell'array per non modificare l'originale
@@ -958,25 +1064,20 @@ export default defineComponent({
// Ordinamento per stringhe o altri tipi
const compA = valA.toString().toLowerCase();
const compB = valB.toString().toLowerCase();
- return sort_dir === 1
- ? compA.localeCompare(compB)
- : compB.localeCompare(compA);
+ return sort_dir === 1 ? compA.localeCompare(compB) : compB.localeCompare(compA);
});
// logga i primi N elementi, mostrando il nome del prodotto (productInfo.name e la data di pibblicazione : productinfo.date_pub
if (sortedArr.length > 0) {
// console.log('Primi 15 elementi ordinati: ***** ');
sortedArr.slice(0, 15).forEach((product, index) => {
- console.log(
- `${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`
- );
+ console.log(`${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`);
});
} else {
console.log('Nessun prodotto trovato.');
}
-
- return sortedArr
+ return sortedArr;
}
return arrprod;
@@ -1007,76 +1108,74 @@ export default defineComponent({
function getProdBySchedaRigaCol(recscheda: ISchedaSingola, pagina: number, riga: number, col: number) {
try {
- return recscheda.arrProdToShow![pagina][riga][col]
+ return recscheda.arrProdToShow![pagina][riga][col];
} catch (e) {
- return null
+ return null;
}
}
function generatearrProdToViewSorted(usaprodottiSalvati?: boolean, salva?: boolean, salvasudb?: boolean) {
- console.log('generatearrProdToViewSorted... usaprodottiSalvati=', usaprodottiSalvati, ' salva=', salva)
+ console.log('generatearrProdToViewSorted... usaprodottiSalvati=', usaprodottiSalvati, ' salva=', salva);
try {
-
// Svuota
- arrProdToView.value = []
+ arrProdToView.value = [];
- const trovatocatalogo = getCatalogoByMyPage.value
+ const trovatocatalogo = getCatalogoByMyPage.value;
- let arrGeneraleProdotti = []
+ let arrGeneraleProdotti = [];
if (usaprodottiSalvati && trovatocatalogo?.lista_prodotti.length > 0) {
-
} else {
arrGeneraleProdotti = arrProducts.value;
}
- let indprod = 0
- const indprodGenerale = 0
+ let indprod = 0;
+ const indprodGenerale = 0;
- let indtotale = 0
+ let indtotale = 0;
- let arrprod = []
+ let arrprod = [];
let schedaprec = null;
for (const recscheda of optcatalogo.value.arrSchede!) {
if (recscheda && recscheda.scheda) {
- const schedePerRiga = recscheda.scheda.numschede_perRiga || 1
- const schedePerCol = recscheda.scheda.numschede_perCol || 1
- const schedePerPagina = schedePerRiga * schedePerCol
+ const schedePerRiga = recscheda.scheda.numschede_perRiga || 1;
+ const schedePerCol = recscheda.scheda.numschede_perCol || 1;
+ const schedePerPagina = schedePerRiga * schedePerCol;
- let arrProdFiltrati: IProduct[] = []
+ let arrProdFiltrati: IProduct[] = [];
if (usaprodottiSalvati && trovatocatalogo?.lista_prodotti.length > 0) {
- arrProdFiltrati = trovatocatalogo?.lista_prodotti
+ arrProdFiltrati = trovatocatalogo?.lista_prodotti;
} else {
if (recscheda.scheda.productTypes!.length > 0) {
// Filtra i prodotti in base ai filtri impostati !
if (checkIfFiltriDiversi(recscheda.scheda, schedaprec) || indprod === 0) {
- arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
- schedaprec = { ...recscheda.scheda }
- indprod = 0
+ arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda);
+ schedaprec = { ...recscheda.scheda };
+ indprod = 0;
}
} else {
- let sort_field = recscheda.scheda.sort_field! || optcatalogo.value.sort_field
- let sort_dir = recscheda.scheda.sort_dir || optcatalogo.value.sort_dir
+ let sort_field = recscheda.scheda.sort_field! || optcatalogo.value.sort_field;
+ let sort_dir = recscheda.scheda.sort_dir || optcatalogo.value.sort_dir;
if (sort_field) {
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, sort_field, sort_dir);
- indprod = 0
+ indprod = 0;
} else {
- indprod = indprodGenerale
- arrProdFiltrati = arrGeneraleProdotti
+ indprod = indprodGenerale;
+ arrProdFiltrati = arrGeneraleProdotti;
}
}
}
- let indadded = 0
- recscheda.arrProdToShow = []
+ let indadded = 0;
+ recscheda.arrProdToShow = [];
for (let pagina = 0; pagina < 600; pagina++) {
- indadded = 0
- let lastresultend = false
+ indadded = 0;
+ let lastresultend = false;
if (!recscheda.arrProdToShow[pagina]) {
recscheda.arrProdToShow[pagina] = [];
}
@@ -1085,52 +1184,39 @@ export default defineComponent({
// Aggiunge il prossimo prodotto che non è stato ancora inserito
const result = addNextProductToTheView(arrProdFiltrati, indprod);
if (result.end) {
- lastresultend = true
+ lastresultend = true;
break; // Esci dal ciclo se non ci sono più prodotti disponibili
} else {
- if (result.indprod)
- indprod = result.indprod // Aggiorna indprod per il prossimo giro
+ if (result.indprod) indprod = result.indprod; // Aggiorna indprod per il prossimo giro
if (result.myrec) {
-
- const riga = Math.floor(indadded / schedePerCol)
- const col = indadded % schedePerCol
+ const riga = Math.floor(indadded / schedePerCol);
+ const col = indadded % schedePerCol;
if (!recscheda.arrProdToShow[pagina][riga]) {
recscheda.arrProdToShow[pagina][riga] = [];
}
- arrprod.push(result.myrec)
+ arrprod.push(result.myrec);
- recscheda.arrProdToShow[pagina][riga][col] = result.myrec
+ recscheda.arrProdToShow[pagina][riga][col] = result.myrec;
- indadded++
- indtotale++
+ indadded++;
+ indtotale++;
// console.log('indadded', indadded)
if (optcatalogo.value.maxnumlibri! > 0) {
- if (indtotale > optcatalogo.value.maxnumlibri!)
- break
-
-
-
+ if (indtotale > optcatalogo.value.maxnumlibri!) break;
} else {
// if (indtotale > 1000)
// break
}
-
}
}
-
}
- if (lastresultend)
- break; // Esci dal ciclo se non ci sono più prodotti disponibili
-
+ if (lastresultend) break; // Esci dal ciclo se non ci sono più prodotti disponibili
if (recscheda.numPagineMax! > 0) {
- if (pagina + 1 >= recscheda.numPagineMax!)
- break; // fine pagine
+ if (pagina + 1 >= recscheda.numPagineMax!) break; // fine pagine
}
-
-
}
// console.log('*** arrProdToShow', recscheda.arrProdToShow)
@@ -1141,25 +1227,27 @@ export default defineComponent({
// console.log(' FINE - generatearrProdToViewSorted !')
-
if (!usaprodottiSalvati && salva) {
if (trovatocatalogo) {
if (optrigenera.value.rig_mod === costanti.RIGENERAMOD.AGGIUNGI_SOLO) {
// aggiungi solo i record che non sono presenti su lista_prodotti
- trovatocatalogo.lista_prodotti = trovatocatalogo.lista_prodotti.filter(p => !arrprod.some(ap => ap._id === p._id))
- trovatocatalogo.lista_prodotti.push(...arrprod.filter(ap => !trovatocatalogo.lista_prodotti.some(p => p._id === ap._id)))
+ trovatocatalogo.lista_prodotti = trovatocatalogo.lista_prodotti.filter(
+ (p) => !arrprod.some((ap) => ap._id === p._id)
+ );
+ trovatocatalogo.lista_prodotti.push(
+ ...arrprod.filter((ap) => !trovatocatalogo.lista_prodotti.some((p) => p._id === ap._id))
+ );
} else {
- trovatocatalogo.lista_prodotti = arrprod
+ trovatocatalogo.lista_prodotti = arrprod;
}
if (salvasudb) {
- salvaListaProdotti(false)
+ salvaListaProdotti(false);
}
}
}
-
} catch (e) {
- console.error('Err', e)
+ console.error('Err', e);
}
// console.log('Fine...')
@@ -1167,23 +1255,21 @@ export default defineComponent({
function salvaListaProdotti(ricarica: boolean) {
// Estrai solo gli ID dei prodotti filtrati
- const myarr = [...getCatalogoByMyPage.value.lista_prodotti]
- const productIds = myarr.map(product => product._id);
+ const myarr = [...getCatalogoByMyPage.value.lista_prodotti];
+ const productIds = myarr.map((product) => product._id);
let mydata = {
- lista_prodotti: productIds
- }
+ lista_prodotti: productIds,
+ };
// Salva gli ID dei prodotti nel catalogo
- tools.saveFieldToServer($q, 'catalogs', getCatalogoByMyPage.value._id, mydata, !optcatalogo.value.showListaArgomenti, false)
-
+ tools.saveFieldToServer($q, 'catalogs', getCatalogoByMyPage.value._id, mydata, !showListaFiltrata.value, false);
if (ricarica) {
generatearrProdToViewSorted(true, false);
}
}
-
/*function getProducts() {
let arrprod = productStore.getProducts(cosa.value)
if (!search.value) {
@@ -1201,32 +1287,45 @@ export default defineComponent({
}*/
function getKeyCatAtLoad() {
- return tools.COOK_CATEGORIA + (showListaArgomenti.value ? '_LA' : '')
+ return tools.COOK_CATEGORIA + (showListaFiltrata.value ? '_LA' : '');
+ }
+ function getKeyCollanaAtLoad() {
+ return tools.COOK_COLLANA + (showListaFiltrata.value ? '_LA' : '');
}
async function mounted() {
// console.log('mounted Catalogo')
- generatinglist.value = true
+ generatinglist.value = true;
- if (showListaArgomenti.value)
- cat.value = tools.getCookie(getKeyCatAtLoad(), '')
+ if (optcatalogo.value.showListaArgomenti) cat.value = tools.getCookie(getKeyCatAtLoad(), '');
+
+ if (optcatalogo.value.showListaCollane) collana.value = tools.getCookie(getKeyCollanaAtLoad(), '');
if (getCatalogoByMyPage.value) {
- tabcatalogo.value = tools.getCookie('TAB_CAT', 'lista')
+ tabcatalogo.value = tools.getCookie('TAB_CAT', 'lista');
} else {
- tabcatalogo.value = 'lista'
+ tabcatalogo.value = 'lista';
}
- optrigenera.value.visibilitaDisp = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_DISP', costanti.DISP.DISPONIBILI)
- if (!showListaArgomenti.value)
- optrigenera.value.rig_mod = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'RIG_MOD', costanti.RIGENERAMOD.AGGIUNGI_SOLO)
- optrigenera.value.stato = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_STATO', costanti.STATO.IN_COMMERCIO)
+ optrigenera.value.visibilitaDisp = tools.getCookie(
+ (showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_DISP',
+ costanti.DISP.DISPONIBILI
+ );
+ if (!showListaFiltrata.value)
+ optrigenera.value.rig_mod = tools.getCookie(
+ (showListaFiltrata.value ? 'INC_ES_' : '') + 'RIG_MOD',
+ costanti.RIGENERAMOD.AGGIUNGI_SOLO
+ );
+ optrigenera.value.stato = tools.getCookie(
+ (showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_STATO',
+ costanti.STATO.IN_COMMERCIO
+ );
- loadpage.value = false
- await productStore.loadProducts(true)
+ loadpage.value = false;
+ await productStore.loadProducts(true);
- mycolumns.value = fieldsTable.getArrColsByTable('products')
+ mycolumns.value = fieldsTable.getArrColsByTable('products');
searchList.value = [
{
@@ -1242,29 +1341,25 @@ export default defineComponent({
filter: null,
tablesel: 'products',
},
- ]
+ ];
- optauthors.value = productStore.getAuthors()
+ optauthors.value = productStore.getAuthors();
//++Todo: Per ora visualizzo solo il "Negozio" e non i GAS...
- cosa.value = shared_consts.PROD.BOTTEGA
-
-
+ cosa.value = shared_consts.PROD.BOTTEGA;
//cosa.value = tools.getCookie(tools.COOK_COSA_PRODOTTI, shared_consts.PROD.GAS, true)
//if (cosa.value === shared_consts.PROD.TUTTI)
-
// Inizializza
- loadpage.value = true
+ loadpage.value = true;
window.addEventListener('scroll', handleScroll);
- calcArrProducts()
-
+ calcArrProducts();
}
function loaddata() {
- numRecLoaded.value = 20
+ numRecLoaded.value = 20;
}
// Remove the event listener on component destroy
@@ -1274,12 +1369,28 @@ export default defineComponent({
function getCatProds() {
return [{ label: '[Seleziona un Argomento]', value: '', icon: undefined, color: undefined }].concat(
- productStore.getCatProds(cosa.value).map(rec => ({
- label: `${rec.name} (${productStore.getTotaliProdottiByIdCatProd(rec._id)})`,
- value: rec._id,
- icon: rec.icon,
- color: rec.color,
- })).concat({ label: '[Senza Argomento]', value: costanti.NO_CATEGORY, icon: undefined, color: undefined }),
+ productStore
+ .getCatProds(cosa.value)
+ .map((rec) => ({
+ label: `${rec.name} (${productStore.getTotaliProdottiByIdCatProd(rec._id)})`,
+ value: rec._id,
+ icon: rec.icon,
+ color: rec.color,
+ }))
+ .concat({ label: '[Senza Argomento]', value: costanti.NO_CATEGORY, icon: undefined, color: undefined })
+ );
+ }
+ function getCollane() {
+ return [{ label: '[Seleziona una Collana]', value: '', icon: undefined, color: undefined }].concat(
+ productStore
+ .getCollane()
+ .map((rec) => ({
+ label: `${rec.title} (${productStore.getTotaliProdottiByIdCollana(rec._id)})`,
+ value: rec._id,
+ icon: rec.icon,
+ color: rec.color,
+ }))
+ .concat({ label: '[Senza Collana]', value: costanti.NO_CATEGORY, icon: undefined, color: undefined })
);
}
@@ -1288,26 +1399,23 @@ export default defineComponent({
function onLoadScroll(index: number, done: any) {
if (index >= 1) {
if (numRecLoaded.value < arrProducts.value.length) {
+ const step = 10;
+ let mynrec = numRecLoaded.value + step;
- const step = 10
- let mynrec = numRecLoaded.value + step
-
- if (mynrec > arrProducts.value.length)
- mynrec = arrProducts.value.length
-
- numRecLoaded.value = mynrec
+ if (mynrec > arrProducts.value.length) mynrec = arrProducts.value.length;
+ numRecLoaded.value = mynrec;
}
- done()
+ done();
} else {
- done(true)
+ done(true);
}
}
function filterFn(val: any, update: any, abort: any) {
update(() => {
const needle = val.toLowerCase();
- optauthors.value = productStore.getAuthors().filter(v => {
+ optauthors.value = productStore.getAuthors().filter((v) => {
const authorName = v.label.toLowerCase();
const wordsToSearch = needle.split(' ');
return wordsToSearch.every((word: any) => {
@@ -1322,7 +1430,7 @@ export default defineComponent({
}
function selauthor(id: string, value: string) {
- filter.value.author = id
+ filter.value.author = id;
}
/*function searchval(newval: any, table: any, tablesel: any) {
@@ -1338,49 +1446,63 @@ export default defineComponent({
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean = false) => {
// console.log('valoriopt', item.table)
- return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
- })
+ return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter);
+ });
const loadImage = (src: any) => {
return new Promise((resolve, reject) => {
- const img = new Image()
- img.onload = () => resolve(img)
- img.onerror = reject
- img.src = src
- })
- }
-
-
+ const img = new Image();
+ img.onload = () => resolve(img);
+ img.onerror = reject;
+ img.src = src;
+ });
+ };
function groupedPages(recscheda: ISchedaSingola) {
- return recscheda.arrProdToShow
+ return recscheda.arrProdToShow;
}
function generateStyleCatalogo(optcatalogo: IOptCatalogo) {
-
- return {
-
- }
+ return {};
}
function generateStylePageScheda(optcatalogo: IOptCatalogo, scheda: IMyScheda) {
- const marginTop = scheda.dimensioni?.pagina?.dimensioni?.margini?.top ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.top) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.top) || '')
- const marginBottom = scheda.dimensioni?.pagina?.dimensioni?.margini?.bottom ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.bottom) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.bottom) || '')
- const marginLeft = scheda.dimensioni?.pagina?.dimensioni?.margini?.left ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.left) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.left) || '')
- const marginRight = scheda.dimensioni?.pagina?.dimensioni?.margini?.right ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.right) || '')
-
- const paddingTop = scheda.dimensioni?.pagina?.dimensioni?.padding?.top ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.top) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.top) || '')
- const paddingBottom = scheda.dimensioni?.pagina?.dimensioni?.padding?.bottom ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.bottom) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.bottom) || '')
- const paddingLeft = scheda.dimensioni?.pagina?.dimensioni?.padding?.left ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.left) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.left) || '')
- const paddingRight = scheda.dimensioni?.pagina?.dimensioni?.padding?.right ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) || '')
+ const marginTop = scheda.dimensioni?.pagina?.dimensioni?.margini?.top
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.top)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.top) || '';
+ const marginBottom = scheda.dimensioni?.pagina?.dimensioni?.margini?.bottom
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.bottom)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.bottom) || '';
+ const marginLeft = scheda.dimensioni?.pagina?.dimensioni?.margini?.left
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.left)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.left) || '';
+ const marginRight = scheda.dimensioni?.pagina?.dimensioni?.margini?.right
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.margini?.right)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.right) || '';
+ const paddingTop = scheda.dimensioni?.pagina?.dimensioni?.padding?.top
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.top)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.top) || '';
+ const paddingBottom = scheda.dimensioni?.pagina?.dimensioni?.padding?.bottom
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.bottom)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.bottom) || '';
+ const paddingLeft = scheda.dimensioni?.pagina?.dimensioni?.padding?.left
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.left)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.left) || '';
+ const paddingRight = scheda.dimensioni?.pagina?.dimensioni?.padding?.right
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.right)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) || '';
// Esiste un immagine di sfondo specifica della singola pagina ?
- const recimg = getSfondoImgCatalogo(scheda)
- const backgroundImage = recimg.imagefile! ?? ''
- const backgroundSize = recimg.fit
+ const recimg = getSfondoImgCatalogo(scheda);
+ const backgroundImage = recimg.imagefile! ?? '';
+ const backgroundSize = recimg.fit;
- const width = scheda.dimensioni?.pagina?.dimensioni?.size?.width ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.width) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '')
- const height = scheda.dimensioni?.pagina?.dimensioni?.size?.height ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '')
+ const width = scheda.dimensioni?.pagina?.dimensioni?.size?.width
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.width)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '');
+ const height = scheda.dimensioni?.pagina?.dimensioni?.size?.height
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '');
return {
marginBottom,
@@ -1395,38 +1517,58 @@ export default defineComponent({
backgroundSize,
'--width': width,
'--height': height,
- ...((width && width !== '0px') ? { width: `${width} !important` } : {}),
- ...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
+ ...(width && width !== '0px' ? { width: `${width} !important` } : {}),
+ ...(height && height !== '0px' ? { height: `${height} !important` } : {}), // Aggiungi l'altezza solo se è valorizzata
};
}
function generateStyleByPageDim(optcatalogo: IOptCatalogo, mypage: IDimensioni) {
- const marginTop = mypage.margini?.top ? tools.adjustSize(optcatalogo, mypage.margini?.top) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.top) || '')
- const marginBottom = mypage.margini?.bottom ? tools.adjustSize(optcatalogo, mypage.margini?.bottom) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.bottom) || '')
- const marginLeft = mypage.margini?.left ? tools.adjustSize(optcatalogo, mypage.margini?.left) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.left) || '')
- const marginRight = mypage.margini?.right ? tools.adjustSize(optcatalogo, mypage.margini?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.right) || '')
+ const marginTop = mypage.margini?.top
+ ? tools.adjustSize(optcatalogo, mypage.margini?.top)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.top) || '';
+ const marginBottom = mypage.margini?.bottom
+ ? tools.adjustSize(optcatalogo, mypage.margini?.bottom)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.bottom) || '';
+ const marginLeft = mypage.margini?.left
+ ? tools.adjustSize(optcatalogo, mypage.margini?.left)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.left) || '';
+ const marginRight = mypage.margini?.right
+ ? tools.adjustSize(optcatalogo, mypage.margini?.right)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.margini?.right) || '';
- const paddingTop = mypage.padding?.top ? tools.adjustSize(optcatalogo, mypage.padding?.top) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.top) || '')
- const paddingBottom = mypage.padding?.bottom ? tools.adjustSize(optcatalogo, mypage.padding?.bottom) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.bottom) ?? '')
- const paddingLeft = mypage.padding?.left ? tools.adjustSize(optcatalogo, mypage.padding?.left) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.left) ?? '')
- const paddingRight = mypage.padding?.right ? tools.adjustSize(optcatalogo, mypage.padding?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) ?? '')
+ const paddingTop = mypage.padding?.top
+ ? tools.adjustSize(optcatalogo, mypage.padding?.top)
+ : tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.top) || '';
+ const paddingBottom = mypage.padding?.bottom
+ ? tools.adjustSize(optcatalogo, mypage.padding?.bottom)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.bottom) ?? '');
+ const paddingLeft = mypage.padding?.left
+ ? tools.adjustSize(optcatalogo, mypage.padding?.left)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.left) ?? '');
+ const paddingRight = mypage.padding?.right
+ ? tools.adjustSize(optcatalogo, mypage.padding?.right)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) ?? '');
// Esiste un immagine di sfondo specifica della singola pagina ?
- const recimg = getSfondoImgCatalogo(null, mypage)
- let fileimg = recimg.imagefile! ?? ''
- let backgroundSize = recimg.fit
+ const recimg = getSfondoImgCatalogo(null, mypage);
+ let fileimg = recimg.imagefile! ?? '';
+ let backgroundSize = recimg.fit;
if (!fileimg) {
// Esiste un immagine di sfondo uguali per tutte le pagine ?
- fileimg = optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
- backgroundSize = optcatalogo.dimensioni_def?.pagina.imgsfondo?.fit
- fileimg = fileimg ? `url(${tools.getDirUpload() + costanti.DIR_CATALOGO + fileimg})` : ''
+ fileimg = optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile;
+ backgroundSize = optcatalogo.dimensioni_def?.pagina.imgsfondo?.fit;
+ fileimg = fileimg ? `url(${tools.getDirUpload() + costanti.DIR_CATALOGO + fileimg})` : '';
}
- const backgroundImage = fileimg ?? ''
+ const backgroundImage = fileimg ?? '';
- const width = mypage.size?.width ? tools.adjustSize(optcatalogo, mypage.size?.width) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '')
- const height = mypage.size?.height ? tools.adjustSize(optcatalogo, mypage.size?.height) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '')
+ const width = mypage.size?.width
+ ? tools.adjustSize(optcatalogo, mypage.size?.width)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '');
+ const height = mypage.size?.height
+ ? tools.adjustSize(optcatalogo, mypage.size?.height)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '');
return {
marginBottom,
@@ -1441,21 +1583,27 @@ export default defineComponent({
backgroundSize,
'--width': width,
'--height': height,
- ...((width && width !== '0px') ? { width: `${width} !important` } : {}),
- ...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
+ ...(width && width !== '0px' ? { width: `${width} !important` } : {}),
+ ...(height && height !== '0px' ? { height: `${height} !important` } : {}), // Aggiungi l'altezza solo se è valorizzata
};
}
function getWidthPagina(optcatalogo: IOptCatalogo, scheda: IMyScheda) {
- return scheda.dimensioni?.pagina?.dimensioni?.size?.width ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.width) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '')
+ return scheda.dimensioni?.pagina?.dimensioni?.size?.width
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.width)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '');
}
function getHeightPagina(optcatalogo: IOptCatalogo, scheda: IMyScheda) {
- return scheda.dimensioni?.pagina?.dimensioni?.size?.height ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '')
+ return scheda.dimensioni?.pagina?.dimensioni?.size?.height
+ ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height)
+ : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '');
}
function getStyleRowSeparator(recscheda: ISchedaSingola) {
- const paddingLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.left) ?? '0px';
- const paddingRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.right) ?? '0px';
+ const paddingLeft =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.left) ?? '0px';
+ const paddingRight =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.right) ?? '0px';
return {
paddingLeft: `${paddingLeft}`,
@@ -1470,23 +1618,27 @@ export default defineComponent({
const height = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.size?.height) ?? '';
const marginTop = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.top) || '0';
- const marginBottom = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.bottom) || '0';
+ const marginBottom =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.bottom) || '0';
const marginLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.left) || '0';
- const marginRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.right) || '0';
+ const marginRight =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.right) || '0';
const paddingTop = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.top) || '0';
- const paddingBottom = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.bottom) || '0';
+ const paddingBottom =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.bottom) || '0';
const paddingLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.left) || '0';
- const paddingRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.right) || '0';
+ const paddingRight =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.padding?.right) || '0';
const out: any = {
placeContent,
flex: `0 1 ${width} !important`,
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`,
- ...((width && width !== '0px') ? { width: `${width} !important` } : {}),
- ...((height && height !== '0px') ? { height: `${height} !important` } : {})
- }
+ ...(width && width !== '0px' ? { width: `${width} !important` } : {}),
+ ...(height && height !== '0px' ? { height: `${height} !important` } : {}),
+ };
/*if (width) {
out.width = `${width} !important`
@@ -1495,25 +1647,33 @@ export default defineComponent({
out.height = `${height} !important`
}*/
- return out
-
+ return out;
}
function getStyleSchedaProdotto(recscheda: ISchedaSingola) {
const placeContent = 'center';
- const width = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.size?.width) ?? '100px';
+ const width =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.size?.width) ?? '100px';
const height = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.size?.height);
- const marginTop = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.top) || '0px';
- const marginBottom = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.bottom) || '0px';
- const marginLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.left) || '0px';
- const marginRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.right) || '0px';
+ const marginTop =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.top) || '0px';
+ const marginBottom =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.bottom) || '0px';
+ const marginLeft =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.left) || '0px';
+ const marginRight =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.margini?.right) || '0px';
- const paddingTop = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.top) || '0px';
- const paddingBottom = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.bottom) || '0px';
- const paddingLeft = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.left) || '0px';
- const paddingRight = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.right) || '0px';
+ const paddingTop =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.top) || '0px';
+ const paddingBottom =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.bottom) || '0px';
+ const paddingLeft =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.left) || '0px';
+ const paddingRight =
+ tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.scheda_prodotto?.padding?.right) || '0px';
return {
placeContent,
@@ -1521,26 +1681,24 @@ export default defineComponent({
flex: `0 1 ${width} !important`,
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`,
- ...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
+ ...(height && height !== '0px' ? { height: `${height} !important` } : {}), // Aggiungi l'altezza solo se è valorizzata
};
}
function containsProducts(page: IProduct[][]) {
- return page && page.length > 0 && page[0] && page[0].length > 0
+ return page && page.length > 0 && page[0] && page[0].length > 0;
}
function naviga(path: string) {
- router.push(path)
+ router.push(path);
}
function updateProducts(arr: any) {
if (getCatalogoByMyPage.value) {
- getCatalogoByMyPage.value.lista_prodotti = [...arr]
+ getCatalogoByMyPage.value.lista_prodotti = [...arr];
- if (optcatalogo.value.showListaArgomenti)
- salvaListaProdotti(true)
- else
- generatearrProdToViewSorted(true, false);
+ if (showListaFiltrata.value) salvaListaProdotti(true);
+ else generatearrProdToViewSorted(true, false);
}
}
@@ -1551,103 +1709,173 @@ export default defineComponent({
// add this record to lista_prodotti
if (getCatalogoByMyPage.value && !getCatalogoByMyPage.value.lista_prodotti.some((p) => p._id === element._id)) {
// inserire il record in cima
- const arr = getCatalogoByMyPage.value.lista_prodotti
- arr.unshift(element)
+ const arr = getCatalogoByMyPage.value.lista_prodotti;
+ arr.unshift(element);
- updateProducts(arr)
+ updateProducts(arr);
- addnewProd.value = false
+ addnewProd.value = false;
}
}
-
}
function clickaddNewBook() {
- addnewProd.value = true
+ addnewProd.value = true;
}
function toggleDebug() {
- optcatalogo.value.indebug = !optcatalogo.value.indebug
+ optcatalogo.value.indebug = !optcatalogo.value.indebug;
}
const preparePDF = async () => {
- optcatalogo.value.generazionePDFInCorso = true
- optcatalogo.value.areadistampa!.scale = optcatalogo.value.areadistampa!.scale_printable
- }
+ optcatalogo.value.generazionePDFInCorso = true;
+ optcatalogo.value.areadistampa!.scale = optcatalogo.value.areadistampa!.scale_printable;
+ };
const terminaPDF = async () => {
- optcatalogo.value.generazionePDFInCorso = false
- optcatalogo.value.areadistampa!.scale = 1
+ optcatalogo.value.generazionePDFInCorso = false;
+ optcatalogo.value.areadistampa!.scale = 1;
+ };
+
+ async function generateLargePDF(
+ opt: any,
+ pagesSelector = '.page',
+ salvasufiledascaricare: boolean,
+ dir_out: string,
+ file_out: string
+ ) {
+ const pages = document.querySelectorAll(pagesSelector);
+ const pdfs = [];
+
+ for (let i = 0; i < pages.length; i++) {
+ const page = pages[i];
+
+ // Nascondi altre pagine
+ pages.forEach((p) => p.classList.add('hidden'));
+ page.classList.remove('hidden');
+
+ await new Promise((resolve) => setTimeout(resolve, 100));
+
+ // Genera singolo PDF
+ const pdfBlob = await new Promise((resolve) => {
+ html2pdf()
+ .set(opt)
+ .from(page)
+ .toPdf()
+ .output('blob', { compress: true })
+ .then(resolve)
+ .catch(() => resolve(null));
+ });
+
+ if (pdfBlob) {
+ pdfs.push(pdfBlob);
+ }
+ }
+
+ // Unisci PDF
+ const finalPdf = await PDFDocument.create();
+ for (const blob of pdfs) {
+ const pdf = await PDFDocument.load(await blob.arrayBuffer());
+ const copiedPages = await finalPdf.copyPages(pdf, pdf.getPageIndices());
+ copiedPages.forEach((p) => finalPdf.addPage(p));
+ }
+
+ const finalPdfBytes = await finalPdf.save(); // Uint8Array
+
+ // ✅ Conversione in Blob
+ const blob = new Blob([finalPdfBytes], { type: 'application/pdf' });
+
+ // ✅ Download
+ if (salvasufiledascaricare) {
+ saveAs(blob, opt.filename);
+ } else {
+ // ✅ Crea un oggetto File da Blob
+ const pdfFile = new File([blob], 'report.pdf', { type: 'application/pdf' });
+
+ // Converti il file appena generato
+ await globalStore.convertPdf(
+ pdfFile,
+ widthpdf.value,
+ heightpdf.value,
+ compressionepdf.value,
+ dir_out,
+ file_out
+ );
+ }
+
+ // Ripristina visibilità
+ pages.forEach((p) => p.classList.remove('hidden'));
}
-
-
-
const generatePDF = async () => {
-
- await nextTick()
+ await nextTick();
$q.dialog({
message: 'Generare il PDF ?',
ok: {
label: t('dialog.yes'),
- push: true
+ push: true,
},
cancel: {
- label: t('dialog.cancel')
+ label: t('dialog.cancel'),
},
- title: 'Generazione PDF'
+ title: 'Generazione PDF',
}).onOk(async () => {
-
-
$q.loading.show({
- message: 'Caricamento immagini e generazione PDF in corso...'
- })
+ message: 'Caricamento immagini e generazione PDF in corso...',
+ });
try {
-
- let defaultMargin = 0.1
+ let defaultMargin = 0.1;
if (optcatalogo.value.printable) {
- defaultMargin = 0
+ defaultMargin = 0;
} else {
- defaultMargin = 0
+ defaultMargin = 0;
}
- const unit = optcatalogo.value.areadistampa!.unit
+ const unit = optcatalogo.value.areadistampa!.unit;
- let myformat = { ...optcatalogo.value.areadistampa!.format }
+ let myformat = { ...optcatalogo.value.areadistampa!.format };
- const scale = tools.getScale(optcatalogo.value)
+ const scale = tools.getScale(optcatalogo.value);
- const scalecanvas = optcatalogo.value.areadistampa!.scalecanvas
+ const scalecanvas = optcatalogo.value.areadistampa!.scalecanvas;
if (tools.isObject(myformat) && scale > 0) {
} else {
- myformat = [210, 297]
+ myformat = [210, 297];
}
+ const formatwidth = myformat[0] * scale;
+ const formatheight = myformat[1] * scale;
- const formatwidth = (myformat[0] * scale)
- const formatheight = (myformat[1] * scale)
+ let myfile = getPdfFilename();
- let myfile = getPdfFilename()
+ // myfile += '_' + tools.getDateYYYYMMDD_Today();
- myfile += '_' + formatwidth + '_' + formatheight + '_' + unit + '_scale_' + scale
+ myfile += '.pdf';
- myfile += '.pdf'
+ let file_out = myfile;
-
- const element = document.getElementById('pdf-content')
+ const element = document.getElementById('pdf-content');
const opt = {
margin: [
- optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.top) || defaultMargin) : defaultMargin,
- optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.left) || defaultMargin) : defaultMargin,
- optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.bottom) || defaultMargin) : defaultMargin,
- optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.right) || defaultMargin) : defaultMargin
+ optcatalogo.value.printable
+ ? parseFloat(optcatalogo.value.areadistampa!.margini?.top) || defaultMargin
+ : defaultMargin,
+ optcatalogo.value.printable
+ ? parseFloat(optcatalogo.value.areadistampa!.margini?.left) || defaultMargin
+ : defaultMargin,
+ optcatalogo.value.printable
+ ? parseFloat(optcatalogo.value.areadistampa!.margini?.bottom) || defaultMargin
+ : defaultMargin,
+ optcatalogo.value.printable
+ ? parseFloat(optcatalogo.value.areadistampa!.margini?.right) || defaultMargin
+ : defaultMargin,
],
filename: myfile,
image: {
type: 'jpeg',
- quality: 0.98
+ quality: 0.98,
},
html2canvas: {
scale: scalecanvas,
@@ -1661,37 +1889,40 @@ export default defineComponent({
compress: optcatalogo.value.areadistampa!.compress,
},
enableLinks: true,
- pagebreak: { mode: 'avoid-all', before: '.card-page' }
- }
+ pagebreak: { mode: 'avoid-all', before: '.card-page' },
+ };
- console.log('opt di stampa', opt)
+ console.log('opt di stampa', opt);
// a4: [595.28, 841.89]
- await html2pdf().set(opt).from(element).save()
+ if (true) {
+ await generateLargePDF(opt, '.pdf-section', false, 'upload/', file_out);
+ } else {
+ await html2pdf().set(opt).from(element).save();
+ }
- optcatalogo.value.generazionePDFInCorso = false
- optcatalogo.value.areadistampa!.scale = 1
+ optcatalogo.value.generazionePDFInCorso = false;
+ optcatalogo.value.areadistampa!.scale = 1;
- $q.loading.hide()
+ $q.loading.hide();
$q.notify({
color: 'positive',
message: 'PDF generato con successo!',
- icon: 'check'
- })
+ icon: 'check',
+ });
} catch (error) {
- $q.loading.hide()
+ $q.loading.hide();
$q.notify({
color: 'negative',
message: 'Errore nella generazione del PDF',
- icon: 'error'
- })
- console.error('Errore nella generazione del PDF:', error)
+ icon: 'error',
+ });
+ console.error('Errore nella generazione del PDF:', error);
}
- })
- }
+ });
+ };
-
- onMounted(mounted)
+ onMounted(mounted);
return {
userStore,
@@ -1751,7 +1982,7 @@ export default defineComponent({
clickaddNewBook,
addProductToList,
addnewProd,
- showListaArgomenti,
+ showListaFiltrata,
rigeneraLibri,
optrigenera,
generatinglist,
@@ -1761,10 +1992,13 @@ export default defineComponent({
getCatalogoByMyPage,
getReferentiCatalogo,
reSortList,
- preparePDF, terminaPDF, toggleDebug,
+ preparePDF,
+ terminaPDF,
+ toggleDebug,
generatePDF,
getPdfFilename,
- }
- }
-})
-
+ filtroStrApplicato,
+ getCollane,
+ };
+ },
+});
diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue
index 93a3a8c8..2bece10d 100755
--- a/src/views/ecommerce/catalogo/catalogo.vue
+++ b/src/views/ecommerce/catalogo/catalogo.vue
@@ -98,11 +98,14 @@
-
+
+
+
+ {{ reccollana.label }}
+
+
- Seleziona un Argomento
+ Seleziona {{ filtroStrApplicato }}
-
-
+
+
+
+ {{ reccollana.label }}
+
+
@@ -373,7 +407,8 @@
-
+
+
- Seleziona un Argomento
+ Seleziona {{ filtroStrApplicato }}