diff --git a/.prettierrc b/.prettierrc index 3fb4af0b..258a7233 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,11 +1,10 @@ { "singleAttributePerLine": true, - "printWidth": 80, + "printWidth": 100, "tabWidth": 2, "useTabs": false, - "semi": true, "singleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "arrowParens": "always" -} \ No newline at end of file +} diff --git a/alimentazione_sana-stampabile_compressed copia-converted.pdf b/alimentazione_sana-stampabile_compressed copia-converted.pdf new file mode 100644 index 00000000..3983fcdb Binary files /dev/null and b/alimentazione_sana-stampabile_compressed copia-converted.pdf differ diff --git a/alimentazione_sana-stampabile_compressed copia-converted_compressed.pdf b/alimentazione_sana-stampabile_compressed copia-converted_compressed.pdf new file mode 100644 index 00000000..122a39ef Binary files /dev/null and b/alimentazione_sana-stampabile_compressed copia-converted_compressed.pdf differ diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index ff664085..0cbae87f 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -2527,5 +2527,10 @@ export const shared_consts = { ONBOTTOM: '1', }, + PREPARA_PDF: { + WEB: 1, + STAMPA: 2, + }, + PUNTI_PER_POLLICE: 96 } diff --git a/src/components/CGallery/CGallery.ts b/src/components/CGallery/CGallery.ts index c57ac7d5..ab098138 100755 --- a/src/components/CGallery/CGallery.ts +++ b/src/components/CGallery/CGallery.ts @@ -41,6 +41,16 @@ export default defineComponent({ required: false, default: '', }, + quality: { + type: String, + required: false, + default: 'original', + }, + resize: { + type: Boolean, + required: false, + default: false, + }, imgGall: { type: Object as PropType, required: true, @@ -62,6 +72,10 @@ export default defineComponent({ const fullscreen = ref(false) const fullscreensrc = ref('') + const uploadOptions = ref({ // qui definisci le opzioni da passare + quality: 'original', // esempio di opzione di qualità + resize: true // opzione per abilitare il ridimensionamento + }) function isValid(myobj: any): boolean { return (myobj && typeof myobj !== 'string' && typeof myobj !== 'undefined') @@ -101,6 +115,10 @@ export default defineComponent({ ] } + uploadOptions.value = { + quality: props.quality, + resize: props.resize, + } } function getnumimages() { @@ -396,6 +414,7 @@ export default defineComponent({ isListImgValid, costanti, getrealdirectory, + uploadOptions, } } }) diff --git a/src/components/CGallery/CGallery.vue b/src/components/CGallery/CGallery.vue index df4ab6d3..4051f82b 100755 --- a/src/components/CGallery/CGallery.vue +++ b/src/components/CGallery/CGallery.vue @@ -81,7 +81,8 @@ : 'Aggiungi Immagine' " accept="image/*" :url="getUrl()" :headers="tools.getheaders()" :max-file-size="3000000" :multiple="!single" auto-upload hide-upload-btn no-thumbnails @uploaded="uploaded" @rejected="onRejected" - style="width: 208px"> + style="width: 208px" + :options="uploadOptions"> diff --git a/src/components/CMyEditElem/CMyEditElem.ts b/src/components/CMyEditElem/CMyEditElem.ts index f5afc8c4..69bac70d 100755 --- a/src/components/CMyEditElem/CMyEditElem.ts +++ b/src/components/CMyEditElem/CMyEditElem.ts @@ -347,6 +347,7 @@ export default defineComponent({ myel.value.catalogo.areadistampa.margini = { left: '0.59', top: '0.59', right: '0.59', bottom: '0.28' }; myel.value.catalogo.print_isTemplate = false; myel.value.catalogo.print_linkIdTemplate = ''; + myel.value.catalogo.print_linkIdTemplatePerStampa = ''; } myel.value.catalogo.areadistampa = tools.resetRecIAreaDiStampa(myel.value.catalogo.areadistampa); @@ -356,6 +357,7 @@ export default defineComponent({ myel.value.catalogo.dimensioni_def = { isTemplate: false, linkIdTemplate: '', + linkIdTemplatePerStampa: '', name: '', pagina: {}, }; diff --git a/src/components/CMyEditElem/CMyEditElem.vue b/src/components/CMyEditElem/CMyEditElem.vue index 9705606a..4d107788 100755 --- a/src/components/CMyEditElem/CMyEditElem.vue +++ b/src/components/CMyEditElem/CMyEditElem.vue @@ -1489,7 +1489,9 @@ :key="recscheda._id" :name="ind" dense - :label="`${ind}. ` + recscheda.scheda.name ? recscheda.scheda.name : `Scheda ` + (ind + 1)" + :label=" + `${ind}. ` + recscheda.scheda.name ? recscheda.scheda.name : `Scheda ` + (ind + 1) + " >
@@ -1780,6 +1782,20 @@ label="Pagina di Default" icon="fas fa-play-circle" > + + + + +
+ + @@ -2428,13 +2472,32 @@ :options="Products.getOptCatalogoPrintTemplate()" @update:model-value="modifElem" label="Catalogo Stampa collegato:" - style="width: 250px" + style="width: 350px" + emit-value + map-options + > + + -
+
Per Stampa: , required: false, @@ -103,7 +101,7 @@ export default defineComponent({ function handleUpdate(newList) { internalProducts.value = newList; - riaggiornaListaProdAlGenitore() + riaggiornaListaProdAlGenitore(); } function riaggiornaListaProdAlGenitore() { @@ -266,6 +264,7 @@ export default defineComponent({ field: 'validato', align: 'left', style: '', + visu: costanti.VISUCAMPI.PER_EDITORE, }, { name: 'scraped', @@ -273,6 +272,7 @@ export default defineComponent({ field: 'scraped', align: 'left', style: '', + visu: costanti.VISUCAMPI.PER_EDITORE, }, { name: 'scraped_error', @@ -280,6 +280,7 @@ export default defineComponent({ field: 'scraped_error', align: 'left', style: '', + visu: costanti.VISUCAMPI.PER_EDITORE, }, { name: 'image', @@ -303,6 +304,7 @@ export default defineComponent({ label: 'Sinossi', field: 'trafiletto', align: 'left', + visu: costanti.VISUCAMPI.PER_EDITORE, }, { name: 'catprods', @@ -421,6 +423,12 @@ export default defineComponent({ }, ]); + const allColumnsComputed = computed(() => { + return allColumns.value.filter( + (col) => !col.visu || col.visu === costanti.VISUCAMPI.PER_TUTTI + ); + }); + async function mounted() { console.log('mounted CProductTable'); loading.value = true; @@ -515,10 +523,7 @@ export default defineComponent({ switch (field.field) { case 'image': return element.productInfo?.imagefile - ? tools.getFullFileNameByImageFile( - 'productInfos', - element.productInfo?.imagefile - ) + ? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile) : element.productInfo?.image_link; case 'name': @@ -538,9 +543,7 @@ export default defineComponent({ : 'NO'; case 'scraped': - return element.scraped === true - ? 'SI' - : ''; + return element.scraped === true ? 'SI' : ''; case 'scraped_error': return element.scraped_error === true ? 'ERR' @@ -550,8 +553,7 @@ export default defineComponent({ return element.isbn; case 'trafiletto': - return element.productInfo?.descr_trafiletto_catalogo?.length > - 100 + return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI ✏️' : 'NO ✏️'; @@ -562,9 +564,7 @@ export default defineComponent({ return element.arrvariazioni?.[0]?.edizione; case 'casaeditrice': - return products.getCasaEditriceByIdPublisher( - element.productInfo?.idPublisher - ); + return products.getCasaEditriceByIdPublisher(element.productInfo?.idPublisher); case 'idCollana': return tools.formatCollane(element.productInfo?.idCollana); @@ -575,9 +575,7 @@ export default defineComponent({ ); case 'tipologia': - return products.getDescrByIdTipologia( - element.arrvariazioni?.[0]?.idTipologia || '' - ); + return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || ''); case 'tipoformato': return products.getDescrByIdTipoFormato( @@ -591,9 +589,7 @@ export default defineComponent({ return element.price ? '€ ' + element.price.toFixed(2) : ''; case 'prezzo_sconto': - return element.sale_price - ? '€ ' + element.sale_price.toFixed(2) - : ''; + return element.sale_price ? '€ ' + element.sale_price.toFixed(2) : ''; case 'rank3M': return element.productInfo?.rank3M; @@ -627,9 +623,7 @@ export default defineComponent({ case 'quantity': if (tools.isUtente()) - return tools.getDescrQuantitàByQuantity( - element.arrvariazioni?.[0]?.quantita - ); + return tools.getDescrQuantitàByQuantity(element.arrvariazioni?.[0]?.quantita); else return element.arrvariazioni?.[0]?.quantita; default: @@ -665,9 +659,7 @@ export default defineComponent({ case 'validato': if (element.validaprod?.esito === costanti.VALIDATO.SI) { return 'bg-green'; - } else if ( - element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV - ) { + } else if (element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV) { return 'bg-red'; } else { return 'bg-grey'; @@ -839,19 +831,14 @@ export default defineComponent({ persistent: false, }) .onOk(() => { - internalProducts.value = internalProducts.value.filter( - (p: any) => p._id !== product._id - ); + internalProducts.value = internalProducts.value.filter((p: any) => p._id !== product._id); emit('update:lista_prodotti', internalProducts.value); // Notifica il parent del cambiamento }); }; // 8. Salvataggio delle colonne selezionate in un cookie const saveSelectedColumns = () => { - tools.setCookie( - addstr.value + 'selColCat_2', - JSON.stringify(selectedColumns.value) - ); + tools.setCookie(addstr.value + 'selColCat_2', JSON.stringify(selectedColumns.value)); }; // 9. Watcher per salvare automaticamente le preferenze quando cambiano @@ -896,13 +883,20 @@ export default defineComponent({ function showProduct(element: any) { if (isProduct()) { - selProd.value = element; + let link_macro = element.productInfo?.link_macro; - showProd.value = true; + if (tools.isUtente() && link_macro) { + tools.openUrl(link_macro + '?utm_source=catalog&id=' + props.idcatalog) + } else { + selProd.value = element; + + showProd.value = true; + } } else if (isCatalog()) { // Apri la pagina del catalogo if (element.idPageAssigned) { const mypagepath = productStore.getPathByPage(element.idPageAssigned); + // fai il route sulla pagina myfilename $router.push(`/${mypagepath}`); } @@ -956,7 +950,7 @@ export default defineComponent({ } return prod; }); - riaggiornaListaProdAlGenitore() + riaggiornaListaProdAlGenitore(); } catch (e) { console.error('err', e); } @@ -967,12 +961,11 @@ export default defineComponent({ loading.value = true; updatefromgm.value = true; field_updated_fromGM.value = ''; - field_updated_fromGM.value = - await globalStore.getGM_FieldOf_T_Web_Articoli( - selProd.value.productInfo.sku!, - field, - shared_consts.CmdQueryMs.GET - ); + field_updated_fromGM.value = await globalStore.getGM_FieldOf_T_Web_Articoli( + selProd.value.productInfo.sku!, + field, + shared_consts.CmdQueryMs.GET + ); loading.value = false; } } @@ -987,40 +980,36 @@ export default defineComponent({ sortAttribute.value = sortAttributeToSort; sortDirection.value = 1; } - internalProducts.value = internalProducts.value.sort( - (a: any, b: any) => { - const aVal = getFieldValue(a, { field: sortAttributeToSort }); - const bVal = getFieldValue(b, { field: sortAttributeToSort }); - if (aVal instanceof Date && bVal instanceof Date) { - return sortDirection.value === 1 - ? aVal.getTime() - bVal.getTime() - : bVal.getTime() - aVal.getTime(); - } - if ( - typeof aVal === 'string' && - typeof bVal === 'string' && - aVal.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/) && - bVal.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/) - ) { - const aDate = new Date(aVal.split('/').reverse().join('-')); - const bDate = new Date(bVal.split('/').reverse().join('-')); - return sortDirection.value === 1 - ? aDate.getTime() - bDate.getTime() - : bDate.getTime() - aDate.getTime(); - } - if (typeof aVal === 'number' && typeof bVal === 'number') { - return sortDirection.value === 1 ? aVal - bVal : bVal - aVal; - } - if (typeof aVal === 'string' && typeof bVal === 'string') { - return sortDirection.value === 1 - ? aVal.localeCompare(bVal) - : bVal.localeCompare(aVal); - } + internalProducts.value = internalProducts.value.sort((a: any, b: any) => { + const aVal = getFieldValue(a, { field: sortAttributeToSort }); + const bVal = getFieldValue(b, { field: sortAttributeToSort }); + if (aVal instanceof Date && bVal instanceof Date) { return sortDirection.value === 1 - ? String(aVal).localeCompare(String(bVal)) - : String(bVal).localeCompare(String(aVal)); + ? aVal.getTime() - bVal.getTime() + : bVal.getTime() - aVal.getTime(); } - ); + if ( + typeof aVal === 'string' && + typeof bVal === 'string' && + aVal.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/) && + bVal.match(/^\d{1,2}\/\d{1,2}\/\d{4}$/) + ) { + const aDate = new Date(aVal.split('/').reverse().join('-')); + const bDate = new Date(bVal.split('/').reverse().join('-')); + return sortDirection.value === 1 + ? aDate.getTime() - bDate.getTime() + : bDate.getTime() - aDate.getTime(); + } + if (typeof aVal === 'number' && typeof bVal === 'number') { + return sortDirection.value === 1 ? aVal - bVal : bVal - aVal; + } + if (typeof aVal === 'string' && typeof bVal === 'string') { + return sortDirection.value === 1 ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal); + } + return sortDirection.value === 1 + ? String(aVal).localeCompare(String(bVal)) + : String(bVal).localeCompare(String(aVal)); + }); } }; @@ -1062,9 +1051,7 @@ export default defineComponent({ .join('|'), ...internalProducts.value.map((product: any) => { return selectedColumns.value - .filter( - (col) => !allColumns.value.find((c) => c.name === col)?.noexp - ) + .filter((col) => !allColumns.value.find((c) => c.name === col)?.noexp) .map((col: string) => { const field = { field: col }; return field.field === 'pos' @@ -1075,8 +1062,7 @@ export default defineComponent({ }), ].join('\r\n'); - const filename = - 'prodotti_' + new Date().toISOString().slice(0, 10) + '.csv'; + const filename = 'prodotti_' + new Date().toISOString().slice(0, 10) + '.csv'; const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); const link = document.createElement('a'); const url = URL.createObjectURL(blob); @@ -1091,10 +1077,7 @@ export default defineComponent({ } function isSortable(field: string): boolean { - return ( - allColumns && - !allColumns.value.find((col) => col.name === field)?.notsortable - ); + return allColumns && !allColumns.value.find((col) => col.name === field)?.notsortable; } function getImageByElement(element) { @@ -1161,6 +1144,7 @@ export default defineComponent({ isVisibleEditBtn, isProduct, isCatalog, + allColumnsComputed, }; }, }); diff --git a/src/components/CProductTable/CProductTable.vue b/src/components/CProductTable/CProductTable.vue index ee799c7c..5eda81c5 100755 --- a/src/components/CProductTable/CProductTable.vue +++ b/src/components/CProductTable/CProductTable.vue @@ -8,7 +8,7 @@
-