import{l as m,r as p}from"./app-BQOAD8kE.js";import{_ as $}from"./LayoutInfoprodutor-D0LIgXmS.js";import{C as o,l as n,n as s,A as x,B as l,D as u,u as b,t as i,H as f,I as k,K as w,x as d,_ as z,z as _}from"./Button-DnvJ7MH3.js";import"./usePwaInstall-HB_UDdOh.js";import"./smartphone-BQ2R3CLp.js";import"./x-CZb06UDe.js";import"./circle-dollar-sign-Cje-8E9F.js";import"./users-B7oCDICQ.js";import"./mail-fztQFaEl.js";import"./file-code-B_x81AQB.js";import"./ThemeToggler-CwZKjgi8.js";import"./external-link-CLOtX57O.js";import"./check-DLFhEh9z.js";import"./circle-check-myKI1ZZV.js";const B={class:"space-y-6"},S={class:"flex items-center justify-between"},A={class:"text-zinc-600 dark:text-zinc-400"},N={class:"flex gap-2"},V=["onClick"],O={class:"rounded-2xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-800"},q={class:"divide-y divide-zinc-200 dark:divide-zinc-700"},D={class:"flex items-start justify-between gap-4"},P={class:"min-w-0 flex-1"},R={class:"font-medium text-zinc-900 dark:text-white"},T={key:0,class:"mt-1 text-sm text-zinc-500 dark:text-zinc-400"},E={class:"mt-2 text-zinc-700 dark:text-zinc-300"},F={class:"mt-2 text-xs text-zinc-500 dark:text-zinc-400"},H={key:0,class:"flex shrink-0 gap-2"},I={key:0,class:"p-8 text-center text-zinc-500 dark:text-zinc-400"},K={key:0,class:"flex justify-center gap-2"},oe=Object.assign({layout:$},{__name:"Comments",props:{produto:{type:Object,required:!0},comments:{type:Object,required:!0},status_filter:{type:String,default:"pending"}},setup(t){const c=t,g=[{value:"pending",label:"Pendentes"},{value:"approved",label:"Aprovados"},{value:"rejected",label:"Rejeitados"},{value:"all",label:"Todos"}],y=()=>`/produtos/${c.produto.id}/member-builder/comments`;function h(a){p.get(y(),{status:a},{preserveState:!0})}function C(a){p.put(`/produtos/${c.produto.id}/member-builder/comments/${a}`,{status:"approved"},{preserveScroll:!0})}function j(a){p.put(`/produtos/${c.produto.id}/member-builder/comments/${a}`,{status:"rejected"},{preserveScroll:!0})}return(a,r)=>(o(),n("div",B,[s("div",S,[r[1]||(r[1]=s("h1",{class:"text-2xl font-bold text-zinc-900 dark:text-white"},"Comentários",-1)),x(b(m),{href:`/produtos/${t.produto.id}/member-builder`,class:"text-sm text-[var(--color-primary)] hover:underline"},{default:l(()=>[...r[0]||(r[0]=[u("Voltar ao Member Builder",-1)])]),_:1},8,["href"])]),s("p",A,i(t.produto.name),1),s("div",N,[(o(),n(f,null,k(g,e=>s("button",{key:e.value,type:"button",class:w(["rounded-lg px-3 py-2 text-sm font-medium transition",t.status_filter===e.value?"bg-[var(--color-primary)] text-white":"bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-600"]),onClick:v=>h(e.value)},i(e.label),11,V)),64))]),s("div",O,[s("ul",q,[(o(!0),n(f,null,k(t.comments.data,e=>(o(),n("li",{key:e.id,class:"p-4"},[s("div",D,[s("div",P,[s("p",R,i(e.user?.name)+" ("+i(e.user?.email)+")",1),e.lesson?(o(),n("p",T,"Aula: "+i(e.lesson.title),1)):d("",!0),s("p",E,i(e.content),1),s("p",F,i(e.status)+" · "+i(e.created_at),1)]),e.status==="pending"?(o(),n("div",H,[x(z,{size:"sm",onClick:v=>C(e.id)},{default:l(()=>[...r[2]||(r[2]=[u("Aprovar",-1)])]),_:1},8,["onClick"]),x(z,{size:"sm",variant:"outline",onClick:v=>j(e.id)},{default:l(()=>[...r[3]||(r[3]=[u("Rejeitar",-1)])]),_:1},8,["onClick"])])):d("",!0)])]))),128))]),t.comments.data?.length?d("",!0):(o(),n("div",I," Nenhum comentário encontrado. "))]),t.comments.prev_page_url||t.comments.next_page_url?(o(),n("div",K,[t.comments.prev_page_url?(o(),_(b(m),{key:0,href:t.comments.prev_page_url,class:"rounded-lg border border-zinc-200 px-4 py-2 text-sm dark:border-zinc-600"},{default:l(()=>[...r[4]||(r[4]=[u("Anterior",-1)])]),_:1},8,["href"])):d("",!0),t.comments.next_page_url?(o(),_(b(m),{key:1,href:t.comments.next_page_url,class:"rounded-lg border border-zinc-200 px-4 py-2 text-sm dark:border-zinc-600"},{default:l(()=>[...r[5]||(r[5]=[u("Próxima",-1)])]),_:1},8,["href"])):d("",!0)])):d("",!0)]))}});export{oe as default};
