- Cataloghi: parte finale... prima bozza 9 dic
This commit is contained in:
@@ -2281,6 +2281,21 @@ export const colTableGestoreOrdini = [
|
||||
AddCol({ name: 'status', label_trans: 'orderscart.status', fieldtype: costanti.FieldType.number }),
|
||||
]
|
||||
|
||||
export const colTableVariazioni = [
|
||||
AddCol({ name: '_id', label_trans: 'catalogo.id', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'price', label_trans: 'catalogo.prezzo', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'sale_price', label_trans: 'catalogo.prezzo_scontato', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'quantita', label_trans: 'catalogo.quantita', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'availability', label_trans: 'catalogo.availability', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'formato', label_trans: 'catalogo.formato', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'misure', label_trans: 'catalogo.misure', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'tipologia', label_trans: 'catalogo.tipologia', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'edizione', label_trans: 'catalogo.edizione', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'preOrderDate', label_trans: 'catalogo.preOrderDate', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'addtocart_link', label_trans: 'catalogo.addtocart_link', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'eta', label_trans: 'catalogo.eta', fieldtype: costanti.FieldType.string }),
|
||||
]
|
||||
|
||||
export const colTableProductInfos = [
|
||||
AddCol({ name: 'code', label_trans: 'products.code', required: true }),
|
||||
AddCol({ name: 'codice_EAN', label_trans: 'products.codice_EAN' }),
|
||||
@@ -4045,6 +4060,13 @@ export const fieldsTable = {
|
||||
colkey: '_id',
|
||||
collabel: (rec: any) => `${rec.name} (${rec.code})`,
|
||||
},
|
||||
{
|
||||
value: 'arrvariazioni',
|
||||
label: 'Variazioni Prodotti',
|
||||
columns: colTableVariazioni,
|
||||
colkey: '_id',
|
||||
collabel: 'price',
|
||||
},
|
||||
{
|
||||
value: 'producers',
|
||||
label: 'Produttori',
|
||||
|
||||
@@ -8903,6 +8903,17 @@ export const tools = {
|
||||
let parts = number.toFixed(2).split('.');
|
||||
return parts.length > 1 ? parts[1] : '00';
|
||||
},
|
||||
arrotonda2Dec(number: any): string {
|
||||
let num = ''
|
||||
try {
|
||||
if (number)
|
||||
num = number.toFixed(2)
|
||||
} catch (e) {
|
||||
return number
|
||||
}
|
||||
|
||||
return num
|
||||
},
|
||||
|
||||
getRecordByField(field: any, record: any) {
|
||||
let mioval = ''
|
||||
@@ -9460,6 +9471,14 @@ export const tools = {
|
||||
var jsonResult = this.xmlToJson(xmlDoc);
|
||||
return jsonResult;
|
||||
},
|
||||
|
||||
getScale(optcatalogo: ICatalogo) {
|
||||
if (optcatalogo.printable && optcatalogo.generazionePDFInCorso)
|
||||
return optcatalogo.areadistampa!.scale_printable
|
||||
else
|
||||
return optcatalogo.areadistampa!.scale
|
||||
},
|
||||
|
||||
// FINE !
|
||||
|
||||
// getLocale() {
|
||||
|
||||
@@ -1274,13 +1274,16 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
const autori = this.getAutoriByArrayAuthors(myproduct.productInfo.authors)
|
||||
|
||||
|
||||
const maxDescriptionLength = testo.maxlength ?? 100;
|
||||
const description = myproduct.productInfo.short_descr || '';
|
||||
const long_descr = myproduct.productInfo.description || '';
|
||||
const date_pub = tools.getstrDateShort(myproduct.productInfo.date_publishing) || '';
|
||||
const ranking_globale = myproduct.productInfo.rank1Y || 0;
|
||||
const ranking_globale = myproduct.productInfo.rank1Y! || 0;
|
||||
const ranking = myproduct.indiceRanking! || 0;
|
||||
const venduti = myproduct.productInfo.totaleVenduti || 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 truncatedDescription = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
@@ -1290,12 +1293,22 @@ export const useProducts = defineStore('Products', {
|
||||
? long_descr.substring(0, long_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr;
|
||||
|
||||
|
||||
let addtesto = false
|
||||
|
||||
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
||||
const descrizione_completa_macro = long_descr_macro.length > maxDescriptionLength
|
||||
if (long_descr_macro.length > maxDescriptionLength) {
|
||||
addtesto = true
|
||||
}
|
||||
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>'
|
||||
|
||||
let descrizione_completa_macro = addtesto
|
||||
? long_descr_macro.substring(0, long_descr_macro.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
: long_descr_macro;
|
||||
|
||||
|
||||
if (addtesto) {
|
||||
descrizione_completa_macro += addstrcontinua
|
||||
}
|
||||
|
||||
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
|
||||
const descrizione_breve_macro = short_descr.length > maxDescriptionLength
|
||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
@@ -1304,11 +1317,11 @@ export const useProducts = defineStore('Products', {
|
||||
const sottotitolo = myproduct.productInfo.sottotitolo || '';
|
||||
const link_macro = myproduct.productInfo.link_macro || '';
|
||||
|
||||
const prezzo = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].price?.toFixed(2) : ''
|
||||
const prezzo_scontato = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].sale_price?.toFixed(2) : ''
|
||||
const misure = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].misure : ''
|
||||
const formato = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].formato : ''
|
||||
const pagine = myproduct.arrvariazioni ? myproduct.arrvariazioni[0].pagine : ''
|
||||
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || ''
|
||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || ''
|
||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
@@ -1316,11 +1329,12 @@ export const useProducts = defineStore('Products', {
|
||||
const replacements = {
|
||||
'{autore}': autori || '',
|
||||
'{titolo}': myproduct.productInfo.name || '',
|
||||
'{sottotitolo}': sottotitolo || '',
|
||||
'{sottotitolo}': (sottotitolo) || '',
|
||||
'{descrizione_da_fdv}': truncatedDescription || '',
|
||||
'{descrizione_estesa_fdv}': truncatedlongDescription || '',
|
||||
'{descrizione_estesa}': descrizione_completa_macro || '',
|
||||
'{pagine}': pagine || '',
|
||||
'{debug}': (debugstr) || '',
|
||||
'{pagine}': (pagine ) || '',
|
||||
'{misure}': misure || '',
|
||||
'{date_pub}': date_pub || '',
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
|
||||
Reference in New Issue
Block a user