- Aggiornati margini.
- Cataloghi: Export ed Import di una pagine ed i suoi elementi !
This commit is contained in:
@@ -163,6 +163,7 @@ export const colIText = [
|
||||
AddCol({ name: 'maxlength', label_trans: 'catalogo.maxlength', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'posiz_text', label_trans: 'catalogo.posiz_text', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'perc_text', label_trans: 'catalogo.perc_text', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'margintop', label_trans: 'catalogo.margintop', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'line_height', label_trans: 'catalogo.line_height', fieldtype: costanti.FieldType.number }),
|
||||
]
|
||||
export const colmyIImg = [
|
||||
|
||||
@@ -3527,6 +3527,13 @@ export const tools = {
|
||||
return mydate
|
||||
},
|
||||
|
||||
getDateYYYYMMDD_Today() {
|
||||
// Ottieni la data attuale nel formato YYYY-MM-DD
|
||||
const today = new Date();
|
||||
const formattedDate = today.toISOString().split('T')[0]; // Format YYYY-MM-DD
|
||||
return formattedDate
|
||||
},
|
||||
|
||||
isDateArrived(mydate: Date | number | string | undefined) {
|
||||
const datenow = this.getDateNow()
|
||||
const diff = date.getDateDiff(datenow, mydate)
|
||||
@@ -8012,9 +8019,9 @@ export const tools = {
|
||||
} else if (!!myrow && !!myrow.directory) {
|
||||
ris = myrow.directory
|
||||
} else if (table === 'myelems') {
|
||||
ris = 'pages/' + myrow.path
|
||||
ris = 'pages/' + (path ? path : myrow.path)
|
||||
} else if (table === 'listcards') {
|
||||
ris = 'pages/' + myrow.path
|
||||
ris = 'pages/' + (path ? path : myrow.path)
|
||||
} else if (table === 'imgcards') {
|
||||
ris = 'pages/' + path
|
||||
} else if (table === 'productInfos') {
|
||||
@@ -8024,10 +8031,11 @@ export const tools = {
|
||||
} else {
|
||||
ris = table
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('err getDirectoryGall', e)
|
||||
}
|
||||
// console.log('getDirectoryGall', ris)
|
||||
console.log('getDirectoryGall', ris, 'mypath', path, 'myrow', myrow)
|
||||
return ris
|
||||
},
|
||||
|
||||
@@ -8035,7 +8043,7 @@ export const tools = {
|
||||
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + filename
|
||||
},
|
||||
|
||||
getImgFileByElem(elem: IMyElem, reccard?: IMyCard) {
|
||||
getImgFileByElem(elem: IMyElem, reccard?: IMyCard, path?: string) {
|
||||
if (elem) {
|
||||
|
||||
let addtourl = ''
|
||||
@@ -8043,21 +8051,23 @@ export const tools = {
|
||||
addtourl = '?v=' + elem.vers_img
|
||||
}
|
||||
|
||||
const mypath = (path ? path : elem.path)
|
||||
|
||||
if (elem.type === shared_consts.ELEMTYPE.CARD) {
|
||||
if (reccard?.imagefile) {
|
||||
if (reccard.vers_img) {
|
||||
addtourl = '?v=' + reccard.vers_img
|
||||
}
|
||||
|
||||
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + reccard.imagefile + addtourl
|
||||
return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + reccard.imagefile + addtourl
|
||||
} else
|
||||
return ''
|
||||
} else if (elem.type === shared_consts.ELEMTYPE.IMAGE) {
|
||||
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.container + addtourl
|
||||
return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.container + addtourl
|
||||
} else if (elem.type === shared_consts.ELEMTYPE.QRCODE) {
|
||||
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.image + addtourl
|
||||
return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.image + addtourl
|
||||
} else {
|
||||
return costanti.DIR_UPLOAD + 'pages/' + elem.path + '/' + elem.image + addtourl
|
||||
return costanti.DIR_UPLOAD + 'pages/' + mypath + '/' + elem.image + addtourl
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -8910,8 +8920,8 @@ export const tools = {
|
||||
num = number.toFixed(2)
|
||||
} catch (e) {
|
||||
return number
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return num
|
||||
},
|
||||
|
||||
@@ -9300,6 +9310,9 @@ export const tools = {
|
||||
size: '14px',
|
||||
}
|
||||
}
|
||||
if (!rec.size) {
|
||||
rec.size = this.resetISize(rec.size!)
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
@@ -1283,7 +1283,8 @@ export const useProducts = defineStore('Products', {
|
||||
const ranking = myproduct.indiceRanking! || 0;
|
||||
const venduti = myproduct.productInfo.totaleVenduti! || 0;
|
||||
|
||||
const debugstr = " Rank=" + ranking + "<br> 1Y=" + (myproduct.productInfo.rank1Y! || '') + '<br> Venduti=' + venduti + '<br> Data Pubb=' + date_pub
|
||||
const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">'+venduti+'</a>'
|
||||
const debugstr = " Rank=" + ranking + "<br> 1Y=" + (myproduct.productInfo.rank1Y! || '') + '<br> Venduti=' + linkvenduti + '<br> Data Pubb=' + date_pub
|
||||
|
||||
const truncatedDescription = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
@@ -1355,7 +1356,7 @@ export const useProducts = defineStore('Products', {
|
||||
result = result.replace(new RegExp(key, 'g'), value);
|
||||
}
|
||||
|
||||
return result
|
||||
return result.trim()
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -1926,6 +1926,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
async importToServerCmd($q: any, t: any, cmd: number, data: any, recorddaimportare: boolean = false) {
|
||||
$q.loading.show({
|
||||
message: 'Importazione in corso, attendere ...'
|
||||
})
|
||||
|
||||
return Api.SendReq('/admin/import', 'POST', { cmd, data })
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
@@ -1953,7 +1957,9 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
|
||||
}
|
||||
$q.loading.hide()
|
||||
}).catch((error) => {
|
||||
$q.loading.hide()
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
return {}
|
||||
})
|
||||
|
||||
@@ -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