modif main_modules

This commit is contained in:
2025-10-30 18:48:15 +01:00
parent b804230b1b
commit 7c1bfae861
3 changed files with 109 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"optionid":"profil_en",
"title": "Profil",
"optionid":"formpagans",
"title": "Collecte des données public de Pagans",
"description": "Profil available in apxtri",
"commment": "",
"lastupdatedata": "",

View File

@@ -0,0 +1,103 @@
var apx = apx || {};
apx.apxform = {};
apx.apxform.loadwco = async (id, ctx) => {
// check if not authenticate, do nothing cause by default screensignin and wait authentification
// if authenticate, if url xhash then redirect if no url then change wco-link=screenmyworld
// if (dayjs(apx.data.headers.xdays).diff(dayjs(), "hours") >= 24) apx.apxauth.checkisauth();
//load main.mustache of the component
//when wco-xxx change it run this function
console.log(
`Load wconame:apxauth apx.apxauth.loadwco with id:${id} and ctx: ${JSON.stringify(
ctx
)}`
);
// Check that in localdb tpl exist if not means it is not authenticated
if (!apx.data.tpl[`apxauthscreen${ctx.link}`]) ctx.link="signin";
const tpldataname = `${apx.data.pagename}_${id}_apxauth`;
const apxauthid = document.getElementById(id);
const data = apx.apxauth.getdata(id, ctx);
if (apxauthid.innerHTML.trim() === "") {
apxauthid.innerHTML = Mustache.render(apx.data.tpl.apxauthmain, data);
}
apxauthid.querySelector(`.screenaction`).innerHTML = Mustache.render(
apx.data.tpl[`apxauthscreen${ctx.link}`],
data
);
apxauthid.querySelector(`.msginfo`).innerHTML = "";
};
apx.apxauth.getdata = (id, ctx) => {
const tpldataname = `${apx.data.pagename}_${id}_apxauth`;
const data = JSON.parse(JSON.stringify(apx.data.tpldata[tpldataname]));
data.id = id;
data.xalias = apx.data.headers.xalias;
data.xtribe = apx.data.headers.xtribe;
data.emailsupport = apx.data?.appdata?.emailsupport
? apx.data.appdata.emailsupport
: "";
console.log("data:",data)
switch (ctx.link) {
case "myworld":
if (!data.profils) data.profils = [];
apx.data.headers.xprofils.forEach((p) => {
if (!["anonymous", "pagans", "persons"].includes(p)) {
data.profils.push(apx.data.options.profil.itms[p].title);
}
});
data.noprofils = data.profils.length == 0;
data.member = apx.data.headers.xprofils.includes("persons");
data.websites = apx.data?.appdata?.websites || [];
data.optionlinks=apx.data.tpldata[tpldataname].optionlinks
data.town=apx.data.town
data.nation=apx.data.nation
if (1==1 || apx.data.headers.xprofils.includes('major')){
apx.data.tpldata[tpldataname].optionlinksmajor.forEach(o=>data.optionlinks.push(o))
apx.save()
}
if (!apx.data.itms) apx.data.itms={}
if (!apx.data.wco) apx.data.wco={}
// get towns list
axios
.get(`/api/apxtri/odmdb/idx/apxtri/towns/towns`, {
headers: apx.data.headers, withCredentials:true
})
.then((rep) => {
console.log(rep)
if (rep.status==200){
apx.data.itms.towns=rep.data.data.idx
data.townsnumber= Object.keys(apx.data.itms.towns).length;
apx.data.wco.townsnumber={textContent:Object.keys(apx.data.itms.towns).length};
apx.listendatawco('townsnumber');
apx.save()
}
})
.catch((err) => {
console.log("ERROR, geting towns itms not available",err)
});
axios
.get(`/api/apxtri/odmdb/idx/apxtri/pagans/lst_alias`, {
headers: apx.data.headers, withCredentials:true
})
.then((rep) => {
if (rep.status==200){
console.log(rep)
data.pagansnumber=rep.data.data.idx.length
apx.data.wco.pagansnumber={textContent:rep.data.data.idx.length};
apx.listendatawco('pagansnumber');
apx.save();
}
})
.catch((err) => {
console.log("ERROR, geting pagans itms not available",err)
});
break;
case "information":
break;
default:
break;
}
console.log("data for tpl:", data);
return data;
};

View File

@@ -23,8 +23,8 @@
@import "tailwindcss" source("/var/lib/apxtowns/data/apxtri/objects/wwws/admin/src / * * / *.{html,js,mustache}");
@import "./sourcetw.css";
*/
@import "/opt/apxtowns/farm-test/apxtri/node_modules/tailwindcss";
@plugin "/opt/apxtowns/farm-test/apxtri/node_modules/daisyui";
@import "/opt/apxtowns/main_modules/tailwindcss";
@plugin "/opt/apxtowns/main_modules/daisyui";
@import "./sourcetw.css";
/*
add h-sm a vertical breakpoint to check screen height that doies not exist in tw or daisyui
@@ -50,7 +50,7 @@
}
}
@plugin "/opt/apxtowns/farm-test/apxtri/node_modules/daisyui/theme" {
@plugin "/opt/apxtowns/main_modules/daisyui/theme" {
name: "apxtridark";
default: true;
prefersdark: true;
@@ -86,7 +86,7 @@
}
@plugin "/opt/apxtowns/farm-test/apxtri/node_modules/daisyui/theme" {
@plugin "/opt/apxtowns/main_modules/daisyui/theme" {
name: "apxtrilight";
default: false;
prefersdark: false;