- Aggiunto bottone Aggiungi al Carrello sulla lista dei libri dei cataloghi

This commit is contained in:
Surya Paolo
2025-06-06 00:07:47 +02:00
parent 06fe6eb861
commit 664975b1fd
36 changed files with 1110 additions and 751 deletions

View File

@@ -112,7 +112,7 @@ export default defineComponent({
const { t } = useI18n();
const userStore = useUserStore();
const globalStore = useGlobalStore();
const products = useProducts();
const Products = useProducts();
const listord = ref(<IOrderCart[]>[]);
const sumval = ref(0);
@@ -137,19 +137,19 @@ export default defineComponent({
const field_updated_fromGM = ref('');
const dataextractedWeb = ref('');
const widthoggetto = ref(40)
const heightoggetto = ref(40)
const widthoggetto = ref(40);
const heightoggetto = ref(40);
// Crea una copia locale reattiva di modelValue
const optcatalogo = ref<IOptCatalogo>({ ...props.modelValue });
const mywidthogg = computed(() => {
return widthoggetto.value * tools.getScaleX(optcatalogo.value, props.scheda)
})
return widthoggetto.value * tools.getScaleX(optcatalogo.value, props.scheda);
});
const myheightogg = computed(() => {
return heightoggetto.value * tools.getScaleY(optcatalogo.value, props.scheda)
})
return heightoggetto.value * tools.getScaleY(optcatalogo.value, props.scheda);
});
const editOn = computed({
get(): boolean {
@@ -213,7 +213,7 @@ export default defineComponent({
const scale = ref(1);
const getTesto_Right = computed(() => {
return products.replaceKeyWordsByProduct(
return Products.replaceKeyWordsByProduct(
optcatalogo.value,
myproduct.value!,
props.scheda.testo_right!,
@@ -221,7 +221,7 @@ export default defineComponent({
);
});
const getTesto_Right_attaccato = computed(() => {
return products.replaceKeyWordsByProduct(
return Products.replaceKeyWordsByProduct(
optcatalogo.value,
myproduct.value!,
props.scheda.testo_right_attaccato!,
@@ -229,7 +229,7 @@ export default defineComponent({
);
});
const getTesto_Debug = computed(() => {
return products.replaceKeyWordsByProduct(
return Products.replaceKeyWordsByProduct(
optcatalogo.value,
myproduct.value!,
{ contenuto: '{debug}', maxlength: 10000 },
@@ -238,7 +238,7 @@ export default defineComponent({
});
const getTesto_Bottom = computed(() => {
return products.replaceKeyWordsByProduct(
return Products.replaceKeyWordsByProduct(
optcatalogo.value,
myproduct.value!,
props.scheda.testo_bottom!,
@@ -255,7 +255,7 @@ export default defineComponent({
/*const myproduct = computed((): IProduct => {
console.log('getproduct computed')
const ris = products.getProduct(props.code)
const ris = Products.getProduct(props.code)
console.log(' received', ris)
return ris
})*/
@@ -271,7 +271,7 @@ export default defineComponent({
}
if (myproduct.value) {
const ris = await products.addtoCartBase({
const ris = await Products.addtoCartBase({
$q,
t,
id: myproduct.value._id,
@@ -286,8 +286,7 @@ export default defineComponent({
function getnumstore() {
if (myproduct.value) {
if (myproduct.value.storehouses)
return myproduct.value.storehouses.length;
if (myproduct.value.storehouses) return myproduct.value.storehouses.length;
else return 0;
}
return 0;
@@ -320,13 +319,6 @@ export default defineComponent({
}
}
function initproduct() {
myorder.quantity = 0;
myorder.quantitypreordered = 0;
myorder.idStorehouse = '';
myorder.idGasordine = '';
}
async function updateproduct(atload: boolean, forza?: boolean) {
let carica = true;
@@ -343,13 +335,13 @@ export default defineComponent({
updateproductmodif(null, forza);
}
// products.updateQuantityAvailable(myproduct.value._id)
// Products.updateQuantityAvailable(myproduct.value._id)
}
async function ricarica() {
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;
}
@@ -361,9 +353,9 @@ export default defineComponent({
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();
@@ -441,9 +433,7 @@ export default defineComponent({
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 = '';
@@ -451,8 +441,7 @@ export default defineComponent({
} catch (e) {}
if (labelDataArrivoMerce.value !== dataArrivoMerce)
labelDataArrivoMerce.value = dataArrivoMerce;
if (labelDataRitiro.value !== dataRitiro)
labelDataRitiro.value = dataRitiro;
if (labelDataRitiro.value !== dataRitiro) labelDataRitiro.value = dataRitiro;
updateTimerLabel();
}
@@ -487,9 +476,7 @@ export default defineComponent({
return (
myproduct.value.gasordine &&
myproduct.value.gasordine.dataora_chiusura_ordini &&
tools.getCountDown(
myproduct.value.gasordine.dataora_chiusura_ordini
) === ''
tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini) === ''
);
} else return false;
}
@@ -501,7 +488,7 @@ export default defineComponent({
async function load() {
indvariazSel.value = -1;
initproduct();
Products.initproduct(myorder);
await updateproduct(true, true);
labelDataArrivoMerce.value = '';
labelDataRitiro.value = '';
@@ -509,30 +496,9 @@ export default defineComponent({
// console.log('Load', myproduct.value.name)
if (myproduct.value) {
arrordersCart.value = products.getOrdersCartInAttesaByIdProduct(
myproduct.value._id
);
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;
}
if (myproduct.value.gasordine) {
myorder.idGasordine = myproduct.value.gasordine._id;
}
const ord = products.getOrderProductInCart(myproduct.value._id);
if (ord) {
myorder.quantity = ord.quantity;
myorder.quantitypreordered = ord.quantitypreordered;
// Seleziona il Negozio che avevo già scelto nell'ordine !
if (ord.idStorehouse) storeSelected.value = ord.idStorehouse;
}
Products.setMyOrder(myorder, myproduct.value, storeSelected.value, {
setstore: true,
});
}
updateLabel();
@@ -554,9 +520,7 @@ export default defineComponent({
function visuListDisponibili() {
if (myproduct.value) {
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) => {
@@ -569,9 +533,7 @@ export default defineComponent({
function visuListBookable() {
if (myproduct.value) {
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) => {
@@ -601,8 +563,7 @@ export default defineComponent({
(myproduct.value.bookableGASBloccatiQty +
myproduct.value.QuantitaPrenotateInAttesa!) *
myproduct.value.productInfo.weight!,
myproduct.value.qtyToReachForGas *
myproduct.value.productInfo.weight!
myproduct.value.qtyToReachForGas * myproduct.value.productInfo.weight!
) / 100
);
else return 0;
@@ -770,12 +731,11 @@ export default defineComponent({
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
);
field_updated_fromGM.value = await globalStore.getGM_FieldOf_T_Web_Articoli(
myproduct.value.productInfo.sku!,
field,
shared_consts.CmdQueryMs.GET
);
loading.value = false;
}
}
@@ -798,7 +758,7 @@ export default defineComponent({
}
if (!dataupdated) {
tools.showNegativeNotif($q, t('dbgm.dati_non_estratti'));
visudataextracted.value = false
visudataextracted.value = false;
}
return dataupdated;
})
@@ -858,7 +818,7 @@ export default defineComponent({
openlistorders,
func_tools,
toolsext,
products,
Products,
arrordersCart,
endload,
shared_consts,
@@ -918,7 +878,7 @@ export default defineComponent({
widthoggetto,
heightoggetto,
mywidthogg,
myheightogg
myheightogg,
};
},
});