- Aggiornati margini.
- Cataloghi: Export ed Import di una pagine ed i suoi elementi !
This commit is contained in:
@@ -272,7 +272,17 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
getPage: (state: IGlobalState) => (path: string): IMyPage | undefined => state.mypage.find((page) => (`/${page.path}`) === path),
|
||||
getPageById: (state: IGlobalState) => (idpage: string): IMyPage | undefined => state.mypage.find((page) => (`/${page._id}`) === idpage),
|
||||
getPageById: (state: IGlobalState) => (idpage: string): IMyPage | undefined => {
|
||||
const mypage = state.mypage.find((page) => (`${page._id}`) === idpage)
|
||||
return mypage
|
||||
},
|
||||
getPathByIdPage: (state: IGlobalState) => (idpage: string): string => {
|
||||
const mypage = state.mypage.find((page) => (`${page._id}`) === idpage)
|
||||
if (mypage) {
|
||||
return mypage.path!
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
getMyElemsByIdPage: (state: IGlobalState) => (idPage?: string): IMyElem[] | [] => {
|
||||
return state.myelems.filter((page: IMyElem) => (page._id === idPage)).sort((a: any, b: any) => a.order - b.order)
|
||||
@@ -1203,6 +1213,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
let newpath = prompt(t('mypages.duplica_newname'))
|
||||
|
||||
if (!newpath)
|
||||
return false
|
||||
|
||||
$q.dialog({
|
||||
message: t('mypages.duplica_conferma', { path, newpath }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
@@ -1230,6 +1243,46 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
},
|
||||
|
||||
async exportPage(path: string, $q: any, t: any) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
return Api.SendReq('/exppage', 'POST', { path })
|
||||
.then((res) => {
|
||||
if (res && res.data && res.data.json) {
|
||||
tools.showPositiveNotif($q, t('mypages.expok'))
|
||||
return res.data.json
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('mypages.experr'))
|
||||
return null
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error loadTable', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return null
|
||||
})
|
||||
},
|
||||
|
||||
importPage(jsonString: string, $q: any, t: any) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
return Api.SendReq('/imppage', 'POST', { jsonString })
|
||||
.then((res) => {
|
||||
if (res && res.data && res.data.ris) {
|
||||
tools.showPositiveNotif($q, t('mypages.impok'))
|
||||
return res.data.ris
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('mypages.imperr'))
|
||||
return null
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error importPage', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return null
|
||||
})
|
||||
},
|
||||
|
||||
async loadPageTest() {
|
||||
|
||||
console.log('loadPageTest')
|
||||
@@ -2301,7 +2354,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return;
|
||||
}
|
||||
|
||||
const filenameToDownload = tools.removeFileExtension(pdfFile.name) + '-output.pdf'
|
||||
const filenameToDownload = tools.removeFileExtension(pdfFile.name) + '-compresso.pdf'
|
||||
|
||||
const formData = new FormData();
|
||||
if (pdfFile instanceof File) {
|
||||
|
||||
Reference in New Issue
Block a user