- generato lista libri, con possibilità di cambiare l'ordinamento dei libri o di cancellare libri.

This commit is contained in:
Surya Paolo
2025-04-01 18:36:45 +02:00
parent 61c1dc3d0d
commit 79d1c5fe1d
15 changed files with 507 additions and 302 deletions

View File

@@ -368,174 +368,7 @@ export default defineComponent({
}
function addNewScheda() {
let maxorder = 0
myel.value.catalogo!.arrSchede?.forEach(scheda => {
if (scheda?.order > maxorder) {
maxorder = scheda.order
}
})
let testodef: IText = {}
testodef = tools.resetIText(testodef)
const defaultDimensioniPag = tools.resetRecIDimensioni(null)
defaultDimensioniPag.size = {
width: '800px',
height: '600px',
}
defaultDimensioniPag.margini = {
top: '12px',
bottom: '0px',
left: '0px',
right: '0px',
}
defaultDimensioniPag.padding = {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
}
const defaultDimensioniRiga = tools.resetRecIDimensioni(null)
defaultDimensioniRiga.size = {
width: '800px',
height: '300px',
}
defaultDimensioniRiga.margini = {
top: '40px',
bottom: '0px',
left: '0px',
right: '0px',
}
defaultDimensioniRiga.padding = {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
}
const defaultSchedaProdotto = tools.resetRecIDimensioni(null)
defaultSchedaProdotto.size = {
width: '360px',
height: '230px',
}
defaultSchedaProdotto.margini = {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
}
defaultSchedaProdotto.padding = {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
}
const dimensioni: IElementiScheda = {
pagina: { dimensioni: defaultDimensioniPag, testo_down: testodef, testo_up: testodef, testo_title: testodef },
riga: defaultDimensioniRiga,
scheda_prodotto: defaultSchedaProdotto,
immagine_prodotto: {
size: {
width: '150px',
height: '235px',
},
margini: {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
},
padding: {
top: '0px',
bottom: '0px',
left: '0px',
right: '0px',
},
},
}
const newscheda: IMyScheda = {
_id: objectId(),
idapp: tools.appid()!,
isTemplate: false,
isPagIntro: false,
show_separatore: true,
name: 'Scheda Nuova',
dimensioni,
numschede_perRiga: 2,
numschede_perCol: 2,
testo_right_attaccato: {
contenuto: '',
maxlength: 0,
font: {
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
},
},
testo_right: {
contenuto: '',
maxlength: 0,
font: {
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
},
},
testo_bottom: {
contenuto: '',
maxlength: 0,
font: {
posiz_text: costanti.POSIZ_TESTO.IN_BASSO,
}
},
barcode: {
show: false,
format: '',
size: {
width: '2',
height: '100',
},
font: {
name: 'monospace',
size: '16px',
}
},
productTypes: [],
excludeproductTypes: [],
editore: [],
argomenti: [],
author: '',
sort_field: '',
sort_dir: 0,
arrProdottiSpeciali: [],
etichette: {
novita: {
show: false,
months: 6,
},
bestseller: {
show: false,
primiNInClassifica: 20
}
}
}
if (!myel.value.catalogo!.arrSchede)
myel.value.catalogo!.arrSchede = []
myel.value.catalogo!.arrSchede.push(
{
_id: objectId(),
scheda: newscheda,
order: maxorder + 10,
numPagineMax: 0,
}
)
// console.log('arrschede', myel.value.catalogo!.arrSchede)
Products.addNewScheda(myel.value.catalogo)
modifElem()