1import{a1 as R,r as b,A as w,k as C,c as u,b as o,f as e,e as y,t as m,F as B,d as M,p as z,o as D,u as c,g as _,h as S}from"./index-BAF_Jm8G.js";import{u as A}from"./index-DvXfJsH2.js";import{_ as $}from"./StatusBadge-DDtMTHEz.js";import{C as L}from"./chevron-left-y7-pIwY_.js";const V=R("refs",()=>{const a=b(!1),l=b([]),i=b({}),n=b({size:30,number:1});return{loading:a,data:l,meta:i,page:n,get:async(s=null)=>{a.value=!0,s!==null&&typeof s=="number"&&(n.value.number=s);try{const{data:d}=await w.get("/referrals",{params:{page:n.value}});l.value=d.data,i.value=d.meta}catch(d){console.error(d)}finally{a.value=!1}},more:async()=>{if(!a.value){n.value.number+=1,a.value=!0;try{const{data:s}=await w.get("/referrals",{params:{page:n.value}});l.value.push(...s.data),i.value=s.meta}catch(s){console.error(s)}finally{a.value=!1}}}}}),W={class:"py-4 px-2 border border-gray-200 shadow rounded-box flex flex-col"},E={class:"flex flex-row justify-between items-center"},F={class:"flex flex-row items-center justify-between"},G={class:"font-bold text-lg"},q={key:0,class:"flex flex-col text-sm"},H={class:"flex flex-row gap-2"},I=["onClick"],N={key:1,class:"text-sm text-gray-400"},O={__name:"RefCard",props:{obj:{type:Object,required:!0}},setup(a){const{openModal:l}=C(),i=n=>{l("RefDetailModal",{referral:n})};return(n,r)=>{var t,s,d,p,x,v,g;return o(),u("div",W,[e("div",E,[r[1]||(r[1]=e("span",{class:"text-gray-400"},"Direkt Bayilik",-1)),y($,{status:(t=a.obj.referable)==null?void 0:t.status,"status-text":(s=a.obj.referable)==null?void 0:s.status_text},null,8,["status","status-text"])]),e("div",F,[e("span",G,m((d=a.obj.referable)==null?void 0:d.name),1),e("button",{class:"btn btn-sm btn-ghost font-medium",type:"button",onClick:r[0]||(r[0]=f=>i(a.obj))}," Detay Gör ")]),r[2]||(r[2]=e("span",{class:"text-gray-600 mt-2"},"Alt Bayiler",-1)),(p=a.obj.referable)!=null&&p.referrals.length?(o(),u("div",q,[(o(!0),u(B,null,M((x=a.obj.referable)==null?void 0:x.referrals,f=>{var k,h,j;return o(),u("div",{class:"flex flex-row items-center justify-between",key:f.id},[e("div",H,[e("span",null,m((k=f.referable)==null?void 0:k.name),1),y($,{status:(h=f.referable)==null?void 0:h.status,"status-text":(j=f.referable)==null?void 0:j.status_text},null,8,["status","status-text"])]),e("button",{class:"btn btn-sm btn-ghost font-medium",onClick:Q=>i(f),type:"button"}," Detay Gör ",8,I)])}),128))])):(o(),u("div",N,m((v=a.obj.referable)==null?void 0:v.name)+" adlı bayinin sistemde alt bayisi bulunmamaktadır. "+m((g=a.obj.referable)==null?void 0:g.name)+" adlı bayinin alt bayi getirmesi durumunda sizde kazanırsınız. ",1))])}}},P={class:"bg-base-100 h-16 relative border-b border-gray-300"},T={class:"text-base-content flex flex-row justify-center items-center py-4 relative"},Y={class:"px-2 pt-4 h-[calc(100dvh-var(--flutter-safe-bottom)-4rem)] overflow-y-auto"},J={key:0,class:"flex h-full w-full justify-center items-center"},K={key:1,class:"flex justify-center py-4"},te={__name:"RefPanel",setup(a){const l=V(),i=z("refsWrapper"),{openModal:n}=C();return A(i,()=>{l.more()},{distance:10,canLoadMore:()=>{var r,t;return!(l.loading||((r=l.meta)==null?void 0:r.current_page)>=((t=l.meta)==null?void 0:t.last_page))}}),D(()=>{l.get(1)}),(r,t)=>(o(),u("div",null,[e("div",P,[e("div",T,[e("button",{class:"absolute top-1/2 -translate-y-1/2 left-4 border border-gray-300 rounded-box w-8 h-8",onClick:t[0]||(t[0]=s=>r.$emit("close"))},[y(c(L),{class:"w-5 h-5 absolute cep-center text-base-content"})]),t[2]||(t[2]=e("h1",{class:"text-lg font-medium"},"Bayilerim",-1))])]),e("main",Y,[e("button",{class:"btn btn-cep btn-block py-6 rounded",type:"button",onClick:t[1]||(t[1]=s=>c(n)("AddRefModal"))}," Yeni Bayi Ekle "),e("div",{class:"w-full h-[calc(100dvh-var(--flutter-safe-bottom)-9rem)] mt-2 flex flex-col gap-2 overflow-y-auto scroll-hidden",ref_key:"refsWrapper",ref:i},[!c(l).loading&&c(l).data.length===0?(o(),u("div",J,t[3]||(t[3]=[e("span",{class:"text-gray-400"},"Henüz bayi eklemediniz.",-1)]))):_("",!0),(o(!0),u(B,null,M(c(l).data,s=>(o(),S(O,{key:s.id,obj:s}
1,null,8,["obj"]))),128)),c(l).loading?(o(),u("div",K,t[4]||(t[4]=[e("span",{class:"loading loading-spinner loading-lg"},null,-1)]))):_("",!0)],512)])]))}};export{te 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.