- generato lista libri, con possibilità di cambiare l'ordinamento dei libri o di cancellare libri.
This commit is contained in:
@@ -12,7 +12,8 @@ import type {
|
||||
IStatusSkill,
|
||||
StateConnection,
|
||||
ISchedaSingola,
|
||||
IOptQueryGM
|
||||
IOptQueryGM,
|
||||
IOptCatalogo
|
||||
} from '@model';
|
||||
import {
|
||||
ICity, IMySkill,
|
||||
@@ -211,6 +212,31 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}),
|
||||
|
||||
getters: {
|
||||
|
||||
sovrascriviSchedaFromTemplate: (state: IGlobalState) => (idTemplate: string, origScheda: ISchedaSingola) => {
|
||||
|
||||
const arrschede: ISchedaSingola[] = state.myschedas
|
||||
const myfindscheda = arrschede.find((recscheda: ISchedaSingola) => recscheda.scheda?._id === idTemplate)
|
||||
|
||||
const linkIdTemplate = origScheda.scheda?.linkIdTemplate
|
||||
const precname = origScheda.scheda?.name
|
||||
|
||||
if (myfindscheda) {
|
||||
const myschedatocopy = tools.jsonCopy(myfindscheda)
|
||||
|
||||
if (myschedatocopy) {
|
||||
myschedatocopy.scheda._id = origScheda.scheda?._id
|
||||
myschedatocopy.scheda.isTemplate = false
|
||||
myschedatocopy.scheda.name = precname
|
||||
myschedatocopy.scheda.linkIdTemplate = linkIdTemplate
|
||||
|
||||
return myschedatocopy.scheda
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
},
|
||||
|
||||
// conta: (state: IGlobalState) => { state.conta },
|
||||
// listatodo: (state: IGlobalState) => { state.listatodo },
|
||||
// category: (state: IGlobalState) => { state.category },
|
||||
@@ -258,10 +284,22 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return false
|
||||
},
|
||||
|
||||
getSchedeOpt: (state: IGlobalState) => {
|
||||
getSchedeOpt: (state: IGlobalState) => (tag?: string) => {
|
||||
const Products = useProducts()
|
||||
|
||||
return Products.getSchedeOpt(state.myschedas)
|
||||
return Products.getSchedeOpt(state.myschedas, tag)
|
||||
},
|
||||
|
||||
getLinkIdTemplateByName: (state: IGlobalState) => (name: string) => {
|
||||
|
||||
try {
|
||||
const myrecscheda = state.myschedas.find((recscheda: ISchedaSingola) => recscheda.scheda.name === name)
|
||||
|
||||
return myrecscheda.scheda._id
|
||||
} catch (error) {
|
||||
return ''
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
isMyLang: (state: IGlobalState) => (rec: any) => {
|
||||
@@ -2393,6 +2431,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
createCatalogoVuoto(): IOptCatalogo {
|
||||
return {
|
||||
productTypes: [0],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
editore: [],
|
||||
pdf: false,
|
||||
dimensioni_def: {
|
||||
pagina: tools.resetRecIDimensioni(null)
|
||||
},
|
||||
areadistampa: tools.resetRecIAreaDiStampa(null),
|
||||
}
|
||||
},
|
||||
|
||||
async prepareAddNewElem(order: any, $q: any, t: any, myelem: any, newtype: any) {
|
||||
|
||||
const newrec: IMyElem = {
|
||||
@@ -2411,30 +2464,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
} else if (newrec.type === shared_consts.ELEMTYPE.CARD) {
|
||||
newrec.class2 = 'row justify-center'
|
||||
} else if (newrec.type === shared_consts.ELEMTYPE.SEARCHPRODUCT) {
|
||||
newrec.catalogo = {
|
||||
productTypes: [0],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
editore: [],
|
||||
pdf: false,
|
||||
dimensioni_def: {
|
||||
pagina: tools.resetRecIDimensioni(null)
|
||||
},
|
||||
}
|
||||
|
||||
newrec.catalogo = this.createCatalogoVuoto()
|
||||
|
||||
} else if (newrec.type === shared_consts.ELEMTYPE.CATALOGO) {
|
||||
newrec.catalogo = {
|
||||
//++AddCATALOGO_FIELDS
|
||||
productTypes: [0],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
editore: [],
|
||||
pdf: false,
|
||||
dimensioni_def: {
|
||||
pagina: tools.resetRecIDimensioni(null)
|
||||
},
|
||||
}
|
||||
newrec.catalogo = this.createCatalogoVuoto()
|
||||
}
|
||||
|
||||
const mynewrec = await this.addNewElem($q, t, newrec)
|
||||
|
||||
Reference in New Issue
Block a user