import products dinamically

This commit is contained in:
Surya Paolo
2024-02-06 20:13:06 +01:00
parent dbcd2aee63
commit 3c0f040d92
53 changed files with 1847 additions and 325 deletions

View File

@@ -2041,13 +2041,19 @@ export const colTableProductInfos = [
AddCol({ name: 'color', label_trans: 'products.color' }),
AddCol({ name: 'size', label_trans: 'products.size' }),
AddCol({ name: 'weight', label_trans: 'products.weight', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'weight_lordo', label_trans: 'products.weight_lordo', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'vegan', label_trans: 'products.vegan', fieldtype: costanti.FieldType.boolean }),
AddCol({
name: 'unit', label_trans: 'products.unit',
fieldtype: costanti.FieldType.select, jointable: 'units',
}),
AddCol({
name: 'unit_lordo', label_trans: 'products.unit_lordo',
fieldtype: costanti.FieldType.select, jointable: 'units',
}),
AddCol({ name: 'stars', label_trans: 'products.stars', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'date', label_trans: 'products.date', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'link_scheda', label_trans: 'products.link_scheda' }),
AddCol({ name: 'ingredienti', label_trans: 'products.ingredienti', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'valori_nutrizionali', label_trans: 'products.valori_nutrizionali', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'note', label_trans: 'products.note', fieldtype: costanti.FieldType.html }),

View File

@@ -3756,6 +3756,14 @@ export const tools = {
}
},
notisVerifiedByUser(user: IUserFields) {
try {
return user && user.hasOwnProperty('verified_by_aportador') && user.verified_by_aportador === false
} catch (e) {
return false
}
},
addMinutes(mydate: Date, minutes: number) {
return date.addToDate(mydate, { minutes })
},
@@ -8301,6 +8309,7 @@ export const tools = {
return weight
},
getWeightTotalByOrder(order: IOrder) {
return (order.product && order.product.productInfo && order.product.productInfo.weight ? order.product.productInfo.weight : 1) * (order.quantitypreordered | 0 + order.quantity | 0)
},

View File

@@ -985,7 +985,7 @@ export const useProducts = defineStore('Products', {
enableAddQty(myorder: IOrder, myproduct: IProduct): boolean {
const globalStore = useGlobalStore()
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
return (this.getQtyBookableAvailable(myproduct) > 0
return ((this.getQtyBookableAvailable(myproduct) > 0)
&& (myproduct.maxBookableSinglePersQty === 0
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableSinglePersQty))
)
@@ -1011,6 +1011,10 @@ export const useProducts = defineStore('Products', {
step = myproduct.minBuyQty
}
if (step === 0) {
step = 1
}
return step
},