- Cataloghi: BestSeller, Novità

This commit is contained in:
Surya Paolo
2024-11-28 16:04:48 +01:00
parent e10ff192bf
commit 6932590f3e
30 changed files with 1086 additions and 456 deletions

View File

@@ -22,6 +22,7 @@ import {
IText,
IAreaDiStampa,
ICatalogo,
IPagina,
} from '@model'
import MixinBase from '@/mixins/mixin-base'
@@ -351,6 +352,31 @@ export const tools = {
},
],
posizTextOptions: [
{ label: 'In basso', value: costanti.POSIZ_TESTO.IN_BASSO },
{ label: 'A Destra', value: costanti.POSIZ_TESTO.A_DESTRA },
],
fontSizeOptions: [
{ label: '9', value: '9' },
{ label: '10', value: '10' },
{ label: '11', value: '11' },
{ label: '12', value: '12' },
{ label: '13', value: '13' },
{ label: '14', value: '14' },
{ label: '15', value: '15' },
{ label: '16', value: '16' },
{ label: '18', value: '18' },
{ label: '20', value: '20' },
{ label: '22', value: '22' },
],
formatOptions: [
{ label: 'auto', value: 'CODE128' },
{ label: 'EAN-13', value: 'EAN-13' },
{ label: 'UPC', value: 'upc' },
],
SelectListFormatPDF: [
{ label: 'a4 (mm)', value: [210, 297] },
{ label: '22,60 x 31,26 (in mm)', value: [226.0, 312.6] },
@@ -9223,6 +9249,23 @@ export const tools = {
rec.contenuto = ''
rec.maxlength = 0
rec.font = {
line_height: 1,
posiz_text: 0,
perc_text: '50%',
name: '',
size: '14px',
}
}
if (!rec.font) {
rec.font = {
line_height: 1,
posiz_text: 0,
perc_text: '50%',
name: '',
size: '14px',
}
}
return rec
@@ -9253,6 +9296,35 @@ export const tools = {
return myrec
},
resetRecIPagina(rec: IPagina | null) {
let myrec: IPagina = {}
if (!rec) {
let dimensioni: IDimensioni = this.resetRecIDimensioni(null)
myrec = {
dimensioni,
testo_up: this.resetIText(null),
testo_down: this.resetIText(null),
}
}
if (!myrec.dimensioni) {
myrec.dimensioni = this.resetRecIDimensioni(null)
}
if (!myrec.testo_up) {
myrec.testo_up = this.resetIText(null)
}
if (!myrec.testo_down) {
myrec.testo_down = this.resetIText(null)
}
return myrec
},
resetRecIAreaDiStampa(rec: IAreaDiStampa | null) {
let myrec: IAreaDiStampa = {}
@@ -9304,19 +9376,68 @@ export const tools = {
}
},
getValueAndSuffix(myvalue: any): {value: number, suffix: string} {
getValueAndSuffix(myvalue: any): { value: number, suffix: string } {
if (!myvalue) {
return {value: 0, suffix: ''};
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
return { value: numericalValue, suffix: unit }; // Restituisce il valore con il suffisso
},
xmlToJson(xml: any) {
// Converte un XML in un oggetto JavaScript
var obj: any = {};
if (xml.nodeType === 1) { // Elemento
// Se ha attributi, aggiungili all'oggetto
if (xml.attributes.length > 0) {
obj["@attributes"] = {}
for (var j = 0; j < xml.attributes.length; j++) {
var attribute = xml.attributes.item(j);
obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
}
}
} else if (xml.nodeType === 3) { // Testo
obj = xml.nodeValue;
}
// Se ha figli, applica la funzione ricorsivamente
if (xml.hasChildNodes()) {
for (var i = 0; i < xml.childNodes.length; i++) {
var item = xml.childNodes.item(i);
var nodeName = item.nodeName;
if (typeof (obj[nodeName]) === "undefined") {
obj[nodeName] = this.xmlToJson(item);
} else {
if (typeof (obj[nodeName]) === "object") {
// Se l'elemento esiste già, trasformalo in un array
if (typeof (obj[nodeName].push) === "undefined") {
var old = obj[nodeName];
obj[nodeName] = [];
obj[nodeName].push(old);
}
obj[nodeName].push(this.xmlToJson(item));
} else {
obj[nodeName] = [obj[nodeName]];
obj[nodeName].push(this.xmlToJson(item));
}
}
}
}
return obj
},
// Esempio di utilizzo
convertXMLStringToJSON(xmlString: string): any {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xmlString, "application/xml");
var jsonResult = this.xmlToJson(xmlDoc);
return jsonResult;
},
// FINE !
// getLocale() {