- 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

View File

@@ -1,6 +1,6 @@
{ {
"singleAttributePerLine": true, "singleAttributePerLine": true,
"printWidth": 60, "printWidth": 80,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,

View File

@@ -1,42 +1,53 @@
import type { PropType } from 'vue'; import type { PropType } from 'vue';
import { defineComponent, ref, toRef, computed, watch, onMounted, reactive, onBeforeUnmount } from 'vue' import {
import { useI18n } from 'vue-i18n' defineComponent,
import { useUserStore } from '@store/UserStore' ref,
import { useGlobalStore } from '@store/globalStore' toRef,
import { useQuasar } from 'quasar' computed,
watch,
onMounted,
reactive,
onBeforeUnmount,
} from 'vue';
import { useI18n } from 'vue-i18n';
import { useUserStore } from '@store/UserStore';
import { useGlobalStore } from '@store/globalStore';
import { useQuasar } from 'quasar';
import { CTitleBanner } from '../CTitleBanner' import { CTitleBanner } from '../CTitleBanner';
import { CCardState } from '../CCardState' import { CCardState } from '../CCardState';
import { CCopyBtn } from '../CCopyBtn' import { CCopyBtn } from '../CCopyBtn';
import { CViewTable } from '../CViewTable' import { CViewTable } from '../CViewTable';
import { CMyValueDb } from '../CMyValueDb' import { CMyValueDb } from '../CMyValueDb';
import { CPrice } from '../CPrice' import { CPrice } from '../CPrice';
import { CText } from '../CText' import { CText } from '../CText';
import { CLabel } from '@src/components/CLabel' import { CLabel } from '@src/components/CLabel';
import { CSchedaProdotto } from '@src/components/CSchedaProdotto' import { CSchedaProdotto } from '@src/components/CSchedaProdotto';
import { CModifTrafiletto } from '@src/components/CModifTrafiletto' import { CModifTrafiletto } from '@src/components/CModifTrafiletto';
import { CBarCode } from '../CBarCode' import { CBarCode } from '../CBarCode';
import { CTableCupleLabelValue } from '../CTableCupleLabelValue' import { CTableCupleLabelValue } from '../CTableCupleLabelValue';
import { func_tools, toolsext } from '@store/Modules/toolsext' import { func_tools, toolsext } from '@store/Modules/toolsext';
import type { import type {
IOptCatalogo, IGasordine, IMyScheda, IOrder, IOrderCart, IOptCatalogo,
IProduct, IVariazione, IGasordine,
IRecFields IMyScheda,
IOrder,
IOrderCart,
IProduct,
IVariazione,
IRecFields,
} from '@src/model'; } from '@src/model';
import { import { IBaseOrder } from '@src/model';
IBaseOrder import { tools } from '@tools';
} from '@src/model' import { useProducts } from '@store/Products';
import { tools } from '@tools'
import { useProducts } from '@store/Products'
import { shared_consts } from '@src/common/shared_vuejs' import { shared_consts } from '@src/common/shared_vuejs';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router';
import { costanti } from '@costanti'
import { costanti } from '@costanti';
export default defineComponent({ export default defineComponent({
name: 'CCatalogoCard', name: 'CCatalogoCard',
@@ -65,7 +76,7 @@ export default defineComponent({
options: { options: {
type: Object, type: Object,
required: false, required: false,
default: () => { } default: () => {},
}, },
modelValue: { modelValue: {
type: Object as PropType<IOptCatalogo>, type: Object as PropType<IOptCatalogo>,
@@ -79,63 +90,75 @@ export default defineComponent({
scheda: { scheda: {
type: Object as PropType<IMyScheda>, type: Object as PropType<IMyScheda>,
required: false, required: false,
default: () => ({ default: () => ({}),
}),
}, },
}, },
components: { components: {
CTitleBanner, CCardState, CCopyBtn, CMyValueDb, CPrice, CBarCode, CLabel, CTitleBanner,
CText, CViewTable, CTableCupleLabelValue, CSchedaProdotto, CModifTrafiletto CCardState,
CCopyBtn,
CMyValueDb,
CPrice,
CBarCode,
CLabel,
CText,
CViewTable,
CTableCupleLabelValue,
CSchedaProdotto,
CModifTrafiletto,
}, },
setup(props, { emit }) { setup(props, { emit }) {
const $q = useQuasar() const $q = useQuasar();
const { t } = useI18n() const { t } = useI18n();
const userStore = useUserStore() const userStore = useUserStore();
const globalStore = useGlobalStore() const globalStore = useGlobalStore();
const products = useProducts() const products = useProducts();
const listord = ref(<IOrderCart[]>[]) const listord = ref(<IOrderCart[]>[]);
const sumval = ref(0) const sumval = ref(0);
const loading = ref(false) const loading = ref(false);
const indvariazSel = ref(-1) const indvariazSel = ref(-1);
const site = ref(globalStore.site) const site = ref(globalStore.site);
const arrlistScheda = ref([]) const arrlistScheda = ref([]);
const $router = useRouter();
const $router = useRouter() const fullscreenImage = ref(<any>null);
const fullscreenImage = ref(<any>null) const apriSchedaPDF = ref(false);
const visufromgm = ref(false);
const apriSchedaPDF = ref(false) const visudataextracted = ref(false);
const visufromgm = ref(false) const updatefromgm = ref(false);
const updatefromgm = ref(false) const updatetogm = ref(false);
const updatetogm = ref(false) const showQtaDisponibile = ref(false);
const showQtaDisponibile = ref(false) const field_updated_fromGM = ref('');
const field_updated_fromGM = ref('') const dataextractedWeb = ref('');
// Crea una copia locale reattiva di modelValue // Crea una copia locale reattiva di modelValue
const optcatalogo = ref<IOptCatalogo>({ ...props.modelValue }); const optcatalogo = ref<IOptCatalogo>({ ...props.modelValue });
const editOn = computed({ const editOn = computed({
get(): boolean { get(): boolean {
return globalStore.editOn ? globalStore.editOn : false return globalStore.editOn ? globalStore.editOn : false;
}, },
set(value: boolean) { set(value: boolean) {
return tools.updateEditOn(value) return tools.updateEditOn(value);
} },
}) });
// Watcher per sincronizzare le modifiche di modelValue // Watcher per sincronizzare le modifiche di modelValue
watch(() => props.modelValue, (newVal) => { watch(
() => props.modelValue,
(newVal) => {
optcatalogo.value = { ...newVal }; optcatalogo.value = { ...newVal };
// updateCatalogoPadre() // updateCatalogoPadre()
}, { deep: false }); },
{ deep: false }
);
function updateCatalogoPadre() { function updateCatalogoPadre() {
emit('update:modelValue', optcatalogo.value); emit('update:modelValue', optcatalogo.value);
@@ -144,7 +167,7 @@ export default defineComponent({
// Metodo per aggiornare il valore del catalogo // Metodo per aggiornare il valore del catalogo
const updateCatalogo = (updatedCatalogo: IOptCatalogo) => { const updateCatalogo = (updatedCatalogo: IOptCatalogo) => {
optcatalogo.value = updatedCatalogo; // Aggiorna la copia locale optcatalogo.value = updatedCatalogo; // Aggiorna la copia locale
updateCatalogoPadre() updateCatalogoPadre();
}; };
const myorder = reactive(<IOrder>{ const myorder = reactive(<IOrder>{
@@ -155,69 +178,69 @@ export default defineComponent({
idGasordine: '', idGasordine: '',
storehouse: {}, storehouse: {},
gasordine: { active: false }, gasordine: { active: false },
}) });
const storeSelected = ref('') const storeSelected = ref('');
const arrordersCart = ref(<IOrderCart[]>[]) const arrordersCart = ref(<IOrderCart[]>[]);
const modifOn = ref(false) const modifOn = ref(false);
const modifTrafiletto = ref(false) const modifTrafiletto = ref(false);
const modifProd = ref(false) const modifProd = ref(false);
const timerInterval = ref(<any>null) const timerInterval = ref(<any>null);
const timerLabelScadenza = ref('') const timerLabelScadenza = ref('');
const labelDataRitiro = ref('') const labelDataRitiro = ref('');
const labelDataArrivoMerce = ref('') const labelDataArrivoMerce = ref('');
const openlistorders = ref(false) const openlistorders = ref(false);
const endload = ref(false) const endload = ref(false);
const myproduct = ref(<IProduct | null>{}) const myproduct = ref(<IProduct | null>{});
const isFullScreen = ref(false) const isFullScreen = ref(false);
const imageSrc = ref('URL_DEL_TUO_FILE_IMMAGINE') const imageSrc = ref('URL_DEL_TUO_FILE_IMMAGINE');
const startX = ref(0) const startX = ref(0);
const startY = ref(0) const startY = ref(0);
const scale = ref(1) const scale = ref(1);
const getTesto_Right = computed(() => { const getTesto_Right = computed(() => {
return products.replaceKeyWordsByProduct( return products.replaceKeyWordsByProduct(
optcatalogo.value, optcatalogo.value,
myproduct.value!, myproduct.value!,
props.scheda.testo_right!, props.scheda.testo_right!,
props.idPage, props.idPage
) );
}) });
const getTesto_Right_attaccato = computed(() => { const getTesto_Right_attaccato = computed(() => {
return products.replaceKeyWordsByProduct( return products.replaceKeyWordsByProduct(
optcatalogo.value, optcatalogo.value,
myproduct.value!, myproduct.value!,
props.scheda.testo_right_attaccato!, props.scheda.testo_right_attaccato!,
props.idPage, props.idPage
) );
}) });
const getTesto_Debug = computed(() => { const getTesto_Debug = computed(() => {
return products.replaceKeyWordsByProduct( return products.replaceKeyWordsByProduct(
optcatalogo.value, optcatalogo.value,
myproduct.value!, myproduct.value!,
{ contenuto: '{debug}', maxlength: 10000 }, { contenuto: '{debug}', maxlength: 10000 },
props.idPage, props.idPage
) );
}) });
const getTesto_Bottom = computed(() => { const getTesto_Bottom = computed(() => {
return products.replaceKeyWordsByProduct( return products.replaceKeyWordsByProduct(
optcatalogo.value, optcatalogo.value,
myproduct.value!, myproduct.value!,
props.scheda.testo_bottom!, props.scheda.testo_bottom!,
props.idPage, props.idPage
) );
}) });
watch(() => editOn.value, (to: any, from: any) => {
if (!editOn.value)
ricarica()
})
watch(
() => editOn.value,
(to: any, from: any) => {
if (!editOn.value) ricarica();
}
);
/*const myproduct = computed((): IProduct => { /*const myproduct = computed((): IProduct => {
console.log('getproduct computed') console.log('getproduct computed')
@@ -226,23 +249,26 @@ export default defineComponent({
return ris return ris
})*/ })*/
function iconWhishlist(order: IProduct) { function iconWhishlist(order: IProduct) {
return 'fas fa-heart' return 'fas fa-heart';
} }
async function addtoCart(add: boolean) { async function addtoCart(add: boolean) {
if (!userStore.isLogged) { if (!userStore.isLogged) {
tools.showNeutralNotif($q, t('ecomm.area_personale')) tools.showNeutralNotif($q, t('ecomm.area_personale'));
globalStore.rightDrawerOpen = true globalStore.rightDrawerOpen = true;
return false return false;
} }
if (myproduct.value) { if (myproduct.value) {
const ris = await products.addtoCartBase({ $q, t, id: myproduct.value._id, order: myorder, addqty: add }) const ris = await products.addtoCartBase({
updateproduct(false) $q,
t,
id: myproduct.value._id,
order: myorder,
addqty: add,
});
updateproduct(false);
if (ris && ris.myord) { if (ris && ris.myord) {
} }
} }
} }
@@ -250,179 +276,178 @@ export default defineComponent({
function getnumstore() { function getnumstore() {
if (myproduct.value) { if (myproduct.value) {
if (myproduct.value.storehouses) if (myproduct.value.storehouses)
return myproduct.value.storehouses.length return myproduct.value.storehouses.length;
else else return 0;
return 0
} }
return 0 return 0;
} }
function getSingleStorehouse() { function getSingleStorehouse() {
try { try {
if (!myproduct.value) if (!myproduct.value) return '';
return ''
const mystore = myproduct.value.storehouses[0] const mystore = myproduct.value.storehouses[0];
if (mystore) if (mystore) return mystore.name + ' (' + mystore.city + ')';
return mystore.name + ' (' + mystore.city + ')' else return '';
else
return ''
} catch (e) { } catch (e) {
return '' return '';
} }
} }
function getSingleGasordine(gasordine: IGasordine) { function getSingleGasordine(gasordine: IGasordine) {
try { try {
const mygas = gasordine const mygas = gasordine;
if (mygas) if (mygas)
/*return mygas.name + ' (' + mygas.city + ') ' + t('gas.dataora_chiusura_ordini') + ': ' + tools.getstrDateShort(mygas.dataora_chiusura_ordini) /*return mygas.name + ' (' + mygas.city + ') ' + t('gas.dataora_chiusura_ordini') + ': ' + tools.getstrDateShort(mygas.dataora_chiusura_ordini)
+ ' ' + t('gas.data_arrivo_merce') + ': ' + tools.getstrDateShort(mygas.data_arrivo_merce) + ' ' + t('gas.data_arrivo_merce') + ': ' + tools.getstrDateShort(mygas.data_arrivo_merce)
+ ' ' + t('gas.dataora_ritiro') + ': ' + tools.getstrDateShort(mygas.dataora_ritiro)*/ + ' ' + t('gas.dataora_ritiro') + ': ' + tools.getstrDateShort(mygas.dataora_ritiro)*/
return mygas.name return mygas.name;
else else return '';
return ''
} catch (e) { } catch (e) {
return '' return '';
} }
} }
function initproduct() { function initproduct() {
myorder.quantity = 0;
myorder.quantity = 0 myorder.quantitypreordered = 0;
myorder.quantitypreordered = 0 myorder.idStorehouse = '';
myorder.idStorehouse = '' myorder.idGasordine = '';
myorder.idGasordine = ''
} }
async function updateproduct(atload: boolean, forza?: boolean) { async function updateproduct(atload: boolean, forza?: boolean) {
let carica = true;
let carica = true
if (atload) { if (atload) {
if (props.product) { if (props.product) {
myproduct.value = props.product myproduct.value = props.product;
carica = false carica = false;
} }
} else { } else {
} }
if (carica) { if (carica) {
myproduct.value = null; myproduct.value = null;
updateproductmodif(null, forza) updateproductmodif(null, forza);
} }
// products.updateQuantityAvailable(myproduct.value._id) // products.updateQuantityAvailable(myproduct.value._id)
} }
async function ricarica() { async function ricarica() {
endload.value = false endload.value = false;
if (myproduct.value) { if (myproduct.value) {
const prod = await products.loadProductById(myproduct.value._id) const prod = await products.loadProductById(myproduct.value._id);
if (prod) { if (prod) {
myproduct.value = prod myproduct.value = prod;
} }
} }
await load() await load();
} }
async function updateproductmodif(element: any, forza?: boolean) { async function updateproductmodif(element: any, forza?: boolean) {
console.log('CCATALOGOCARD: updateproductmodif') console.log('CCATALOGOCARD: updateproductmodif');
try { try {
if (element?._id) { if (element?._id) {
myproduct.value = await products.getProductById(element?._id, forza) myproduct.value = await products.getProductById(element?._id, forza);
} else { } else {
myproduct.value = await products.getProductById(props.id, forza) myproduct.value = await products.getProductById(props.id, forza);
} }
updateLabel() updateLabel();
} catch (e) { } catch (e) {
console.error('err', e) console.error('err', e);
} }
} }
function getStorehouses() { function getStorehouses() {
if (!myproduct.value) if (!myproduct.value) return [];
return []
const myarr: any = [] const myarr: any = [];
let ind = 1 let ind = 1;
myproduct.value.storehouses.forEach((store) => { myproduct.value.storehouses.forEach((store) => {
myarr.push( myarr.push({
{
id: ind, id: ind,
label: store.name + ' (' + store.city + ')', label: store.name + ' (' + store.city + ')',
value: store._id value: store._id,
}) });
ind++ ind++;
}) });
// console.log('arraystore', myarr) // console.log('arraystore', myarr)
return myarr return myarr;
} }
function checkifCartDisable() { function checkifCartDisable() {
// return !myorder.idStorehouse // return !myorder.idStorehouse
return isOrdineChiuso() return isOrdineChiuso();
} }
function checkifCartEnable() { function checkifCartEnable() {
return false return false;
} }
function getQtyWarn() { function getQtyWarn() {
if (myorder.quantity > 0) { if (myorder.quantity > 0) {
return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantity }) return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantity });
} }
return '' return '';
} }
function getQtyWarnPreOrdered() { function getQtyWarnPreOrdered() {
if (myorder.quantitypreordered > 0) { if (myorder.quantitypreordered > 0) {
return t('ecomm.di_cui_x_in_carrello', { qty: myorder.quantitypreordered }) return t('ecomm.di_cui_x_in_carrello', {
qty: myorder.quantitypreordered,
});
} }
return '' return '';
} }
watch(() => props.id, async (newval, oldval) => { watch(
() => props.id,
async (newval, oldval) => {
// console.log('change code') // console.log('change code')
await load() await load();
}) }
);
watch(() => storeSelected.value, (newval, oldval) => { watch(
myorder.idStorehouse = newval () => storeSelected.value,
}) (newval, oldval) => {
myorder.idStorehouse = newval;
}
);
function updateLabel() { function updateLabel() {
let dataArrivoMerce = '' let dataArrivoMerce = '';
let dataRitiro = '' let dataRitiro = '';
try { try {
if (myproduct.value && myproduct.value.gasordine) { if (myproduct.value && myproduct.value.gasordine) {
if (myproduct.value.gasordine.data_arrivo_merce) if (myproduct.value.gasordine.data_arrivo_merce)
dataArrivoMerce = tools.getstrDateShort(myproduct.value.gasordine.data_arrivo_merce) dataArrivoMerce = tools.getstrDateShort(
myproduct.value.gasordine.data_arrivo_merce
);
if (myproduct.value.gasordine.dataora_ritiro) if (myproduct.value.gasordine.dataora_ritiro)
dataRitiro = tools.getstrDateTime(myproduct.value.gasordine.dataora_ritiro) dataRitiro = tools.getstrDateTime(
myproduct.value.gasordine.dataora_ritiro
);
} else { } else {
dataArrivoMerce = '' dataArrivoMerce = '';
dataRitiro = '' dataRitiro = '';
}
} catch (e) {
} }
} catch (e) {}
if (labelDataArrivoMerce.value !== dataArrivoMerce) if (labelDataArrivoMerce.value !== dataArrivoMerce)
labelDataArrivoMerce.value = dataArrivoMerce labelDataArrivoMerce.value = dataArrivoMerce;
if (labelDataRitiro.value !== dataRitiro) if (labelDataRitiro.value !== dataRitiro)
labelDataRitiro.value = dataRitiro labelDataRitiro.value = dataRitiro;
updateTimerLabel() updateTimerLabel();
} }
async function mounted() { async function mounted() {
await load() await load();
// Start the timer when the component is mounted // Start the timer when the component is mounted
startTimer(); startTimer();
@@ -434,18 +459,28 @@ export default defineComponent({
} }
function updateTimerLabel() { function updateTimerLabel() {
if (myproduct.value && (myproduct.value.gasordine && myproduct.value.gasordine._id && myproduct.value.gasordine.dataora_chiusura_ordini)) if (
timerLabelScadenza.value = tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini) myproduct.value &&
else myproduct.value.gasordine &&
timerLabelScadenza.value = '' myproduct.value.gasordine._id &&
myproduct.value.gasordine.dataora_chiusura_ordini
)
timerLabelScadenza.value = tools.getCountDown(
myproduct.value.gasordine.dataora_chiusura_ordini
);
else timerLabelScadenza.value = '';
} }
function isOrdineChiuso() { function isOrdineChiuso() {
if (myproduct.value) { if (myproduct.value) {
return myproduct.value.gasordine && myproduct.value.gasordine.dataora_chiusura_ordini && return (
tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini) === '' myproduct.value.gasordine &&
} else myproduct.value.gasordine.dataora_chiusura_ordini &&
return false tools.getCountDown(
myproduct.value.gasordine.dataora_chiusura_ordini
) === ''
);
} else return false;
} }
function startTimer() { function startTimer() {
@@ -454,93 +489,112 @@ export default defineComponent({
} }
async function load() { async function load() {
indvariazSel.value = -1 indvariazSel.value = -1;
initproduct() initproduct();
await updateproduct(true, true) await updateproduct(true, true);
labelDataArrivoMerce.value = '' labelDataArrivoMerce.value = '';
labelDataRitiro.value = '' labelDataRitiro.value = '';
// console.log('Load', myproduct.value.name) // console.log('Load', myproduct.value.name)
if (myproduct.value) { if (myproduct.value) {
arrordersCart.value = products.getOrdersCartInAttesaByIdProduct(myproduct.value._id) arrordersCart.value = products.getOrdersCartInAttesaByIdProduct(
myproduct.value._id
);
if (myproduct.value.storehouses && myproduct.value.storehouses.length === 1) { if (
myproduct.value.storehouses &&
myproduct.value.storehouses.length === 1
) {
// Se solo 1 presente, metto fisso l'unico negozio ! // Se solo 1 presente, metto fisso l'unico negozio !
myorder.idStorehouse = myproduct.value.storehouses[0]._id myorder.idStorehouse = myproduct.value.storehouses[0]._id;
} }
if (myproduct.value.gasordine) { if (myproduct.value.gasordine) {
myorder.idGasordine = myproduct.value.gasordine._id myorder.idGasordine = myproduct.value.gasordine._id;
} }
const ord = products.getOrderProductInCart(myproduct.value._id) const ord = products.getOrderProductInCart(myproduct.value._id);
if (ord) { if (ord) {
myorder.quantity = ord.quantity myorder.quantity = ord.quantity;
myorder.quantitypreordered = ord.quantitypreordered myorder.quantitypreordered = ord.quantitypreordered;
// Seleziona il Negozio che avevo già scelto nell'ordine ! // Seleziona il Negozio che avevo già scelto nell'ordine !
if (ord.idStorehouse) if (ord.idStorehouse) storeSelected.value = ord.idStorehouse;
storeSelected.value = ord.idStorehouse
} }
} }
updateLabel() updateLabel();
// console.log('myproduct', myproduct.value, 'arrvariaz', myproduct.value.arrvariazioni, 'compl', props.complete) // console.log('myproduct', myproduct.value, 'arrvariaz', myproduct.value.arrvariazioni, 'compl', props.complete)
if (props.complete && myproduct.value && myproduct.value.arrvariazioni) { if (props.complete && myproduct.value && myproduct.value.arrvariazioni) {
// console.log('ENTRATO') // console.log('ENTRATO')
indvariazSel.value = 0 indvariazSel.value = 0;
} }
// console.log('°°° ENDLOAD °°°') // console.log('°°° ENDLOAD °°°')
endload.value = true endload.value = true;
} }
function getclimgproduct() { function getclimgproduct() {
return 'myimgproduct centermydiv' return 'myimgproduct centermydiv';
} }
function visuListDisponibili() { function visuListDisponibili() {
if (myproduct.value) { if (myproduct.value) {
openlistorders.value = true openlistorders.value = true;
sumval.value = products.getSumQtyOrderProductInOrdersCart(myproduct.value._id) sumval.value = products.getSumQtyOrderProductInOrdersCart(
myproduct.value._id
);
listord.value = arrordersCart.value.filter((orderscart: IOrderCart) => orderscart.items!.reduce((accumulator, item) => { listord.value = arrordersCart.value.filter((orderscart: IOrderCart) =>
return accumulator + item.order.quantity orderscart.items!.reduce((accumulator, item) => {
}, 0)) return accumulator + item.order.quantity;
} else }, 0)
return false );
} else return false;
} }
function visuListBookable() { function visuListBookable() {
if (myproduct.value) { if (myproduct.value) {
openlistorders.value = true openlistorders.value = true;
sumval.value = products.getSumQtyPreOrderInOrdersCart(myproduct.value._id) sumval.value = products.getSumQtyPreOrderInOrdersCart(
myproduct.value._id
);
listord.value = arrordersCart.value.filter((orderscart: IOrderCart) => orderscart.items!.reduce((accumulator, item) => { listord.value = arrordersCart.value.filter((orderscart: IOrderCart) =>
return accumulator + item.order.quantitypreordered orderscart.items!.reduce((accumulator, item) => {
}, 0)) return accumulator + item.order.quantitypreordered;
}, 0)
);
} else { } else {
return '' return '';
} }
} }
function isOrdGas(): boolean { function isOrdGas(): boolean {
if (myproduct.value) if (myproduct.value)
return (myproduct.value && !!myproduct.value.idGasordine && myproduct.value.gasordine! && myproduct.value.gasordine.active) return (
else myproduct.value &&
return false !!myproduct.value.idGasordine &&
myproduct.value.gasordine! &&
myproduct.value.gasordine.active
);
else return false;
} }
function getpercqtaraggiunta(): number { function getpercqtaraggiunta(): number {
if (myproduct.value) if (myproduct.value)
return tools.calcperc((myproduct.value.bookableGASBloccatiQty + myproduct.value.QuantitaPrenotateInAttesa!) * myproduct.value.productInfo.weight!, myproduct.value.qtyToReachForGas * myproduct.value.productInfo.weight!) / 100 return (
else tools.calcperc(
return 0 (myproduct.value.bookableGASBloccatiQty +
myproduct.value.QuantitaPrenotateInAttesa!) *
myproduct.value.productInfo.weight!,
myproduct.value.qtyToReachForGas *
myproduct.value.productInfo.weight!
) / 100
);
else return 0;
} }
function toggleFullScreen() { function toggleFullScreen() {
@@ -579,34 +633,35 @@ export default defineComponent({
} }
function naviga(path: string) { function naviga(path: string) {
$router.push(path) $router.push(path);
} }
function setvariazioneSelected(indvariaz: number) { function setvariazioneSelected(indvariaz: number) {
if (indvariazSel.value === indvariaz) if (indvariazSel.value === indvariaz) indvariazSel.value = -1;
indvariazSel.value = -1
else { else {
indvariazSel.value = -1 indvariazSel.value = -1;
indvariazSel.value = indvariaz indvariazSel.value = indvariaz;
} }
} }
function click_author(id: any, autore: any) { function click_author(id: any, autore: any) {
emit('selauthor', id, autore) emit('selauthor', id, autore);
} }
function click_opendetail() { function click_opendetail() {
if (!optcatalogo.value.pdf) if (!optcatalogo.value.pdf) emit('opendetail');
emit('opendetail')
} }
function escludiArticolo(variazione: IVariazione) { function escludiArticolo(variazione: IVariazione) {
const hasExcludeProductTypes = !optcatalogo.value.excludeproductTypes || (optcatalogo.value.excludeproductTypes && (optcatalogo.value.excludeproductTypes.includes(variazione.versione!))) const hasExcludeProductTypes =
!optcatalogo.value.excludeproductTypes ||
(optcatalogo.value.excludeproductTypes &&
optcatalogo.value.excludeproductTypes.includes(variazione.versione!));
return hasExcludeProductTypes return hasExcludeProductTypes;
} }
function checkIfVariazioneDaVisu(variazione: IVariazione) { function checkIfVariazioneDaVisu(variazione: IVariazione) {
return !escludiArticolo(variazione) return !escludiArticolo(variazione);
} }
function isProductNovita() { function isProductNovita() {
@@ -624,27 +679,25 @@ export default defineComponent({
return publishingDate > monthsAgoDate; return publishingDate > monthsAgoDate;
} }
function isProductBestseller() { function isProductBestseller() {
try { try {
if (props.scheda.etichette?.bestseller?.show) { if (props.scheda.etichette?.bestseller?.show) {
// diventa un bestseller quando il numero di fatturati Annuali è superiore a // diventa un bestseller quando il numero di fatturati Annuali è superiore a
const numfatturati = props.scheda.etichette?.bestseller?.quantiFattRaggiunti ?? 50; const numfatturati =
props.scheda.etichette?.bestseller?.quantiFattRaggiunti ?? 50;
return myproduct.value!.productInfo.fatLast6M > numfatturati return myproduct.value!.productInfo.fatLast6M > numfatturati;
} }
} catch (e) { } catch (e) {
return false return false;
} }
return false return false;
} }
function getScale() { function getScale() {
if (optcatalogo.value.printable) if (optcatalogo.value.printable)
return optcatalogo.value.areadistampa!.scale_printable return optcatalogo.value.areadistampa!.scale_printable;
else else return optcatalogo.value.areadistampa!.scale;
return optcatalogo.value.areadistampa!.scale
} }
/*async function refreshDataFromGM() { /*async function refreshDataFromGM() {
@@ -685,38 +738,91 @@ export default defineComponent({
async function refreshSingleBookFromGM(options: any) { async function refreshSingleBookFromGM(options: any) {
if (myproduct.value) { if (myproduct.value) {
loading.value = true loading.value = true;
updatefromgm.value = true updatefromgm.value = true;
field_updated_fromGM.value = '' field_updated_fromGM.value = '';
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options }) const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({
sku: myproduct.value.productInfo.sku!,
isbn: myproduct.value.productInfo.code,
...options,
});
if (ris) { if (ris) {
// field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
if (ris.error) { if (ris.error) {
tools.showNegativeNotif($q, ris.error) tools.showNegativeNotif($q, ris.error);
} else { } else {
await updateproduct(false, false);
await updateproduct(false, false) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'));
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
} }
updatefromgm.value = false updatefromgm.value = false;
} }
loading.value = false loading.value = false;
} }
} }
async function refreshFieldFromGM(field: string) { async function refreshFieldFromGM(field: string) {
if (myproduct.value) { if (myproduct.value) {
loading.value = true loading.value = true;
updatefromgm.value = true updatefromgm.value = true;
field_updated_fromGM.value = '' field_updated_fromGM.value = '';
field_updated_fromGM.value = await globalStore.getGM_FieldOf_T_Web_Articoli(myproduct.value.productInfo.sku!, field, shared_consts.CmdQueryMs.GET) field_updated_fromGM.value =
loading.value = false await globalStore.getGM_FieldOf_T_Web_Articoli(
myproduct.value.productInfo.sku!,
field,
shared_consts.CmdQueryMs.GET
);
loading.value = false;
} }
} }
onMounted(mounted) async function scrapingBook(update: boolean, aggiornasoloSeVuoti: boolean) {
onBeforeUnmount(beforeDestroy) const options = {
update,
aggiornasoloSeVuoti,
};
const myparam = { product_id: myproduct.value._id, options };
loading.value = true;
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;
});
loading.value = false;
return dataupdated;
}
async function getDataExtracted() {
visudataextracted.value = true;
loading.value = true;
dataextractedWeb.value = '... caricamento in corso...';
try {
const data = await scrapingBook(false);
const html = tools.generateHtmlTableFromObject(data);
dataextractedWeb.value = html;
} catch (error) {
console.error('Errore durante l\'estrazione dei dati:', error);
dataextractedWeb.value = 'Errore nel caricamento dei dati.';
} finally {
loading.value = false;
}
}
onMounted(mounted);
onBeforeUnmount(beforeDestroy);
return { return {
visuListDisponibili, visuListDisponibili,
@@ -783,16 +889,19 @@ export default defineComponent({
updateCatalogo, updateCatalogo,
optcatalogo, optcatalogo,
visufromgm, visufromgm,
visudataextracted,
updatefromgm, updatefromgm,
showQtaDisponibile, showQtaDisponibile,
field_updated_fromGM, field_updated_fromGM,
refreshFieldFromGM, refreshFieldFromGM,
updatetogm, updatetogm,
dataextractedWeb,
// refreshDataFromGM, // refreshDataFromGM,
// refreshAllDataBookFromGM, // refreshAllDataBookFromGM,
refreshSingleBookFromGM, refreshSingleBookFromGM,
loading, loading,
modifTrafiletto, modifTrafiletto,
} getDataExtracted,
} };
}) },
});

View File

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

View File

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

View File

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

View File

@@ -71,6 +71,8 @@
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</div> </div>
</q-card-section>
<q-card-actions>
<div class=""> <div class="">
<q-btn <q-btn
rounded rounded
@@ -80,6 +82,24 @@
label="Riaggiorna da GM" label="Riaggiorna da GM"
@click="refreshSingleBookFromGM({usaDBGMLocale: false})" @click="refreshSingleBookFromGM({usaDBGMLocale: false})"
></q-btn> ></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 <q-btn
rounded rounded
class="q-ma-sm" class="q-ma-sm"
@@ -90,7 +110,8 @@
@click="updateRecordToGM" @click="updateRecordToGM"
></q-btn> ></q-btn>
</div> </div>
</q-card-section>
</q-card-actions>
</q-card> </q-card>
</template> </template>

View File

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

View File

@@ -3,19 +3,28 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
max-width: 800px; /* Limita la larghezza per schermi grandi */ margin: 0 auto;
margin: 0 auto; /* Centra il contenuto */
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 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 */ /* Stile delle righe della tabella */
.table-row { .table-row {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 2px; padding: 4px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
@@ -27,7 +36,7 @@
/* Stile delle celle */ /* Stile delle celle */
.table-cell { .table-cell {
flex: 1; flex: 1;
padding: 8px; padding: 2px;
} }
/* Stile specifico per la colonna delle etichette */ /* Stile specifico per la colonna delle etichette */

View File

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

View File

@@ -98,6 +98,7 @@ export interface IVariazione {
addtocart_link?: string addtocart_link?: string
eta?: string eta?: string
validaprod?: IValidaProd validaprod?: IValidaProd
scraped?: boolean
} }
export interface IAuthor { export interface IAuthor {

View File

@@ -1906,8 +1906,9 @@ const msg_it = {
code_o_text_search: 'Inserisci il codice o il testo da cercare', code_o_text_search: 'Inserisci il codice o il testo da cercare',
code_add_to_cart: 'Aggiungi un codice al carrello', code_add_to_cart: 'Aggiungi un codice al carrello',
qta_prenotate_in_attesa: '(Preordinate In attesa {qty})', qta_prenotate_in_attesa: '(Preordinate In attesa {qty})',
prodotti_trovati: 'Trovati {qta} su {qtatot}', prodotti_trovati: 'Trovati {qta}{qtatot}',
prodotti_trovati_qta: 'Trovati {qta}', prodotti_trovati_qta: 'Trovati {qta}',
su: 'su',
bloccati: 'Bloccati', bloccati: 'Bloccati',
bookedGASQtyOrdered: 'Prenotate', bookedGASQtyOrdered: 'Prenotate',
bookedGASQtyOrdered_str: 'Prenotati {qta} su {qtatot} {unit}', bookedGASQtyOrdered_str: 'Prenotati {qta} su {qtatot} {unit}',
@@ -2070,7 +2071,9 @@ const msg_it = {
}, },
dbgm: { dbgm: {
updateLocalDb_OK: 'DB Aggiornato', updateLocalDb_OK: 'Dati Aggiornati in locale',
updateLocalDb_ERROR: 'Errore aggiornamento singolo libro',
scrapingOkUpdated: 'Dati Aggiornati prelevando dal Web',
}, },
queryai: { queryai: {

View File

@@ -2841,6 +2841,7 @@ export const colTableProducts = [
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'validaprod', label_trans: 'products.validaprod', fieldtype: costanti.FieldType.verifica }), AddCol({ name: 'validaprod', label_trans: 'products.validaprod', fieldtype: costanti.FieldType.verifica }),
AddCol({ name: 'scraped', label_trans: 'products.scraped', fieldtype: costanti.FieldType.boolean }),
AddCol(DeleteRec), AddCol(DeleteRec),
AddCol(DuplicateRec), AddCol(DuplicateRec),
] ]

View File

@@ -10020,6 +10020,24 @@ export const tools = {
return addstr; return addstr;
}, },
generateHtmlTableFromObject(obj: object) {
if (!obj || typeof obj !== 'object') return '';
let html = '<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse;">';
html += '<thead><tr><th>Chiave</th><th>Valore</th></tr></thead><tbody>';
for (const [key, value] of Object.entries(obj)) {
// Se il valore è un oggetto o array, lo converto in JSON stringa
const displayValue = value && typeof value === 'object' ? JSON.stringify(value) : String(value);
html += `<tr><td>${key}</td><td>${displayValue}</td></tr>`;
}
html += '</tbody></table>';
return html;
},
// FINE ! // FINE !

View File

@@ -1815,7 +1815,7 @@ export const useProducts = defineStore('Products', {
break; break;
case '{stato}': case '{stato}':
replacements[key] = this.getDescrStatiProdottoByIdStatoProdotto( replacements[key] = this.getDescrStatiProdottoByIdStatoProdotto(
myproduct.productInfo.idStatoProdotto || '' myproduct.productInfo?.idStatoProdotto || ''
); );
break; break;
case '{scale}': case '{scale}':

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,17 @@
<template> <template>
<q-page> <q-page>
<div class="text-center"> <div class="text-center">
<q-spinner v-if="!loadpage" color="primary" size="3em" :thickness="2" /> <q-spinner
v-if="!loadpage"
color="primary"
size="3em"
:thickness="2"
/>
</div> </div>
<div v-if="loadpage" class="panel"> <div
v-if="loadpage"
class="panel"
>
<div> <div>
<div class="text-center"> <div class="text-center">
<CSelectUserActive></CSelectUserActive> <CSelectUserActive></CSelectUserActive>
@@ -16,9 +24,18 @@
dense dense
toggle-color="purple" toggle-color="purple"
:options="[ :options="[
{ value: shared_consts.PROD.TUTTI, slot: 'tutti' }, {
{ value: shared_consts.PROD.BOTTEGA, slot: 'bottega' }, value: shared_consts.PROD.TUTTI,
{ value: shared_consts.PROD.GAS, slot: 'gas' }, slot: 'tutti',
},
{
value: shared_consts.PROD.BOTTEGA,
slot: 'bottega',
},
{
value: shared_consts.PROD.GAS,
slot: 'gas',
},
]" ]"
> >
<template v-slot:tutti> <template v-slot:tutti>
@@ -26,7 +43,10 @@
<div class="text-center"> <div class="text-center">
{{ t('ecomm.tutti') }} {{ t('ecomm.tutti') }}
</div> </div>
<q-icon right name="fas fa-user-friends" /> <q-icon
right
name="fas fa-user-friends"
/>
</div> </div>
</template> </template>
@@ -41,7 +61,10 @@
}) })
}} }}
</div> </div>
<q-icon right name="fas fa-user-friends" /> <q-icon
right
name="fas fa-user-friends"
/>
</div> </div>
</template> </template>
@@ -56,7 +79,10 @@
}) })
}} }}
</div> </div>
<q-icon right name="fas fa-store" /> <q-icon
right
name="fas fa-store"
/>
</div> </div>
</template> </template>
</q-btn-toggle> </q-btn-toggle>
@@ -82,15 +108,24 @@
</template> </template>
</q-input> </q-input>
</div> </div>
<div class="row q-gutter-xs justify-center q-mx-auto"> <div
<div v-for="(reccat, index) in getCatProds()" :key="index"> class="row q-gutter-xs justify-center q-mx-auto"
>
<div
v-for="(reccat, index) in getCatProds()"
:key="index"
>
<q-btn <q-btn
:push="cat === reccat.value" :push="cat === reccat.value"
dense dense
:size="tools.isMobile() ? '0.70rem' : '1rem'" :size="tools.isMobile() ? '0.70rem' : '1rem'"
:icon="reccat.icon ? reccat.icon : undefined" :icon="reccat.icon ? reccat.icon : undefined"
:color="cat === reccat.value ? 'primary' : undefined" :color="
:text-color="cat === reccat.value ? 'white' : 'black'" cat === reccat.value ? 'primary' : undefined
"
:text-color="
cat === reccat.value ? 'white' : 'black'
"
rounded rounded
:label="reccat.label" :label="reccat.label"
@click="cat = reccat.value" @click="cat = reccat.value"
@@ -101,10 +136,13 @@
<div class="text-center q-py-sm prod_trov"> <div class="text-center q-py-sm prod_trov">
{{ {{
t('ecomm.prodotti_trovati', { t('ecomm.prodotti_trovati', {
qta: getArrProducts.length, qta: arrProducts.length,
qtatot: productStore.getNumProdTot(), qtatot:
productStore.getNumProdTot() > 0
? ` ${t('ecomm.su')} ${productStore.getNumProdTot()}`
: '',
}) })
}}{{}} }}
</div> </div>
<div class="row justify-around"> <div class="row justify-around">
<div <div
@@ -112,7 +150,11 @@
v-for="(product, index) in getArrProducts" v-for="(product, index) in getArrProducts"
:key="index" :key="index"
> >
<CProductCard :id="product._id" :complete="false" :cosa="cosa" /> <CProductCard
:id="product._id"
:complete="false"
:cosa="cosa"
/>
</div> </div>
</div> </div>
</div> </div>
@@ -120,8 +162,7 @@
</q-page> </q-page>
</template> </template>
<script lang="ts" src="./cash.ts"> <script lang="ts" src="./cash.ts"></script>
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './cash'; @import './cash';

View File

@@ -8,10 +8,15 @@
{{ getTitoloCatalogo() }} {{ getTitoloCatalogo() }}
</div> </div>
<div <div
v-if="ispageCatalogata && (tools.isEditor() || tools.isCommerciale()) && myCatalog?.referenti?.length > 0" v-if="
ispageCatalogata &&
(tools.isEditor() || tools.isCommerciale()) &&
myCatalog?.referenti?.length > 0
"
class="text-h7 text-center text-red q-ma-sm" class="text-h7 text-center text-red q-ma-sm"
> >
{{ $t('cataloglist.referenti') }}: <span class="text-bold">{{ getReferentiCatalogo() }}</span> {{ $t('cataloglist.referenti') }}:
<span class="text-bold">{{ getReferentiCatalogo() }}</span>
</div> </div>
<q-tabs <q-tabs
v-model="tabcatalogo" v-model="tabcatalogo"
@@ -103,7 +108,9 @@
v-for="(reccat, index) in getCatProds()" v-for="(reccat, index) in getCatProds()"
:key="index" :key="index"
class="category" class="category"
:class="{ category_sel: cat === reccat.value }" :class="{
category_sel: cat === reccat.value,
}"
@click="cat = reccat.value" @click="cat = reccat.value"
> >
{{ reccat.label }} {{ reccat.label }}
@@ -117,7 +124,9 @@
v-for="(reccollana, index) in getCollane()" v-for="(reccollana, index) in getCollane()"
:key="index" :key="index"
class="category" class="category"
:class="{ category_sel: collana === reccollana.value }" :class="{
category_sel: collana === reccollana.value,
}"
@click="collana = reccollana.value" @click="collana = reccollana.value"
> >
{{ reccollana.label }} {{ reccollana.label }}
@@ -130,7 +139,9 @@
class="text-center q-py-sm prod_trov" class="text-center q-py-sm prod_trov"
> >
<div <div
v-if="cat === '' && arrProducts.length === 0 && showListaFiltrata" v-if="
cat === '' && arrProducts.length === 0 && showListaFiltrata
"
class="row justify-center text-h6" class="row justify-center text-h6"
> >
Seleziona {{ filtroStrApplicato }} Seleziona {{ filtroStrApplicato }}
@@ -139,18 +150,14 @@
v-else v-else
v-show="productStore.getNumProdTot() !== arrProducts.length" v-show="productStore.getNumProdTot() !== arrProducts.length"
> >
<span v-if="productStore.getNumProdTot()" <span>
>{{ {{
t('ecomm.prodotti_trovati', { t('ecomm.prodotti_trovati', {
qta: arrProducts.length, qta: arrProducts.length,
qtatot: productStore.getNumProdTot(), qtatot:
}) productStore.getNumProdTot() > 0
}} ? ` ${t('ecomm.su')} ${productStore.getNumProdTot()}`
</span> : '',
<span v-else>
{{
t('ecomm.prodotti_trovati_qta', {
qta: arrProducts.length,
}) })
}} }}
</span> </span>
@@ -171,7 +178,7 @@
</q-inner-loading> </q-inner-loading>
<q-btn <q-btn
v-if="!showListaFiltrata" v-if="!showListaFiltrata && tools.is"
rounded rounded
icon="fas fa-redo" icon="fas fa-redo"
label="Rigenera Lista" label="Rigenera Lista"
@@ -325,7 +332,9 @@
class="row justify-center" class="row justify-center"
> >
<q-btn <q-btn
v-if="optcatalogo.pdf && !optcatalogo.generazionePDFInCorso" v-if="
optcatalogo.pdf && !optcatalogo.generazionePDFInCorso
"
:label="`1) PREPARA PDF`" :label="`1) PREPARA PDF`"
@click="preparePDF" @click="preparePDF"
></q-btn> ></q-btn>
@@ -335,7 +344,9 @@
@click="terminaPDF" @click="terminaPDF"
></q-btn> ></q-btn>
<q-btn <q-btn
v-if="optcatalogo.pdf && optcatalogo.generazionePDFInCorso" v-if="
optcatalogo.pdf && optcatalogo.generazionePDFInCorso
"
:label="`2) Genera PDF ` + getPdfFilename()" :label="`2) Genera PDF ` + getPdfFilename()"
@click="generatePDF()" @click="generatePDF()"
color="positive" color="positive"
@@ -353,7 +364,9 @@
v-if="myCatalog.pdf_generato" v-if="myCatalog.pdf_generato"
class="bg-green-1 q-ma-sm q-pa-sm" class="bg-green-1 q-ma-sm q-pa-sm"
> >
<div class="bg-blue-1 text-red text-bold text-h6 q-ma-sm q-pa-sm"> <div
class="bg-blue-1 text-red text-bold text-h6 q-ma-sm q-pa-sm"
>
<strong>PDF generati Temporanei</strong> <strong>PDF generati Temporanei</strong>
</div> </div>
@@ -400,18 +413,26 @@
</q-table> </q-table>
<div class="bg-red-1 q-pa-md q-mt-md"> <div class="bg-red-1 q-pa-md q-mt-md">
<div class="bg-blue-1 text-green text-bold text-h6 q-ma-sm q-pa-sm"> <div
class="bg-blue-1 text-green text-bold text-h6 q-ma-sm q-pa-sm"
>
<strong>PDF Pubblicati OnLine</strong> <strong>PDF Pubblicati OnLine</strong>
</div> </div>
<table class="q-table q-table--flat q-table--dense q-ma-none q-pa-none"> <table
class="q-table q-table--flat q-table--dense q-ma-none q-pa-none"
>
<tbody> <tbody>
<tr> <tr>
<td><strong>PDF OnLine:</strong></td> <td>
<strong>PDF OnLine:</strong>
</td>
<td> <td>
<a <a
v-if="myCatalog.pdf_online" v-if="myCatalog.pdf_online"
:href="tools.getHost() + myCatalog.pdf_online" :href="
tools.getHost() + myCatalog.pdf_online
"
target="_blank" target="_blank"
class="text-bold" class="text-bold"
> >
@@ -419,22 +440,40 @@
</a> </a>
<span v-else>-</span> <span v-else>-</span>
</td> </td>
<td>{{ tools.getstrDateTime(myCatalog.data_online) }}</td> <td>
{{
tools.getstrDateTime(myCatalog.data_online)
}}
</td>
</tr> </tr>
<tr> <tr>
<td><strong>PDF OnLine Stampa:</strong></td> <td>
<strong>PDF OnLine Stampa:</strong>
</td>
<td> <td>
<a <a
v-if="myCatalog.pdf_online_stampa" v-if="myCatalog.pdf_online_stampa"
:href="tools.getHost() + myCatalog.pdf_online_stampa" :href="
tools.getHost() +
myCatalog.pdf_online_stampa
"
target="_blank" target="_blank"
class="text-bold" class="text-bold"
> >
{{ tools.getHost() + myCatalog.pdf_online_stampa }} {{
tools.getHost() +
myCatalog.pdf_online_stampa
}}
</a> </a>
<span v-else>-</span> <span v-else>-</span>
</td> </td>
<td>{{ tools.getstrDateTime(myCatalog.data_online_stampa) }}</td> <td>
{{
tools.getstrDateTime(
myCatalog.data_online_stampa
)
}}
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -463,7 +502,9 @@
v-for="(reccat, index) in getCatProds()" v-for="(reccat, index) in getCatProds()"
:key="index" :key="index"
class="category" class="category"
:class="{ category_sel: cat === reccat.value }" :class="{
category_sel: cat === reccat.value,
}"
@click="cat = reccat.value" @click="cat = reccat.value"
> >
{{ reccat.label }} {{ reccat.label }}
@@ -477,7 +518,9 @@
v-for="(reccollana, index) in getCollane()" v-for="(reccollana, index) in getCollane()"
:key="index" :key="index"
class="category" class="category"
:class="{ category_sel: collana === reccollana.value }" :class="{
category_sel: collana === reccollana.value,
}"
@click="collana = reccollana.value" @click="collana = reccollana.value"
> >
{{ reccollana.label }} {{ reccollana.label }}
@@ -544,15 +587,26 @@
<CMySelect <CMySelect
:col="fieldsTable.getColByColumns(mycolumns, item.key)" :col="fieldsTable.getColByColumns(mycolumns, item.key)"
v-if=" v-if="
item.type === costanti.FieldType.select || item.type === costanti.FieldType.select_by_server item.type === costanti.FieldType.select ||
item.type === costanti.FieldType.select_by_server
"
:label="
item.value && item.value._id > 0
? undefined
: labelcombo(item)
" "
:label="item.value && item.value._id > 0 ? undefined : labelcombo(item)"
v-model:value="item.value" v-model:value="item.value"
:addall="item.addall" :addall="item.addall"
:addnone="item.addnone" :addnone="item.addnone"
:addlast="true" :addlast="true"
:tablesel="item.type === costanti.FieldType.select_by_server ? item.tablesel : ''" :tablesel="
:pickup="item.type === costanti.FieldType.select_by_server" item.type === costanti.FieldType.select_by_server
? item.tablesel
: ''
"
:pickup="
item.type === costanti.FieldType.select_by_server
"
:label-color="$q.dark.isActive ? 'white' : 'black'" :label-color="$q.dark.isActive ? 'white' : 'black'"
myclass="comboselector" myclass="comboselector"
color="primary" color="primary"
@@ -564,7 +618,10 @@
:filter="item.filter" :filter="item.filter"
:filter_extra="item.filter_extra" :filter_extra="item.filter_extra"
style="font-size: 0.8rem !important" style="font-size: 0.8rem !important"
:useinput="item.useinput && item.type !== costanti.FieldType.select_by_server" :useinput="
item.useinput &&
item.type !== costanti.FieldType.select_by_server
"
> >
</CMySelect> </CMySelect>
</div> </div>
@@ -601,7 +658,11 @@
<div class="text-center q-py-sm prod_trov"> <div class="text-center q-py-sm prod_trov">
<div <div
v-if="cat === '' && arrProducts.length === 0 && showListaFiltrata" v-if="
cat === '' &&
arrProducts.length === 0 &&
showListaFiltrata
"
class="row justify-center text-h6" class="row justify-center text-h6"
> >
Seleziona {{ filtroStrApplicato }} Seleziona {{ filtroStrApplicato }}
@@ -609,13 +670,17 @@
<span <span
v-else v-else
v-show="productStore.getNumProdTot() !== arrProducts.length" v-show="productStore.getNumProdTot() !== arrProducts.length"
>{{ >
{{
t('ecomm.prodotti_trovati', { t('ecomm.prodotti_trovati', {
qta: arrProducts.length, qta: arrProducts.length,
qtatot: productStore.getNumProdTot(), qtatot:
productStore.getNumProdTot() > 0
? ` ${t('ecomm.su')} ${productStore.getNumProdTot()}`
: '',
}) })
}}</span }}
> </span>
</div> </div>
<div <div
class="row justify-around" class="row justify-around"
@@ -644,14 +709,26 @@
optcatalogo.first_page.text_html && optcatalogo.first_page.text_html &&
optcatalogo.first_page.text_html.contenuto optcatalogo.first_page.text_html.contenuto
" "
:style="generateStyleByPageDim(optcatalogo, optcatalogo.first_page)" :style="
generateStyleByPageDim(
optcatalogo,
optcatalogo.first_page
)
"
> >
<div v-html="optcatalogo.first_page.text_html.contenuto"></div> <div
v-html="optcatalogo.first_page.text_html.contenuto"
></div>
</div> </div>
<div :style="generateStyleCatalogo(optcatalogo)"> <div :style="generateStyleCatalogo(optcatalogo)">
<div class="flex-container-book"> <div class="flex-container-book">
<q-infinite-scroll <q-infinite-scroll
v-if="!optcatalogo.pdf && arrLoaded && arrLoaded.length > 0 && !ismounting" v-if="
!optcatalogo.pdf &&
arrLoaded &&
arrLoaded.length > 0 &&
!ismounting
"
ref="myinfscroll" ref="myinfscroll"
:initial-index="0" :initial-index="0"
@load="onLoadScroll" @load="onLoadScroll"
@@ -668,7 +745,9 @@
v-if=" v-if="
product.active || product.active ||
(show_hide && (show_hide &&
product.productInfo.productTypes.includes(shared_consts.PRODUCTTYPE.PRODUCT)) product.productInfo.productTypes.includes(
shared_consts.PRODUCTTYPE.PRODUCT
))
" "
:id="product._id" :id="product._id"
:product="product" :product="product"
@@ -708,13 +787,17 @@
> >
<!-- Itera sulle schede --> <!-- Itera sulle schede -->
<div <div
v-for="(recscheda, schedaIndex) in optcatalogo.arrSchede" v-for="(
recscheda, schedaIndex
) in optcatalogo.arrSchede"
:key="schedaIndex" :key="schedaIndex"
> >
<div v-if="recscheda && recscheda.scheda"> <div v-if="recscheda && recscheda.scheda">
<!-- Itera sulle pagine --> <!-- Itera sulle pagine -->
<div <div
v-for="(page, pageIndex) in groupedPages(recscheda)" v-for="(page, pageIndex) in groupedPages(
recscheda
)"
:key="pageIndex" :key="pageIndex"
> >
<div <div
@@ -725,13 +808,24 @@
'card-page': false, 'card-page': false,
'pdf-section': true, 'pdf-section': true,
}" }"
:style="generateStylePageScheda(optcatalogo, recscheda.scheda)" :style="
generateStylePageScheda(
optcatalogo,
recscheda.scheda
)
"
> >
<div <div
v-if="recscheda.scheda.dimensioni.pagina?.testo_title?.contenuto" v-if="
recscheda.scheda.dimensioni.pagina
?.testo_title?.contenuto
"
:style="{ :style="{
'--scalecatalog': tools.getScale(optcatalogo), '--scalecatalog':
'line-height': recscheda.scheda.dimensioni.pagina?.testo_title?.font.line_height, tools.getScale(optcatalogo),
'line-height':
recscheda.scheda.dimensioni.pagina
?.testo_title?.font.line_height,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
position: 'relative', // Posizionamento assoluto position: 'relative', // Posizionamento assoluto
@@ -745,14 +839,24 @@
> >
<div <div
v-html="getTitoloPagina(null, recscheda)" v-html="getTitoloPagina(null, recscheda)"
style="display: flex; flex-direction: row; justify-content: center" style="
display: flex;
flex-direction: row;
justify-content: center;
"
></div> ></div>
</div> </div>
<div <div
v-if="recscheda.scheda.dimensioni.pagina?.testo_up?.contenuto" v-if="
recscheda.scheda.dimensioni.pagina?.testo_up
?.contenuto
"
:style="{ :style="{
'--scalecatalog': tools.getScale(optcatalogo), '--scalecatalog':
'line-height': recscheda.scheda.dimensioni.pagina?.testo_up?.font.line_height, tools.getScale(optcatalogo),
'line-height':
recscheda.scheda.dimensioni.pagina
?.testo_up?.font.line_height,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
}" }"
@@ -781,7 +885,9 @@
v-for="(prod, colIndex) in row" v-for="(prod, colIndex) in row"
:key="`${pageIndex}-${rowIndex}-${colIndex}`" :key="`${pageIndex}-${rowIndex}-${colIndex}`"
class="flex-item-book" class="flex-item-book"
:style="getStyleSchedaProdotto(recscheda)" :style="
getStyleSchedaProdotto(recscheda)
"
> >
<CContainerCatalogoCard <CContainerCatalogoCard
v-if="prod && prod.active" v-if="prod && prod.active"
@@ -802,7 +908,9 @@
@selauthor="selauthor" @selauthor="selauthor"
/> />
<CProductCard <CProductCard
v-else-if="prod && (prod.active || show_hide)" v-else-if="
prod && (prod.active || show_hide)
"
:id="prod._id" :id="prod._id"
:complete="false" :complete="false"
:cosa="cosa" :cosa="cosa"
@@ -813,13 +921,18 @@
<!-- Separatore --> <!-- Separatore -->
<div <div
v-if="recscheda.scheda?.show_separatore && rowIndex !== page.length - 1" v-if="
recscheda.scheda?.show_separatore &&
rowIndex !== page.length - 1
"
class="text-center" class="text-center"
:style="getStyleRow(recscheda)" :style="getStyleRow(recscheda)"
> >
<q-separator <q-separator
inset inset
:size="tools.adjustSize(optcatalogo, '1px')" :size="
tools.adjustSize(optcatalogo, '1px')
"
></q-separator> ></q-separator>
</div> </div>
</div> </div>
@@ -840,9 +953,13 @@
optcatalogo.last_page.text_html && optcatalogo.last_page.text_html &&
optcatalogo.last_page.text_html.contenuto optcatalogo.last_page.text_html.contenuto
" "
:style="generateStyleByPageDim(optcatalogo, optcatalogo.last_page)" :style="
generateStyleByPageDim(optcatalogo, optcatalogo.last_page)
"
> >
<div v-html="optcatalogo.last_page.text_html.contenuto"></div> <div
v-html="optcatalogo.last_page.text_html.contenuto"
></div>
</div> </div>
</div> </div>
</div> </div>
@@ -854,14 +971,18 @@
<div> <div>
Sfondo: Sfondo:
{{ {{
tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
}} }}
</div> </div>
<q-img <q-img
v-if="optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile" v-if="optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile"
:src=" :src="
tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
" "
> >
</q-img> </q-img>
@@ -871,17 +992,37 @@
<div class="row justify-center q-mx-auto bg-blue-1"> <div class="row justify-center q-mx-auto bg-blue-1">
<div> <div>
Prima Pagina: Prima Pagina:
{{ tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.first_page.imgsfondo.imagefile }} {{
tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.first_page.imgsfondo.imagefile
}}
</div> </div>
<q-img :src="tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.first_page.imgsfondo.imagefile"> <q-img
:src="
tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.first_page.imgsfondo.imagefile
"
>
</q-img> </q-img>
<div> <div>
Ultima Pagina: Ultima Pagina:
{{ tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.last_page.imgsfondo.imagefile }} {{
tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.last_page.imgsfondo.imagefile
}}
</div> </div>
<q-img :src="tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.last_page.imgsfondo.imagefile"> <q-img
:src="
tools.getDirUpload() +
costanti.DIR_CATALOGO +
optcatalogo.last_page.imgsfondo.imagefile
"
>
</q-img> </q-img>
</div> </div>
</q-tab-panel> </q-tab-panel>

View File

@@ -1,12 +1,22 @@
<template> <template>
<q-page> <q-page>
<div class="text-center"> <div class="text-center">
<q-spinner v-if="!loadpage" color="primary" size="3em" :thickness="2" /> <q-spinner
v-if="!loadpage"
color="primary"
size="3em"
:thickness="2"
/>
</div> </div>
<div v-if="loadpage" class="panel"> <div
v-if="loadpage"
class="panel"
>
<div> <div>
<CSelectUserActive></CSelectUserActive> <CSelectUserActive></CSelectUserActive>
<div class="text-center text-h7 text-blue">Filtra Prodotti per:</div> <div class="text-center text-h7 text-blue">
Filtra Prodotti per:
</div>
<div class="text-center"> <div class="text-center">
<q-btn-toggle <q-btn-toggle
v-model="cosa" v-model="cosa"
@@ -16,23 +26,32 @@
glossy glossy
toggle-color="primary" toggle-color="primary"
:options="[ :options="[
{ value: shared_consts.PROD.GAS, slot: 'gas' }, {
{ value: shared_consts.PROD.BOTTEGA, slot: 'bottega' }, value: shared_consts.PROD.GAS,
slot: 'gas',
},
{
value: shared_consts.PROD.BOTTEGA,
slot: 'bottega',
},
]" ]"
> >
<template v-slot:tutti> <template v-slot:tutti>
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<div class="text-center"> <div class="text-center">
{{ t("ecomm.tutti") }} {{ t('ecomm.tutti') }}
</div> </div>
<q-icon right name="fas fa-check-square" /> <q-icon
right
name="fas fa-check-square"
/>
</div> </div>
</template> </template>
<template v-slot:gas> <template v-slot:gas>
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<div class="text-center"> <div class="text-center">
{{ t("gas.ordina_sul_gas") }} {{ t('gas.ordina_sul_gas') }}
<!--<br /> <!--<br />
{{ {{
t('gas.x_prodotti_gas', { t('gas.x_prodotti_gas', {
@@ -40,14 +59,17 @@
}) })
}}--> }}-->
</div> </div>
<q-icon right name="fas fa-user-friends" /> <q-icon
right
name="fas fa-user-friends"
/>
</div> </div>
</template> </template>
<template v-slot:bottega> <template v-slot:bottega>
<div class="row items-center no-wrap"> <div class="row items-center no-wrap">
<div class="text-center"> <div class="text-center">
{{ t("gas.bottega") }} {{ t('gas.bottega') }}
<!--<br /> <!--<br />
{{ {{
t('gas.x_prodotti_bottega', { t('gas.x_prodotti_bottega', {
@@ -55,7 +77,10 @@
}) })
}}--> }}-->
</div> </div>
<q-icon right name="fas fa-store" /> <q-icon
right
name="fas fa-store"
/>
</div> </div>
</template> </template>
</q-btn-toggle> </q-btn-toggle>
@@ -93,37 +118,67 @@
</q-slide-transition> </q-slide-transition>
<div v-if="cosa === shared_consts.PROD.GAS"> <div v-if="cosa === shared_consts.PROD.GAS">
<div v-if="!idGasSel"> <div v-if="!idGasSel">
<div class="text-center text-h6 text-red">Ordini Attivi:</div> <div class="text-center text-h6 text-red">
Ordini Attivi:
</div>
</div> </div>
<div class="row q-gutter-xs justify-center q-mx-auto">
<div <div
v-for="(recgas, index) in productStore.getGasordinesActives()" class="row q-gutter-xs justify-center q-mx-auto"
>
<div
v-for="(
recgas, index
) in productStore.getGasordinesActives()"
:key="index" :key="index"
> >
<q-btn <q-btn
push push
dense dense
:size="tools.isMobile() ? '0.9rem' : '1.05rem'" :size="
:color="idGasSel === recgas._id ? 'primary' : undefined" tools.isMobile() ? '0.9rem' : '1.05rem'
:text-color="idGasSel === recgas._id ? 'white' : 'black'" "
:color="
idGasSel === recgas._id
? 'primary'
: undefined
"
:text-color="
idGasSel === recgas._id
? 'white'
: 'black'
"
:label="recgas.name" :label="recgas.name"
@click="idGasSel = recgas._id" @click="idGasSel = recgas._id"
> >
</q-btn> </q-btn>
</div> </div>
</div> </div>
<div class="row q-gutter-xs justify-center q-mx-auto">
<div <div
v-for="(reccat, index) in getCatProdsByGas(idGasSel)" class="row q-gutter-xs justify-center q-mx-auto"
>
<div
v-for="(reccat, index) in getCatProdsByGas(
idGasSel
)"
:key="index" :key="index"
> >
<q-btn <q-btn
:push="cat === reccat.value" :push="cat === reccat.value"
dense dense
:size="tools.isMobile() ? '0.70rem' : '0.85rem'" :size="
:icon="reccat.icon ? reccat.icon : undefined" tools.isMobile() ? '0.70rem' : '0.85rem'
:color="cat === reccat.value ? 'primary' : undefined" "
:text-color="cat === reccat.value ? 'white' : 'black'" :icon="
reccat.icon ? reccat.icon : undefined
"
:color="
cat === reccat.value
? 'primary'
: undefined
"
:text-color="
cat === reccat.value ? 'white' : 'black'
"
rounded rounded
:label="reccat.label" :label="reccat.label"
@click="cat = reccat.value" @click="cat = reccat.value"
@@ -137,16 +192,32 @@
class="row q-gutter-xs justify-center q-mx-auto" class="row q-gutter-xs justify-center q-mx-auto"
> >
<div <div
v-for="(recsubcat, index) in getSubCatProdsByGas(idGasSel, cat)" v-for="(
recsubcat, index
) in getSubCatProdsByGas(idGasSel, cat)"
:key="index" :key="index"
> >
<q-btn <q-btn
:push="subcat === recsubcat.value" :push="subcat === recsubcat.value"
dense dense
:size="tools.isMobile() ? '0.70rem' : '0.85rem'" :size="
:icon="recsubcat.icon ? recsubcat.icon : undefined" tools.isMobile() ? '0.70rem' : '0.85rem'
:color="subcat === recsubcat.value ? 'positive' : undefined" "
:text-color="subcat === recsubcat.value ? 'white' : 'blue'" :icon="
recsubcat.icon
? recsubcat.icon
: undefined
"
:color="
subcat === recsubcat.value
? 'positive'
: undefined
"
:text-color="
subcat === recsubcat.value
? 'white'
: 'blue'
"
rounded rounded
:label="recsubcat.label" :label="recsubcat.label"
@click="subcat = recsubcat.value" @click="subcat = recsubcat.value"
@@ -157,16 +228,25 @@
<div class="text-center q-py-sm prod_trov"> <div class="text-center q-py-sm prod_trov">
<span <span
v-show="productStore.getNumProdTot() !== arrProducts.length" v-show="
productStore.getNumProdTot() !==
arrProducts.length
"
>{{ >{{
t("ecomm.prodotti_trovati", { t('ecomm.prodotti_trovati', {
qta: arrProducts.length, qta: arrProducts.length,
qtatot: productStore.getNumProdTot(), qtatot:
productStore.getNumProdTot() > 0
? ` ${t('ecomm.su')} ${productStore.getNumProdTot()}`
: '',
}) })
}}</span }}</span
> >
</div> </div>
<div class="row justify-around" v-if="tools.isManager()"> <div
class="row justify-around"
v-if="tools.isManager()"
>
<q-toggle <q-toggle
v-model="show_hide" v-model="show_hide"
push push
@@ -200,22 +280,40 @@
</div> </div>
<template v-slot:loading> <template v-slot:loading>
<div class="text-center"> <div class="text-center">
<q-spinner-dots color="primary" size="40px" /> <q-spinner-dots
color="primary"
size="40px"
/>
</div> </div>
</template> </template>
</q-infinite-scroll> </q-infinite-scroll>
</div> </div>
</div> </div>
<div v-else> <div v-else>
<div class="row q-gutter-xs justify-center q-mx-auto"> <div
<div v-for="(reccat, index) in getCatProds()" :key="index"> class="row q-gutter-xs justify-center q-mx-auto"
>
<div
v-for="(reccat, index) in getCatProds()"
:key="index"
>
<q-btn <q-btn
:push="cat === reccat.value" :push="cat === reccat.value"
dense dense
:size="tools.isMobile() ? '0.70rem' : '1rem'" :size="
:icon="reccat.icon ? reccat.icon : undefined" tools.isMobile() ? '0.70rem' : '1rem'
:color="cat === reccat.value ? 'primary' : undefined" "
:text-color="cat === reccat.value ? 'white' : 'black'" :icon="
reccat.icon ? reccat.icon : undefined
"
:color="
cat === reccat.value
? 'primary'
: undefined
"
:text-color="
cat === reccat.value ? 'white' : 'black'
"
rounded rounded
:label="reccat.label" :label="reccat.label"
@click="cat = reccat.value" @click="cat = reccat.value"
@@ -225,16 +323,25 @@
</div> </div>
<div class="text-center q-py-sm prod_trov"> <div class="text-center q-py-sm prod_trov">
<span <span
v-show="productStore.getNumProdTot() !== arrProducts.length" v-show="
productStore.getNumProdTot() !==
arrProducts.length
"
>{{ >{{
t("ecomm.prodotti_trovati", { t('ecomm.prodotti_trovati', {
qta: arrProducts.length, qta: arrProducts.length,
qtatot: productStore.getNumProdTot(), qtatot:
productStore.getNumProdTot() > 0
? ` ${t('ecomm.su')} ${productStore.getNumProdTot()}`
: '',
}) })
}}</span }}</span
> >
</div> </div>
<div class="row justify-around" v-if="tools.isManager()"> <div
class="row justify-around"
v-if="tools.isManager()"
>
<q-toggle <q-toggle
v-model="show_hide" v-model="show_hide"
push push
@@ -268,7 +375,10 @@
</div> </div>
<template v-slot:loading> <template v-slot:loading>
<div class="text-center"> <div class="text-center">
<q-spinner-dots color="primary" size="40px" /> <q-spinner-dots
color="primary"
size="40px"
/>
</div> </div>
</template> </template>
</q-infinite-scroll> </q-infinite-scroll>
@@ -279,9 +389,8 @@
</q-page> </q-page>
</template> </template>
<script lang="ts" src="./productsList.ts"> <script lang="ts" src="./productsList.ts"></script>
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./productsList"; @import './productsList';
</style> </style>