Site Configuration by Server Params (confsites and confpages)

This commit is contained in:
Surya Paolo
2022-11-28 14:00:15 +01:00
parent fab0dbbb72
commit 58dc1dfdcc
76 changed files with 2504 additions and 5004 deletions

View File

@@ -17,6 +17,37 @@ export const costanti = {
CERCO: 2,
},
Lang: {
IT: 1,
EN: 2,
ES: 4,
FR: 8,
DE: 16,
},
ArrLang: [
{
label: 'Italiano',
value: 1,
},
{
label: 'Inglese',
value: 2,
},
{
label: 'Spagnolo',
value: 4,
},
{
label: 'Francese',
value: 8,
},
{
label: 'Tedesco',
value: 16,
},
],
ShowTypeTask: {
SHOW_LAST_N_COMPLETED: 200,
SHOW_ONLY_TOCOMPLETE: 201,

View File

@@ -1467,6 +1467,14 @@ export const colTableSites = [
fieldtype: costanti.FieldType.binary,
jointable: 'confsite_opt',
}),
AddCol({
name: 'confpages.lang',
field: 'confpages',
subfield: 'lang',
label_trans: 'confpages.lang',
fieldtype: costanti.FieldType.binary,
jointable: 'confpages_lang',
}),
AddCol({
name: 'policy.show',
field: 'policy',
@@ -1541,13 +1549,6 @@ export const colTableSites = [
subfield: 'whatsapp',
label_trans: 'reg.whatsapp',
}),
AddCol({
name: 'contacts.whatsapp',
field: 'contacts',
subfield: 'whatsapp',
label_trans: 'reg.whatsapp_home',
fieldtype: costanti.FieldType.boolean,
}),
AddCol({
name: 'contacts.telegram',
field: 'contacts',
@@ -1620,20 +1621,6 @@ export const colTableSites = [
label_trans: 'confpages.dark',
fieldtype: costanti.FieldType.boolean,
}),
AddCol({
name: 'footer_mobile.show_buttHome',
field: 'footer_mobile',
subfield: 'show_buttHome',
label_trans: 'reg.show_buttHome',
fieldtype: costanti.FieldType.boolean,
}),
AddCol({
name: 'footer_mobile.whatsapp',
field: 'footer_mobile',
subfield: 'show_profile',
label_trans: 'reg.show_profile',
fieldtype: costanti.FieldType.boolean,
}),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]
@@ -2970,11 +2957,12 @@ export const fieldsTable = {
return this.tablesList.find((rec) => rec.value === mytable)
},
getColByTable(mytable: string, namecol: string) {
const tablerec: any = this.tablesList.find((rec) => rec.value === mytable)
if (tablerec) {
// console.log('tablerec', tablerec.columns)
console.log('tablerec', tablerec.columns)
const mycol = tablerec.columns.find((col: any) => col.name === namecol)
// console.log('mycol = ', mycol)
console.log('mycol = ', mycol)
return mycol
} else
return null
@@ -3096,15 +3084,7 @@ export const fieldsTable = {
},
userlist() {
if (static_data.functionality.ENABLE_REG_AYNI) {
return colTableUsers
} else if (static_data.functionality.ENABLE_REG_CNM) {
return colTableUsersCNM
} else if (static_data.functionality.ENABLE_REG_ISP) {
return colTableUsersISP
} else {
return colTableUsersBase
}
return colTableUsersISP
},
tablesList: [
@@ -3328,6 +3308,15 @@ export const fieldsTable = {
colicon: 'icon',
noshow: true,
},
{
value: 'confpages_lang',
label: 'Lingua',
columns: colTableGeneric,
colkey: 'value',
collabel: 'label',
colicon: 'icon',
noshow: true,
},
{
value: 'fonts_installed',
label: 'Font Installati',

View File

@@ -12,7 +12,7 @@ import {
ITodo,
IUserFields,
Privacy,
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim,
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif, IMyElem, IMyCard, ILabelValue, ILabelValueStr, IAnim, ILang,
} from '@model'
import { fieldsTable } from '@store/Modules/fieldsTable'
@@ -2713,6 +2713,10 @@ export const tools = {
return true
},
getLangUsed() {
return static_data.lang_available.map((m: ILang) => m.value)
},
checkLangPassed($q: any, $router: Router, mylangpass: string) {
// console.log('checkLangPassed ', mylang)
const userStore = useUserStore()
@@ -2744,6 +2748,7 @@ export const tools = {
}
console.log('static_data.arrLangUsed', static_data.arrLangUsed, 'mylang', mylang)
if (!(static_data.arrLangUsed.includes(mylang))) {
// console.log('non incluso ', mylang)
// mylang = static_data.arrLangUsed[0]
@@ -4738,7 +4743,7 @@ export const tools = {
let ris = true
const online = this.getValDb('SITO_ONLINE', false, true)
ris = userStore.isAdmin && !pertutti ? true : online
console.log('sito_online', ris)
// console.log('sito_online', ris)
return ris
},
@@ -4964,7 +4969,10 @@ export const tools = {
},
isVerified(): boolean {
if (static_data.functionality.ENABLE_REG_NEED_TELEGRAM) {
const globalStore = useGlobalStore()
const site = globalStore.site
if (site.confpages.enabledRegNeedTelegram) {
return tools.TelegVerificato()
} else {
return this.isEmailVerified()
@@ -6445,19 +6453,24 @@ export const tools = {
}
},
getValueByRemoteField(col: IColGridTable, row: any, value: any, col_tabfooter: string) {
getValueByRemoteField(col: IColGridTable, row: any) {
if (col) {
if (col.remote_table && col.remote_key && col.remote_field && col_tabfooter) {
if (col.remote_table && col.remote_key && col.remote_field) {
const myarrremote = row[col.remote_table]
let myarr: any = []
for (const myrec of myarrremote) {
let myval = myrec[col.remote_field]
myarr.push(myval)
if (myarrremote) {
for (const myrec of myarrremote) {
let myval = myrec[col.remote_field]
myarr.push(myval)
}
}
console.log('myarrremote', myarrremote)
// console.log('myarr', myarr)
return myarr ? myarr.join(' - ') : ''
}
@@ -6507,6 +6520,11 @@ export const tools = {
obj.col_title = 'descr'
obj.col_footer = 'idCity'
obj.col_tabfooter = 'mycities'
} else if (table === 'cities') {
obj.prop_colkey = '_id'
obj.col_title = 'comune'
obj.col_footer = 'comune'
obj.col_tabfooter = 'mycities'
}
return obj
@@ -6860,6 +6878,25 @@ export const tools = {
return false
},
isLangEnabled(lang: number): any {
const globalStore = useGlobalStore()
if (globalStore.site) {
if (globalStore.site.confpages.hasOwnProperty('lang')) {
return this.isBitActive(globalStore.site.confpages.lang, lang)
}
if (!globalStore.site.confpages.hasOwnProperty('lang') || globalStore.site.confpages.lang === 0) {
if (lang === costanti.Lang.IT) {
return true
}
}
}
return false
},
getAskToVerifyReg(): boolean {
return this.getConfSiteOptionEnabled(shared_consts.ConfSite.Need_Aportador_On_DataReg_To_Verify_Reg)
},
@@ -7242,9 +7279,9 @@ export const tools = {
let mycl = ''
if (myanim)
mycl = (!!myanim.name ? myanim.name : '') +
' ' + (!!myanim.clduration ? myanim.clduration : '') +
' ' + (!!myanim.cldelay ? myanim.cldelay : '') +
' ' + (!!myanim.timingtype ? myanim.timingtype : '')
' ' + (!!myanim.clduration ? myanim.clduration : '') +
' ' + (!!myanim.cldelay ? myanim.cldelay : '') +
' ' + (!!myanim.timingtype ? myanim.timingtype : '')
else
mycl = ''
@@ -7255,6 +7292,20 @@ export const tools = {
},
getLabelFooterByRow(row: any, field: string, tablesel: string) {
if (field) {
const mycol = fieldsTable.getColByTable(tablesel, field)
if (mycol) {
console.log('remote_table = ', mycol.remote_table, 'remote_key', mycol.remote_key)
console.log('ROW', row)
return tools.getValueByRemoteField(mycol, row)
}
}
return ''
},
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {
// return navigator.languages[0]

View File

@@ -266,6 +266,8 @@ export const toolsext = {
}
console.log('static_data.arrLangUsed', static_data.arrLangUsed, 'mylang', mylang)
if (!(static_data.arrLangUsed.includes(mylang))) {
// console.log('non incluso ', mylang)
// mylang = static_data.arrLangUsed[0]

View File

@@ -9,6 +9,8 @@ import { tools } from '@store/Modules/tools'
import { defineStore } from 'pinia'
import { useUserStore } from '@store/UserStore'
import { toolsext } from '@store/Modules/toolsext'
import { useGlobalStore } from './globalStore'
import { ref } from 'vue'
export const useProducts = defineStore('Products', {
state: (): IProductsState => ({
@@ -127,9 +129,11 @@ export const useProducts = defineStore('Products', {
async loadProducts() {
const userStore = useUserStore()
console.log('loadProducts')
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
// console.log('loadProducts')
if (!globalStore.site.confpages.enableEcommerce)
return null
console.log('getProducts', 'userid=', userStore.my._id)
@@ -170,8 +174,9 @@ export const useProducts = defineStore('Products', {
console.log('loadProduct', code)
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
if (!globalStore.site.confpages.enableEcommerce)
return null
console.log('getProduct', 'code', code)
@@ -204,8 +209,9 @@ export const useProducts = defineStore('Products', {
console.log('loadOrders')
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
if (!globalStore.site.confpages.enableEcommerce)
return null
console.log('loadOrders', 'userid=', userStore.my._id)
@@ -256,8 +262,9 @@ export const useProducts = defineStore('Products', {
async addToCart({ product, order }: { product: IProduct, order: IOrder }) {
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
if (!globalStore.site.confpages.enableEcommerce)
return null
const neworder = this.createOrderByProduct(product, order)
@@ -293,7 +300,9 @@ export const useProducts = defineStore('Products', {
async addSubQtyToItem({ addqty, subqty, order } : { addqty: boolean, subqty: boolean, order: IOrder }) {
const userStore = useUserStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
const globalStore = useGlobalStore()
if (!globalStore.site.confpages.enableEcommerce)
return null
// console.log('addSubQtyToItem', 'userid=', userStore.my._id, order)
@@ -326,8 +335,9 @@ export const useProducts = defineStore('Products', {
async UpdateStatusCart({ cart_id, status }: { cart_id:string, status: number }) {
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
if (!globalStore.site.confpages.enableEcommerce)
return null
// console.log('addSubQtyToItem', 'userid=', userStore.my._id, order)
@@ -356,8 +366,9 @@ export const useProducts = defineStore('Products', {
async UpdateOrderStatus({ order_id, status }: { order_id: string, status: number }) {
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!static_data.functionality.ENABLE_ECOMMERCE)
if (!globalStore.site.confpages.enableEcommerce)
return null
// console.log('addSubQtyToItem', 'userid=', userStore.my._id, order)

View File

@@ -364,7 +364,10 @@ export const useProjectStore = defineStore({
async dbLoad({ checkPending, onlyiffirsttime }: {checkPending: boolean, onlyiffirsttime: boolean}) {
if (!static_data.functionality.ENABLE_PROJECTS_LOADING)
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!globalStore.site.confpages.enableProj)
return null
if (onlyiffirsttime) {
@@ -382,11 +385,9 @@ export const useProjectStore = defineStore({
// console.log('dbLoad', nametable, checkPending, 'userid=', userStore.my._id)
const userStore = useUserStore()
const globalStore = useGlobalStore()
const ris = await Api.SendReq('/projects/' + userStore.my._id, 'GET', null)
.then((res) => {
if (res.data.projects) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
this.projects = res.data.projects
} else {

View File

@@ -257,7 +257,7 @@ export const useTodoStore = defineStore('Todos', {
const globalStore = useGlobalStore()
const userStore = useUserStore()
if (!static_data.functionality.ENABLE_PROJECTS_LOADING)
if (!globalStore.site.confpages.enableProj)
return null
// console.log('dbLoad', nametable, checkPending, 'userid=', userStore.my._id)

View File

@@ -276,7 +276,6 @@ export const useUserStore = defineStore('UserStore', {
if (username === '') return ''
// Check if is this User!
const myrec = this.getUserByUsername(username)
// console.log('myrec', myrec)
if (myrec && myrec.profile && !!myrec.profile.img && myrec.profile.img !== '' && myrec.profile.img !== 'undefined') {
return costanti.DIR_UPLOAD + 'profile/' + this.my.username + '/' + myrec.profile.img
}
@@ -968,21 +967,24 @@ export const useUserStore = defineStore('UserStore', {
globalStore.checkUpdates()
}
const isok = await globalStore.loadAfterLogin()
this.isLogged = isok && isLogged
console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
// console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
if (static_data.functionality.ENABLE_TODOS_LOADING)
if (globalStore.site.confpages.enableTodos)
await todos.dbLoad({ checkPending: true })
if (static_data.functionality.ENABLE_PROJECTS_LOADING)
if (globalStore.site.confpages.enableProj)
await projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
globalStore.addDynamicPages($router)
static_data.lang_available = globalStore.getLangAvailable()
static_data.arrLangUsed = tools.getLangUsed()
// console.log('$router', $router)
globalStore.finishLoading = true
@@ -1002,7 +1004,7 @@ export const useUserStore = defineStore('UserStore', {
try {
const globalStore = useGlobalStore()
console.log('*** autologin_FromLocalStorage ***')
// console.log('*** autologin_FromLocalStorage ***')
// INIT
let isLogged = false
@@ -1026,77 +1028,11 @@ export const useUserStore = defineStore('UserStore', {
isLogged = tools.isLogged()
}
/*if (token) {
const expirationDateStr = localStorage.getItem(toolsext.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow()
if (now < expirationDate) {
const _id = String(localStorage.getItem(toolsext.localStorage.userId))
const username = String(localStorage.getItem(toolsext.localStorage.username))
const name = String(localStorage.getItem(toolsext.localStorage.name))
const surname = String(localStorage.getItem(toolsext.localStorage.surname))
const verified_email = localStorage.getItem(toolsext.localStorage.verified_email) === 'true'
const verified_by_aportador = localStorage.getItem(toolsext.localStorage.verified_by_aportador) === 'true'
const made_gift = localStorage.getItem(toolsext.localStorage.made_gift) === 'true'
const myperm = localStorage.getItem(toolsext.localStorage.perm)
let perm = 0
if (myperm) perm = parseInt(myperm, 10)
const img = String(localStorage.getItem(toolsext.localStorage.img))
let teleg_id = 0
const telegid = localStorage.getItem(toolsext.localStorage.teleg_id)
if (telegid) teleg_id = parseInt(telegid, 10)
globalStore.wasAlreadySubOnDb = localStorage.getItem(toolsext.localStorage.wasAlreadySubOnDb) === 'true'
console.log('************* autologin _id', _id)
this.setAuth(token)
this.authUser({
_id,
username,
name,
surname,
verified_email,
verified_by_aportador,
made_gift,
perm,
profile: {
img,
teleg_id,
myshares: [],
friends: [],
req_friends: [],
asked_friends: [],
mygroups: [],
asked_groups: [],
manage_mygroups: []
},
})
isLogged = true
}
}*/
return await this.setGlobal($router, isLogged)
.then((loadstorage: any) => {
console.log('RISULT setGlobal:', loadstorage)
if (loadstorage) {
if ($q.screen.gt.sm) {
// globalStore.setleftDrawerOpen(true)
}
/*if (toolsext.getLocale() !== '') {
// console.log('SETLOCALE :', this.$i18n.locale)
$i18n.locale = toolsext.getLocale() // Set Lang
} else {
userStore.setlang($router, this.$i18n.locale)
}*/
globalroutines('loadapp', '')
// Create Subscription to Push Notification
@@ -1104,9 +1040,6 @@ export const useUserStore = defineStore('UserStore', {
}
})
// console.log('autologin _id STATE ', this._id)
// return true
} catch (e: any) {
console.error('ERR autologin ', e.message)
return false

View File

@@ -9,6 +9,7 @@ import {
IMyPage, IMySkill, IParamsPickup,
IParamsQuery,
ISettings,
ISites,
StateConnection,
} from '@model'
import { static_data } from '@src/db/static_data'
@@ -32,6 +33,8 @@ import { useTodoStore } from '@store/Todos'
import { useMessageStore } from './MessageStore'
import { useNotifStore } from '@store/NotifStore'
import { useCircuitStore } from '@store/CircuitStore'
import { routesAdmin } from '@src/router/routesAdmin'
import LandingFooter from '@src/components/LandingFooter/LandingFooter'
const stateConnDefault = 'online'
@@ -270,7 +273,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
return state.skills
else if (table === 'goods')
return state.goods
// else if (table === 'subskills')
// else if (table === 'subskills')
// return state.subSkills
else if (table === 'statusSkills')
return state.statusSkills
@@ -306,7 +309,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
},
actions: {
setValueSettingsByKey({ key, value, serv }: {key: string, value: any, serv: boolean}): any {
setValueSettingsByKey({ key, value, serv }: { key: string, value: any, serv: boolean }): any {
// Update the Server
// Update in Memory
@@ -351,6 +354,43 @@ export const useGlobalStore = defineStore('GlobalStore', {
return this.stateConnection === 'online'
},
getLangAvailable() {
let myarrLang = []
// console.log('lang Server: ', this.site.confpages.lang)
if (tools.isLangEnabled(costanti.Lang.IT)) {
myarrLang.push({
label: 'Italiano', icon: 'fa-flag-it', value: 'it', image: '../images/it.png', short: 'IT',
})
}
if (tools.isLangEnabled(costanti.Lang.EN)) {
// console.log('ENG')
myarrLang.push(
{
label: 'English', icon: 'fa-flag-us', value: 'enUs', image: '../images/gb.png', short: 'EN',
},
)
}
if (tools.isLangEnabled(costanti.Lang.ES)) {
myarrLang.push(
{
label: 'Español', icon: 'fa-flag-es', value: 'es', image: '../images/es.png', short: 'ES',
},
)
}
if (tools.isLangEnabled(costanti.Lang.FR)) {
myarrLang.push(
{ label: 'Français', icon: 'fa-facebook', value: 'fr', image: '../public/images/fr.png', short: 'FR' })
}
if (tools.isLangEnabled(costanti.Lang.DE)) {
myarrLang.push(
{ label: 'German', icon: 'fa-flag-de', value: 'de', image: '../public/images/de.png', short: 'DE' }
)
}
return myarrLang
},
addDynamicPages($router: Router | null) {
// console.log('this.mypage', this.mypage)
// console.log('addDynamicPages')
@@ -387,6 +427,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
}
const baseroutes = static_data.getDynamicPages(this.site);
const adminRoutes = routesAdmin.routesAd(this.site);
const last = {
active: true,
order: 10000,
@@ -412,7 +456,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (!toolsext.sito_online(false)) {
static_data.routes = [sito_offline, last]
} else {
static_data.routes = [...static_data.baseroutes, ...arrpagesroute, last]
static_data.routes = [...baseroutes, ...adminRoutes, ...arrpagesroute, last]
}
for (const menu of static_data.routes) {
@@ -433,17 +477,13 @@ export const useGlobalStore = defineStore('GlobalStore', {
// console.log('$router', $router)
if ($router) {
if (tools.sito_online(false)) {
// console.log('SITO ONLINE', arrpagesroute)
arrpagesroute.forEach((route: any) => {
static_data.routes.forEach((route: any) => {
if (!$router.hasRoute(route.name)) {
$router.addRoute(route)
})
}
})
$router.addRoute(last)
} else {
// console.log('SITO OFFLINE')
$router.addRoute(sito_offline)
$router.addRoute(last)
if (!tools.sito_online(false)) {
$router.replace('/sito_offline')
}
@@ -587,7 +627,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
// return
// }
if (!static_data.functionality.PWA)
if (!this.site.confpages.enablePwa)
return
if (!('serviceWorker' in navigator)) {
@@ -717,7 +758,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
//
}
if (static_data.functionality.PWA) {
if (this.site.confpages.enablePwa) {
if ('serviceWorker' in navigator) {
// REMOVE ALL SUBSCRIPTION
console.log('REMOVE ALL SUBSCRIPTION...')
@@ -736,8 +777,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
})
}).catch((err) => {
console.error('err ready service worker', err)
})
console.error('err ready service worker', err)
})
}
}
@@ -817,7 +858,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async sendPushNotif({ params }: {params: any}) {
async sendPushNotif({ params }: { params: any }) {
return Api.SendReq('/push/send', 'POST', { params })
.then((res) => {
@@ -920,8 +961,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
path = path.substring(1)
const mypage = this.getPage(`/${path}`)
console.log('mypage', mypage)
// Controlla se l'ho già caricato
if (!!mypage && (!!mypage.content || mypage.loadFirst)) {
if (!!mypage && (!!mypage.content || mypage.loadFirst || mypage.loaded)) {
return mypage
}
@@ -935,6 +978,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (index >= 0) {
console.log('load page', path, '...')
this.mypage[index] = res.data.mypage
this.mypage[index].loaded = true
}
return res.data.mypage
}
@@ -1045,7 +1089,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
.catch((error) => false)
},
async callFunz({ mydata }: {mydata: any}) {
async callFunz({ mydata }: { mydata: any }) {
// console.log('saveFieldValue', mydata)
return Api.SendReq('/callfunz', 'PATCH', { data: mydata })
@@ -1060,7 +1104,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async askFunz({ mydata }: {mydata: any}) {
async askFunz({ mydata }: { mydata: any }) {
// console.log('saveFieldValue', mydata)
return Api.SendReq('/askfunz', 'PATCH', { data: mydata })
@@ -1072,7 +1116,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async DeleteRec({ table, id }: {table: string, id: string}) {
async DeleteRec({ table, id }: { table: string, id: string }) {
console.log('DeleteRec', table, id)
return Api.SendReq('/delrec/' + table + '/' + id, 'DELETE', null)
@@ -1090,7 +1134,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async DeleteFile({ filename }: {filename: string}) {
async DeleteFile({ filename }: { filename: string }) {
console.log('DeleteFile', filename)
return Api.SendReq(`/delfile/${tools.getvers()}/`, 'DELETE', { filename })
@@ -1108,7 +1152,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async DuplicateRec({ table, id }: {table: string, id: string}) {
async DuplicateRec({ table, id }: { table: string, id: string }) {
console.log('DuplicateRec', id)
return Api.SendReq('/duprec/' + table + '/' + id, 'POST', null)
@@ -1126,7 +1170,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async InviaMsgADonatori({ msgobj, navemediatore, tipomsg }: {msgobj: any, navemediatore: any, tipomsg: any}) {
async InviaMsgADonatori({ msgobj, navemediatore, tipomsg }: { msgobj: any, navemediatore: any, tipomsg: any }) {
console.log('InviaMsgADonatori', msgobj)
const mydata = {
@@ -1155,7 +1199,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async InviaMsgAFlotta({ flotta, inviareale, inviaemail, tipomsg }: {flotta: any, inviareale: boolean, inviaemail: boolean, tipomsg: any}) {
async InviaMsgAFlotta({ flotta, inviareale, inviaemail, tipomsg }: { flotta: any, inviareale: boolean, inviaemail: boolean, tipomsg: any }) {
console.log('InviaMsgAFlotta')
const mydata = {
@@ -1225,7 +1269,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async GetNave({ riga, col, riga1don, col1don, ind_order }: {riga: any, col: any, riga1don: any, col1don: any, ind_order: number}) {
async GetNave({ riga, col, riga1don, col1don, ind_order }: { riga: any, col: any, riga1don: any, col1don: any, ind_order: number }) {
// console.log('GetNave')
const mydata = {
@@ -1252,7 +1296,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async GetData({ data }: {data: any}) {
async GetData({ data }: { data: any }) {
console.log('GetData')
const mydata = {
@@ -1275,7 +1319,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async GetArrDoniNavi({ ricalcola, showall }: {ricalcola: boolean, showall: boolean}) {
async GetArrDoniNavi({ ricalcola, showall }: { ricalcola: boolean, showall: boolean }) {
console.log('GetArrDoniNavi')
const mydata = {
@@ -1299,7 +1343,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async GetFlotte({ ricalcola, showall }: {ricalcola: boolean, showall: boolean}) {
async GetFlotte({ ricalcola, showall }: { ricalcola: boolean, showall: boolean }) {
console.log('GetFlotte')
const mydata = {
@@ -1323,7 +1367,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async GetFlotta({ riga, col_prima, col_ultima }: {riga: any, col_prima: any, col_ultima: any}) {
async GetFlotta({ riga, col_prima, col_ultima }: { riga: any, col_prima: any, col_ultima: any }) {
console.log('GetFlotta')
const mydata = {
@@ -1416,6 +1460,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.mailinglist = (res.data.mailinglist) ? [...res.data.mailinglist] : []
}
this.mypage = (res.data.mypage) ? [...res.data.mypage] : []
for (const page of this.mypage) {
if (page.loadFirst)
page.loaded = true
}
this.myelems = (res.data.myelems) ? [...res.data.myelems] : []
// console.log('this.mypage', this.mypage)
@@ -1466,7 +1514,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
})
},
async sendEmailTest({ previewonly }: {previewonly: any}) {
async sendEmailTest({ previewonly }: { previewonly: any }) {
const usertosend = {
locale: tools.getLocale(),
previewonly
@@ -1634,6 +1682,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'fieldstype') myarr = costanti.FieldTypeArr
else if (table === 'metodo_pagamento') myarr = tools.SelectMetodiPagamento
else if (table === 'confsite_opt') myarr = tools.ConfSiteOpt
else if (table === 'confpages_lang') myarr = costanti.ArrLang
else if (table === 'bottype') myarr = shared_consts.BotType
else if (table === 'visibility') myarr = shared_consts.Visibility
else if (table === 'cat_interesse_arcadei') myarr = shared_consts.Cat_Interesse_Arcadei
@@ -1743,7 +1792,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (!myelem._id)
return false
return await this.DeleteRec({table: 'myelems', id: myelem._id }).then((ris) => {
return await this.DeleteRec({ table: 'myelems', id: myelem._id }).then((ris) => {
if (ris) {
this.myelems = this.myelems.filter((rec) => rec._id !== myelem._id)
tools.showPositiveNotif($q, t('db.deletedrecord'))