- generato lista libri, con possibilità di cambiare l'ordinamento dei libri o di cancellare libri.
This commit is contained in:
@@ -32,7 +32,18 @@ export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as PropType<IOptCatalogo>,
|
||||
required: true,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
idprodtoshow: {
|
||||
type: String,
|
||||
required: false,
|
||||
default : '',
|
||||
},
|
||||
nameLinkTemplate: {
|
||||
type: String,
|
||||
required: false,
|
||||
default : '',
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
@@ -101,10 +112,12 @@ export default defineComponent({
|
||||
|
||||
console.log('myproduct.value', myproduct.value)
|
||||
|
||||
if (myproduct.value) {
|
||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, myproduct.value._id.toString())
|
||||
} else {
|
||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||
if (!props.idprodtoshow) {
|
||||
if (myproduct.value) {
|
||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, myproduct.value._id.toString())
|
||||
} else {
|
||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -123,18 +136,57 @@ export default defineComponent({
|
||||
return lista && lista.value && lista.value._id ? lista.value._id : ''
|
||||
}
|
||||
|
||||
function populateDataWithlinkIdTemplate() {
|
||||
console.log('populateDataWithlinkIdTemplate')
|
||||
|
||||
if (optcatalogo.value) {
|
||||
|
||||
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||
if (recscheda.scheda?.linkIdTemplate) {
|
||||
// ricopia da Template:
|
||||
const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda)
|
||||
if (myscheda) {
|
||||
recscheda.scheda = { ...myscheda }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(' FINE - populateDataWithlinkIdTemplate')
|
||||
}
|
||||
|
||||
|
||||
async function mounted() {
|
||||
// console.log('mounted Catalogo')
|
||||
|
||||
optcatalogo.value = props.modelValue
|
||||
loadpage.value = false
|
||||
if (props.modelValue) {
|
||||
optcatalogo.value = props.modelValue
|
||||
} else {
|
||||
optcatalogo.value = globalStore.createCatalogoVuoto()
|
||||
productStore.addNewScheda(optcatalogo.value)
|
||||
|
||||
const id = tools.getCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||
if (props.nameLinkTemplate) {
|
||||
const linkIdTemplate = globalStore.getLinkIdTemplateByName(props.nameLinkTemplate)
|
||||
optcatalogo.value.arrSchede[0].scheda.linkIdTemplate = linkIdTemplate
|
||||
} else {
|
||||
optcatalogo.value.arrSchede[0].scheda.name = 'SEARCH_NEW'
|
||||
}
|
||||
}
|
||||
|
||||
const id = props.idprodtoshow || tools.getCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||
|
||||
if (props.nameLinkTemplate) {
|
||||
populateDataWithlinkIdTemplate()
|
||||
}
|
||||
|
||||
loadpage.value = false
|
||||
|
||||
if (id) {
|
||||
await loadProduct(id)
|
||||
}
|
||||
|
||||
|
||||
mycolumns.value = fieldsTable.getArrColsByTable('products')
|
||||
|
||||
searchList.value = [
|
||||
|
||||
Reference in New Issue
Block a user