possibilità di modificare un ordine, e anche i totali
This commit is contained in:
@@ -5,7 +5,7 @@ import { Api } from '@api'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
|
||||
async function sendRequest(url: string, method: string, mydata: any) {
|
||||
if (process.env.DEBUG) console.log('sendRequest', method, url)
|
||||
// if (process.env.DEBUG) console.log('sendRequest', method, url)
|
||||
|
||||
let request
|
||||
if (method === 'GET') request = Api.get(url, mydata)
|
||||
|
||||
@@ -357,6 +357,8 @@ export const getcolorderscart = [
|
||||
AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_consegnato', label_trans: 'order.date_consegnato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'preparato', label_trans: 'order.preparato', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_preparato', label_trans: 'order.date_preparato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'pagato', label_trans: 'order.pagato', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'date_pagato', label_trans: 'order.date_pagato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({ name: 'spedito', label_trans: 'order.spedito', fieldtype: costanti.FieldType.boolean }),
|
||||
|
||||
@@ -3864,19 +3864,19 @@ export const tools = {
|
||||
},
|
||||
|
||||
setLangAtt($q: any, $router: Router, mylang: string) {
|
||||
console.log('setLangAtt =', mylang)
|
||||
// console.log('setLangAtt =', mylang)
|
||||
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
// dynamic import, so loading on demand only
|
||||
import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => {
|
||||
console.log(' Import dinamically lang =', lang)
|
||||
// console.log(' Import dinamically lang =', lang)
|
||||
if ($q.lang)
|
||||
$q.lang.set(this.getlangforQuasar(lang.default.isoName))
|
||||
|
||||
import('../../statics/i18n').then(() => {
|
||||
console.log(' *** MY LANG DOPO=', $q.lang.isoName)
|
||||
// console.log(' *** MY LANG DOPO=', $q.lang.isoName)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -143,16 +143,16 @@ export const toolsext = {
|
||||
setLangAtt($q: any, $router: Router, mylang: string) {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
console.log('setLangAtt =', mylang)
|
||||
// console.log('setLangAtt =', mylang)
|
||||
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
|
||||
|
||||
// dynamic import, so loading on demand only
|
||||
import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => {
|
||||
console.log(' Import dinamically lang =', lang)
|
||||
// console.log(' Import dinamically lang =', lang)
|
||||
|
||||
$q.lang.set(this.getlangforQuasar(lang.default.isoName))
|
||||
import('../../statics/i18n').then(() => {
|
||||
console.log(' *** MY LANG DOPO=', $q.lang.isoName)
|
||||
// console.log(' *** MY LANG DOPO=', $q.lang.isoName)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
|
||||
user: null,
|
||||
totalQty: 0,
|
||||
totalPrice: 0,
|
||||
totalPriceCalc: 0,
|
||||
status: 0,
|
||||
confermato: false,
|
||||
consegnato: false,
|
||||
@@ -198,6 +199,9 @@ export const useProducts = defineStore('Products', {
|
||||
if (tipoord === shared_consts.OrderStat.IN_CORSO.value)
|
||||
return state.orders.filter((rec: IOrderCart) => ((rec.status ? rec.status : 0) <= shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
|
||||
else if (tipoord === shared_consts.OrderStat.PREPARED.value)
|
||||
return state.orders.filter((rec: IOrderCart) => (rec.status === shared_consts.OrderStatus.PREPARED)
|
||||
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
|
||||
else if (tipoord === shared_consts.OrderStat.CONFERMATI.value)
|
||||
return state.orders.filter((rec: IOrderCart) => (rec.status === shared_consts.OrderStatus.ORDER_CONFIRMED)
|
||||
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
|
||||
@@ -356,6 +360,7 @@ export const useProducts = defineStore('Products', {
|
||||
idapp: process.env.APP_ID,
|
||||
status: shared_consts.OrderStatus.IN_CART,
|
||||
TotalPriceProduct: 0,
|
||||
TotalPriceProductCalc: 0,
|
||||
idProduct: product._id,
|
||||
product, // Copia tutto l'oggetto Product !
|
||||
|
||||
@@ -391,12 +396,12 @@ export const useProducts = defineStore('Products', {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
// console.log('loadProducts')
|
||||
//console.log('loadProducts')
|
||||
|
||||
if (!globalStore.site.confpages.enableEcommerce)
|
||||
return null
|
||||
|
||||
console.log('getProducts', 'userid=', userStore.my._id)
|
||||
// console.log('getProducts', 'userid=', userStore.my._id)
|
||||
|
||||
// if (userStore.my._id === '') {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
@@ -407,7 +412,7 @@ export const useProducts = defineStore('Products', {
|
||||
ris = await Api.SendReq('/products', 'POST', { userId: userStore.my._id })
|
||||
.then((res) => {
|
||||
if (res.data.products) {
|
||||
console.log('aggiorna prodotti')
|
||||
// console.log('aggiorna prodotti')
|
||||
this.products = []
|
||||
this.products = res.data.products
|
||||
} else {
|
||||
@@ -460,7 +465,7 @@ export const useProducts = defineStore('Products', {
|
||||
const idord = this.orders.findIndex((ord: IOrderCart) => ord._id === myorderscart._id)
|
||||
if (idord >= 0) {
|
||||
console.log('aggiorna ordine')
|
||||
this.orders[idord] = {...myorderscart}
|
||||
this.orders[idord] = { ...myorderscart }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,7 +556,7 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
async loadOrders() {
|
||||
|
||||
console.log('loadOrders')
|
||||
// console.log('loadOrders')
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
|
||||
@@ -1134,7 +1134,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
setlang($q: any, router: Router, newstr: string) {
|
||||
console.log('SETLANG', newstr)
|
||||
// console.log('SETLANG', newstr)
|
||||
this.lang = newstr
|
||||
toolsext.setLangAtt($q, router, newstr)
|
||||
toolsext.setLangAtt($q, router, newstr)
|
||||
|
||||
@@ -488,7 +488,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
addDynamicPages($router: Router | null) {
|
||||
// console.log('this.mypage', this.mypage)
|
||||
console.log('addDynamicPages.........')
|
||||
/// console.log('addDynamicPages.........')
|
||||
const arrpagesroute: IListRoutes[] = []
|
||||
|
||||
for (const page of this.mypage) {
|
||||
@@ -907,7 +907,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
async loadAfterLogin() {
|
||||
console.log('loadAfterLogin')
|
||||
// console.log('loadAfterLogin')
|
||||
this.clearDataAfterLoginOnlyIfActiveConnection()
|
||||
|
||||
let isok = false
|
||||
|
||||
Reference in New Issue
Block a user