corretto totali in attesa
This commit is contained in:
@@ -195,7 +195,7 @@ export default defineComponent({
|
|||||||
// console.log('Load', myproduct.value.name)
|
// console.log('Load', myproduct.value.name)
|
||||||
// console.log('created Cproductcard', code)
|
// console.log('created Cproductcard', code)
|
||||||
|
|
||||||
arrordersCart.value = products.getOrdersCartByIdProduct(myproduct.value._id)
|
arrordersCart.value = products.getOrdersCartInAttesaByIdProduct(myproduct.value._id)
|
||||||
|
|
||||||
if (!!myproduct.value) {
|
if (!!myproduct.value) {
|
||||||
if (myproduct.value.storehouses && myproduct.value.storehouses.length === 1) {
|
if (myproduct.value.storehouses && myproduct.value.storehouses.length === 1) {
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ export const useProducts = defineStore('Products', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getOrdersCartByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
getOrdersCartByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
||||||
// console.log('getOrdersCartByIdProduct')
|
|
||||||
// console.log('.cart.items', this.cart.items)
|
|
||||||
try {
|
try {
|
||||||
if (state.orders) {
|
if (state.orders) {
|
||||||
const ris = state.orders.filter((ordercart: IOrderCart) => {
|
const ris = state.orders.filter((ordercart: IOrderCart) => {
|
||||||
@@ -146,6 +144,25 @@ export const useProducts = defineStore('Products', {
|
|||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getOrdersCartInAttesaByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
||||||
|
try {
|
||||||
|
if (state.orders) {
|
||||||
|
const ris = state.orders.filter((ordercart: IOrderCart) => {
|
||||||
|
return ordercart.items!.some(item => {
|
||||||
|
if (item.order)
|
||||||
|
return (item.order.idProduct === idproduct)
|
||||||
|
&& (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
// console.log('Ordini ', ris)
|
||||||
|
return ris ? ris : []
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err', e)
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
},
|
||||||
|
|
||||||
updateQuantityAvailable: (state: IProductsState) => (id: string): any => {
|
updateQuantityAvailable: (state: IProductsState) => (id: string): any => {
|
||||||
|
|
||||||
const indelem = state.products.findIndex((prod: IProduct) => prod._id === id)
|
const indelem = state.products.findIndex((prod: IProduct) => prod._id === id)
|
||||||
|
|||||||
Reference in New Issue
Block a user