From 7c1bfae86137cc58099f1d4130639e34123aa36b Mon Sep 17 00:00:00 2001 From: philc Date: Thu, 30 Oct 2025 18:48:15 +0100 Subject: [PATCH] modif main_modules --- options/itm/formpagans_fr.json | 4 +- wco/apxform/apxform.js | 103 ++++++++++++++++++++++++++++ wwws/admin/src/static/css/input.css | 8 +-- 3 files changed, 109 insertions(+), 6 deletions(-) diff --git a/options/itm/formpagans_fr.json b/options/itm/formpagans_fr.json index fe8bc0e..a481758 100644 --- a/options/itm/formpagans_fr.json +++ b/options/itm/formpagans_fr.json @@ -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": "", diff --git a/wco/apxform/apxform.js b/wco/apxform/apxform.js index e69de29..f45b68a 100644 --- a/wco/apxform/apxform.js +++ b/wco/apxform/apxform.js @@ -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; +}; \ No newline at end of file diff --git a/wwws/admin/src/static/css/input.css b/wwws/admin/src/static/css/input.css index 5866bfa..4ea9598 100644 --- a/wwws/admin/src/static/css/input.css +++ b/wwws/admin/src/static/css/input.css @@ -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;