PageSourceSearch

https://serene-medovik-df543e.netlify.app/assets/CorrectionAdminPage-DwXgVAbi.js

js serene-medovik-df543e.netlify.app collected 2026-10-03 11:23:45 UTC 5,850 bytes, 23 lines download raw bytes

1import{j as e,c as h,R as _,D as C,C as w}from"./ui-DVBlfA5z.js";import{C as d,B as g,s as m,g as E}from"./admin-dBc4hj6A.js";import{r as u}from"./vendor-BBdBhp03.js";import{c as t}from"./index-EzaRBE5U.js";import"./supabase-CwXC4dzy.js";const y=()=>{const[o,f]=u.useState([]),[a,p]=u.useState(!1),c=async()=>{p(!0);try{const{data:s,error:r}=await m.rpc("detect_corrupted_profiles");if(r)throw console.error("Erreur RPC detect_corrupted_profiles:",r),r;s&&(f(s),s.length>0?t.success(`${s.length} profil(s) corrompu(s) détecté(s)`):t.success("Aucun profil corrompu détecté"))}catch(s){console.error("Erreur détection profils corrompus:",s),t.error("Erreur lors de la détection. Vérifiez que la fonction SQL est déployée.")}finally{p(!1)}};u.useEffect(()=>{c()},[]);const j=async s=>{try{const{data:r,error:n}=await m.rpc("get_user_metadata",{user_id:s.id});if(n){console.error("Erreur récupération métadonnées:",n),t.error("Erreur: La fonction get_user_metadata n'existe pas. Exécutez le SQL dans le dashboard.");return}if(!r||!r.nom_complet&&!r.fonction){t.error("Aucune donnée récupérable pour cet utilisateur");return}const l={};r.nom_complet&&(l.nom_complet=r.nom_complet),r.fonction&&(l.fonction=r.fonction);const{error:x}=await m.from("profiles").update(l).eq("id",s.id);if(x){console.error("Erreur mise à jour profil:",x),t.error("Erreur lors de la mise à jour du profil");return}const i=r.nom_complet||s.nom_complet,N=r.fonction||s.fonction,v=`Bonjour ${i},
2
3Nous avons corrigé automatiquement votre profil sur PERMUTONS-CI :
4✅ Nom : ${i}
5✅ Fonction : ${N}
6
7⚠️ *ATTENTION* : Vos postes sont encore incorrects :
8- Poste actuel : ${s.poste_actuel_nom}
9- Poste désiré : ${s.poste_desire_1_nom}
10
11📝 *MERCI DE CORRIGER VOS POSTES :*
12
131. Connectez-vous sur https://permutons.ci
142. Cliquez sur "PROFIL" en haut à droite
153. Corrigez votre poste actuel et poste désiré
164. Cliquez sur "Enregistrer"
17
18Ou répondez à ce message avec :
19- Votre poste actuel (ville/localité)
20- Votre poste désiré (ville/localité)
21
22Merci !
23L'équipe PERMUTONS-CI`;t.success(`Profil restauré : ${i}`);const b=`https://wa.me/${s.whatsapp.replace(/[^0-9]/g,"")}?text=${encodeURIComponent(v)}`;window.open(b,"_blank"),c()}catch(r){console.error("Erreur restauration:",r),t.error("Erreur lors de la restauration")}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(d,{className:"bg-orange-50 border-orange-200",children:e.jsx("div",{className:"p-4 sm:p-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(h,{className:"h-6 w-6 text-orange-600 flex-shrink-0 mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-orange-900 mb-2",children:"Correction des profils corrompus"}),e.jsx("p",{className:"text-sm text-orange-800 mb-4",children:"Cet outil détecte automatiquement les profils affectés par le bug d'inscription qui transforme les données en valeurs par défaut."}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(g,{variant:"solid",onClick:c,disabled:a,leftIcon:e.jsx(_,{className:`h-4 w-4 ${a?"animate-spin":""}`}),className:"bg-orange-600 hover:bg-orange-700",children:a?"Analyse en cours...":"Analyser les profils"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-orange-900 bg-white px-4 py-2 rounded-lg border border-orange-300",children:[e.jsx(h,{className:"h-4 w-4"}),e.jsx("span",{className:"font-semibold",children:o.length}),e.jsx("span",{children:"profil(s) corrompu(s)"})]})]})]})]})})}),o.length>0&&e.jsx(d,{children:e.jsxs("div",{className:"p-4 sm:p-6",children:[e.jsx("h4",{className:"text-lg font-semibold mb-4",children:"Profils nécessitant une correction"}),e.jsx("div",{className:"space-y-3",children:o.map(s=>e.jsx("div",{className:"p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h5",{className:"font-semibold text-gray-900",children:s.nom_complet}),e.jsx("span",{className:"text-xs bg-red-100 text-red-700 px-2 py-1 rounded",children:"Corrompu"})]}),e.jsx("span",{className:"text-xs text-gray-500",children:new Date(s.created_at).toLocaleDateString("fr-FR")})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm text-gray-600",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"WhatsApp:"})," ",s.whatsapp]}),e.jsxs("div",{className:"truncate",children:[e.jsx("strong",{children:"Email:"})," ",s.email]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Fonction actuelle:"})," ",s.fonction]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Poste actuel:"})," ",s.poste_actuel_nom]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Poste désiré:"})," ",s.poste_desire_1_nom]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.issues.map((r,n)=>e.jsx("span",{className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded",children:r},n))}),e.jsx("div",{className:"pt-2",children:e.jsx(g,{variant:"solid",size:"sm",onClick:()=>j(s),leftIcon:e.jsx(C,{className:"h-4 w-4"}),className:"bg-orange-600 hover:bg-orange-700 w-full sm:w-auto",children:"Restaurer et Contacter"})})]})},s.id))})]})}),!a&&o.length===0&&e.jsx(d,{className:"bg-green-50 border-green-200",children:e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(w,{className:"h-12 w-12 text-green-600 mx-auto mb-3"}),e.jsx("h4",{className:"text-lg font-semibold text-green-900 mb-2",children:"Aucun profil corrompu détecté"}),e.jsx("p",{className:"text-sm text-green-700",children:"Tous les profils semblent avoir des données valides."})]})})]})},I=()=>e.jsx(E,{children:e.jsx("div",{className:"max-w-7xl mx-auto p-4 sm:p-6",children:e.jsx(y,{})})});export{I as default};

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.