- estrazione dei dati del libro sul sito di Amazon.

- possibilità di visualizzare i dati estratti e di aggiornare i dati, sia solo se vuoti, che sovrascrivere tutti i dati.
This commit is contained in:
Surya Paolo
2025-05-16 18:52:12 +02:00
parent 810815a12a
commit 859ba022fa
18 changed files with 1840 additions and 798 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,10 @@
:style="
scheda.dimensioni?.pagina?.dimensioni?.size?.height
? ' height: ' +
tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height) +
tools.adjustSize(
optcatalogo,
scheda.dimensioni?.pagina?.dimensioni?.size?.height
) +
'px !important; '
: ''
"
@@ -51,12 +54,26 @@
'flex', // Classi comuni
'image-container',
{ 'shadow-2': options.in_3d && !optcatalogo.pdf }, // Classe condizionale
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? '' : 'flex flex-row', // Layout flessibile
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? ''
: 'flex flex-row', // Layout flessibile
]"
:style="{
gap: tools.adjustSize(optcatalogo, scheda.dimensioni?.scheda_prodotto?.size?.gap) ?? '0.1rem',
width: tools.adjustSize(optcatalogo, scheda.dimensioni?.scheda_prodotto?.size?.width) ?? '100%',
height: tools.adjustSize(optcatalogo, scheda.dimensioni?.scheda_prodotto?.size?.height),
gap:
tools.adjustSize(
optcatalogo,
scheda.dimensioni?.scheda_prodotto?.size?.gap
) ?? '0.1rem',
width:
tools.adjustSize(
optcatalogo,
scheda.dimensioni?.scheda_prodotto?.size?.width
) ?? '100%',
height: tools.adjustSize(
optcatalogo,
scheda.dimensioni?.scheda_prodotto?.size?.height
),
}"
>
<div>
@@ -68,11 +85,16 @@
v-if="myproduct.productInfo"
:src="
myproduct.productInfo.imagefile
? tools.getFullFileNameByImageFile('productInfos', myproduct.productInfo.imagefile)
? tools.getFullFileNameByImageFile(
'productInfos',
myproduct.productInfo.imagefile
)
: myproduct.productInfo.image_link
"
:alt="myproduct.productInfo.name"
:fit="scheda.dimensioni?.immagine_prodotto?.size?.fit ?? 'cover'"
:fit="
scheda.dimensioni?.immagine_prodotto?.size?.fit ?? 'cover'
"
:class="{
'book-image-fixed': complete,
'cursor-pointer': !complete,
@@ -82,15 +104,25 @@
:style="{
zIndex: 2,
width:
scheda.testo_right.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
scheda.testo_right.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? (scheda.testo_right.font?.perc_text ?? '50%')
: '45%',
...(tools.adjustSize(optcatalogo, scheda.dimensioni?.immagine_prodotto?.size?.width) && {
...(tools.adjustSize(
optcatalogo,
scheda.dimensioni?.immagine_prodotto?.size?.width
) && {
width:
tools.adjustSize(optcatalogo, scheda.dimensioni?.immagine_prodotto.size?.width) + ' !important',
tools.adjustSize(
optcatalogo,
scheda.dimensioni?.immagine_prodotto.size?.width
) + ' !important',
}),
height: scheda.dimensioni?.immagine_prodotto?.size?.height
? tools.adjustSize(optcatalogo, scheda.dimensioni?.immagine_prodotto?.size?.height)
? tools.adjustSize(
optcatalogo,
scheda.dimensioni?.immagine_prodotto?.size?.height
)
: undefined,
display: 'block',
}"
@@ -179,7 +211,10 @@
</q-item-section>
</q-item>-->
<q-item
v-if="!optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)"
v-if="
!optcatalogo.generazionePDFInCorso &&
(editOn || options.show_edit_book)
"
clickable
v-close-popup
@click="refreshSingleBookFromGM({ usaDBGMLocale: false })"
@@ -197,7 +232,9 @@
</q-item>
<q-item
v-if="
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
tools.isManager() &&
!optcatalogo.generazionePDFInCorso &&
(editOn || options.show_edit_book)
"
clickable
v-close-popup
@@ -255,7 +292,9 @@
-->
<q-item
v-if="
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
tools.isManager() &&
!optcatalogo.generazionePDFInCorso &&
(editOn || options.show_edit_book)
"
clickable
v-close-popup
@@ -275,6 +314,29 @@
<q-item-label>Visualizza su GM</q-item-label>
</q-item-section>
</q-item>
<q-item
v-if="
!optcatalogo.generazionePDFInCorso &&
(editOn || options.show_edit_book)
"
clickable
v-close-popup
@click="getDataExtracted()"
>
<q-item-section avatar>
<q-avatar
icon="fas fa-sitemap"
color="orange"
text-color="white"
/>
</q-item-section>
<q-item-section>
<q-item-label
>Visualizza dati Estrapolati (dal WEB
Esterno)</q-item-label
>
</q-item-section>
</q-item>
<!--<q-item
v-if="
@@ -299,7 +361,9 @@
<q-item
v-if="
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
tools.isManager() &&
!optcatalogo.generazionePDFInCorso &&
(editOn || options.show_edit_book)
"
clickable
v-close-popup
@@ -316,7 +380,10 @@
/>
</q-item-section>
<q-item-section>
<q-item-label>Visualizza su GM (con le Quantità in Magazzino)</q-item-label>
<q-item-label
>Visualizza su GM (con le Quantità in
Magazzino)</q-item-label
>
</q-item-section>
</q-item>
</q-list>
@@ -334,12 +401,21 @@
:idPage="idPage"
>
<div
v-if="scheda.testo_right_attaccato.font?.posiz_text !== costanti.POSIZ_TESTO.IN_BASSO"
v-if="
scheda.testo_right_attaccato.font?.posiz_text !==
costanti.POSIZ_TESTO.IN_BASSO
"
:style="{
alignSelf:
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? '' : 'center',
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? ''
: 'center',
marginTop:
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? 'auto' : '0',
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
? 'auto'
: '0',
}"
>
<CText
@@ -356,15 +432,36 @@
:value="myproduct.productInfo.code"
:format="scheda.barcode.format"
:fontsizeprop="scheda.barcode.font?.size"
:gap="tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)"
:width="parseInt(tools.adjustSize(optcatalogo, scheda.barcode.size?.width))"
:widthlines="tools.adjustSize(optcatalogo, scheda.barcode.widthlines)"
:height="tools.adjustSize(optcatalogo, scheda.barcode.size?.height)"
:gap="
tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)
"
:width="
parseInt(
tools.adjustSize(
optcatalogo,
scheda.barcode.size?.width
)
)
"
:widthlines="
tools.adjustSize(optcatalogo, scheda.barcode.widthlines)
"
:height="
tools.adjustSize(
optcatalogo,
scheda.barcode.size?.height
)
"
:show_at_right="scheda.barcode?.show_at_right"
>
</CBarCode>
</div>
<div v-if="scheda.etichette?.bestseller?.show && isProductBestseller()">
<div
v-if="
scheda.etichette?.bestseller?.show &&
isProductBestseller()
"
>
<q-img
src="/images/bestseller.png"
alt="Bestseller"
@@ -373,7 +470,11 @@
fit="contain"
></q-img>
</div>
<div v-else-if="scheda.etichette?.novita?.show && isProductNovita()">
<div
v-else-if="
scheda.etichette?.novita?.show && isProductNovita()
"
>
<q-img
src="/images/novita.png"
alt="Novita"
@@ -387,7 +488,10 @@
</div>
</CText>
<div
v-if="scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO"
v-if="
scheda.testo_right_attaccato.font?.posiz_text ===
costanti.POSIZ_TESTO.IN_BASSO
"
class="flexible-width"
:style="{
marginTop: 'auto',
@@ -407,15 +511,32 @@
:value="myproduct.productInfo.code"
:format="scheda.barcode.format"
:fontsizeprop="scheda.barcode.font?.size"
:gap="tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)"
:width="parseInt(tools.adjustSize(optcatalogo, scheda.barcode.size?.width))"
:widthlines="tools.adjustSize(optcatalogo, scheda.barcode.widthlines)"
:height="tools.adjustSize(optcatalogo, scheda.barcode.size?.height)"
:gap="
tools.adjustSize(optcatalogo, scheda.barcode.size?.gap)
"
:width="
parseInt(
tools.adjustSize(
optcatalogo,
scheda.barcode.size?.width
)
)
"
:widthlines="
tools.adjustSize(optcatalogo, scheda.barcode.widthlines)
"
:height="
tools.adjustSize(optcatalogo, scheda.barcode.size?.height)
"
:show_at_right="scheda.barcode.show_at_right"
>
</CBarCode>
</div>
<div v-if="scheda.etichette?.bestseller?.show && isProductBestseller()">
<div
v-if="
scheda.etichette?.bestseller?.show && isProductBestseller()
"
>
<q-img
src="/images/bestseller.png"
alt="Bestseller"
@@ -424,7 +545,11 @@
fit="contain"
></q-img>
</div>
<div v-else-if="scheda.etichette?.novita?.show && isProductNovita()">
<div
v-else-if="
scheda.etichette?.novita?.show && isProductNovita()
"
>
<q-img
src="/images/novita.png"
alt="Novita"
@@ -486,7 +611,9 @@
>
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title> {{ t('ecomm.listaord') }} - {{ myproduct.productInfo.name }} </q-toolbar-title>
<q-toolbar-title>
{{ t('ecomm.listaord') }} - {{ myproduct.productInfo.name }}
</q-toolbar-title>
<q-btn
flat
round
@@ -524,20 +651,34 @@
</div>
</td>
<td class="text-center">
<strong>{{ tools.getNomeUtenteEUsernameByRecUser(ordcart.user) }}</strong>
<strong>{{
tools.getNomeUtenteEUsernameByRecUser(ordcart.user)
}}</strong>
</td>
<td class="text-center">
<strong>{{ shared_consts.getStatusStr(ordcart.status) }}</strong>
<strong>{{
shared_consts.getStatusStr(ordcart.status)
}}</strong>
</td>
<td class="text-center">
<div
v-for="(singleord, index) in ordcart.items"
:key="index"
>
<span v-if="singleord.order.idProduct === myproduct._id && singleord.order.quantity > 0">
<span
v-if="
singleord.order.idProduct === myproduct._id &&
singleord.order.quantity > 0
"
>
{{ singleord.order.quantity }}</span
>
<span v-if="singleord.order.idProduct === myproduct._id && singleord.order.quantitypreordered > 0">
<span
v-if="
singleord.order.idProduct === myproduct._id &&
singleord.order.quantitypreordered > 0
"
>
{{ singleord.order.quantitypreordered }}</span
>
</div>
@@ -562,7 +703,12 @@
</q-dialog>
<q-dialog
v-if="true && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda"
v-if="
true &&
myproduct &&
myproduct.productInfo &&
myproduct.productInfo.link_scheda
"
v-model="apriSchedaPDF"
maximized
>
@@ -599,7 +745,12 @@
</q-dialog>
<q-dialog
v-if="false && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda"
v-if="
false &&
myproduct &&
myproduct.productInfo &&
myproduct.productInfo.link_scheda
"
v-model="apriSchedaPDF"
fullscreen
>
@@ -638,7 +789,9 @@
>
<q-img
:src="
myproduct.productInfo.imagefile ? `` + myproduct.productInfo.imagefile : myproduct.productInfo.image_link
myproduct.productInfo.imagefile
? `` + myproduct.productInfo.imagefile
: myproduct.productInfo.image_link
"
:alt="myproduct.productInfo.name"
:fit="tools.isMobile() ? 'fill' : 'contain'"
@@ -713,7 +866,11 @@
campispeciali: true,
numrec: 1,
where:
'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = \'' + myproduct.productInfo.code + '\'',
'T.IdArticolo =' +
myproduct.productInfo.sku +
' AND T.Ean13 = \'' +
myproduct.productInfo.code +
'\'',
showQtaDisponibile,
outhtml: true,
}"
@@ -722,6 +879,38 @@
</q-card-section>
</q-card>
</q-dialog>
<q-dialog
v-if="visudataextracted && myproduct"
v-model="visudataextracted"
>
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title> Visu </q-toolbar-title>
<q-btn
flat
round
color="white"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<div class="row justify-center">Dati</div><br>
<q-inner-loading
id="spinner"
:showing="loading"
>
<q-spinner-tail
color="primary"
size="4em"
>
</q-spinner-tail>
</q-inner-loading>
<div v-html="dataextractedWeb"></div>
</q-card-section>
</q-card>
</q-dialog>
<q-dialog
v-if="updatefromgm && myproduct"
v-model="updatefromgm"

View File

@@ -162,6 +162,7 @@ export default defineComponent({
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: 'name', label: 'Titolo', field: 'name', align: 'left' },
{ name: 'sottotitolo', label: 'Sottotitolo', field: 'sottotitolo', align: 'left' },
@@ -313,6 +314,11 @@ export default defineComponent({
? '<span class="text-bold">ERR</span>'
: 'NO';
case 'scraped':
return element.scraped === true
? '<span class="text-bold">SI</span>'
: '';
case 'isbn':
return element.isbn;

View File

@@ -1,30 +1,32 @@
import { PropType, computed, defineComponent, onMounted, ref, watch } from "vue";
import draggable from 'vuedraggable'
import {
PropType,
computed,
defineComponent,
onMounted,
ref,
watch,
} from 'vue';
import draggable from 'vuedraggable';
import { tools } from '@tools'
import { tools } from '@tools';
import { useGlobalStore } from '@src/store/globalStore'
import { useGlobalStore } from '@src/store/globalStore';
import { CTableCupleLabelValue } from '@src/components/CTableCupleLabelValue'
import { CTableCupleLabelValue } from '@src/components/CTableCupleLabelValue';
import { costanti } from '@costanti'
import type {
IMyScheda,
IProduct,
IRecFields
} from '@src/model';
import { shared_consts } from "app/src/common/shared_vuejs";
import { useProducts } from "app/src/store/Products";
import { useI18n } from "vue-i18n";
import { useQuasar } from "quasar";
import { costanti } from '@costanti';
import type { IMyScheda, IProduct, IRecFields } from '@src/model';
import { shared_consts } from 'app/src/common/shared_vuejs';
import { useProducts } from 'app/src/store/Products';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
export default defineComponent({
name: "CSchedaProdotto",
name: 'CSchedaProdotto',
emits: ['updateproductmodif'],
components: {
CTableCupleLabelValue
CTableCupleLabelValue,
},
props: {
modelValue: {
@@ -34,36 +36,35 @@ export default defineComponent({
scheda: {
type: Object as PropType<IMyScheda>,
required: false,
default: () => ({
}),
default: () => ({}),
},
},
setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna
const $q = useQuasar()
const { t } = useI18n()
const $q = useQuasar();
const { t } = useI18n();
const globalStore = useGlobalStore()
const products = useProducts()
const globalStore = useGlobalStore();
const products = useProducts();
const mytab = ref('scheda')
const mytab = ref('scheda');
const loading = ref(false)
const loading = ref(false);
const updatetogm = ref(false)
const field_updated_toGM = ref('')
const updatetogm = ref(false);
const field_updated_toGM = ref('');
const myproduct = ref<IProduct>({ ...props.modelValue })
const myproduct = ref<IProduct>({ ...props.modelValue });
watch(() => props.modelValue, (newVal) => {
myproduct.value = { ...newVal };
}, { deep: false });
watch(
() => props.modelValue,
(newVal) => {
myproduct.value = { ...newVal };
},
{ deep: false }
);
async function mounted() {
}
async function mounted() {}
/*
// Aggiorna la copia locale quando il prop cambia
@@ -79,101 +80,102 @@ export default defineComponent({
const arrlist: IRecFields[] = [
{
editOn: false,
label: "Fatturati",
table: "productinfos",
label: 'Fatturati',
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: "totFat",
debounce: "1000",
mykey: 'totFat',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimi 3 Mesi",
table: "productinfos",
label: 'Fatturati ultimi 3 Mesi',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast3M",
debounce: "1000",
mykey: 'fatLast3M',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimi 6 Mesi",
table: "productinfos",
label: 'Fatturati ultimi 6 Mesi',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast6M",
debounce: "1000",
mykey: 'fatLast6M',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimo Anno",
table: "productinfos",
label: 'Fatturati ultimo Anno',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast1Y",
debounce: "1000",
mykey: 'fatLast1Y',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimi 2 Anni",
table: "productinfos",
label: 'Fatturati ultimi 2 Anni',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast2Y",
debounce: "1000",
mykey: 'fatLast2Y',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti",
table: "productinfos",
label: 'Venduti',
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: "totVen",
debounce: "1000", type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimi 3 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast3M",
debounce: "1000",
mykey: 'totVen',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimi 6 Mesi",
table: "productinfos",
label: 'Venduti Ultimi 3 Mesi',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast6M",
debounce: "1000",
mykey: 'vLast3M',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimo Anno",
table: "productinfos",
label: 'Venduti Ultimi 6 Mesi',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast1Y",
debounce: "1000",
mykey: 'vLast6M',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti Ultimi 2 Anni",
table: "productinfos",
label: 'Venduti Ultimo Anno',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "vLast2Y",
debounce: "1000",
mykey: 'vLast1Y',
debounce: '1000',
type: costanti.FieldType.number,
},
{
editOn: false,
label: 'Venduti Ultimi 2 Anni',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: 'vLast2Y',
debounce: '1000',
type: costanti.FieldType.number,
},
@@ -209,101 +211,102 @@ export default defineComponent({
type: costanti.FieldType.number,
},*/
];
return arrlist
return arrlist;
}
function getArrListDescrizioni(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: true,
label: "Descrizione Sinossi per Catalogo",
label: 'Descrizione Sinossi per Catalogo',
title: myproduct.value?.productInfo?.name,
table: "productinfos",
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: "descr_trafiletto_catalogo",
debounce: "1000",
mykey: 'descr_trafiletto_catalogo',
debounce: '1000',
type: costanti.FieldType.editor_nohtml,
dense: true,
showall: true,
},
{
editOn: true,
label: "Descrizione breve macro",
label: 'Descrizione breve macro',
title: myproduct.value?.productInfo?.name,
table: "productinfos",
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: "descrizione_breve_macro",
mykey: 'descrizione_breve_macro',
maxlength: 650,
debounce: "1000",
debounce: '1000',
type: costanti.FieldType.editor_nohtml,
dense: true,
showall: true,
},
{
editOn: true,
label: "Descrizione Estesa",
table: "productinfos",
label: 'Descrizione Estesa',
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: "descrizione_completa_macro",
maxlength: props.scheda?.testo_bottom?.maxlength ? props.scheda?.testo_bottom?.maxlength : 10000,
debounce: "1000",
mykey: 'descrizione_completa_macro',
maxlength: props.scheda?.testo_bottom?.maxlength
? props.scheda?.testo_bottom?.maxlength
: 10000,
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
showall: true,
},
{
editOn: true,
label: "Link a gruppomacro.com",
table: "productinfos",
label: 'Link a gruppomacro.com',
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: "link_macro",
debounce: "1000",
mykey: 'link_macro',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
showall: true,
},
]
return arrlist
];
return arrlist;
}
function getArrListScheda(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: true,
label: "Verifica",
table: "products",
id: myproduct.value._id,
rec: myproduct.value,
mykey: "validaprod",
debounce: "1000",
type: costanti.FieldType.verifica,
dense: true,
},
{
editOn: true,
label: "Titolo",
table: "productinfos",
label: 'Titolo',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "name",
debounce: "1000",
mykey: 'name',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "SottoTitolo",
table: "productinfos",
label: 'Verifica',
table: 'products',
id: myproduct.value._id,
rec: myproduct.value,
mykey: 'validaprod',
debounce: '1000',
type: costanti.FieldType.verifica,
dense: true,
},
{
editOn: true,
label: 'SottoTitolo',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "sottotitolo",
debounce: "1000",
mykey: 'sottotitolo',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
},
@@ -320,153 +323,174 @@ export default defineComponent({
},*/
{
editOn: false,
label: "Pubblicazione",
table: "productinfos",
label: 'Pubblicazione',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "date_pub",
debounce: "1000",
mykey: 'date_pub',
debounce: '1000',
type: costanti.FieldType.onlydate,
dense: true,
},
{
editOn: false,
label: "Stato",
table: "productinfos",
label: 'ISBN',
table: 'products',
id: myproduct.value._id,
rec: myproduct.value,
mykey: 'isbn',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
},
{
editOn: false,
label: 'Stato',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "idStatoProdotto",
debounce: "1000",
mykey: 'idStatoProdotto',
debounce: '1000',
type: costanti.FieldType.select,
jointable: 't_web_statiprodottos',
dense: true,
},
{
editOn: true,
label: "Argomento",
table: "productinfos",
label: 'Argomento',
table: 'productinfos',
id: myproduct.value.productInfo?._id,
rec: myproduct.value.productInfo,
mykey: "idCatProds",
debounce: "1000",
mykey: 'idCatProds',
debounce: '1000',
type: costanti.FieldType.multiselect,
jointable: 'catprtotali',
dense: true,
},
{
editOn: true,
label: "Pagine",
table: "arrvariazioni",
label: 'Pagine',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "pagine",
debounce: "0",
mykey: 'pagine',
debounce: '0',
type: costanti.FieldType.number,
dense: true,
},
{
editOn: true,
label: "Misure",
table: "arrvariazioni",
label: 'Misure',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "misure",
debounce: "1000",
mykey: 'misure',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Edizione",
table: "arrvariazioni",
label: 'Edizione',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "edizione",
debounce: "1000",
mykey: 'edizione',
debounce: '1000',
type: costanti.FieldType.string,
dense: true,
},
{
editOn: false,
label: "Tipologia",
table: "arrvariazioni",
label: 'Tipologia',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "idTipologia",
debounce: "1000",
mykey: 'idTipologia',
debounce: '1000',
type: costanti.FieldType.select,
jointable: 't_web_tipologies',
dense: true,
},
{
editOn: true,
label: "Formato",
table: "arrvariazioni",
label: 'Formato',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "idTipoFormato",
debounce: "1000",
mykey: 'idTipoFormato',
debounce: '1000',
type: costanti.FieldType.select,
jointable: 't_web_tipiformatos',
dense: true,
},
{
editOn: true,
label: "Prezzo",
table: "arrvariazioni",
label: 'Prezzo',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "price",
debounce: "0",
mykey: 'price',
debounce: '0',
type: costanti.FieldType.number,
dense: true,
},
{
editOn: true,
label: "Prezzo Scontato",
table: "arrvariazioni",
label: 'Prezzo Scontato',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "sale_price",
debounce: "0",
mykey: 'sale_price',
debounce: '0',
type: costanti.FieldType.number,
dense: true,
},
{
editOn: false,
label: "Magazzino",
table: "arrvariazioni",
label: 'Magazzino',
table: 'arrvariazioni',
id: myproduct.value._id,
rec: myproduct.value,
mykey: "quantita",
debounce: "0",
mykey: 'quantita',
debounce: '0',
type: costanti.FieldType.number,
dense: true,
},
{
editOn: false,
label: "Aggiornato (da GM) il",
table: "productinfos",
label: 'Aggiornato (da GM) il',
table: 'productinfos',
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "date_updated_fromGM",
debounce: "1000",
mykey: 'date_updated_fromGM',
debounce: '1000',
type: costanti.FieldType.onlydate,
dense: true,
},
]
return arrlist
{
editOn: false,
label: 'Dati estratti dal Web',
table: 'products',
id: myproduct.value._id,
rec: myproduct.value,
mykey: 'scraped',
debounce: '1000',
type: costanti.FieldType.boolean,
dense: true,
},
];
return arrlist;
}
function updateproductmodif(element: any) {
console.log('CSCHEDAPRODOTTO updateproductmodif ', element)
emit('updateproductmodif', element)
console.log('CSCHEDAPRODOTTO updateproductmodif ', element);
emit('updateproductmodif', element);
}
async function updateFieldsDataToGM(data: any) {
@@ -479,7 +503,7 @@ export default defineComponent({
const sku = myproduct.value.productInfo.sku;
if (!sku) {
throw new Error("SKU non disponibile per il prodotto.");
throw new Error('SKU non disponibile per il prodotto.');
}
// Aggiorna il campo nel database utilizzando setGM_FieldOf_T_Web_Articoli
@@ -491,8 +515,13 @@ export default defineComponent({
console.log(`Record aggiornato con successo. Risultato:`, result);
} catch (error) {
console.error(`Errore durante l'aggiornamento del record:`, error.message);
throw new Error(`Errore durante l'aggiornamento del record: ${error.message}`);
console.error(
`Errore durante l'aggiornamento del record:`,
error.message
);
throw new Error(
`Errore durante l'aggiornamento del record: ${error.message}`
);
} finally {
loading.value = false; // Disattiva lo stato di caricamento
updatetogm.value = false; // Indica che l'aggiornamento è terminato
@@ -503,19 +532,25 @@ export default defineComponent({
}
function updateRecordToGM() {
console.log('myproduct.value.productInfo.catprods', myproduct.value.productInfo.catprods)
console.log(
'myproduct.value.productInfo.catprods',
myproduct.value.productInfo.catprods
);
let mydata = {
ListaArgomenti: products.getArrayidArgomentoByArridCatProds(myproduct.value.productInfo.idCatProds)
}
console.log('devo salvare mydata', mydata)
updateFieldsDataToGM(mydata)
ListaArgomenti: products.getArrayidArgomentoByArridCatProds(
myproduct.value.productInfo.idCatProds
),
};
console.log('devo salvare mydata', mydata);
updateFieldsDataToGM(mydata);
}
async function updateproduct(load?: boolean) {
myproduct.value = await products.getProductById(myproduct.value._id, load)
myproduct.value = await products.getProductById(
myproduct.value._id,
load
);
}
/*async function refreshDataFromGM() {
@@ -535,28 +570,64 @@ export default defineComponent({
async function refreshSingleBookFromGM(options: any) {
if (myproduct.value) {
loading.value = true
await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options })
loading.value = true;
await globalStore
.updateAllBookFromGM_T_Web_Articoli({
sku: myproduct.value.productInfo.sku!,
isbn: myproduct.value.productInfo.code,
...options,
})
.then((ris) => {
if (ris) {
if (ris.error) {
tools.showNegativeNotif($q, ris.error)
tools.showNegativeNotif($q, ris.error);
} else {
updateproduct(false)
updateproduct(false);
// console.log('product AGGIORNATO:', myproduct.value)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'));
}
loading.value = false
loading.value = false;
}
})
.catch((e) => {
console.error('Errore aggiornamento singolo libro:', e);
tools.showNegativeNotif($q, t('dbgm.updateLocalDb_ERROR'));
loading.value = false;
});
}
}
async function scrapingBook(update: boolean, aggiornasoloSeVuoti: boolean) {
const options = {
update,
aggiornasoloSeVuoti,
}
const myparam = { product_id: myproduct.value._id, options };
loading.value = true;
onMounted(mounted)
const dataupdated = await globalStore
.scrapingBook(myparam)
.then((dataupdated) => {
if (dataupdated) {
tools.showPositiveNotif($q, t('dbgm.scrapingOkUpdated'));
}
return dataupdated;
})
.catch((e) => {
console.error('Errore aggiornamento singolo libro:', e);
tools.showNegativeNotif($q, t('dbgm.updateLocalDb_ERROR'));
loading.value = false;
});
if (dataupdated) {
updateproductmodif()
}
loading.value = false;
}
onMounted(mounted);
return {
tools,
@@ -576,7 +647,8 @@ export default defineComponent({
loading,
updateRecordToGM,
refreshSingleBookFromGM,
scrapingBook,
// refreshDataFromGM,
}
}
})
};
},
});

View File

@@ -71,6 +71,8 @@
</q-tab-panel>
</q-tab-panels>
</div>
</q-card-section>
<q-card-actions>
<div class="">
<q-btn
rounded
@@ -80,6 +82,24 @@
label="Riaggiorna da GM"
@click="refreshSingleBookFromGM({usaDBGMLocale: false})"
></q-btn>
<q-btn
v-if="tools.isAdmin()"
rounded
class="q-ma-sm"
color="accent"
icon="fas fa-save"
label="Aggiorna estrapolando dal WEB (solo Vuoti)"
@click="scrapingBook(true, true)"
></q-btn>
<q-btn
v-if="tools.isAdmin()"
rounded
class="q-ma-sm"
color="negative"
icon="fas fa-database"
label="Sovrascrivi estrapolando dal WEB"
@click="scrapingBook(true, false)"
></q-btn>
<q-btn
rounded
class="q-ma-sm"
@@ -90,7 +110,8 @@
@click="updateRecordToGM"
></q-btn>
</div>
</q-card-section>
</q-card-actions>
</q-card>
</template>

View File

@@ -338,10 +338,10 @@ export default defineComponent({
? ` - (${rec.productInfo.authors.name} ${rec.productInfo.authors.surname}) `
: '';
}
if (rec.productInfo.idStatoProdotto) {
if (!productStore.isPubblicatoById(rec.productInfo.idStatoProdotto))
if (rec.productInfo?.idStatoProdotto) {
if (!productStore.isPubblicatoById(rec.productInfo?.idStatoProdotto))
label +=
' (' + productStore.getDescrStatiProdottoByIdStatoProdotto(rec.productInfo.idStatoProdotto || '') + ')';
' (' + productStore.getDescrStatiProdottoByIdStatoProdotto(rec.productInfo?.idStatoProdotto || '') + ')';
}
if (productStore.isEsaurito(rec)) {
label += ' (Attualmente non disponibile)';

View File

@@ -3,19 +3,28 @@
display: flex;
flex-direction: column;
width: 100%;
max-width: 800px; /* Limita la larghezza per schermi grandi */
margin: 0 auto; /* Centra il contenuto */
margin: 0 auto;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* Quando cè la classe two-columns: usa grid 2 colonne */
.table-container.two-columns {
display: grid;
grid-template-columns: 1fr 1fr;
column-gap: 30px; /* distanza tra le colonne */
row-gap: 10px;
padding: 8px;
margin: 0px;
}
/* Stile delle righe della tabella */
.table-row {
display: flex;
align-items: center;
padding: 2px;
padding: 4px;
border-bottom: 1px solid #eee;
}
@@ -27,7 +36,7 @@
/* Stile delle celle */
.table-cell {
flex: 1;
padding: 8px;
padding: 2px;
}
/* Stile specifico per la colonna delle etichette */

View File

@@ -1,5 +1,6 @@
<template>
<div class="table-container">
<div :class="['table-container', { 'two-columns': list.length > 10 }]">
<div
v-for="(myrec, index) in list"
:key="index"