1import{_ as R,p as q,C as V,o as x,b as n,c as u,e as p,k as B,d as s,w as b,G as g,g as I,D as L,m as h,E as S,y as C,l as D,t as i,F as T,r as F,f as M}from"./index-Ci-JScWs.js";import{A as U}from"./AppSidebar-CjjLbj8Y.js";import{C as $}from"./CadrePage-DAexQ4Ua.js";import{E as O}from"./EtatVide-Cy7vpRKc.js";import{u as j}from"./useNbRelances-Bcqq06s_.js";import{A as z}from"./AppFooter-CbNSDwrp.js";import{P as G}from"./ProspectModal-Uh_TH4vT.js";import{u as H}from"./useReloadOnVisible-G3WzlY_t.js";import"./picto-gold-white-CclbRKlx.js";import"./picto-gold-black-DzMLNhCo.js";const J={class:"app-layout"},K={class:"app-content"},Q={key:0,class:"loading"},W={key:1,class:"load-error"},X={class:"load-error-icon"},Y={class:"load-error-msg"},Z={key:3,class:"table-wrap"},ee={class:"table"},te=["onClick"],se={class:"prospect-titre"},ae={class:"prospect-sub"},oe={class:"prix"},re={class:"prospect-sub"},ne=["onClick"],le={__name:"ArchivesPage",setup(ie){const v=q(),{nbRelances:y}=j(),o=h([]),m=h(!0),c=h(""),r=h(null);function k(e){return e?parseInt(e).toLocaleString("fr-FR")+" â¬":"-"}function A(e){r.value={...e}}async function P(e){await C.from("prospects").update({statut:""}).eq("id",e.id).eq("user_id",v.user.id),o.value=o.value.filter(a=>a.id!==e.id)}function w(e){if(e.statut!=="NE PLUS CONTACTER")o.value=o.value.filter(a=>a.id!==e.id),r.value=null;else{const a=o.value.findIndex(l=>l.id===e.id);a!==-1&&(o.value[a]=e),r.value={...e}}}function E(e){o.value=o.value.filter(a=>a.id!==e.id),r.value=null}async function N({silencieux:e=!1}={}){var l;const a=(l=v.user)==null?void 0:l.id;if(!a){e||(m.value=!1);return}e||(m.value=!0,c.value="");try{const{data:t,error:_}=await S(()=>C.from("prospects").select("*").eq("user_id",a).eq("statut","NE PLUS CONTACTER").order("created_at",{ascending:!1}),15e3);if(_)throw _;o.value=t||[],e&&(c.value="")}catch(t){if(e){console.error("loadArchives (silencieux):",(t==null?void 0:t.message)||t);return}c.value=t!=null&&t.__timeout?"Le chargement nâa pas abouti dans le temps imparti. Aucune donnée nâest perdue.":"Impossible de charger vos archives pour le moment."}finally{e||(m.value=!1)}}let d=null;function f(e){return d||(d=(async()=>{try{await L(v),await N(e)}finally{d=null}})(),d)}return V(()=>{var e;return(e=v.user)==null?void 0:e.id},(e,a)=>{e&&e!==a&&f()}),H(f),x(f),(e,a)=>{const l=D("IconCharte");return n(),u("div",J,[p(U,{"nb-relances":B(y)},null,8,["nb-relances"]),s("div",K,[p($,{titre:"Archives",sousTitre:"Contacts marqués « Ne plus contacter »"},{picto:b(()=>[p(l,{name:"document"})]),default:b(()=>[m.value?(n(),u("div",Q,"Chargement...")):c.value?(n(),u("div",W,[s("div",X,[p(l,{name:"alerte"})]),s("div",Y,i(c.value),1),s("button",{class:"btn-retry",onClick:a[0]||(a[0]=t=>f())},"Réessayer")])):o.value.length===0?(n(),g(O,{key:2,picto:"document",message:"Les contacts que vous marquez « Ne plus contacter » se rangent ici, hors du parcours sans être perdus."})):(n(),u("div",Z,[s("table",ee,[a[3]||(a[3]=s("thead",null,[s("tr",null,[s("th",null,"Bien"),s("th",null,"Ville"),s("th",null,"Prix"),s("th",null,"Vendeur"),s("th",null,"Date ajout"),s("th",null,"Actions")])],-1)),s("tbody",null,[(n(!0),u(T,null,F(o.value,t=>(n(),u("tr",{key:t.id,class:"prospect-row",onClick:_=>A(t)},[s("td",null,[s("div",se,i(t.titre||t.type||"-"),1),s("div",ae,i(t.shab?t.shab+" m²":""),1)]),s("td",null,i(t.ville||"-"),1),s("td",oe,i(k(t.prix)),1),s("td",null,i(t.vendeur||"-"),1),s("td",re,i(t.date_ajout||"-"),1),s("td",{onClick:a[1]||(a[1]=M(()=>{},["stop"]))},[s("button",{class:"action-btn action-restore",onClick:_=>P(t),title:"Restaurer"},"â© Restaurer",8,ne)])],8,te))),128))])])]))]),_:1}),p(z)]),r.value?(n(),g(G,{key:r.value.id,prospect:r.value,onClose:a[2]||(a[2]=t=>r.value=null),onUpdated:w,onDeleted:E},null,8,["prospect"])):I("",!0)])}}},ge=R(le,[["__scopeId","data-v-e14a077e"]]);export{ge 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.