email da inviare ai clienti ...

This commit is contained in:
Surya Paolo
2024-01-09 15:32:21 +01:00
parent 1021331f7c
commit 6dc74b5826
34 changed files with 1318 additions and 486 deletions

View File

@@ -14,6 +14,24 @@ import { ref } from 'vue'
import translate from '@src/globalroutines/util'
function getRecordOrdersCartEmpty(): IOrderCart {
return {
numorder: 0,
numord_pers: 0,
userId: '',
user: null,
totalQty: 0,
totalPrice: 0,
status: 0,
confermato: false,
consegnato: false,
pagato: false,
spedito: false,
ricevuto: false,
note: '',
}
}
function getRecordProductInfoEmpty(): IProductInfo {
return {
code: '',
@@ -57,19 +75,19 @@ function getRecordProductEmpty(): IProduct {
minBuyQty: 1,
minStepQty: 1,
maxBookableSinglePersQty: 0,
stockQty: 0,
stockBloccatiQty: 0,
bookedQtyOrdered: 0,
bookedQtyConfirmed: 0,
qtyToReachForGas: 0,
maxbookableGASQty: 0,
bookedGASQtyOrdered: 0,
bookedGASQtyConfirmed: 0,
bookableGASBloccatiQty: 0,
canBeShipped: false,
QuantitaOrdinateInAttesa: 0,
QuantitaPrenotateInAttesa: 0,
@@ -228,6 +246,14 @@ export const useProducts = defineStore('Products', {
return null
},
getOrdersCartById: (state: IProductsState) => (idordercart: string): IOrderCart => {
if (state.orders) {
const orderscart = state.orders.find((rec: IOrderCart) => rec._id === idordercart)
return orderscart ?? getRecordOrdersCartEmpty()
}
return getRecordOrdersCartEmpty()
},
getSumQtyPreOrderInOrdersCart: (state: IProductsState) => (idproduct: string): number => {
let totalQuantity = 0;
@@ -688,7 +714,7 @@ export const useProducts = defineStore('Products', {
return ris
},
async UpdateOrderCartStatus({ order_id, status }: { order_id: string, status: number }) {
@@ -900,8 +926,18 @@ export const useProducts = defineStore('Products', {
getNumQtaBottega() {
const arrprod = this.getProducts(shared_consts.PROD.BOTTEGA)
return arrprod.length
}
},
async sendMailToTheBuyer(idOrdersCart: string, templemail_id: string, test: boolean) {
return await Api.SendReq('/orders/sendmail', 'POST', { templemail_id, idOrdersCart, previewonly: tools.isDebug(), test })
.then((res) => {
console.log('res', res)
if (res)
return res.data
else
return null
})
},
},