- Estrazione dei dati da Amazon
- Ciclo di Estrapolazione di tutti i prodotti ed aggiornamento dei campi scraped e scraped_updated - Creazione file CSV con i campi modificati.
This commit is contained in:
@@ -2500,6 +2500,7 @@ export const shared_consts = {
|
||||
SCHEDA_PRODOTTO: {
|
||||
CMD_NONE: 0,
|
||||
CMD_MODIFICA: 1,
|
||||
CMD_SCHEDA: 2,
|
||||
},
|
||||
|
||||
VISU_SEARCHPROD_MODE: {
|
||||
|
||||
@@ -20,4 +20,15 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
|
||||
.custom-flat-button {
|
||||
border: 1px solid #0078D4; /* Colore del bordo */
|
||||
background-color: transparent; /* Rendi il background trasparente */
|
||||
color: #0078D4; /* Colore dell'icona e del testo */
|
||||
}
|
||||
|
||||
.custom-flat-button:hover {
|
||||
background-color: rgba(0, 120, 212, 0.1); /* Aggiungi un colore di hover, se desideri */
|
||||
border-color: #005A8C; /* Colore del bordo al passaggio del mouse */
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import { PropType, computed, defineComponent, onMounted, ref, watch } from 'vue';
|
||||
import {
|
||||
PropType,
|
||||
computed,
|
||||
defineComponent,
|
||||
onMounted,
|
||||
ref,
|
||||
watch,
|
||||
} from 'vue';
|
||||
import draggable from 'vuedraggable';
|
||||
|
||||
import { tools } from '@tools';
|
||||
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useGlobalStore } from '@src/store/globalStore';
|
||||
import { useProducts } from '@src/store/productStore';
|
||||
|
||||
@@ -58,12 +67,14 @@ export default defineComponent({
|
||||
// Copia locale della lista_prodotti per manipolazione interna
|
||||
const internalProducts = ref([...(props.lista_prodotti || [])]);
|
||||
|
||||
const productStore = useProducts()
|
||||
const productStore = useProducts();
|
||||
|
||||
const $router = useRouter()
|
||||
const $router = useRouter();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
const products = useProducts();
|
||||
|
||||
@@ -117,7 +128,24 @@ export default defineComponent({
|
||||
|
||||
// Colonne della tabella
|
||||
const allColumns_Raccolta = ref([
|
||||
{ name: 'pos', label: 'Ind', field: 'pos', align: 'left', style: 'width: 50px', notsortable: true },
|
||||
{
|
||||
name: 'pos',
|
||||
label: 'Ind',
|
||||
field: 'pos',
|
||||
align: 'left',
|
||||
style: 'width: 50px',
|
||||
notsortable: true,
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
label: 'Mod',
|
||||
field: '',
|
||||
align: 'left',
|
||||
style: 'width: 50px',
|
||||
edit: true,
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{
|
||||
name: 'drag',
|
||||
label: 'Ord',
|
||||
@@ -128,16 +156,63 @@ export default defineComponent({
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{ name: 'image', label: 'Foto', field: 'image', align: 'center', noexp: true, notsortable: true },
|
||||
{
|
||||
name: 'image',
|
||||
label: 'Foto',
|
||||
field: 'image',
|
||||
align: 'center',
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{ name: 'title', label: 'Titolo', field: 'title', align: 'left' },
|
||||
{ name: 'pdf_generato', label: 'Generato', field: 'pdf_generato', align: 'center' },
|
||||
{ name: 'data_generato', label: 'Data Generato', field: 'data_generato', align: 'center' },
|
||||
{ name: 'pdf_generato_stampa', label: 'Generato Stampa', field: 'pdf_generato_stampa', align: 'center' },
|
||||
{ name: 'data_generato_stampa', label: 'Data Generato Stampa', field: 'data_generato_stampa', align: 'center' },
|
||||
{ name: 'pdf_online', label: 'PDF OnLine', field: 'pdf_online', align: 'center' },
|
||||
{ name: 'pdf_online_stampa', label: 'PDF OnLine Stampa', field: 'pdf_online_stampa', align: 'center' },
|
||||
{ name: 'data_online', label: 'Data Online', field: 'data_online', align: 'center' },
|
||||
{ name: 'data_online_stampa', label: 'Data Online Stampa', field: 'data_online_stampa', align: 'center' },
|
||||
{
|
||||
name: 'pdf_generato',
|
||||
label: 'Generato',
|
||||
field: 'pdf_generato',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'data_generato',
|
||||
label: 'Data Generato',
|
||||
field: 'data_generato',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'pdf_generato_stampa',
|
||||
label: 'Generato Stampa',
|
||||
field: 'pdf_generato_stampa',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'data_generato_stampa',
|
||||
label: 'Data Generato Stampa',
|
||||
field: 'data_generato_stampa',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'pdf_online',
|
||||
label: 'PDF OnLine',
|
||||
field: 'pdf_online',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'pdf_online_stampa',
|
||||
label: 'PDF OnLine Stampa',
|
||||
field: 'pdf_online_stampa',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'data_online',
|
||||
label: 'Data Online',
|
||||
field: 'data_online',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'data_online_stampa',
|
||||
label: 'Data Online Stampa',
|
||||
field: 'data_online_stampa',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'actions',
|
||||
label: 'Azioni',
|
||||
@@ -150,7 +225,24 @@ export default defineComponent({
|
||||
]);
|
||||
|
||||
const allColumns_Catalog = ref([
|
||||
{ name: 'pos', label: 'Ind', field: 'pos', align: 'left', style: 'width: 50px', notsortable: true },
|
||||
{
|
||||
name: 'pos',
|
||||
label: 'Ind',
|
||||
field: 'pos',
|
||||
align: 'left',
|
||||
style: 'width: 50px',
|
||||
notsortable: true,
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
label: 'Mod',
|
||||
field: '',
|
||||
align: 'left',
|
||||
style: 'width: 50px',
|
||||
edit: true,
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{
|
||||
name: 'drag',
|
||||
label: 'Ord',
|
||||
@@ -161,37 +253,156 @@ export default defineComponent({
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{ name: 'validato', label: 'Val', field: 'validato', align: 'left', style: '' },
|
||||
{ name: 'scraped', label: 'Estratto', field: 'scraped', align: 'left', style: '' },
|
||||
{ name: 'image', label: 'Foto', field: 'image', align: 'center', noexp: true, notsortable: true },
|
||||
{
|
||||
name: 'validato',
|
||||
label: 'Val',
|
||||
field: 'validato',
|
||||
align: 'left',
|
||||
style: '',
|
||||
},
|
||||
{
|
||||
name: 'scraped',
|
||||
label: 'Estratto',
|
||||
field: 'scraped',
|
||||
align: 'left',
|
||||
style: '',
|
||||
},
|
||||
{
|
||||
name: 'scraped_error',
|
||||
label: 'Err estrazione',
|
||||
field: 'scraped_error',
|
||||
align: 'left',
|
||||
style: '',
|
||||
},
|
||||
{
|
||||
name: 'image',
|
||||
label: 'Foto',
|
||||
field: 'image',
|
||||
align: 'center',
|
||||
noexp: true,
|
||||
notsortable: true,
|
||||
},
|
||||
{ name: 'name', label: 'Titolo', field: 'name', align: 'left' },
|
||||
{ name: 'sottotitolo', label: 'Sottotitolo', field: 'sottotitolo', align: 'left' },
|
||||
{
|
||||
name: 'sottotitolo',
|
||||
label: 'Sottotitolo',
|
||||
field: 'sottotitolo',
|
||||
align: 'left',
|
||||
},
|
||||
{ name: 'authors', label: 'Autore', field: 'authors', align: 'left' },
|
||||
{ name: 'isbn', label: 'ISBN', field: 'isbn', align: 'left' },
|
||||
{ name: 'trafiletto', label: 'Sinossi', field: 'trafiletto', align: 'left' },
|
||||
{ name: 'catprods', label: 'Argomento', field: 'catprods', align: 'left' },
|
||||
{
|
||||
name: 'trafiletto',
|
||||
label: 'Sinossi',
|
||||
field: 'trafiletto',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'catprods',
|
||||
label: 'Argomento',
|
||||
field: 'catprods',
|
||||
align: 'left',
|
||||
},
|
||||
{ name: 'edizione', label: 'Edizione', field: 'edizione', align: 'left' },
|
||||
{ name: 'casaeditrice', label: 'Casa Editrice', field: 'casaeditrice', align: 'left' },
|
||||
{ name: 'idCollana', label: 'Collana', field: 'idCollana', align: 'left' },
|
||||
{
|
||||
name: 'casaeditrice',
|
||||
label: 'Casa Editrice',
|
||||
field: 'casaeditrice',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'idCollana',
|
||||
label: 'Collana',
|
||||
field: 'idCollana',
|
||||
align: 'left',
|
||||
},
|
||||
{ name: 'stato', label: 'Stato', field: 'stato', align: 'left' },
|
||||
{ name: 'tipologia', label: 'Tipologia', field: 'tipologia', align: 'left' },
|
||||
{ name: 'tipoformato', label: 'Formato', field: 'tipoformato', align: 'left' },
|
||||
{
|
||||
name: 'tipologia',
|
||||
label: 'Tipologia',
|
||||
field: 'tipologia',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'tipoformato',
|
||||
label: 'Formato',
|
||||
field: 'tipoformato',
|
||||
align: 'left',
|
||||
},
|
||||
{ name: 'pagine', label: 'Pag.', field: 'pagine', align: 'right' },
|
||||
{ name: 'prezzo', label: '€', field: 'prezzo', align: 'right' },
|
||||
{ name: 'prezzo_sconto', label: '€ (sconto)', field: 'prezzo_sconto', align: 'right' },
|
||||
{ name: 'date_pub', label: 'Pubblicato', field: 'date_pub', align: 'left' },
|
||||
{
|
||||
name: 'prezzo_sconto',
|
||||
label: '€ (sconto)',
|
||||
field: 'prezzo_sconto',
|
||||
align: 'right',
|
||||
},
|
||||
{
|
||||
name: 'date_pub',
|
||||
label: 'Pubblicato',
|
||||
field: 'date_pub',
|
||||
align: 'left',
|
||||
},
|
||||
//{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
|
||||
//{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
//{ name: "rank6M", label: "Class. 6M", field: "rank6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
//{ name: "rank1Y", label: "Class. 1Y", field: "rank1Y", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: 'totVen', label: 'Vend', field: 'totVen', align: 'right', visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: 'vLast6M', label: 'Ven 6M', field: 'vLast6M', align: 'right', visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: 'fatLast6M', label: 'Fat 6M', field: 'fatLast6M', align: 'right', visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: 'fatLast1Y', label: 'Fat 1A', field: 'fatLast1Y', align: 'right', visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: 'fatLast2Y', label: 'Fat 2A', field: 'fatLast2Y', align: 'right', visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ 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: 'totVen',
|
||||
label: 'Vend',
|
||||
field: 'totVen',
|
||||
align: 'right',
|
||||
visu: costanti.VISUCAMPI.PER_EDITORE,
|
||||
},
|
||||
{
|
||||
name: 'vLast6M',
|
||||
label: 'Ven 6M',
|
||||
field: 'vLast6M',
|
||||
align: 'right',
|
||||
visu: costanti.VISUCAMPI.PER_EDITORE,
|
||||
},
|
||||
{
|
||||
name: 'fatLast6M',
|
||||
label: 'Fat 6M',
|
||||
field: 'fatLast6M',
|
||||
align: 'right',
|
||||
visu: costanti.VISUCAMPI.PER_EDITORE,
|
||||
},
|
||||
{
|
||||
name: 'fatLast1Y',
|
||||
label: 'Fat 1A',
|
||||
field: 'fatLast1Y',
|
||||
align: 'right',
|
||||
visu: costanti.VISUCAMPI.PER_EDITORE,
|
||||
},
|
||||
{
|
||||
name: 'fatLast2Y',
|
||||
label: 'Fat 2A',
|
||||
field: 'fatLast2Y',
|
||||
align: 'right',
|
||||
visu: costanti.VISUCAMPI.PER_EDITORE,
|
||||
},
|
||||
{
|
||||
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',
|
||||
@@ -210,7 +421,9 @@ export default defineComponent({
|
||||
if (props.table === shared_consts.TABLES_CATALOG) {
|
||||
selectedColumns.value = selectedColumns_Catalogs.value;
|
||||
} else {
|
||||
selectedColumns.value = tools.isUtente() ? selectedColumns_Utenti.value : selectedColumns_Editori.value;
|
||||
selectedColumns.value = tools.isUtente()
|
||||
? selectedColumns_Utenti.value
|
||||
: selectedColumns_Editori.value;
|
||||
}
|
||||
|
||||
addstr.value = tools.addstrCookie(props.table);
|
||||
@@ -295,7 +508,10 @@ 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':
|
||||
@@ -318,12 +534,19 @@ export default defineComponent({
|
||||
return element.scraped === true
|
||||
? '<span class="text-bold">SI</span>'
|
||||
: '';
|
||||
case 'scraped_error':
|
||||
return element.scraped_error === true
|
||||
? '<span class="text-bold text-red">ERR</span>'
|
||||
: '';
|
||||
|
||||
case 'isbn':
|
||||
return element.isbn;
|
||||
|
||||
case 'trafiletto':
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'SI' : 'NO';
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length >
|
||||
100
|
||||
? 'SI'
|
||||
: 'NO';
|
||||
|
||||
case 'catprods':
|
||||
return tools.formatCatProds(element.productInfo?.catprods);
|
||||
@@ -332,19 +555,27 @@ 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);
|
||||
|
||||
case 'stato':
|
||||
return products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo?.idStatoProdotto || '');
|
||||
return products.getDescrStatiProdottoByIdStatoProdotto(
|
||||
element.productInfo?.idStatoProdotto || ''
|
||||
);
|
||||
|
||||
case 'tipologia':
|
||||
return products.getDescrByIdTipologia(element.arrvariazioni?.[0]?.idTipologia || '');
|
||||
return products.getDescrByIdTipologia(
|
||||
element.arrvariazioni?.[0]?.idTipologia || ''
|
||||
);
|
||||
|
||||
case 'tipoformato':
|
||||
return products.getDescrByIdTipoFormato(element.arrvariazioni?.[0]?.idTipoFormato || '');
|
||||
return products.getDescrByIdTipoFormato(
|
||||
element.arrvariazioni?.[0]?.idTipoFormato || ''
|
||||
);
|
||||
|
||||
case 'date_pub':
|
||||
return tools.getstrDate(element.productInfo?.date_pub);
|
||||
@@ -353,7 +584,9 @@ 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;
|
||||
@@ -386,7 +619,10 @@ export default defineComponent({
|
||||
return tools.getstrDate(element.productInfo?.dataUltimoOrdine);
|
||||
|
||||
case 'quantity':
|
||||
if (tools.isUtente()) return tools.getDescrQuantitàByQuantity(element.arrvariazioni?.[0]?.quantita);
|
||||
if (tools.isUtente())
|
||||
return tools.getDescrQuantitàByQuantity(
|
||||
element.arrvariazioni?.[0]?.quantita
|
||||
);
|
||||
else return element.arrvariazioni?.[0]?.quantita;
|
||||
|
||||
default:
|
||||
@@ -403,7 +639,9 @@ export default defineComponent({
|
||||
if (!element) return '';
|
||||
switch (field.field) {
|
||||
case 'trafiletto':
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100 ? 'text-green' : 'text-red';
|
||||
return element.productInfo?.descr_trafiletto_catalogo?.length > 100
|
||||
? 'text-green'
|
||||
: 'text-red';
|
||||
|
||||
case 'stato':
|
||||
if (products.isProssimaUscita(element.productInfo)) {
|
||||
@@ -420,7 +658,9 @@ 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';
|
||||
@@ -514,6 +754,7 @@ export default defineComponent({
|
||||
: [
|
||||
'pos',
|
||||
'drag',
|
||||
'edit',
|
||||
'validato',
|
||||
'image',
|
||||
'name',
|
||||
@@ -547,7 +788,9 @@ export default defineComponent({
|
||||
]
|
||||
);
|
||||
const selectedColumns_Catalogs = ref(
|
||||
cookieValue.length > 0 ? cookieValue : ['pos', 'drag', 'image', 'title', 'pdf_generato', 'actions']
|
||||
cookieValue.length > 0
|
||||
? cookieValue
|
||||
: ['pos', 'drag', 'image', 'title', 'pdf_generato', 'actions']
|
||||
);
|
||||
|
||||
const selectedColumns = ref([]);
|
||||
@@ -564,7 +807,8 @@ export default defineComponent({
|
||||
}
|
||||
const ok =
|
||||
allColumns.value.some((col) => col.name === column) &&
|
||||
(!props.optcatalogo.showListaArgomenti || (props.optcatalogo.showListaArgomenti && !column.edit));
|
||||
(!props.optcatalogo.showListaArgomenti ||
|
||||
(props.optcatalogo.showListaArgomenti && !column.edit));
|
||||
return selectedColumns.value.includes(column) && ok;
|
||||
};
|
||||
|
||||
@@ -575,13 +819,32 @@ export default defineComponent({
|
||||
|
||||
// Funzione per eliminare un prodotto
|
||||
const removeProduct = (product) => {
|
||||
internalProducts.value = internalProducts.value.filter((p: any) => p._id !== product._id);
|
||||
emit('update:lista_prodotti', internalProducts.value); // Notifica il parent del cambiamento
|
||||
return $q
|
||||
.dialog({
|
||||
message: t('scheda.removeProduct'),
|
||||
html: true,
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: false,
|
||||
},
|
||||
title: '',
|
||||
cancel: true,
|
||||
persistent: false,
|
||||
})
|
||||
.onOk(() => {
|
||||
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
|
||||
@@ -688,11 +951,12 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -707,32 +971,40 @@ 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();
|
||||
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);
|
||||
}
|
||||
return sortDirection.value === 1
|
||||
? String(aVal).localeCompare(String(bVal))
|
||||
: String(bVal).localeCompare(String(aVal));
|
||||
}
|
||||
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));
|
||||
});
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -772,7 +1044,9 @@ 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'
|
||||
@@ -783,7 +1057,8 @@ 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);
|
||||
@@ -798,7 +1073,10 @@ 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) {
|
||||
|
||||
@@ -47,12 +47,16 @@
|
||||
v-if="isColumnVisible(col.name)"
|
||||
:key="col.name"
|
||||
@click="isSortable(col.name) ? sortTable(col.name) : ''"
|
||||
:style="{ 'background-color': sortAttribute === col.name ? 'yellow' : '' }"
|
||||
:style="{
|
||||
'background-color': sortAttribute === col.name ? 'yellow' : '',
|
||||
}"
|
||||
>
|
||||
<span>{{ col.label }}</span>
|
||||
<span v-if="isSortable(col.name)">
|
||||
<q-icon
|
||||
v-if="sortAttribute === col.name && optcatalogo.showListaArgomenti"
|
||||
v-if="
|
||||
sortAttribute === col.name && optcatalogo.showListaArgomenti
|
||||
"
|
||||
:name="sortDirection === 1 ? 'expand_less' : 'expand_more'"
|
||||
size="36px"
|
||||
class="q-ml-xs"
|
||||
@@ -91,10 +95,14 @@
|
||||
>
|
||||
<!-- Icona Drag Handle -->
|
||||
<td v-if="field.name === 'pos' && isColumnVisible('pos')">
|
||||
{{
|
||||
// put index in the first column
|
||||
internalProducts.indexOf(element) + 1
|
||||
}}
|
||||
<div class="row justify-center">
|
||||
<span class="q-ma-sm"
|
||||
>{{
|
||||
// put index in the first column
|
||||
internalProducts.indexOf(element) + 1
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td
|
||||
v-else-if="field.name === 'drag' && isColumnVisible('drag')"
|
||||
@@ -106,13 +114,36 @@
|
||||
color="primary"
|
||||
/>
|
||||
</td>
|
||||
<td v-else-if="field.name === 'edit' && isColumnVisible('edit')">
|
||||
<span
|
||||
v-if="!tools.isUtente()"
|
||||
class="justify-center"
|
||||
>
|
||||
<q-btn
|
||||
flat
|
||||
rounded
|
||||
outline
|
||||
size="sm"
|
||||
icon="edit"
|
||||
@click="modifyProduct(element)"
|
||||
v-close-popup
|
||||
class="custom-flat-button"
|
||||
/>
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<!-- Immagine Piccola -->
|
||||
<td v-else-if="field.name === 'image' && isColumnVisible('image')">
|
||||
<td
|
||||
v-else-if="field.name === 'image' && isColumnVisible('image')"
|
||||
>
|
||||
<q-img
|
||||
:src="
|
||||
getImageByElement(element)
|
||||
? tools.getFullFileNameByImageFile(table, getImageByElement(element), element._id)
|
||||
? tools.getFullFileNameByImageFile(
|
||||
table,
|
||||
getImageByElement(element),
|
||||
element._id
|
||||
)
|
||||
: element.productInfo?.image_link
|
||||
"
|
||||
style="width: 50px; height: 50px"
|
||||
@@ -130,7 +161,11 @@
|
||||
<span v-html="getFieldValue(element, field)"></span>
|
||||
</td>
|
||||
<!-- Azioni -->
|
||||
<td v-else-if="field.name === 'actions' && isColumnVisible('actions', true)">
|
||||
<td
|
||||
v-else-if="
|
||||
field.name === 'actions' && isColumnVisible('actions', true)
|
||||
"
|
||||
>
|
||||
<q-btn-dropdown
|
||||
label="Azioni"
|
||||
color="primary"
|
||||
@@ -145,8 +180,12 @@
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
<q-icon name="edit" size="20px" class="q-mr-xs" />
|
||||
Modifica
|
||||
<q-icon
|
||||
name="edit"
|
||||
size="20px"
|
||||
class="q-mr-xs"
|
||||
/>
|
||||
Scheda
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
@@ -157,7 +196,11 @@
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
<q-icon name="delete" size="20px" class="q-mr-xs" />
|
||||
<q-icon
|
||||
name="delete"
|
||||
size="20px"
|
||||
class="q-mr-xs"
|
||||
/>
|
||||
Elimina
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
@@ -270,6 +270,18 @@ export default defineComponent({
|
||||
dense: true,
|
||||
showall: true,
|
||||
},
|
||||
{
|
||||
editOn: true,
|
||||
label: 'Imagefile',
|
||||
table: 'productinfos',
|
||||
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
|
||||
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
|
||||
mykey: 'imagefile',
|
||||
debounce: '1000',
|
||||
type: costanti.FieldType.string,
|
||||
dense: true,
|
||||
showall: true,
|
||||
},
|
||||
];
|
||||
|
||||
return arrlist;
|
||||
@@ -310,17 +322,6 @@ export default defineComponent({
|
||||
type: costanti.FieldType.string,
|
||||
dense: true,
|
||||
},
|
||||
/*{
|
||||
editOn: true,
|
||||
label: "Pagine",
|
||||
table: "arrvariazioni",
|
||||
id: myproduct.value._id,
|
||||
rec: myproduct.value,
|
||||
mykey: "data_verifica",
|
||||
debounce: "0",
|
||||
type: costanti.FieldType.date,
|
||||
dense: true,
|
||||
},*/
|
||||
{
|
||||
editOn: false,
|
||||
label: 'Pubblicazione',
|
||||
@@ -478,7 +479,18 @@ export default defineComponent({
|
||||
table: 'products',
|
||||
id: myproduct.value._id,
|
||||
rec: myproduct.value,
|
||||
mykey: 'scraped',
|
||||
mykey: 'scraped_date',
|
||||
debounce: '1000',
|
||||
type: costanti.FieldType.data,
|
||||
dense: true,
|
||||
},
|
||||
{
|
||||
editOn: false,
|
||||
label: 'Err Scraped',
|
||||
table: 'products',
|
||||
id: myproduct.value._id,
|
||||
rec: myproduct.value,
|
||||
mykey: 'scraped_error',
|
||||
debounce: '1000',
|
||||
type: costanti.FieldType.boolean,
|
||||
dense: true,
|
||||
@@ -611,6 +623,8 @@ export default defineComponent({
|
||||
.then((dataupdated) => {
|
||||
if (dataupdated) {
|
||||
tools.showPositiveNotif($q, t('dbgm.scrapingOkUpdated'));
|
||||
} else {
|
||||
tools.showNeutralNotif($q, t('dbgm.scrapingNotUpdated'));
|
||||
}
|
||||
return dataupdated;
|
||||
})
|
||||
|
||||
@@ -99,6 +99,7 @@ export interface IVariazione {
|
||||
eta?: string
|
||||
validaprod?: IValidaProd
|
||||
scraped?: boolean
|
||||
scraped_error?: boolean
|
||||
}
|
||||
|
||||
export interface IAuthor {
|
||||
|
||||
@@ -2068,12 +2068,14 @@ const msg_it = {
|
||||
|
||||
scheda: {
|
||||
isPagIntro: 'Pagina Introduttiva',
|
||||
removeProduct: 'Rimuovere il titolo selezionato dalla lista?',
|
||||
},
|
||||
|
||||
dbgm: {
|
||||
updateLocalDb_OK: 'Dati Aggiornati in locale',
|
||||
updateLocalDb_ERROR: 'Errore aggiornamento singolo libro',
|
||||
scrapingOkUpdated: 'Dati Aggiornati prelevando dal Web',
|
||||
scrapingNotUpdated: 'Dati non aggiorrnati (o non trovati!)',
|
||||
},
|
||||
|
||||
queryai: {
|
||||
|
||||
@@ -2842,6 +2842,7 @@ export const colTableProducts = [
|
||||
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'validaprod', label_trans: 'products.validaprod', fieldtype: costanti.FieldType.verifica }),
|
||||
AddCol({ name: 'scraped', label_trans: 'products.scraped', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'scraped_error', label_trans: 'products.scraped_error', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1050,9 +1050,11 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
async execDbOp(paramquery: any) {
|
||||
// come faccio a ricevere un file da node.js ?
|
||||
return Api.SendReq('/users/dbop', 'POST', paramquery, false, false, 0, 5000, null, null, {timeout: 300000})
|
||||
.then((res) => {
|
||||
|
||||
|
||||
return res.data
|
||||
}).catch((error) => {
|
||||
return false
|
||||
|
||||
@@ -77,6 +77,7 @@ export default defineComponent({
|
||||
|
||||
const risfunz = await userStore.execDbOp({ mydata })
|
||||
|
||||
|
||||
$q.loading.hide()
|
||||
await globalStore.loadSite()
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ export default defineComponent({
|
||||
|
||||
const risfunz = await userStore.execDbOp({ mydata })
|
||||
|
||||
if (options?.generateCSV) {
|
||||
const today = new Date()
|
||||
tools.createAndDownloadCSVFromData(risfunz.data.mystr.data, `${options?.filename}_${today.getFullYear()}-${today.getMonth() + 1}-${today.getDate()}`)
|
||||
}
|
||||
|
||||
$q.loading.hide()
|
||||
await globalStore.loadSite()
|
||||
|
||||
|
||||
@@ -68,9 +68,24 @@
|
||||
@click="EseguiFunz('removeProductInfoWithoutDateUpdatedFromGM')"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Estrai dati da Amazon (Scraper)"
|
||||
label="Estrapola ed Aggiorna TUTTI i dati da Amazon (Scraper)"
|
||||
color="negative"
|
||||
@click="EseguiFunz('ScraperDataAmazon')"
|
||||
@click="EseguiFunz('ScraperMultipleDataAmazon', {update: true, aggiornasoloSeVuoti: true})"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Esporta CSV Dati Mancanti (num.pagine, formato, DataPubbl.)"
|
||||
color="primary"
|
||||
@click="EseguiFunz('ScraperGeneraCSV', {generateCSV: true, filename: 'dati_mancanti'})"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Rimuove Duplicati di ArrVariazioni !"
|
||||
color="negative"
|
||||
@click="EseguiFunz('removeDuplicateVariations')"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Azzera flag 'Estratto' da i Products e ProductInfo"
|
||||
color="negative"
|
||||
@click="EseguiFunz('ScraperAzzeraFlagProducts')"
|
||||
></q-btn>
|
||||
|
||||
<!--
|
||||
|
||||
Reference in New Issue
Block a user