import{ah as b,o as v,a0 as w,b as r,c as o,d as e,F as m,t as f,p,a2 as k,a as c}from"./vue-core-Di3IuVqe.js";import"./cjs-helpers-psZwOBky.js";const M={class:"flex min-h-screen items-center justify-center bg-gradient-to-br from-green-50 to-emerald-100 p-4"},j={class:"w-full max-w-md rounded-2xl bg-white p-8 text-center shadow-lg"},T={key:0,class:"mb-6 rounded-lg bg-gray-50 p-4 text-left text-sm"},q={class:"mb-2 flex justify-between"},N={class:"font-medium"},V={key:0,class:"flex justify-between"},_={class:"font-bold text-green-600"},x=10,F={__name:"PaiementSucces",setup(A){const d=b().query.uuid,g=window.location.href.indexOf("localhost")!==-1?"http://localhost:8083/api":"https://api.omag.ma:7979/api",n=c("verification"),s=c(null);let i=null,l=0;function y(a){return a==null?"":new Intl.NumberFormat("fr-MA",{style:"currency",currency:"MAD"}).format(a)}async function u(){if(!d){n.value="en_attente";return}try{const{data:a}=await k.get(`${g}/paiements-en-ligne/statut/${d}`);if(s.value=a,a.statut==="paye"){n.value="paye";return}if(l+=1,l>=x){n.value="en_attente";return}i=setTimeout(u,3e3)}catch{if(l+=1,l>=x){n.value="en_attente";return}i=setTimeout(u,3e3)}}return v(u),w(()=>i&&clearTimeout(i)),(a,t)=>(r(),o("div",M,[e("div",j,[n.value==="verification"?(r(),o(m,{key:0},[t[0]||(t[0]=e("i",{class:"pi pi-spin pi-spinner text-4xl text-green-500 mb-4"},null,-1)),t[1]||(t[1]=e("h1",{class:"mb-2 text-xl font-bold text-gray-900"},"Vérification du paiement...",-1)),t[2]||(t[2]=e("p",{class:"text-gray-500"},"Merci de patienter quelques instants.",-1))],64)):n.value==="paye"?(r(),o(m,{key:1},[t[5]||(t[5]=e("div",{class:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-green-100"},[e("i",{class:"pi pi-check text-3xl text-green-600"})],-1)),t[6]||(t[6]=e("h1",{class:"mb-2 text-2xl font-bold text-gray-900"},"Paiement confirmé",-1)),t[7]||(t[7]=e("p",{class:"mb-6 text-gray-500"},"Votre règlement a bien été enregistré. Merci !",-1)),s.value?(r(),o("div",T,[e("div",q,[t[3]||(t[3]=e("span",{class:"text-gray-500"},"Référence",-1)),e("span",N,f(s.value.reference_cmi||s.value.oid),1)]),s.value.montant?(r(),o("div",V,[t[4]||(t[4]=e("span",{class:"text-gray-500"},"Montant",-1)),e("span",_,f(y(s.value.montant)),1)])):p("",!0)])):p("",!0)],64)):(r(),o(m,{key:2},[t[8]||(t[8]=e("div",{class:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-orange-100"},[e("i",{class:"pi pi-clock text-3xl text-orange-500"})],-1)),t[9]||(t[9]=e("h1",{class:"mb-2 text-xl font-bold text-gray-900"},"Paiement en cours de traitement",-1)),t[10]||(t[10]=e("p",{class:"text-gray-500"}," Nous n'avons pas encore reçu la confirmation de votre banque. Le statut sera mis à jour automatiquement. ",-1))],64))])]))}};export{F as default};
