import{u as f}from"./BZ7f31ti.js";import{u as k}from"./DKzHUNYh.js";import{u as q,q as C,c as o,a as t,t as a,e as w,F as N,r as x,i as _,l as c,m as B,o as u}from"./BKiFavna.js";import{_ as A}from"./DlAUqK2U.js";const P={class:"page-head"},S={class:"page-hdr"},$={class:"table-wrap"},E={class:"ad-table"},F={class:"actions"},I=["value","onChange"],M={key:0},R={key:0,class:"pagination"},T=["disabled"],V=["disabled"],m=20,j={__name:"advertise-requests",setup(D){const{lang:h}=q(),{api:p}=f(),g=k(),r=c([]),l=c(1),v=c(0),i=B(()=>Math.ceil(v.value/m)),d=async()=>{try{const n=await p.get("/admin/advertise-requests",{page:l.value,limit:m});r.value=n.data.requests,v.value=n.meta.total}catch{}},y=async(n,s)=>{try{await p.put(`/admin/advertise-requests/${n}`,{status:s}),d()}catch(e){g.error(e.message)}};return C(d),(n,s)=>(u(),o("div",null,[t("div",P,[t("h1",S,a(w(h)==="bn"?"বিজ্ঞাপন অনুরোধ":"Advertise Requests"),1)]),t("div",$,[t("table",E,[s[4]||(s[4]=t("thead",null,[t("tr",null,[t("th",null,"Company"),t("th",null,"Person"),t("th",null,"Email"),t("th",null,"Type"),t("th",null,"Budget"),t("th",null,"Status"),t("th",null,"Actions")])],-1)),t("tbody",null,[(u(!0),o(N,null,x(r.value,e=>(u(),o("tr",{key:e.id},[t("td",null,a(e.company),1),t("td",null,a(e.contact_person),1),t("td",null,a(e.email),1),t("td",null,a(e.ad_type||"-"),1),t("td",null,a(e.budget||"-"),1),t("td",null,a(e.status),1),t("td",F,[t("select",{value:e.status,onChange:b=>y(e.id,b.target.value),class:"mini-select"},[...s[2]||(s[2]=[t("option",null,"new",-1),t("option",null,"contacted",-1),t("option",null,"approved",-1),t("option",null,"rejected",-1)])],40,I)])]))),128)),r.value.length?_("",!0):(u(),o("tr",M,[...s[3]||(s[3]=[t("td",{colspan:7,class:"empty"},"No data",-1)])]))])])]),i.value>1?(u(),o("div",R,[t("button",{onClick:s[0]||(s[0]=e=>{l.value--,d()}),disabled:l.value<=1},"Prev",8,T),t("span",null,a(l.value)+" / "+a(i.value),1),t("button",{onClick:s[1]||(s[1]=e=>{l.value++,d()}),disabled:l.value>=i.value},"Next",8,V)])):_("",!0)]))}},J=A(j,[["__scopeId","data-v-4760b878"]]);export{J as default};
