- aggiornamento catalogo: lista titoli del catalogo

- scheda prodotto libro
- migliorata tabella prodotto
This commit is contained in:
Surya Paolo
2025-04-04 18:15:14 +02:00
parent 79d1c5fe1d
commit 9cfc308d09
49 changed files with 1760 additions and 934 deletions

View File

@@ -0,0 +1,353 @@
import { PropType, computed, defineComponent, onMounted, ref, watch } from "vue";
import draggable from 'vuedraggable'
import { tools } from '@tools'
import { useGlobalStore } from '@src/store/globalStore'
import { CTableCupleLabelValue } from '@src/components/CTableCupleLabelValue'
import { costanti } from '@costanti'
import type {
IMyScheda,
IProduct,
IRecFields
} from '@src/model';
import { shared_consts } from "app/src/common/shared_vuejs";
import { useProducts } from "app/src/store/Products";
import { useI18n } from "vue-i18n";
export default defineComponent({
name: "CSchedaProdotto",
emits: [],
components: {
CTableCupleLabelValue
},
props: {
modelValue: {
type: Object as PropType<IProduct>,
required: true,
},
scheda: {
type: Object as PropType<IMyScheda>,
required: false,
default: () => ({
}),
},
updateproductmodif: {
type: Function as PropType<(element: any) => void>,
required: false,
default: () => () => { },
},
},
setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna
const { t } = useI18n()
const globalStore = useGlobalStore()
const products = useProducts()
const mytab = ref('scheda')
const myproduct = ref<IProduct>({ ...props.modelValue })
watch(() => props.modelValue, (newVal) => {
myproduct.value = { ...newVal };
}, { deep: false });
async function mounted() {
}
/*
// Aggiorna la copia locale quando il prop cambia
watch(
() => props.lista_prodotti,
(newVal) => {
internalProducts.value = [...newVal];
}
);
*/
function getArrListStat(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: false,
label: "Fatturati",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "totFat",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimi 3 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast3M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "totVen",
debounce: "1000", type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimi 3 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast3M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimi 6 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast6M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimo Anno",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLastY",
debounce: "1000",
type: costanti.FieldType.number,
},
// SEZIONE RANKING (FATTURATI)
{
editOn: false,
label: "Ranking 3 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "rank3M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Ranking 6 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "rank6M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Ranking 1 Anno",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "rank1Y",
debounce: "1000",
type: costanti.FieldType.number,
},
];
return arrlist
}
function getArrListDescrizioni(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: true,
label: "Descrizione breve macro",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "descrizione_breve_macro",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Descrizione Trafiletto per Catalogo",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "descr_trafiletto_catalogo",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Descrizione Estesa",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "descrizione_completa_macro",
maxlength: props.scheda?.testo_bottom?.maxlength ? props.scheda?.testo_bottom?.maxlength : 10000,
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Link a gruppomacro.com",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "link_macro",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
]
return arrlist
}
function getArrListScheda(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: true,
label: "Titolo",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "name",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "SottoTitolo",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "sottotitolo",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: false,
label: "Pubblicazione",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "date_pub",
debounce: "1000",
type: costanti.FieldType.onlydate,
dense: true,
},
{
editOn: true,
label: "Pagine",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "pagine",
debounce: "0",
type: costanti.FieldType.number,
dense: true,
},
{
editOn: true,
label: "Misure",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "misure",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Formato",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "formato",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Prezzo",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "price",
debounce: "0",
type: costanti.FieldType.number,
dense: true,
},
{
editOn: true,
label: "Prezzo Scontato",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "sale_price",
debounce: "0",
type: costanti.FieldType.number,
dense: true,
},
{
editOn: false,
label: "Magazzino",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "quantita",
debounce: "0",
type: costanti.FieldType.number,
dense: true,
},
]
return arrlist
}
onMounted(mounted)
return {
tools,
globalStore,
costanti,
shared_consts,
t,
products,
getArrListScheda,
getArrListDescrizioni,
getArrListStat,
mytab,
myproduct,
}
}
})