@@ -599,7 +617,7 @@
:options="{
nameTable: 'T_Web_Articoli',
campispeciali: true,
- numrec: 100,
+ numrec: 1,
where: 'T.IdArticolo =' + myproduct.productInfo.sku,
showQtaDisponibile,
outhtml: true,
diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue
index 91847760..bd035656 100755
--- a/src/components/CMyEditElem/CMyEditElem.vue
+++ b/src/components/CMyEditElem/CMyEditElem.vue
@@ -1713,7 +1713,7 @@
multiple
emit-value
map-options
- option-value="idCollana"
+ option-value="_id"
option-label="title"
>
diff --git a/src/components/CMyRecCatalog/CMyRecCatalog.ts b/src/components/CMyRecCatalog/CMyRecCatalog.ts
index cd24c3cd..4b030525 100755
--- a/src/components/CMyRecCatalog/CMyRecCatalog.ts
+++ b/src/components/CMyRecCatalog/CMyRecCatalog.ts
@@ -111,8 +111,9 @@ export default defineComponent({
collanestr.value = ''
if (myrec.value.idCollane) {
for (const idcollana of myrec.value.idCollane) {
- const reccoll: ICollana = products.collane!.find((coll: ICollana) => coll.idCollana === idcollana)
- collanestr.value += reccoll.title + ' '
+ const reccoll: ICollana = products.collane!.find((coll: ICollana) => coll._id === idcollana)
+ if (reccoll)
+ collanestr.value += reccoll.title + ' '
}
}
argomentistr.value = ''
diff --git a/src/components/CProductTable/CProductTable.ts b/src/components/CProductTable/CProductTable.ts
index 156f5cf6..06344f46 100755
--- a/src/components/CProductTable/CProductTable.ts
+++ b/src/components/CProductTable/CProductTable.ts
@@ -52,7 +52,7 @@ export default defineComponent({
},
setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna
- const internalProducts = ref([...props.lista_prodotti]);
+ const internalProducts = ref([...props.lista_prodotti || []]);
const { t } = useI18n()
@@ -108,6 +108,7 @@ export default defineComponent({
{ name: "authors", label: "Autore", field: "authors", align: "left" },
{ name: "trafiletto", label: "Trafiletto", field: "trafiletto", align: "left" },
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
+ { name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
{ name: "date_pub", label: "Pubblicato", field: "date_pub", align: "left" },
{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right" },
@@ -116,6 +117,7 @@ export default defineComponent({
{ name: "pagine", label: "Pag.", field: "pagine", align: "right" },
{ name: "totVen", label: "Venduti", field: "totVen", align: "right" },
{ name: "totFat", label: "Fattur.", field: "totFat", align: "right" },
+ { name: "fatLast6M", label: "Fat 6M", field: "fatLast6M", align: "right" },
{ name: "ult_ord", label: "Ult. Ordine", field: "ult_ord", align: "left" },
{ name: "quantity", label: "Magazz.", field: "quantity", align: "right" },
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" },
diff --git a/src/components/CProductTable/CProductTable.vue b/src/components/CProductTable/CProductTable.vue
index 63a23e9f..6b8eb08b 100755
--- a/src/components/CProductTable/CProductTable.vue
+++ b/src/components/CProductTable/CProductTable.vue
@@ -83,6 +83,8 @@
| {{ tools.formatCatProds(element.productInfo?.catprods) }} |
+
+ {{ tools.formatCollane(element.productInfo?.idCollana) }} |
{{ tools.getstrDate(element.productInfo?.date_pub) }} |
@@ -124,6 +126,12 @@
>
{{ element.productInfo?.totFat }}
+
+ {{ element.productInfo?.fatLast6M }}
+ |
{{ tools.getstrDate(element.productInfo?.dataUltimoOrdine) }} |
@@ -231,8 +239,8 @@
:options="{
nameTable: 'T_Web_Articoli',
campispeciali: true,
- numrec: 100,
- where: 'T.IdArticolo =' + selProd.productInfo.sku,
+ numrec: 1,
+ where: 'T.IdArticolo =' + selProd.productInfo.sku + ' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
showQtaDisponibile,
outhtml: true,
}"
diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts
index d78034b7..22a23203 100755
--- a/src/model/GlobalStore.ts
+++ b/src/model/GlobalStore.ts
@@ -1603,7 +1603,7 @@ export interface IAttivita {
}
export interface IOptQueryGM {
- idapp: string
+ idapp?: string
nameTable: string
campispeciali?: boolean
query?: string
diff --git a/src/model/Products.ts b/src/model/Products.ts
index 47651a75..cc0014f8 100755
--- a/src/model/Products.ts
+++ b/src/model/Products.ts
@@ -54,6 +54,7 @@ export interface IProductInfo {
totFat?: number,
vLast3M?: number,
fatLast3M?: number,
+ fatLast6M?: number,
vLast6M?: number,
vLastY?: number,
vLast2Y?: number,
@@ -103,7 +104,6 @@ export interface IProdView {
export interface IProduct {
_id?: any
- indiceRanking?: number
active?: boolean
isbn?: string
idProductInfo?: string,
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index 7edf81f8..470fa4b7 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -4376,7 +4376,7 @@ export const fieldsTable = {
value: 'collanas',
label: 'Collane',
columns: colTableCollane,
- colkey: 'idCollana',
+ colkey: '_id',
collabel: 'title',
},
{
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 8b1a17e0..331383e5 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -26,7 +26,8 @@ import type {
IAreaDiStampa,
IOptCatalogo,
IPagina,
- IMyScheda
+ IMyScheda,
+ ICollana
} from '@model';
import {
Privacy,
@@ -63,6 +64,7 @@ import type { AxiosResponse } from 'axios';
import { default as Axios } from 'axios'
import { PayloadMessageTypes } from '@src/common'
import { useNotifStore } from '@store/NotifStore'
+import { useProducts } from '../Products';
const { t } = i18n.global;
@@ -3556,6 +3558,11 @@ export const tools = {
}
},
+ getDateFromISOString(mydate): Date {
+ const mydate2 = new Date(mydate)
+ return mydate2
+ },
+
getDateNow() {
const mydate = new Date()
return mydate
@@ -9870,6 +9877,28 @@ export const tools = {
.join(", ");
},
+ formatCollane(collane: number[] | number | undefined | null): string {
+ if (!collane) {
+ return "";
+ }
+
+ const products = useProducts()
+ if (Array.isArray(collane)) {
+ // Estrai le collane e uniscile con ', '
+ return collane
+ .map((idcollana) => {
+ const reccoll: ICollana | undefined = products.collane!.find((coll: ICollana) => coll.idCollana === idcollana)
+ return reccoll ? `${reccoll.title ?? ""}`.trim() : ""
+ })
+ .filter((name) => name.length > 0) // Filtra eventuali nomi vuoti
+ .join(", ");
+ } else {
+ const reccoll: ICollana | undefined = products.collane!.find((coll: ICollana) => coll.idCollana === collane)
+ return reccoll ? `${reccoll.title}` : ''
+
+ }
+ },
+
// FINE !
diff --git a/src/store/Products.ts b/src/store/Products.ts
index a88faeaa..130eb467 100755
--- a/src/store/Products.ts
+++ b/src/store/Products.ts
@@ -1388,7 +1388,7 @@ export const useProducts = defineStore('Products', {
}
const autori = this.getAutoriByArrayAuthors(myproduct.productInfo.authors)
- const collana = myproduct.productInfo.collana
+ const collana = tools.formatCollane(myproduct.productInfo.idCollana)
const maxDescriptionLength = testo.maxlength ?? 100;
const description = myproduct.productInfo.short_descr || '';
@@ -1480,7 +1480,7 @@ export const useProducts = defineStore('Products', {
'{ranking_globale}': ranking_globale || '',
'{venduti}': venduti || '',
'{formato}': formato || '',
- '{collana_title}': collana ? collana.title || '' : '',
+ '{collana}': collana ? collana || '' : '',
'{prezzo}': prezzo || '',
'{scale}': scale || '',
'{prezzo_scontato}': prezzo_scontato || '',
@@ -1493,6 +1493,7 @@ export const useProducts = defineStore('Products', {
'{imagefile}': imagefile || '',
};
+
// Esegue le sostituzioni
let result = testo.contenuto;
for (const [key, value] of Object.entries(replacements)) {
diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts
index 2282f12e..6b5da25f 100644
--- a/src/store/globalStore.ts
+++ b/src/store/globalStore.ts
@@ -2590,9 +2590,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
const options: IOptQueryGM = {
nameTable: 'T_Web_Articoli',
campispeciali: !field,
- numrec: 100,
+ numrec: 1,
query: '',
- where: 'T.IdArticolo =' + sku,
+ where: 'T.IdArticolo =' + sku + ' AND T.DataPubblicazione IS NOT NULL ORDER BY T.DataOra DESC;',
fieldGM: field,
showQtaDisponibile: false,
outhtml: false,
@@ -2623,6 +2623,12 @@ export const useGlobalStore = defineStore('GlobalStore', {
return !!valueris
},
+ async updateAllBookFromGM_T_Web_Articoli(sku: string) {
+
+ const valueris = await this.updateAllBookTableContent({ sku });
+
+ return valueris
+ },
async setGM_FieldOf_T_Web_Articoli(sku: string, data: Record, cmd: number) {
try {
@@ -2668,6 +2674,22 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
},
+ async updateAllBookTableContent(options: any) {
+ try {
+ // aggiungi idapp ad options
+ options.idapp = tools.getEnv('VITE_APP_ID')
+ return Api.SendReq('/apisqlsrv/updateAllBook', 'POST', { options })
+ .then((res) => {
+ return res.data.data
+ }).catch((error: any) => {
+ console.error('Error fetchTableContent: ', error)
+ })
+ } catch (error) {
+ console.error("Errore nel recupero della tabella:", error);
+ throw error;
+ }
+ },
+
async saveTableContent(options: IOptQueryGM) {
try {
return Api.SendReq('/apisqlsrv/save-table', 'POST', { options })
diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts
index 0bd75e97..cf6d7aec 100755
--- a/src/views/ecommerce/catalogo/catalogo.ts
+++ b/src/views/ecommerce/catalogo/catalogo.ts
@@ -22,7 +22,8 @@ import { CSelectUserActive } from '@src/components/CSelectUserActive'
import type {
IOptCatalogo, IDimensioni, IFilterCatalogo,
IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg,
- IText
+ IText,
+ ICollana,
} from 'model';
import {
IMyPage,
@@ -444,7 +445,7 @@ export default defineComponent({
filtroProductTypes: number[],
filtroExcludeProductTypes: number[],
editore: string[],
- idCollane: number[],
+ idCollane: ICollana[],
arrargomstr: any[],
catstr: string,
gasselstr: string,
@@ -504,7 +505,7 @@ export default defineComponent({
// Filtri per collana
const hasCollana = boolfiltroVuotoCollane
? true
- : idCollane.includes(product.productInfo.idCollana);
+ : (idCollane || []).some((item: ICollana) => product.productInfo.idCollana === item.idCollana)
// Filtri per GAS
const productgassel = !gasselstr || (cosaValue === shared_consts.PROD.GAS && product.idGasordine === gasselstr);