- 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

@@ -1,4 +1,4 @@
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda } from 'model'
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda } from 'model'
import { Api } from '@api'
import { serv_constants } from '@src/store/Modules/serv_constants'
@@ -12,6 +12,9 @@ import { toolsext } from '@store/Modules/toolsext'
import { useGlobalStore } from './globalStore'
import { ref } from 'vue'
import objectId from '@src/js/objectId'
import { costanti } from '@costanti'
import translate from '@src/globalroutines/util'
import { useCatalogStore } from './CatalogStore'
@@ -163,7 +166,7 @@ export const useProducts = defineStore('Products', {
mystr = ' - '
mystr += myarrcat.name
}
}
}
return mystr
},
@@ -1529,7 +1532,7 @@ export const useProducts = defineStore('Products', {
},
getSchedeOpt(arrschede: IMyScheda[]): any[] {
getSchedeOpt(arrschede: ISchedaSingola[], tag?: string): any[] {
let arr: any = []
@@ -1547,7 +1550,9 @@ export const useProducts = defineStore('Products', {
pagename = '[Pag: ' + pagename + '] '
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
arr.push({ label: mylabel, value: recscheda.scheda!._id })
if (!tag || mylabel.startsWith(tag)) {
arr.push({ label: mylabel, value: recscheda.scheda!._id })
}
}
});
}
@@ -1556,6 +1561,178 @@ export const useProducts = defineStore('Products', {
},
addNewScheda(catalogo: IOptCatalogo) {
let maxorder = 0
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 (!catalogo!.arrSchede)
catalogo!.arrSchede = []
catalogo!.arrSchede.push(
{
_id: objectId(),
scheda: newscheda,
order: maxorder + 10,
numPagineMax: 0,
}
)
}
},