- Cataloghi: qualita di stampa e margini
This commit is contained in:
@@ -34,12 +34,6 @@ export const costanti = {
|
||||
'Printable',
|
||||
'numschede_perCol',
|
||||
'numschede_perRiga',
|
||||
'first_page_img',
|
||||
'first_page_html',
|
||||
'first_page_height',
|
||||
'last_page_img?',
|
||||
'last_page_html',
|
||||
'last_page_height',
|
||||
'text',
|
||||
],
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ export const colIText = [
|
||||
AddCol({ name: 'maxlength', label_trans: 'catalogo.maxlength', fieldtype: costanti.FieldType.number }),
|
||||
]
|
||||
export const colmyIImg = [
|
||||
AddCol({ name: 'filename', label_trans: 'iimg.filename', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'imagefile', label_trans: 'iimg.imagefile', fieldtype: costanti.FieldType.image }),
|
||||
AddCol({ name: 'fit', label_trans: 'iimg.fit', fieldtype: costanti.FieldType.string }),
|
||||
]
|
||||
|
||||
@@ -202,14 +202,6 @@ export const colmyelCatalogo = [
|
||||
AddCol({ name: 'optcatalogo.', label_trans: 'catalogo.optcatalogo.', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'margine_pagina', label_trans: 'margine_pagina', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'margine_riga', label_trans: 'margine_riga', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'first_page_img', label_trans: 'catalogo.first_page_img', fieldtype: costanti.FieldType.image }),
|
||||
AddCol({ name: 'last_page_img', label_trans: 'catalogo.last_page_img', fieldtype: costanti.FieldType.image }),
|
||||
AddCol({ name: 'first_page_html', label_trans: 'catalogo.first_page_html', fieldtype: costanti.FieldType.html }),
|
||||
AddCol({ name: 'first_page_height', label_trans: 'catalogo.first_page_height', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'last_page_height', label_trans: 'catalogo.last_page_html', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'last_page_html', label_trans: 'catalogo.last_page_html', fieldtype: costanti.FieldType.html }),
|
||||
|
||||
AddCol({ name: 'imgsfondo_def', label_trans: 'catalogo.imgsfondo_def', fieldtype: costanti.FieldType.image }),
|
||||
|
||||
]
|
||||
|
||||
@@ -4224,8 +4216,8 @@ export const fieldsTable = {
|
||||
value: 'imgs',
|
||||
label: 'Immagini',
|
||||
columns: colmyIImg,
|
||||
colkey: 'filename',
|
||||
collabel: 'filename',
|
||||
colkey: 'imagefile',
|
||||
collabel: 'imagefile',
|
||||
},
|
||||
{
|
||||
value: 'listcards',
|
||||
|
||||
@@ -15,6 +15,13 @@ import {
|
||||
Privacy,
|
||||
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang, IGroupShort, IPagination, IFavorite, IBookmark,
|
||||
IMovQuery,
|
||||
IDimensioni,
|
||||
ISize,
|
||||
IBorder,
|
||||
IImg,
|
||||
IText,
|
||||
IAreaDiStampa,
|
||||
ICatalogo,
|
||||
} from '@model'
|
||||
|
||||
import MixinBase from '@/mixins/mixin-base'
|
||||
@@ -48,6 +55,7 @@ import { Router } from 'vue-router'
|
||||
import { AxiosResponse, default as Axios } from 'axios'
|
||||
import { PayloadMessageTypes } from '@/common'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
import { isDimensionToken } from 'html2canvas/dist/types/css/syntax/parser'
|
||||
|
||||
export interface INotify {
|
||||
color?: string
|
||||
@@ -343,6 +351,34 @@ export const tools = {
|
||||
},
|
||||
],
|
||||
|
||||
SelectListFormatPDF: [
|
||||
{ label: 'a4 (mm)', value: [210, 297] },
|
||||
{ label: '22,60 x 31,26 (in mm)', value: [226.0, 312.6] },
|
||||
],
|
||||
|
||||
SelectListScalePDF: [
|
||||
{ label: 'Normale (100 DPI)', value: 1 },
|
||||
{ label: 'Medio (200 PDI)', value: 2 },
|
||||
{ label: 'Alto (300 PDI)', value: 3 },
|
||||
],
|
||||
SelectListQualityPDF: [
|
||||
{ label: 'Bassa (1 scale)', value: 1 },
|
||||
{ label: 'Normale (2 scale)', value: 2 },
|
||||
{ label: 'Media (3 scale)', value: 3 },
|
||||
{ label: 'Elevata (4 scale)', value: 4 },
|
||||
],
|
||||
|
||||
SelectListOrientamentoPDF: [
|
||||
{ label: 'Verticale', value: 'portrait' },
|
||||
{ label: 'orizzontale', value: 'landscape' }
|
||||
],
|
||||
|
||||
SelectListUnitPDF: [
|
||||
{ label: 'Millimetri (mm)', value: 'mm' },
|
||||
{ label: 'Centimetri (cm)', value: 'cm' },
|
||||
{ label: 'Pollici (in)', value: 'in' },
|
||||
{ label: 'Pixel (px)', value: 'px' },
|
||||
],
|
||||
|
||||
SelectListColors: [
|
||||
{ label: '[Nessuno]', value: '' },
|
||||
@@ -7949,6 +7985,8 @@ export const tools = {
|
||||
ris = 'pages/' + path
|
||||
} else if (table === 'productInfos') {
|
||||
ris = path
|
||||
} else if (table === 'imgs') {
|
||||
ris = path
|
||||
} else {
|
||||
ris = table
|
||||
}
|
||||
@@ -9145,6 +9183,131 @@ export const tools = {
|
||||
return encodeURIComponent(str); // Codifica la stringa per URL
|
||||
},
|
||||
|
||||
resetISize(rec: ISize | null) {
|
||||
if (!rec) {
|
||||
rec = {
|
||||
width: '',
|
||||
height: ''
|
||||
}
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIBorder(rec: IBorder | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
rec.top = ''
|
||||
rec.bottom = ''
|
||||
rec.left = ''
|
||||
rec.right = ''
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIImg(rec: IImg | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
|
||||
rec.imagefile = ''
|
||||
rec.fit = ''
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetIText(rec: IText | null) {
|
||||
if (!rec) {
|
||||
rec = {}
|
||||
|
||||
rec.contenuto = ''
|
||||
rec.maxlength = 0
|
||||
}
|
||||
|
||||
return rec
|
||||
},
|
||||
|
||||
resetRecIDimensioni(rec: IDimensioni | null) {
|
||||
|
||||
let myrec: IDimensioni = {}
|
||||
|
||||
if (!rec) {
|
||||
myrec = {
|
||||
size: {},
|
||||
margini: {},
|
||||
padding: {},
|
||||
imgsfondo: {},
|
||||
text_html: {},
|
||||
}
|
||||
} else {
|
||||
myrec = rec
|
||||
}
|
||||
|
||||
myrec.size = this.resetISize(myrec.size!)
|
||||
myrec.margini = this.resetIBorder(myrec.margini!)
|
||||
myrec.padding = this.resetIBorder(myrec.padding!)
|
||||
myrec.imgsfondo = this.resetIImg(myrec.imgsfondo!)
|
||||
myrec.text_html = this.resetIText(myrec.text_html!)
|
||||
|
||||
return myrec
|
||||
},
|
||||
|
||||
resetRecIAreaDiStampa(rec: IAreaDiStampa | null) {
|
||||
|
||||
let myrec: IAreaDiStampa = {}
|
||||
|
||||
if (!rec) {
|
||||
myrec = {
|
||||
margini: {},
|
||||
unit: 'mm',
|
||||
compress: false,
|
||||
orientation: 'portrait',
|
||||
format: [210, 297],
|
||||
scale: 1,
|
||||
scalecanvas: 2,
|
||||
}
|
||||
} else {
|
||||
myrec = rec
|
||||
}
|
||||
|
||||
myrec.margini = this.resetIBorder(myrec.margini!)
|
||||
|
||||
return myrec
|
||||
},
|
||||
|
||||
adjustSize(optcatalogo: ICatalogo, mysize: any) {
|
||||
if (!mysize) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Estrae l'unità di misura
|
||||
const unit = mysize.replace(/[\d.]/g, ''); // Ottiene il suffisso (es. 'px')
|
||||
const numericalValue = parseFloat(mysize) || 0; // Converti la parte numerica in float
|
||||
|
||||
let size = numericalValue; // Inizializza size con il valore numerico
|
||||
|
||||
if (optcatalogo.printable && optcatalogo.areadistampa?.scale && optcatalogo.areadistampa?.scale > 0) {
|
||||
size = size * optcatalogo.areadistampa?.scale; // Applicare la scala se necessaria
|
||||
}
|
||||
|
||||
let strfinale = `${size}${unit}`
|
||||
// console.log('mysize', mysize, ' => ', strfinale)
|
||||
return strfinale; // Restituisce il valore con il suffisso
|
||||
},
|
||||
|
||||
getValueAndSuffix(myvalue: any): {value: number, suffix: string} {
|
||||
if (!myvalue) {
|
||||
return {value: 0, suffix: ''};
|
||||
}
|
||||
|
||||
// Estrae l'unità di misura
|
||||
const unit = myvalue.replace(/[\d.]/g, ''); // Ottiene il suffisso (es. 'px')
|
||||
const numericalValue = parseFloat(myvalue) || 0; // Converti la parte numerica in float
|
||||
|
||||
return { value: numericalValue, suffix: unit}; // Restituisce il valore con il suffisso
|
||||
},
|
||||
|
||||
|
||||
// FINE !
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText } from 'model'
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, ICatalogo } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -1267,7 +1267,7 @@ export const useProducts = defineStore('Products', {
|
||||
return authorString
|
||||
},
|
||||
|
||||
replaceKeyWordsByProduct(myproduct: IProduct, testo: IText) {
|
||||
replaceKeyWordsByProduct(optcatalogo: ICatalogo, myproduct: IProduct, testo: IText) {
|
||||
if (!myproduct || !testo.contenuto) {
|
||||
return testo.contenuto;
|
||||
}
|
||||
@@ -1292,6 +1292,7 @@ export const useProducts = defineStore('Products', {
|
||||
const formato = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].formato : ''
|
||||
const pagine = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].pagine : ''
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
const replacements = {
|
||||
'{autore}': autori || '',
|
||||
@@ -1302,6 +1303,7 @@ export const useProducts = defineStore('Products', {
|
||||
'{misure}': misure || '',
|
||||
'{formato}': formato || '',
|
||||
'{prezzo}': prezzo || '',
|
||||
'{scale}': scale || '',
|
||||
'{prezzo_scontato}': prezzo_scontato || '',
|
||||
};
|
||||
|
||||
|
||||
@@ -1200,21 +1200,33 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
async duplicatePage(path: string, $q: any, t: any) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
return Api.SendReq('/duppage', 'POST', { path })
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('mypages.duplicateok'))
|
||||
return true
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('mypages.duplicateerr'))
|
||||
return false
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error loadTable', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return null
|
||||
})
|
||||
let newpath = prompt(t('mypages.duplica_newname'))
|
||||
|
||||
$q.dialog({
|
||||
message: t('mypages.duplica_conferma', { path, newpath }),
|
||||
ok: { label: t('dialog.yes'), push: true },
|
||||
cancel: { label: t('dialog.cancel') },
|
||||
title: t('db.domanda')
|
||||
}).onOk(() => {
|
||||
|
||||
|
||||
return Api.SendReq('/duppage', 'POST', { path, newpath })
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('mypages.duplicateok'))
|
||||
return true
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('mypages.duplicateerr'))
|
||||
return false
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error loadTable', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return null
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
async loadPageTest() {
|
||||
@@ -2240,11 +2252,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Editore: [],
|
||||
pdf: false,
|
||||
dimensioni_def: {
|
||||
pagina: {
|
||||
size: { width: '', height: '' },
|
||||
margini: {left: '', top: '', right: '', bottom: ''},
|
||||
padding: {left: '', top: '', right: '', bottom: ''},
|
||||
},
|
||||
pagina: tools.resetRecIDimensioni(null)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user