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]