From 8a20186e59b79309cb4eec38b00e6be6f13095a1 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Fri, 2 May 2025 10:10:04 +0200 Subject: [PATCH] - ordinamento aggiornare la pagina "templates" per Fatturati ultimo anno - bestseller --- .env | 4 +- index.html | 2 +- package.json | 14 +++--- .../comunitanuovomondo.app/package.json | 8 +-- .../_ALL_SITES/freeplanet.app/package.json | 12 ++--- .../_ALL_SITES/gruppomacro.app/package.json | 14 +++--- scripts/_ALL_SITES/kolibrilab.it/package.json | 12 ++--- .../_ALL_SITES/piuchebuono.app/package.json | 12 ++--- scripts/_ALL_SITES/riso.app/package.json | 12 ++--- src-pwa/custom-service-worker.js | 2 +- src/components/CCatalogoCard/CCatalogoCard.ts | 10 +++- src/components/CMyEditElem/CMyEditElem.ts | 2 +- src/components/CMyEditElem/CMyEditElem.vue | 2 +- src/components/CProductTable/CProductTable.ts | 3 +- src/model/GlobalStore.ts | 3 +- src/model/Products.ts | 5 +- src/store/Modules/costanti.ts | 5 ++ src/store/Products.ts | 2 +- src/store/globalStore.ts | 2 +- src/views/ecommerce/catalogo/catalogo.ts | 50 ++++++++++++++++--- src/views/ecommerce/catalogo/catalogo.vue | 17 +++++++ 21 files changed, 131 insertions(+), 62 deletions(-) diff --git a/.env b/.env index 352c4842..8958e85e 100755 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ -VITE_APP_VERSION="1.2.34" +VITE_APP_VERSION="1.2.35" VITE_LANG_DEFAULT="it" VITE_PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF" -VITE_SERVICE_WORKER_FILE="sw-1.2.34.js" +VITE_SERVICE_WORKER_FILE="sw-1.2.35.js" VITE_PROJECT_ID_MAIN="5cc0a13fe5c9d156728f400a" VITE_VUE_ROUTER_MODE="history" \ No newline at end of file diff --git a/index.html b/index.html index ef437070..edf9fea3 100755 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - + diff --git a/package.json b/package.json index d5030d42..8f36f001 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gruppomacro", - "version": "1.2.34", + "version": "1.2.35", "description": "Gruppo Macro", "productName": "Gruppo Macro", "author": "Surya", @@ -9,20 +9,20 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "PORT=8089 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8089 APP_VERSION='1.2.35' quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", "type-check": "vue-tsc --noEmit", "type-check:watch": "vue-tsc --noEmit --watch", - "buildspa": "APP_VERSION='1.2.34' quasar build -m spa", + "buildspa": "APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.35' 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/comunitanuovomondo.app/package.json b/scripts/_ALL_SITES/comunitanuovomondo.app/package.json index ed0d5359..1982b5f5 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.34", + "version": "1.2.35", "description": "Comunita Nuovo Mondo", "productName": "ComunitaNuovoMondo", "author": "Surya", @@ -9,7 +9,7 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "PORT=8083 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8083 APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.35' 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 feca3890..52b82461 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.34", + "version": "1.2.35", "description": "freeplanet", "productName": "freeplanet", "author": "Surya", @@ -9,11 +9,11 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "PORT=8087 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8087 APP_VERSION='1.2.35' quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8097 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8087 APP_VERSION='1.2.35' 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 d5030d42..8f36f001 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.34", + "version": "1.2.35", "description": "Gruppo Macro", "productName": "Gruppo Macro", "author": "Surya", @@ -9,20 +9,20 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "PORT=8089 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8089 APP_VERSION='1.2.35' quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", "type-check": "vue-tsc --noEmit", "type-check:watch": "vue-tsc --noEmit --watch", - "buildspa": "APP_VERSION='1.2.34' quasar build -m spa", + "buildspa": "APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8099 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8089 APP_VERSION='1.2.35' 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 d3d78eef..0e03d24d 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.34", + "version": "1.2.35", "description": "kolibrilab", "productName": "kolibrilab", "author": "Surya Paolo", @@ -8,11 +8,11 @@ "keywords": [], "license": "MIT", "scripts": { - "dev": "PORT=8083 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8083 APP_VERSION='1.2.35' quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8093 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8083 APP_VERSION='1.2.35' 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 ba39e2e6..7d455e47 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.34", + "version": "1.2.35", "description": "PiuCheBuono", "productName": "PiuCheBuono", "author": "Surya", @@ -9,11 +9,11 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "PORT=8085 APP_VERSION='1.2.34' quasar dev", + "dev": "PORT=8085 APP_VERSION='1.2.35' quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8085 APP_VERSION='1.2.35' 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 b80b5730..7af90eae 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.34", + "version": "1.2.35", "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.34' PORT=8084 quasar dev", + "dev": "APP_VERSION='1.2.35' PORT=8084 quasar dev", "dev_noCheck": "SKIP_TSC=true quasar dev", "build": "quasar build", - "buildpwa": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", - "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.34' quasar build -m pwa", + "buildpwa": "NODE_ENV=production APP_VERSION='1.2.35' quasar build -m pwa", + "buildpwatest": "NODE_ENV=production APP_VERSION='1.2.35' 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.34' quasar dev -m pwa", - "spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.34' quasar dev", + "pwa": "NODE_ENV=development PORT=8094 APP_VERSION='1.2.35' quasar dev -m pwa", + "spa": "NODE_ENV=development PORT=8084 APP_VERSION='1.2.35' 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 593e219a..e87d21cf 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.34"; +const VITE_APP_VERSION = "1.2.35"; // Costanti di configurazione const DYNAMIC_CACHE = 'dynamic-cache-v2'; diff --git a/src/components/CCatalogoCard/CCatalogoCard.ts b/src/components/CCatalogoCard/CCatalogoCard.ts index b83e8356..b73136f5 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.ts +++ b/src/components/CCatalogoCard/CCatalogoCard.ts @@ -630,12 +630,18 @@ export default defineComponent({ function isProductBestseller() { try { - // diventa un bestseller quando il rank6M è tra i primi 10 ordinandoli per rank6M - return myproduct.value!.productInfo.rank6M! > 0 && (myproduct.value!.productInfo.rank6M!) + if (props.scheda.etichette?.bestseller?.show) { + // diventa un bestseller quando il numero di fatturati Annuali è superiore a + const numfatturati = props.scheda.etichette?.bestseller?.quantiFattRaggiunti ?? 50; + + return myproduct.value!.productInfo.fatLast6M > numfatturati + } } catch (e) { return false } + return false + } function getScale() { diff --git a/src/components/CMyEditElem/CMyEditElem.ts b/src/components/CMyEditElem/CMyEditElem.ts index ea14c7d6..96a6a41a 100755 --- a/src/components/CMyEditElem/CMyEditElem.ts +++ b/src/components/CMyEditElem/CMyEditElem.ts @@ -294,7 +294,7 @@ export default defineComponent({ } recscheda.scheda.etichette!.bestseller = { show: false, - primiNInClassifica: 0, + quantiFattRaggiunti: 0, } } diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue index 2c7cd12c..7d7cfb51 100755 --- a/src/components/CMyEditElem/CMyEditElem.vue +++ b/src/components/CMyEditElem/CMyEditElem.vue @@ -2284,7 +2284,7 @@ 0 ? cookieValue : ["pos", "drag", "image", "name", "authors", "catprods", "isbn", "actions"]); + const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "image", "name", "authors", "isbn", "catprods", "stato", "date_pub", "pagine", "trafiletto", "vLast6M", "quantity", "actions"]); // 3. Funzione per verificare se una colonna è visibile (isColumnVisible) diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 929c3a83..bf2c3e2a 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -728,7 +728,7 @@ export interface INovita { export interface IBestseller { show?: boolean - primiNInClassifica?: number + quantiFattRaggiunti?: number } export interface IEtichette { @@ -850,6 +850,7 @@ export interface ISchedaSingola { export interface IOptRigenera { visibilitaDisp?: string + rig_mod?: string stato?: string } diff --git a/src/model/Products.ts b/src/model/Products.ts index 064636b8..b09b949e 100755 --- a/src/model/Products.ts +++ b/src/model/Products.ts @@ -251,18 +251,19 @@ export interface ICatProd { export interface ICatPrTotali { _id: string, name: string, - quanti: number, + quanti?: number, } export interface ICollaneTotali { _id: string, name: string, - quanti: number, + quanti?: number, } export interface ICollana { _id?: any idCollana: number, title: string, + quanti?: number, } export interface ICatAI { diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 45eeedbe..c75adb87 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -533,6 +533,11 @@ export const costanti = { ESAURITI: '2', }, + RIGENERAMOD: { + SOVRASCRIVI: '0', + AGGIUNGI_SOLO: '1', + }, + STATO: { TUTTI: '0', IN_COMMERCIO: '1', diff --git a/src/store/Products.ts b/src/store/Products.ts index 744ab3c8..642578ba 100755 --- a/src/store/Products.ts +++ b/src/store/Products.ts @@ -1926,7 +1926,7 @@ export const useProducts = defineStore('Products', { }, bestseller: { show: false, - primiNInClassifica: 20 + quantiFattRaggiunti: 50 } } } diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 70f9dbbb..48f81f45 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -216,7 +216,7 @@ export const useGlobalStore = defineStore('GlobalStore', { getters: { - sovrascriviSchedaFromTemplate: (state: IGlobalState) => (idTemplate: string, origScheda: ISchedaSingola) => { + sovrascriviSchedaFromTemplate: (state: IGlobalState) => (idTemplate: string, origScheda: ISchedaSingola, optcatalogo: IOptCatalogo) => { const arrschede: ISchedaSingola[] = state.myschedas const myfindscheda = arrschede.find((recscheda: ISchedaSingola) => recscheda.scheda?._id === idTemplate) diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts index 2c39ea86..91d1664f 100755 --- a/src/views/ecommerce/catalogo/catalogo.ts +++ b/src/views/ecommerce/catalogo/catalogo.ts @@ -77,6 +77,11 @@ export default defineComponent({ { label: 'Disponibili', value: costanti.DISP.DISPONIBILI }, { 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 }, { label: 'In Commercio', value: costanti.STATO.IN_COMMERCIO }, @@ -87,7 +92,7 @@ export default defineComponent({ const generatinglist = ref(false) - const optrigenera = ref({ visibilitaDisp: costanti.DISP.DISPONIBILI, stato: costanti.STATO.IN_COMMERCIO }) + const optrigenera = ref({ visibilitaDisp: costanti.DISP.DISPONIBILI, stato: costanti.STATO.IN_COMMERCIO, rig_mod: false }) const optcatalogo = ref({ ...props.modelValue }); @@ -110,6 +115,7 @@ export default defineComponent({ 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 }); @@ -185,7 +191,7 @@ export default defineComponent({ // Cerca se la descrizione introduttiva è stata impostata testo = catalog.descr_introduttiva let clcol = '' - if (catalog.pagina_introduttiva_sfondo_nero) { + if (catalog?.pagina_introduttiva_sfondo_nero) { clcol = `text-white` } testo = `` + testo + `` @@ -218,7 +224,7 @@ export default defineComponent({ let clcol = '' - if (catalog.pagina_introduttiva_sfondo_nero) { + if (catalog?.pagina_introduttiva_sfondo_nero) { clcol = `text-white` } @@ -480,7 +486,7 @@ export default defineComponent({ for (const recscheda of optcatalogo.value.arrSchede!) { if (recscheda.scheda?.linkIdTemplate) { // ricopia da Template: - const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda) + const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda, optcatalogo.value) if (myscheda) { recscheda.scheda = { ...myscheda } } @@ -730,6 +736,8 @@ export default defineComponent({ // console.log('arrprod', arrprod) populateDataWithlinkIdTemplate(); + + // Ordina la lista generatearrProdToViewSorted(!generalista, salva, !optcatalogo.value.showListaArgomenti); loaddata(); @@ -743,9 +751,15 @@ export default defineComponent({ // chiedi prima "Sei sicuro di rigenerare il catalogo?" let risposta_si = false + 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 ?' + } + $q.dialog({ title: 'Rigenera lista', - message: 'Sicuri di rigenerare questa lista di libri, perdendo l\'ordinamento attuale ?', + message: msg, cancel: true, persistent: false }).onOk(() => { @@ -753,6 +767,21 @@ export default defineComponent({ }) } + function reSortList() { + let risposta_si = false + + let msg = 'Sicuri di Riordinare questa lista ?' + + $q.dialog({ + title: 'Riordina lista', + message: msg, + cancel: true, + persistent: false + }).onOk(() => { + calcArrProducts(false) + }) + } + function arraysEqual(arr1, arr2) { return ( Array.isArray(arr1) && @@ -1050,7 +1079,13 @@ export default defineComponent({ if (!usaprodottiSalvati && salva) { if (trovatocatalogo) { - trovatocatalogo.lista_prodotti = arrprod + 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))) + } else { + trovatocatalogo.lista_prodotti = arrprod + } if (salvasudb) { salvaListaProdotti(false) @@ -1119,6 +1154,7 @@ export default defineComponent({ } optrigenera.value.visibilitaDisp = tools.getCookie((showListaArgomenti.value ? 'INC_ES_' : '') + 'VIS_DISP', costanti.DISP.DISPONIBILI) + 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) loadpage.value = false @@ -1530,9 +1566,11 @@ export default defineComponent({ optrigenera, generatinglist, optDisp, + optRigeneraModalita, optStato, getCatalogoByMyPage, getReferentiCatalogo, + reSortList, } } }) diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue index cc78f376..eaefa0c0 100755 --- a/src/views/ecommerce/catalogo/catalogo.vue +++ b/src/views/ecommerce/catalogo/catalogo.vue @@ -146,6 +146,14 @@ @click="rigeneraLibri = true" > + + +
Filtra per Disponibilità Magazzino:
+
Modalità di Creazione:
+ +