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

@@ -2395,36 +2395,6 @@ const colTableEvents = [
AddCol(DuplicateRec),
]
export const colTableCash = [
AddCol({ name: '_id', label_trans: 'event._id' }),
AddCol({ name: 'creatorUserId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({
name: 'idCashCategory',
label_trans: 'Category.idCashCategory',
fieldtype: costanti.FieldType.select,
jointable: 'cashcategory',
}),
AddCol({ name: 'fromUsername', label_trans: 'cash.fromUsername', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'toUsername', label_trans: 'cash.toUsername', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'idOrdersCart', label_trans: 'cash.orderscart', fieldtype: costanti.FieldType.select, jointable: 'orderscart' }),
AddCol({ name: 'type', label_trans: 'cash.type', fieldtype: costanti.FieldType.select, jointable: toolsext.TABTYPECASH }),
AddCol({
name: 'date_payment', label_trans: 'cash.date_payment', fieldtype: costanti.FieldType.onlydate,
sortable: true,
}),
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'causale', label_trans: 'cash.causale' }),
AddCol({ name: 'note', label_trans: 'cash.note' }),
AddCol({ name: 'internal', label_trans: 'cash.internal', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'extra', label_trans: 'cash.extra', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'confirmed', label_trans: 'cash.confirmed', fieldtype: costanti.FieldType.boolean }),
AddCol({
name: 'date_created', label_trans: 'reg.pub_created', fieldtype: costanti.FieldType.onlydate,
sortable: true,
}),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]
export const fields = {
colSettings: [
@@ -3703,7 +3673,7 @@ export const fieldsTable = {
collabel: '_id',
},
{
value: 'orderscart',
value: 'orderscarts',
label: 'Ordini',
columns: colTableOrdersCart,
colkey: '_id',
@@ -3723,13 +3693,6 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'name',
},
{
value: 'cashs',
label: 'Cassa',
columns: colTableCash,
colkey: '_id',
collabel: 'causale',
},
{
value: 'departments',
label: 'Uffici',

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
})
},
},

View File

@@ -15,6 +15,7 @@ import {
IColGridTable,
ISignupIscrizioneConacreisOptions,
ISignupIscrizioneArcadeiOptions,
ISettings,
} from '@src/model'
import { tools } from '@store/Modules/tools'
import translate from '@src/globalroutines/util'
@@ -1021,11 +1022,26 @@ export const useUserStore = defineStore('UserStore', {
}
},
async newsletterload(paramquery: any) {
async newsletterload(force: boolean) {
return Api.SendReq('/news/load', 'POST', paramquery)
.then((res) => {
const globalStore = useGlobalStore()
const mydata = {
locale: tools.getLocale()
}
if ((globalStore.serv_settings.length > 0) && !force)
return null;
return Api.SendReq('/news/load', 'POST', mydata)
.then((res: any) => {
// console.log('res', res)
if (res.data) {
globalStore.serv_settings = res.data.serv_settings
globalStore.templemail = res.data.templemail
globalStore.opzemail = res.data.opzemail
}
return res.data
}).catch((error) => {
return null
@@ -1117,10 +1133,10 @@ export const useUserStore = defineStore('UserStore', {
this.usersList = [...usersList]
},
setlang($q: any, $router: Router, newstr: string) {
setlang($q: any, router: Router, newstr: string) {
console.log('SETLANG', newstr)
this.lang = newstr
toolsext.setLangAtt($q, $router, newstr)
toolsext.setLangAtt($q, router, newstr)
tools.localStSetItem(toolsext.localStorage.lang, this.lang)
},
@@ -1258,7 +1274,7 @@ export const useUserStore = defineStore('UserStore', {
},
async signin($router: Router, authData: ISigninOptions) {
async signin(router: Router, authData: ISigninOptions) {
console.log('LOGIN signin')
const globalStore = useGlobalStore()
@@ -1321,7 +1337,7 @@ export const useUserStore = defineStore('UserStore', {
}).then((code) => {
if (code === tools.OK) {
return this.setGlobal($router, true)
return this.setGlobal(router, true)
.then(() => {
return code
})
@@ -1338,7 +1354,7 @@ export const useUserStore = defineStore('UserStore', {
async logout() {
const globalStore = useGlobalStore()
// const $router = useRouter()
console.log('logout')
@@ -1375,7 +1391,7 @@ export const useUserStore = defineStore('UserStore', {
})
},
async setGlobal($router: Router, isLogged: boolean) {
async setGlobal(router: Router, isLogged: boolean) {
console.log('setGlobal', isLogged)
const globalStore = useGlobalStore()
@@ -1405,7 +1421,7 @@ export const useUserStore = defineStore('UserStore', {
if (globalStore.site.confpages.enableProj)
await projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
globalStore.addDynamicPages($router)
globalStore.addDynamicPages(router)
static_data.lang_available = globalStore.getLangAvailable()
@@ -1426,7 +1442,7 @@ export const useUserStore = defineStore('UserStore', {
// console.log('setGlobal: END')
},
async autologin_FromLocalStorage($router: Router, $q: any) {
async autologin_FromLocalStorage(router: Router, $q: any) {
try {
const globalStore = useGlobalStore()
@@ -1454,7 +1470,7 @@ export const useUserStore = defineStore('UserStore', {
isLogged = tools.isLogged()
}
return await this.setGlobal($router, isLogged)
return await this.setGlobal(router, isLogged)
.then((loadstorage: any) => {
// console.log('RISULT setGlobal:', loadstorage)
if (loadstorage) {
@@ -1758,15 +1774,15 @@ export const useUserStore = defineStore('UserStore', {
.then((res: any) => {
if (res) {
let msg = ''
if (res.data.imported) {
msg += ' ' + t('db.records_imported', {num: res.data.imported})
msg += ' ' + t('db.records_imported', { num: res.data.imported })
}
if (res.data.errors) {
msg += ' ' + t('db.records_errors', {num: res.data.errors})
msg += ' ' + t('db.records_errors', { num: res.data.errors })
}
if (res.data.updated) {
msg += ' ' + t('db.records_updated', {num: res.data.updated})
msg += ' ' + t('db.records_updated', { num: res.data.updated })
}
if (!msg) {
msg = t('db.recupdated')
@@ -1931,7 +1947,7 @@ export const useUserStore = defineStore('UserStore', {
const globalStore = useGlobalStore()
if (globalStore.site && (!globalStore.site.confpages.showCoins && !globalStore.site.confpages.showRIS)) {
if (globalStore.site && (!globalStore.site.confpages.showCoins && !globalStore.site.confpages.showRIS)) {
return false
}

View File

@@ -1,3 +1,4 @@
import { createPinia } from 'pinia';
export default createPinia();