+
Lista generata il:
{{ tools.getstrDate(myrec.data_lista_generata) || '(non ancora generata)' }} da
diff --git a/src/components/CProductTable/CProductTable.ts b/src/components/CProductTable/CProductTable.ts
index 9d54ff96..44544176 100755
--- a/src/components/CProductTable/CProductTable.ts
+++ b/src/components/CProductTable/CProductTable.ts
@@ -120,9 +120,9 @@ export default defineComponent({
// Colonne della tabella
const allColumns = [
{ name: "pos", label: "Ind", field: "pos", align: "left", style: "width: 50px" },
- { name: "drag", label: "Ord", field: "", align: "left", style: "width: 50px", edit: true },
+ { name: "drag", label: "Ord", field: "", align: "left", style: "width: 50px", edit: true, noexp: true },
{ name: "validato", label: "Val", field: "validato", align: "left", style: "" },
- { name: "image", label: "Foto", field: "image", align: "center" },
+ { name: "image", label: "Foto", field: "image", align: "center", noexp: true },
{ name: "name", label: "Titolo del Libro", field: "name", align: "left" },
{ name: "authors", label: "Autore", field: "authors", align: "left" },
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" },
@@ -150,7 +150,7 @@ export default defineComponent({
{ name: "totFat", label: "Fat 5A", field: "totFat", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
{ name: "ult_ord", label: "Ult. Ordine", field: "ult_ord", align: "left", visu: costanti.VISUCAMPI.PER_EDITORE },
{ name: "quantity", label: "Magazz.", field: "quantity", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
- { name: "actions", label: "Azioni", field: "", align: "center", visu: costanti.VISUCAMPI.PER_EDITORE },
+ { name: "actions", label: "Azioni", field: "", align: "center", visu: costanti.VISUCAMPI.PER_EDITORE, noexp: true },
];
function getFieldValue(element: any, field: any): any {
@@ -204,10 +204,10 @@ export default defineComponent({
return tools.getstrDate(element.productInfo?.date_pub);
case 'prezzo':
- return tools.getstrDate(element.price);
+ return element.price ? '€ ' + element.price.toFixed(2) : '';
case 'prezzo_sconto':
- return tools.getstrDate(element.sale_price);
+ return element.sale_price ? '€ ' + element.sale_price.toFixed(2) : '';
case 'rank3M':
return element.productInfo?.rank3M;
@@ -315,6 +315,9 @@ export default defineComponent({
return {}
switch (field.field) {
+ case 'prezzo':
+ case 'prezzo_sconto':
+ return { width: '55px', textAlign: 'right' };
case 'validato':
return {
cursor: 'pointer',
@@ -378,6 +381,11 @@ export default defineComponent({
return selectedColumns.value.includes(column) && ok;
}
+ const getColumnLabelByName = (name: string): string => {
+ const column = allColumns.find((col) => col.name === name);
+ return column ? column.label : '';
+ }
+
// Funzione per eliminare un prodotto
const removeProduct = (product) => {
internalProducts.value = internalProducts.value.filter((p: any) => p._id !== product._id);
@@ -535,6 +543,37 @@ export default defineComponent({
}
}
+ function exportToCSV() {
+ const csvContent = [
+ selectedColumns.value
+ .filter((col) => !allColumns.find((c) => c.name === col)?.noexp)
+ .map((col) => getColumnLabelByName(col))
+ .join('|'),
+ ...internalProducts.value.map((product: any) => {
+ return selectedColumns.value
+ .filter((col) => !allColumns.find((c) => c.name === col)?.noexp)
+ .map((col: string) => {
+ const field = { field: col };
+ return field.field === 'pos' ? internalProducts.value.indexOf(product) + 1 : getFieldValue(product, field);
+ }).join('|');
+ }),
+ ].join('\r\n');
+
+ 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);
+
+ link.setAttribute('href', url);
+ link.setAttribute('download', filename);
+ link.style.visibility = 'hidden';
+
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+
+ }
+
onMounted(mounted)
@@ -575,6 +614,7 @@ export default defineComponent({
getFieldStyle,
getFieldClick,
handleUpdate,
+ exportToCSV,
}
}
})
diff --git a/src/components/CProductTable/CProductTable.vue b/src/components/CProductTable/CProductTable.vue
index d82dd671..cf9dd552 100755
--- a/src/components/CProductTable/CProductTable.vue
+++ b/src/components/CProductTable/CProductTable.vue
@@ -21,6 +21,15 @@
+
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index 60711564..47896c4c 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -1686,6 +1686,7 @@ const msg_it = {
},
myelems: {
+ pubblica_online: 'Pubblica OnLine',
active: 'Attiva',
img: 'img',
image: 'Immagine:',
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index 4dd3b7fc..3ba4b3cd 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -125,7 +125,7 @@ export const colmailinglist = [
]
export const colTableCatalogList = [
- AddCol({ name: 'active', label_trans: 'myelems.active', fieldtype: costanti.FieldType.boolean }),
+ AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'title', label_trans: 'gallery.title' }),
AddCol({
name: 'foto_collana',
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index e6f82086..1786c201 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -9822,21 +9822,42 @@ export const tools = {
return Object.keys(obj).length === 0;
},
+ isUtente() {
+ const userStore = useUserStore()
+
+ return (!userStore.isEditor && !userStore.isCommerciale && !userStore.isAdmin && !userStore.isManager & !userStore.isGrafico)
+ },
+
getsearchList_Cataloghi() {
- const lista = [{
- visible: true,
+ const lista = [
+ {
+ visible: !this.isUtente(),
label: 'Editore',
table: 'lista_editori',
key: 'referenti',
type: costanti.FieldType.select,
- value: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_LISTA_EDITORI + costanti.FILTER_SEP + 'referente', costanti.FILTER_TUTTI),
+ value: this.isUtente() ? costanti.FILTER_TUTTI : this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_LISTA_EDITORI + costanti.FILTER_SEP + 'referente', costanti.FILTER_TUTTI),
keycookie: '',
addall: true,
arrvalue: [],
filter: null,
useinput: false,
icon: 'fas fa-user'
- }]
+ },
+ {
+ visible: !this.isUtente(),
+ label: 'Pubblicati OnLine',
+ key: 'active',
+ type: costanti.FieldType.boolean,
+ value: this.isUtente() ? true: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'active', true),
+ keycookie: '',
+ addall: true,
+ arrvalue: [],
+ filter: null,
+ useinput: false,
+ icon: 'fas fa-globe'
+ },
+ ]
console.log('getsearchList_Cataloghi', lista)
diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue
index dc2cd1a5..503730b4 100755
--- a/src/views/ecommerce/catalogo/catalogo.vue
+++ b/src/views/ecommerce/catalogo/catalogo.vue
@@ -165,7 +165,6 @@
color="primary"
@click="clickaddNewBook()"
>
-