- 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,
"printWidth": 60,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -98,6 +98,7 @@ export interface IVariazione {
addtocart_link?: string
eta?: string
validaprod?: IValidaProd
scraped?: boolean
}
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_add_to_cart: 'Aggiungi un codice al carrello',
qta_prenotate_in_attesa: '(Preordinate In attesa {qty})',
prodotti_trovati: 'Trovati {qta} su {qtatot}',
prodotti_trovati: 'Trovati {qta}{qtatot}',
prodotti_trovati_qta: 'Trovati {qta}',
su: 'su',
bloccati: 'Bloccati',
bookedGASQtyOrdered: 'Prenotate',
bookedGASQtyOrdered_str: 'Prenotati {qta} su {qtatot} {unit}',
@@ -2070,7 +2071,9 @@ const msg_it = {
},
dbgm: {
updateLocalDb_OK: 'DB Aggiornato',
updateLocalDb_OK: 'Dati Aggiornati in locale',
updateLocalDb_ERROR: 'Errore aggiornamento singolo libro',
scrapingOkUpdated: 'Dati Aggiornati prelevando dal Web',
},
queryai: {

View File

@@ -2841,6 +2841,7 @@ export const colTableProducts = [
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', 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: 'scraped', label_trans: 'products.scraped', fieldtype: costanti.FieldType.boolean }),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]

View File

@@ -10020,6 +10020,24 @@ export const tools = {
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 !

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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