PageSourceSearch

https://marcillylacampagne.fr/assets/GererAnnonce-1TMhmYSF.js

js marcillylacampagne.fr collected 2026-10-09 17:18:20 UTC 4,877 bytes, 1 lines download raw bytes

1import{eO as C,ef as i,T as b,X as S,U as f,Z as j,dY as e,bo as l,i as T,bu as h,cW as E,ey as d}from"./vendor-ByPPybGq.js";import{N as L,T as I,d as m,bj as B,cB as F,aM as G}from"./index-Da5QA0C8.js";import{A as M}from"./AnnonceForm-Dvh0Ojs6.js";import"./vendor-date-HeizJUN9.js";import"./vendor-sentry-D6jZ6NM7.js";import"./TurnstileWidget-TUckR42i.js";const g={pending:{label:"En attente de validation par la mairie",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-200",icon:j},approved:{label:"En ligne",className:"bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-200",icon:f},rejected:{label:"Refusee",className:"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-200",icon:S},expired:{label:"Expiree",className:"bg-stone-100 text-stone-700 dark:bg-stone-800 dark:text-stone-200",icon:b}},K=()=>{const[v]=C(),r=v.get("token")||"",[c,a]=i.useState("loading"),[t,N]=i.useState(null),[k,y]=i.useState(0),[u,x]=i.useState(!1),p=async()=>{if(!r){a("invalid");return}try{const n=await B(r);n.ok&&n.annonce?(N(n.annonce),a("ready"),y(o=>o+1)):a("invalid")}catch{a("invalid")}};i.useEffect(()=>{p()},[r]);const w=async n=>{const o=await F(r,{title:n.title,description:n.description,category:n.category,price:n.price,contact_name:n.contact_name,contact_email:n.contact_email,contact_phone:n.contact_phone,show_phone:n.show_phone,show_email:n.show_email,keepImages:n.keepImages,newImages:await n.encodeNewImages(),turnstileToken:n.turnstileToken});return o.ok&&(d.success("Annonce mise a jour. Elle repasse en validation avant nouvelle publication."),await p()),{ok:!!o.ok,error:o.error}},_=async()=>{if(window.confirm("Supprimer definitivement cette annonce ?")){x(!0);try{const n=await G(r);n.ok?a("deleted"):d.error(n.error||"La suppression a echoue.")}catch{d.error("La suppression a echoue.")}finally{x(!1)}}},s=t?g[t.status]??g.pending:null,A=(s==null?void 0:s.icon)??j;return e.jsxs(L,{children:[e.jsx(I,{title:"Gerer mon annonce",description:"Modifier ou supprimer votre petite annonce.",path:"/petites-annonces/gerer",noindex:!0}),e.jsx("section",{className:"bg-bm-bg py-10 md:py-16",children:e.jsxs("div",{className:"container-main max-w-2xl",children:[e.jsxs(l,{to:"/petites-annonces",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors mb-6",children:[e.jsx(T,{className:"w-4 h-4"})," Retour aux annonces"]}),c==="loading"&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-16 justify-center",children:[e.jsx(h,{className:"w-5 h-5 animate-spin"})," Chargement de votre annonce..."]}),c==="invalid"&&e.jsxs("div",{className:"rounded-xl border border-border bg-card p-8 text-center space-y-3",children:[e.jsx(b,{className:"w-12 h-12 mx-auto text-muted-foreground"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Lien invalide"}),e.jsx("p",{className:"text-muted-foreground",children:"Ce lien de gestion n'est plus valide ou l'annonce a ete supprimee."}),e.jsx(m,{asChild:!0,variant:"outline",className:"rounded-lg mt-2",children:e.jsx(l,{to:"/petites-annonces",children:"Voir les annonces"})})]}),c==="deleted"&&e.jsxs("div",{className:"rounded-xl border border-border bg-card p-8 text-center space-y-3",children:[e.jsx(f,{className:"w-12 h-12 mx-auto text-primary"}),e.jsx("h1",{className:"text-2xl font-bold",children:"Annonce supprimee"}),e.jsx("p",{className:"text-muted-foreground",children:"Votre annonce a bien ete retiree du site."}),e.jsx(m,{asChild:!0,variant:"outline",className:"rounded-lg mt-2",children:e.jsx(l,{to:"/petites-annonces",children:"Voir les annonces"})})]}),c==="ready"&&t&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-3xl font-bm-display font-semibold mb-3",children:"Gerer mon annonce"}),s&&e.jsxs("div",{className:`inline-flex items-center gap-2 text-sm font-medium px-3 py-1.5 rounded-full mb-2 ${s.className}`,children:[e.jsx(A,{className:"w-4 h-4"})," ",s.label]}),t.status==="rejected"&&t.moderation_reason&&e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Motif : ",t.moderation_reason,". Corrigez votre annonce et enregistrez pour la soumettre a nouveau."]}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Toute modification renvoie l'annonce en validation et prolonge sa duree de 60 jours."}),e.jsx("div",{className:"rounded-xl border border-border bg-card p-6",children:e.jsx(M,{mode:"edit",initial:t,submitLabel:"Enregistrer les modifications",onSubmit:w},k)}),e.jsx("div",{className:"mt-6 pt-6 border-t border-border",children:e.jsxs(m,{variant:"outline",onClick:_,disabled:u,className:"rounded-lg text-destructive border-destructive/40 hover:text-destructive hover:bg-destructive/10 gap-2",children:[u?e.jsx(h,{className:"w-4 h-4 animate-spin"}):e.jsx(E,{className:"w-4 h-4"}),"Supprimer mon annonce"]})})]})]})})]})};export{K 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.