- aggiornato carrello e bottoni sul catalogo
This commit is contained in:
@@ -175,7 +175,7 @@ export const colTableRaccoltaCataloghi = [
|
||||
|
||||
export const colTableCatalogList = [
|
||||
AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'title', label_trans: 'gallery.title' }),
|
||||
AddCol({ name: 'title', label_trans: 'gallery.title', dont_clone: true}),
|
||||
AddCol({
|
||||
name: 'foto_collana',
|
||||
label_trans: 'cataloglist.foto_collana',
|
||||
@@ -544,6 +544,7 @@ export const colmypage = [
|
||||
AddCol({ name: 'order', label_trans: 'pages.order', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'active', label_trans: 'pages.active', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'inmenu', label_trans: 'pages.inmenu', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'isTemplate', label_trans: 'pages.isTemplate', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'title', label_trans: 'pages.title' }),
|
||||
AddCol({ name: 'subtitle', label_trans: 'pages.subtitle' }),
|
||||
AddCol({ name: 'mainMenu', label_trans: 'pages.mainMenu', fieldtype: costanti.FieldType.boolean }),
|
||||
@@ -902,9 +903,9 @@ export const colTableScontistica = [
|
||||
AddCol({ name: 'description', label_trans: 'scontistica.description' }),
|
||||
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'perc_sconto', label_trans: 'scontistica.perc_sconto', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'applica', label_trans: 'products.applica', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'comulativo', label_trans: 'products.comulativo', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'price', label_trans: 'scontistica.price', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'applica', label_trans: 'scontistica.applica', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'comulativo', label_trans: 'scontistica.comulativo', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
@@ -61,7 +61,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
|
||||
ricevuto: false,
|
||||
note: '',
|
||||
note_per_gestore: '',
|
||||
codice_sconto:'',
|
||||
codice_sconto: '',
|
||||
descr_sconto: '',
|
||||
note_per_admin: '',
|
||||
note_ordine_gas: '',
|
||||
@@ -1518,14 +1518,10 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
let ris = null;
|
||||
|
||||
ris = await Api.SendReq(
|
||||
'/cart/' + this.userActive._id + '/app_sc',
|
||||
'POST',
|
||||
{
|
||||
cart_id,
|
||||
code: codice_sconto,
|
||||
}
|
||||
)
|
||||
ris = await Api.SendReq('/cart/' + this.userActive._id + '/app_sc', 'POST', {
|
||||
cart_id,
|
||||
code: codice_sconto,
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateDataProduct(res);
|
||||
|
||||
@@ -1545,7 +1541,6 @@ export const useProducts = defineStore('Products', {
|
||||
return ris;
|
||||
},
|
||||
|
||||
|
||||
async addtoCartBase({
|
||||
$q,
|
||||
t,
|
||||
@@ -1690,11 +1685,12 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
enableSubQty(myorder: IOrder): boolean {
|
||||
let qty = myorder.quantity + myorder.quantitypreordered;
|
||||
let qty = myorder?.quantity + myorder?.quantitypreordered;
|
||||
return qty ? qty > 0 : false;
|
||||
},
|
||||
|
||||
CanDeleteIfSub(myorder: IOrder): boolean {
|
||||
if (!myorder) return false;
|
||||
let qty = myorder.quantity + myorder.quantitypreordered;
|
||||
|
||||
qty = qty - this.qtaNextSub(myorder, myorder.product!);
|
||||
@@ -1702,33 +1698,30 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
enableAddQty(myorder: IOrder, myproduct: IProduct): boolean {
|
||||
if (!myorder) return false;
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
|
||||
return (
|
||||
(this.getQtyBookableAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
myorder.quantitypreordered + 1 < myproduct.maxBookableSinglePersQty)) ||
|
||||
(this.getQtyAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
!myproduct.maxBookableSinglePersQty ||
|
||||
myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
this.getQtyAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
!myproduct.maxBookableSinglePersQty ||
|
||||
myorder.quantity + 1 < myproduct.maxBookableSinglePersQty)
|
||||
);
|
||||
}
|
||||
const maxAllowed = myproduct.maxBookableSinglePersQty || 0;
|
||||
const qtyAvailable = this.getQtyAvailable(myproduct);
|
||||
const qtyBookableAvailable = this.getQtyBookableAvailable(myproduct);
|
||||
|
||||
const canOrder =
|
||||
qtyAvailable > 0 &&
|
||||
((myorder.quantity + 1 <= maxAllowed && maxAllowed > 0) || maxAllowed === 0);
|
||||
const canPreOrder =
|
||||
globalStore.site.ecomm?.enablePreOrders &&
|
||||
qtyBookableAvailable > 0 &&
|
||||
myorder.quantitypreordered + 1 <= maxAllowed;
|
||||
|
||||
return canOrder || canPreOrder;
|
||||
},
|
||||
|
||||
qtaNextAdd(myorder: IOrder, myproduct: IProduct): number {
|
||||
let step = myproduct.minStepQty || 1;
|
||||
if (this.getQtyAvailable(myproduct) > 0) {
|
||||
if (myorder.quantity === 0) step = myproduct.minBuyQty;
|
||||
if (myorder?.quantity === 0) step = myproduct.minBuyQty;
|
||||
} else {
|
||||
if (myorder.quantitypreordered === 0) step = myproduct.minBuyQty;
|
||||
if (myorder?.quantitypreordered === 0) step = myproduct.minBuyQty;
|
||||
}
|
||||
|
||||
if (step === 0) {
|
||||
@@ -1742,9 +1735,9 @@ export const useProducts = defineStore('Products', {
|
||||
let step = myproduct.minStepQty;
|
||||
let minqta = myproduct.minBuyQty;
|
||||
if (this.getQtyAvailable(myproduct) > 0) {
|
||||
if (myorder.quantity === minqta) step = minqta;
|
||||
if (myorder?.quantity === minqta) step = minqta;
|
||||
} else {
|
||||
if (myorder.quantitypreordered === minqta) step = minqta;
|
||||
if (myorder?.quantitypreordered === minqta) step = minqta;
|
||||
}
|
||||
|
||||
return step;
|
||||
@@ -2596,8 +2589,9 @@ export const useProducts = defineStore('Products', {
|
||||
getFilePathByLinkIdTemplate(linkidTemplate: string) {
|
||||
try {
|
||||
const globalStore = useGlobalStore();
|
||||
const myelem = globalStore.myschedas.find((recscheda: IMyScheda) =>
|
||||
(recscheda: ISchedaSingola) => recscheda.scheda._id === linkidTemplate
|
||||
const myelem = globalStore.myschedas.find(
|
||||
(recscheda: IMyScheda) => (recscheda: ISchedaSingola) =>
|
||||
recscheda.scheda._id === linkidTemplate
|
||||
);
|
||||
if (myelem) {
|
||||
const idPage = myelem.idPageOrig;
|
||||
@@ -2631,7 +2625,12 @@ export const useProducts = defineStore('Products', {
|
||||
myorder.idGasordine = '';
|
||||
},
|
||||
|
||||
setMyOrder(myorder: IOrder, myproduct: IProduct, storeSelected: any = null, options: any = {setstore: false}) {
|
||||
setMyOrder(
|
||||
myorder: IOrder,
|
||||
myproduct: IProduct,
|
||||
storeSelected: any = null,
|
||||
options: any = { setstore: false }
|
||||
) {
|
||||
if (myproduct.storehouses && myproduct.storehouses.length === 1) {
|
||||
// Se solo 1 presente, metto fisso l'unico negozio !
|
||||
myorder.idStorehouse = myproduct.storehouses[0]._id;
|
||||
@@ -2653,8 +2652,6 @@ export const useProducts = defineStore('Products', {
|
||||
storeSelected = ord.idStorehouse;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -388,6 +388,16 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const mypage = state.mypage.find((page) => `${page._id}` === idpage);
|
||||
return mypage;
|
||||
},
|
||||
|
||||
getMyPagesOptionsTemplate: (state: IGlobalState) => (): any[] => {
|
||||
return state.mypage
|
||||
.filter((page: IMyPage) => page.isTemplate === true)
|
||||
.map((page: IMyPage) => ({
|
||||
label: page.title,
|
||||
value: page._id,
|
||||
}));
|
||||
},
|
||||
|
||||
getPathByIdPage:
|
||||
(state: IGlobalState) =>
|
||||
(idpage: string): string => {
|
||||
@@ -2073,8 +2083,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.publishers_sort_qty = [...res.data.publishers];
|
||||
Products.publishers_sort_qty.sort((a, b) => b.quanti - a.quanti);
|
||||
|
||||
// console.table(Products.publishers)
|
||||
// console.table(Products.publishers_sort_qty)
|
||||
// console.table(Products.publishers)
|
||||
// console.table(Products.publishers_sort_qty)
|
||||
|
||||
this.gasordines = res.data.gasordines ? [...res.data.gasordines] : [];
|
||||
this.scontisticas = res.data.scontisticas ? [...res.data.scontisticas] : [];
|
||||
@@ -2595,7 +2605,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('getServerHost', myserv);
|
||||
// console.log('getServerHost', myserv);
|
||||
|
||||
return myserv;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user