- Aggiungere un campo "Vagliato dall'Editore" e aggiungere anche il campo "chi" e delle Note
This commit is contained in:
@@ -101,7 +101,7 @@ export default defineComponent({
|
||||
maxlength: props.scheda?.testo_bottom?.maxlength
|
||||
}
|
||||
|
||||
const savedColumns = tools.getCookie("selColCat");
|
||||
const savedColumns = tools.getCookie("selColCat_2");
|
||||
if (savedColumns) {
|
||||
selectedColumns.value = savedColumns;
|
||||
}
|
||||
@@ -121,6 +121,7 @@ export default defineComponent({
|
||||
const allColumns = [
|
||||
{ name: "pos", label: "Ind", field: "pos", align: "left", style: "width: 50px" },
|
||||
{ name: "drag", label: "Ord", field: "", align: "left", style: "width: 50px", edit: true },
|
||||
{ name: "validato", label: "Val", field: "validato", align: "left", style: "" },
|
||||
{ name: "image", label: "Foto", field: "image", align: "center" },
|
||||
{ name: "name", label: "Titolo del Libro", field: "name", align: "left" },
|
||||
{ name: "authors", label: "Autore", field: "authors", align: "left" },
|
||||
@@ -133,12 +134,14 @@ export default defineComponent({
|
||||
{ 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: "pagine", label: "Pag.", field: "pagine", align: "right" },
|
||||
{ name: "prezzo", label: "€", field: "prezzo", align: "right" },
|
||||
{ name: "prezzo_sconto", label: "€ (sconto)", field: "prezzo_sconto", align: "right" },
|
||||
{ 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 },
|
||||
//{ name: "rank6M", label: "Class. 6M", field: "rank6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
//{ name: "rank1Y", label: "Class. 1Y", field: "rank1Y", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "pagine", label: "Pag.", field: "pagine", align: "right" },
|
||||
{ name: "totVen", label: "Vend", field: "totVen", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "vLast6M", label: "Ven 6M", field: "vLast6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "fatLast6M", label: "Fat 6M", field: "fatLast6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
@@ -167,6 +170,9 @@ export default defineComponent({
|
||||
case 'authors':
|
||||
return formatAuthors(element.productInfo?.authors);
|
||||
|
||||
case 'validato':
|
||||
return element.validaprod?.esito === costanti.VALIDATO.SI ? '<span class="text-bold">SI</span>' : (element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV ? '<span class="text-bold">ERR</span>' : 'NO');
|
||||
|
||||
case 'isbn':
|
||||
return element.isbn;
|
||||
|
||||
@@ -197,6 +203,12 @@ export default defineComponent({
|
||||
case 'date_pub':
|
||||
return tools.getstrDate(element.productInfo?.date_pub);
|
||||
|
||||
case 'prezzo':
|
||||
return tools.getstrDate(element.price);
|
||||
|
||||
case 'prezzo_sconto':
|
||||
return tools.getstrDate(element.sale_price);
|
||||
|
||||
case 'rank3M':
|
||||
return element.productInfo?.rank3M;
|
||||
|
||||
@@ -260,6 +272,15 @@ export default defineComponent({
|
||||
}
|
||||
return '';
|
||||
|
||||
case 'validato':
|
||||
if (element.validaprod?.esito === costanti.VALIDATO.SI) {
|
||||
return 'bg-green';
|
||||
} else if (element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV) {
|
||||
return 'bg-red';
|
||||
} else {
|
||||
return 'bg-grey';
|
||||
}
|
||||
|
||||
case 'quantity':
|
||||
if (products.isPubblicato(element.productInfo)) {
|
||||
if (products.isQtaLimitata(element)) {
|
||||
@@ -291,8 +312,15 @@ export default defineComponent({
|
||||
|
||||
function getFieldStyle(element: any, field: any): Record<string, string> {
|
||||
if (!element)
|
||||
return ''
|
||||
return {}
|
||||
|
||||
switch (field.field) {
|
||||
case 'validato':
|
||||
return {
|
||||
cursor: 'pointer',
|
||||
textAlign: 'center',
|
||||
color: 'white',
|
||||
}
|
||||
case 'image':
|
||||
return {
|
||||
width: '50px',
|
||||
@@ -325,7 +353,7 @@ export default defineComponent({
|
||||
|
||||
let cookieValue: [] | null = null;
|
||||
try {
|
||||
cookieValue = tools.getCookie("selColCat");
|
||||
cookieValue = tools.getCookie("selColCat_2");
|
||||
// Se il cookie esiste e contiene una stringa JSON valida
|
||||
cookieValue = cookieValue ? cookieValue : [];
|
||||
} catch (error) {
|
||||
@@ -333,7 +361,7 @@ export default defineComponent({
|
||||
cookieValue = []; // In caso di errore, inizializza come array vuoto
|
||||
}
|
||||
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "image", "name", "authors", "isbn", "catprods", "stato", "date_pub", "pagine", "trafiletto", "vLast6M", "quantity", "actions"]);
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "validato", "image", "name", "authors", "isbn", "catprods", "stato", "date_pub", "pagine", "trafiletto", "fatLast1Y", "quantity", "actions"]);
|
||||
|
||||
|
||||
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
||||
@@ -358,7 +386,7 @@ export default defineComponent({
|
||||
|
||||
// 8. Salvataggio delle colonne selezionate in un cookie
|
||||
const saveSelectedColumns = () => {
|
||||
tools.setCookie("selColCat", JSON.stringify(selectedColumns.value));
|
||||
tools.setCookie("selColCat_2", JSON.stringify(selectedColumns.value));
|
||||
};
|
||||
|
||||
// 9. Watcher per salvare automaticamente le preferenze quando cambiano
|
||||
@@ -485,6 +513,8 @@ export default defineComponent({
|
||||
|
||||
function getFieldClick(element: any, field: any): (() => void) | null {
|
||||
switch (field.field) {
|
||||
case 'validato':
|
||||
return () => modifyProduct(element)
|
||||
case 'image':
|
||||
return () => showProduct(element);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user