import{Dn as e,Kt as t,M as n,O as r,Q as i,Qt as a,R as o,Tn as s,Y as c,at as l,fr as u,it as d,o as f,or as p,r as m,st as h}from"./dist-CoD0k1Bd.js";import{a as g,i as _,n as v,o as y,r as b,s as x,t as S}from"./dialog-mmWdScO2.js";import{t as C}from"./Label-DKn3cyeE.js";import{t as w}from"./plus-DrIll_vd.js";import{t as T}from"./Input-C3DwKNOf.js";import{t as E}from"./button-mN_poAXs.js";import{t as D}from"./routes-BZ4t1sNs.js";import{t as O}from"./Heading-CCd5Tysh.js";import{t as k}from"./badge-n_RZ0blh.js";import{t as A}from"./InputError-BY5lDrFd.js";var j={class:`flex flex-col space-y-6`},M={class:`flex items-center justify-between gap-4`},N={class:`grid gap-2`},P={class:`grid gap-2`},F=[`value`],I={class:`grid gap-2`},L={class:`overflow-hidden rounded-xl border`},R={class:`w-full text-sm`},z={class:`divide-y`},B={class:`px-4 py-3 font-medium`},V={class:`px-4 py-3 text-muted-foreground`},H={class:`px-4 py-3 font-mono text-xs text-muted-foreground`},U={class:`px-4 py-3 text-center`},W={class:`px-4 py-3 text-right`},G=h({layout:{breadcrumbs:[{title:`Dashboard`,href:D()},{title:`Ad Platform`,href:`/ad-platforms`}]},__name:`Index`,props:{platforms:{},adTypes:{}},setup(h){let D=h,G=Object.fromEntries(D.adTypes.map(e=>[e.value,e.label])),K=f({name:``,ad_type:`affiliate`,countries:``,is_active:!0,sort_order:0}),q=()=>{K.post(`/ad-platforms`,{onSuccess:()=>K.reset()})},J=e=>{f({name:e.name,ad_type:e.ad_type,countries:e.countries??``,is_active:!e.is_active,sort_order:e.sort_order}).put(`/ad-platforms/${e.id}`)};return(f,h)=>(t(),i(o,null,[l(p(m),{title:`Ad Platform`}),c(`div`,j,[c(`div`,M,[l(O,{title:`Ad Platform`,description:`Kelola platform/marketplace iklan`}),l(p(x),null,{default:s(()=>[l(p(S),{"as-child":``},{default:s(()=>[l(p(E),null,{default:s(()=>[l(p(w),{class:`size-4`}),h[3]||=d(` Tambah Platform `,-1)]),_:1})]),_:1}),l(p(y),null,{default:s(()=>[l(p(b),null,{default:s(()=>[l(p(v),null,{default:s(()=>[...h[4]||=[d(`Platform Baru`,-1)]]),_:1}),l(p(g),null,{default:s(()=>[...h[5]||=[d(`Buat platform/marketplace iklan.`,-1)]]),_:1})]),_:1}),c(`form`,{onSubmit:n(q,[`prevent`]),class:`space-y-4`},[c(`div`,N,[l(p(C),{for:`name`},{default:s(()=>[...h[6]||=[d(`Nama Platform `,-1),c(`span`,{class:`text-destructive`},`*`,-1)]]),_:1}),l(p(T),{id:`name`,modelValue:p(K).name,"onUpdate:modelValue":h[0]||=e=>p(K).name=e,required:``},null,8,[`modelValue`]),l(A,{message:p(K).errors.name},null,8,[`message`])]),c(`div`,P,[l(p(C),{for:`ad_type`},{default:s(()=>[...h[7]||=[d(`Jenis Iklan `,-1),c(`span`,{class:`text-destructive`},`*`,-1)]]),_:1}),e(c(`select`,{id:`ad_type`,"onUpdate:modelValue":h[1]||=e=>p(K).ad_type=e,class:`mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm`},[(t(!0),i(o,null,a(D.adTypes,e=>(t(),i(`option`,{key:e.value,value:e.value},u(e.label),9,F))),128))],512),[[r,p(K).ad_type]]),l(A,{message:p(K).errors.ad_type},null,8,[`message`])]),c(`div`,I,[l(p(C),{for:`countries`},{default:s(()=>[...h[8]||=[d(`Negara (pisah koma, mis. ID,MY,PH)`,-1)]]),_:1}),l(p(T),{id:`countries`,modelValue:p(K).countries,"onUpdate:modelValue":h[2]||=e=>p(K).countries=e,placeholder:`ID`},null,8,[`modelValue`]),l(A,{message:p(K).errors.countries},null,8,[`message`])]),l(p(_),null,{default:s(()=>[l(p(E),{type:`submit`,disabled:p(K).processing},{default:s(()=>[...h[9]||=[d(`Simpan`,-1)]]),_:1},8,[`disabled`])]),_:1})],32)]),_:1})]),_:1})]),c(`div`,L,[c(`table`,R,[h[10]||=c(`thead`,{class:`bg-muted/50 text-left text-xs uppercase text-muted-foreground`},[c(`tr`,null,[c(`th`,{class:`px-4 py-3 font-medium`},`Nama`),c(`th`,{class:`px-4 py-3 font-medium`},`Jenis`),c(`th`,{class:`px-4 py-3 font-medium`},`Negara`),c(`th`,{class:`px-4 py-3 font-medium text-center`},`Status`),c(`th`,{class:`px-4 py-3 font-medium text-right`},`Aksi`)])],-1),c(`tbody`,z,[(t(!0),i(o,null,a(D.platforms,e=>(t(),i(`tr`,{key:e.id,class:`hover:bg-muted/30`},[c(`td`,B,u(e.name),1),c(`td`,V,u(p(G)[e.ad_type]??e.ad_type),1),c(`td`,H,u(e.countries??`—`),1),c(`td`,U,[l(p(k),{variant:e.is_active?`default`:`outline`},{default:s(()=>[d(u(e.is_active?`Aktif`:`Coming Soon`),1)]),_:2},1032,[`variant`])]),c(`td`,W,[l(p(E),{variant:`ghost`,size:`sm`,onClick:t=>J(e)},{default:s(()=>[d(u(e.is_active?`Nonaktifkan`:`Aktifkan`),1)]),_:2},1032,[`onClick`])])]))),128))])])])])],64))}});export{G as default};