- corretto scheda prodotto, record salvato

This commit is contained in:
Surya Paolo
2025-05-01 00:20:02 +02:00
parent 358f0d6816
commit 721d2ac38c
32 changed files with 296 additions and 177 deletions

View File

@@ -128,13 +128,13 @@
>
<q-item-section avatar>
<q-avatar
icon="fas fa-pencil-alt"
icon="fas fa-file-alt"
color="primary"
text-color="white"
/>
</q-item-section>
<q-item-section>
<q-item-label>Modifica</q-item-label>
<q-item-label>Scheda Libro</q-item-label>
</q-item-section>
</q-item>
<q-item
@@ -149,7 +149,7 @@
>
<q-item-section avatar>
<q-avatar
icon="fas fa-pencil-alt"
icon="fas fa-align-left"
color="primary"
text-color="white"
/>
@@ -188,13 +188,13 @@
>
<q-item-section avatar>
<q-avatar
icon="fas fa-pencil-alt"
icon="fas fa-cloud-download-alt"
color="accent"
text-color="white"
/>
</q-item-section>
<q-item-section>
<q-item-label>Riaggiorna il Libro da GM</q-item-label>
<q-item-label>Carica dati del Libro (da GM)</q-item-label>
</q-item-section>
</q-item>
<q-item
@@ -207,13 +207,13 @@
>
<q-item-section avatar>
<q-avatar
icon="fas fa-pencil-alt"
icon="fas fa-database"
color="accent"
text-color="white"
/>
</q-item-section>
<q-item-section>
<q-item-label>Riaggiorna il Libro da DBLocale</q-item-label>
<q-item-label>Carica dati del Libro (dal DB Locale)</q-item-label>
</q-item-section>
</q-item>
<!--<q-item
@@ -312,13 +312,13 @@
>
<q-item-section avatar>
<q-avatar
icon="fas fa-eye"
icon="fas fa-boxes"
color="orange"
text-color="white"
/>
</q-item-section>
<q-item-section>
<q-item-label>Visualizza su GM (Tutti i campi)</q-item-label>
<q-item-label>Visualizza su GM (con le Quantità in Magazzino)</q-item-label>
</q-item-section>
</q-item>
</q-list>
@@ -691,7 +691,7 @@
:type="costanti.FieldType.editor_nohtml"
@updateproductmodif="updateproductmodif"
@close="modifTrafiletto = false"
:maxlength="800"
:maxlength="680"
>
</CModifTrafiletto>

View File

@@ -1647,7 +1647,7 @@ export default defineComponent({
}
function SaveValue(newVal: any, valinitial: any) {
console.log('SaveValue', newVal)
// console.log('SaveValue', newVal)
// console.log('rowsel', rowsel, 'colsel', colsel.value)
let myfield = ''
let subf = ''

View File

@@ -49,7 +49,7 @@
v-tooltip="'Copia negli appunti'"
/>
<CAITools></CAITools>
<!--<CAITools></CAITools>-->
<CMyEditorAI
v-if="modelValue"

View File

@@ -1676,6 +1676,22 @@
map-options
>
</q-select>
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
rounded
outlined
v-model="myel.catalogo.idTipoFormato"
:options="Products.tipoformato"
@update:model-value="modifElem"
multiple
label="Tipo Formato"
style="width: 300px"
option-value="IdTipoFormato"
option-label="Descrizione"
emit-value
map-options
>
</q-select>
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
v-if="enableEdit"

View File

@@ -65,7 +65,7 @@ export default defineComponent({
const cmd = ref(shared_consts.SCHEDA_PRODOTTO.CMD_NONE)
const showQtaDisponibile = ref(false)
const loading = ref(false)
const loading = ref(true)
const visufromgm = ref(false)
const updatefromgm = ref(false)
const field_updated_fromGM = ref('')
@@ -77,6 +77,10 @@ export default defineComponent({
const optionscatalogo = ref(<any>{ maxlength: 0 })
function handleUpdate(newList) {
internalProducts.value = newList
emit('update:lista_prodotti', internalProducts.value)
}
const editOn = computed({
get(): boolean {
@@ -90,10 +94,19 @@ export default defineComponent({
async function mounted() {
console.log('mounted CProductTable')
loading.value = true
optionscatalogo.value = {
maxlength: props.scheda?.testo_bottom?.maxlength
}
const savedColumns = tools.getCookie("selColCat");
if (savedColumns) {
selectedColumns.value = savedColumns;
}
loading.value = false
}
// Aggiorna la copia locale quando il prop cambia
@@ -102,7 +115,7 @@ export default defineComponent({
(newVal) => {
internalProducts.value = [...newVal];
}
);
), { deep: true };
// Colonne della tabella
const allColumns = [
@@ -119,6 +132,7 @@ export default defineComponent({
{ name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
{ name: "stato", label: "Stato", field: "stato", align: "left" },
{ name: "tipologia", label: "Tipologia", field: "tipologia", align: "left" },
{ name: "tipoformato", label: "Formato", field: "tipoformato", 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", visu: costanti.VISUCAMPI.PER_EDITORE },
@@ -136,87 +150,97 @@ export default defineComponent({
];
function getFieldValue(element: any, field: any): any {
switch (field.field) {
case 'image':
return element.productInfo?.imagefile
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
: element.productInfo?.image_link;
if (!element)
return ''
case 'name':
return element.productInfo?.name;
try {
switch (field.field) {
case 'image':
return element.productInfo?.imagefile
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
: element.productInfo?.image_link;
case 'authors':
return formatAuthors(element.productInfo?.authors);
case 'name':
return element.productInfo?.name;
case 'isbn':
return element.isbn;
case 'authors':
return formatAuthors(element.productInfo?.authors);
case 'trafiletto':
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI' : 'NO';
case 'isbn':
return element.isbn;
case 'catprods':
return tools.formatCatProds(element.productInfo?.catprods);
case 'trafiletto':
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI' : 'NO';
case 'edizione':
return element.arrvariazioni?.[0]?.edizione;
case 'catprods':
return tools.formatCatProds(element.productInfo?.catprods);
case 'casaeditrice':
return products.getCasaEditriceByIdPublisher(element.productInfo?.idPublisher);
case 'edizione':
return element.arrvariazioni?.[0]?.edizione;
case 'idCollana':
return tools.formatCollane(element.productInfo?.idCollana);
case 'casaeditrice':
return products.getCasaEditriceByIdPublisher(element.productInfo?.idPublisher);
case 'stato':
return products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo?.idStatoProdotto || '');
case 'idCollana':
return tools.formatCollane(element.productInfo?.idCollana);
case 'tipologia':
return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || '');
case 'stato':
return products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo?.idStatoProdotto || '');
case 'tipoformato':
return products.getDescrByIdTipoFormato(element.arrvariazioni?.[0]?.idTipoFormato || '');
case 'tipologia':
return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || '');
case 'date_pub':
return tools.getstrDate(element.productInfo?.date_pub);
case 'tipoformato':
return products.getDescrByIdTipoFormato(element.arrvariazioni?.[0]?.idTipoFormato || '');
case 'rank3M':
return element.productInfo?.rank3M;
case 'date_pub':
return tools.getstrDate(element.productInfo?.date_pub);
case 'rank6M':
return element.productInfo?.rank6M;
case 'rank3M':
return element.productInfo?.rank3M;
case 'rank1Y':
return element.productInfo?.rank1Y;
case 'rank6M':
return element.productInfo?.rank6M;
case 'pagine':
return element.arrvariazioni?.[0]?.pagine;
case 'rank1Y':
return element.productInfo?.rank1Y;
case 'totVen':
return element.productInfo?.totVen;
case 'pagine':
return element.arrvariazioni?.[0]?.pagine;
case 'totFat':
return element.productInfo?.totFat;
case 'totVen':
return element.productInfo?.totVen;
case 'fatLast6M':
return element.productInfo?.fatLast6M;
case 'totFat':
return element.productInfo?.totFat;
case 'fatLast1Y':
return element.productInfo?.fatLast1Y;
case 'fatLast6M':
return element.productInfo?.fatLast6M;
case 'fatLast2Y':
return element.productInfo?.fatLast2Y;
case 'fatLast1Y':
return element.productInfo?.fatLast1Y;
case 'ult_ord':
return tools.getstrDate(element.productInfo?.dataUltimoOrdine);
case 'fatLast2Y':
return element.productInfo?.fatLast2Y;
case 'quantity':
return element.arrvariazioni?.[0]?.quantita;
case 'ult_ord':
return tools.getstrDate(element.productInfo?.dataUltimoOrdine);
default:
return null;
case 'quantity':
return element.arrvariazioni?.[0]?.quantita;
default:
return null;
}
} catch (e) {
console.error('Errore getFieldValue:', e, element, field);
return null;
}
}
function getFieldClass(element: any, field: any): string {
if (!element)
return ''
switch (field.field) {
case 'trafiletto':
return element.productInfo?.descr_trafiletto_catalogo?.length > 100
@@ -265,6 +289,8 @@ export default defineComponent({
}
function getFieldStyle(element: any, field: any): Record<string, string> {
if (!element)
return ''
switch (field.field) {
case 'image':
return {
@@ -357,13 +383,6 @@ export default defineComponent({
.join(", ");
}
// Caricamento delle preferenze al mount del componente
onMounted(() => {
const savedColumns = tools.getCookie("selColCat");
if (savedColumns) {
selectedColumns.value = savedColumns;
}
});
function showProduct(element: any) {
selProd.value = element
@@ -524,6 +543,7 @@ export default defineComponent({
getFieldClass,
getFieldStyle,
getFieldClick,
handleUpdate,
}
}
})

View File

@@ -50,11 +50,13 @@
</thead>
<!-- Corpo della Tabella (Tbody) -->
<draggable
v-model="internalProducts"
v-if="!loading"
:model-value="internalProducts"
tag="tbody"
handle=".drag-handle"
item-key="_id"
@end="onDragEnd"
@update:modelValue="handleUpdate"
>
<template #item="{ element }">
<tr

View File

@@ -296,6 +296,17 @@ export default defineComponent({
type: costanti.FieldType.string,
dense: true,
},
/*{
editOn: true,
label: "Pagine",
table: "arrvariazioni",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "data_verifica",
debounce: "0",
type: costanti.FieldType.date,
dense: true,
},*/
{
editOn: false,
label: "Pubblicazione",

View File

@@ -233,7 +233,6 @@
</div>
<div v-if="tools.isLogged()" class="q-mt-lg"></div>
<slot></slot>
</q-drawer>
</div>
</template>