1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[9387],{59387:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var o=n(89379),i=n(65043),l=n(91357),r=n(70579);const a="/api",s=[{id:"accueil",label:"Accueil",category:"general"},{id:"membres-crm",label:"Coop\xe9ratives (CRM)",category:"gestion"},{id:"agent-ia",label:"Intelligence - Subventions",category:"intelligence"},{id:"rapports",label:"Intelligence - Rapports",category:"intelligence"},{id:"sondage",label:"Intelligence - Sondages",category:"intelligence"},{id:"intranet",label:"Intranet",category:"gestion"},{id:"departements",label:"D\xe9partements",category:"gestion"},{id:"mon-departement",label:"Mon D\xe9partement",category:"personnel"},{id:"formation-lms",label:"Formations LMS",category:"gestion"},{id:"gestion-projets",label:"Projets",category:"gestion"},{id:"partenaires",label:"Partenaires",category:"gestion"},{id:"comites",label:"Comit\xe9s",category:"gestion"},{id:"plaintes",label:"Plaintes",category:"gestion"},{id:"rh",label:"Ressources Humaines",category:"gestion"},{id:"support",label:"Support",category:"communaute"},{id:"annonces",label:"Annonces",category:"communaute"},{id:"forum",label:"Forum",category:"communaute"},{id:"mes-absences",label:"Mes Absences",category:"personnel"},{id:"mes-agents",label:"Mes Agents",category:"personnel"},{id:"formation-mes",label:"Mes Formations",category:"personnel"},{id:"formation-catalogue",label:"Catalogue Formations",category:"personnel"},{id:"gestion-utilisateurs",label:"Utilisateurs",category:"administration"},{id:"profil-federation",label:"Profil Organisation",category:"administration"},{id:"site-web",label:"Site Web - Agents IA",category:"administration"}],d={general:"G\xe9n\xe9ral",gestion:"Gestion",intelligence:"Intelligence",communaute:"Communaut\xe9",personnel:"Personnel",administration:"Administration"};function c(){const e=(0,l.Zp)(),[t,n]=(0,i.useState)([]),[c,g]=(0,i.useState)(""),[u,p]=(0,i.useState)([]),[b,m]=(0,i.useState)([]),[h,f]=(0,i.useState)(!0),[y,x]=(0,i.useState)(!1),[j,v]=(0,i.useState)(null),[S,k]=(0,i.useState)(!1);(0,i.useEffect)(()=>{C()},[]);const C=async()=>{try{var e;const t=localStorage.getItem("token"),o=await fetch("".concat(a,"/admin/tenant-modules"),{headers:{Authorization:"Bearer ".concat(t)}});if(!o.ok)throw new Error("HTTP ".concat(o.status));const i=await o.json();if(n(i.tenants||[]),(null===(e=i.tenants)||void 0===e?void 0:e.length)>0&&!c){const e=i.tenants[0];g(e.id),p(e.disabled_modules||[]),m(e.disabled_mobile_modules||[])}}catch(t){console.error("Error fetching tenants:",t),v({type:"error",text:"Erreur lors du chargement des tenants"})}finally{f(!1)}},w=t.find(e=>e.id===c),z=s.length-u.length,I=s.length-b.length;return h?(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",background:"#f9fafb"},children:[(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)("div",{style:{width:40,height:40,border:"3px solid #e5e7eb",borderTop:"3px solid #3b82f6",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 12px"}}),(0,r.jsx)("p",{style:{color:"#6b7280"},children:"Chargement..."})]}),(0,r.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}):(0,r.jsxs)("div",{style:{minHeight:"100vh",background:"#f9fafb"},children:[(0,r.jsxs)("div",{style:{background:"white",borderBottom:"1px solid #e5e7eb",padding:"16px 32px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16},children:[(0,r.jsx)("button",{onClick:()=>e("/admin/dashboard"),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:14},children:"\u2190 Retour"}),(0,r.jsx)("h1",{style:{fontSize:20,fontWeight:700,color:"#111827",margin:0},children:"Module Visibility"})]}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12},children:[j&&(0,r.jsx)("span",{style:{padding:"6px 12px",borderRadius:6,fontSize:13,fontWeight:500,background:"success"===j.type?"#f0fdf4":"#fef2f2",color:"success"===j.type?"#16a34a":"#dc2626",border:"1px solid ".concat("success"===j.type?"#bbf7d0":"#fecaca")},children:j.text}),(0,r.jsx)("button",{onClick:async()=>{x(!0),v(null);try{const e=localStorage.getItem("token"),t=await fetch("".concat(a,"/admin/tenant-modules/").concat(c),{method:"PUT",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"},body:JSON.stringify({disabled_modules:u,disabled_mobile_modules:b})});if(!t.ok)throw new Error("HTTP ".concat(t.status));n(e=>e.map(e=>e.id===c?(0,o.A)((0,o.A)({},e),{},{disabled_modules:u,disabled_mobile_modules:b}):e)),k(!1),v({type:"success",text:"Modules mis \xe0 jour avec succ\xe8s!"})}catch(e){console.error("Error saving modules:",e),v({type:"error",text:"Erreur lors de la sauvegarde"})}finally{x(!1)}},disabled:y||!S,style:{padding:"8px 20px",borderRadius:8,border:"none",background:S?"#3b82f6":"#e5e7eb",color:S?"white":"#9ca3af",fontWeight:600,fontSize:14,cursor:S?"pointer":"default",opacity:y?.7:1},children:y?"Saving...":"Save"})]})]}),(0,r.jsxs)("div",{style:{maxWidth:960,margin:"0 auto",padding:32},children:[(0,r.jsxs)("div",{style:{background:"white",borderRadius:12,border:"1px solid #e5e7eb",padding:24,marginBottom:24},children:[(0,r.jsx)("label",{style:{display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:8},children:"S\xe9lectionner un portail f\xe9d\xe9ration"}),(0,r.jsx)("select",{value:c,onChange:e=>(e=>{const n=t.find(t=>
1t.id===e);g(e),p((null===n||void 0===n?void 0:n.disabled_modules)||[]),m((null===n||void 0===n?void 0:n.disabled_mobile_modules)||[]),k(!1),v(null)})(e.target.value),style:{width:"100%",maxWidth:400,padding:"10px 12px",borderRadius:8,border:"1px solid #d1d5db",fontSize:14,color:"#111827",background:"white"},children:t.map(e=>(0,r.jsxs)("option",{value:e.id,children:[e.name," (",e.slug,") ",e.is_active?"":"\u2014 Inactif"]},e.id))}),w&&(0,r.jsxs)("p",{style:{marginTop:8,fontSize:13,color:"#6b7280"},children:["Portail: ",z,"/",s.length," modules \u2014 Mobile: ",I,"/",s.length," modules"]})]}),w&&(0,r.jsxs)("div",{style:{background:"white",borderRadius:12,border:"1px solid #e5e7eb",padding:24},children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[(0,r.jsxs)("h2",{style:{fontSize:16,fontWeight:600,color:"#111827",margin:0},children:["Modules \u2014 ",w.name]}),(0,r.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,r.jsx)("button",{onClick:()=>{p([]),k(!0)},style:{fontSize:12,color:"#16a34a",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Tout activer"}),(0,r.jsx)("span",{style:{color:"#d1d5db"},children:"|"}),(0,r.jsx)("button",{onClick:()=>{p(s.map(e=>e.id)),k(!0)},style:{fontSize:12,color:"#dc2626",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Tout d\xe9sactiver"})]})]}),(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 80px",gap:8,marginBottom:12,paddingBottom:8,borderBottom:"2px solid #e5e7eb"},children:[(0,r.jsx)("span",{style:{fontSize:13,fontWeight:700,color:"#374151"},children:"Module"}),(0,r.jsx)("span",{style:{fontSize:12,fontWeight:700,color:"#374151",textAlign:"center"},children:"Portail"}),(0,r.jsx)("span",{style:{fontSize:12,fontWeight:700,color:"#0369a1",textAlign:"center"},children:"Mobile"})]}),Object.entries(d).map(e=>{let[t,n]=e;const o=s.filter(e=>e.category===t);return 0===o.length?null:(0,r.jsxs)("div",{style:{marginBottom:16},children:[(0,r.jsx)("h3",{style:{fontSize:12,fontWeight:600,color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:8},children:n}),o.map(e=>{const t=!u.includes(e.id),n=!b.includes(e.id);return(0,r.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 80px",gap:8,alignItems:"center",padding:"8px 12px",borderRadius:8,marginBottom:4,backgroundColor:t||n?"#f9fafb":"#fafafa",border:"1px solid #e5e7eb"},children:[(0,r.jsx)("span",{style:{fontSize:13,fontWeight:500,color:t?"#166534":"#9ca3af",textDecoration:t?"none":"line-through"},children:e.label}),(0,r.jsx)("label",{style:{display:"flex",justifyContent:"center",cursor:"pointer"},children:(0,r.jsx)("input",{type:"checkbox",checked:t,onChange:()=>{return t=e.id,p(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),k(!0),void v(null);var t},style:{width:16,height:16,accentColor:"#16a34a"}})}),(0,r.jsx)("label",{style:{display:"flex",justifyContent:"center",cursor:"pointer"},children:(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:()=>{return t=e.id,m(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),k(!0),void v(null);var t},style:{width:16,height:16,accentColor:"#0369a1"}})})]},e.id)})]},t)})]})]})]})}}}]); 2//# sourceMappingURL=9387.fa3159a7.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.