var H=Object.defineProperty,$=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var f=(a,i,l)=>i in a?H(a,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[i]=l,m=(a,i)=>{for(var l in i||(i={}))L.call(i,l)&&f(a,l,i[l]);if(w)for(var l of w(i))O.call(i,l)&&f(a,l,i[l]);return a},x=(a,i)=>$(a,k(i));import{r as u,j as e,bj as B,a$ as V}from"./react-vendor-xYZnmIII.js";import{a as z,k as J,m as G,l as K,a5 as M,y as U,z as C,D as b,aE as y,aI as D,aG as h,aJ as r,aF as A,aH as d,J as _,K as q,B as j,M as P,N as Q,O as W,L as p,I as N,T as X}from"./ui-components-CQM92IK3.js";import Y from"./api-copy-kRxB8Vsy.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";const re=({data:a,removing:i,inserting:l,onRemove:I,onInsert:R})=>{const[g,S]=u.useState("top"),T=(n,s,t)=>e.jsxs(h,{children:[e.jsx(d,{children:e.jsx("img",{src:n.image||"/placeholder.jpg",alt:n.name,className:"h-12 w-12 rounded-full object-cover"})}),e.jsx(d,{className:"font-medium",children:n.name}),e.jsx(d,{children:e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:5}).map((v,o)=>e.jsx(B,{className:`h-4 w-4 ${o<n.rating?"fill-yellow-400 text-yellow-400":"text-gray-300"}`},o))})}),e.jsx(d,{className:"max-w-md truncate",children:n.description}),e.jsx(d,{children:e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>I("testimonials",s,t),disabled:i===`testimonials-${s}-${t}`,children:e.jsx(V,{className:"text-destructive h-4 w-4"})})})]},t),E=({category:n})=>{const[s,t]=u.useState({name:"",image:"",rating:5,description:""}),[v,o]=u.useState(!1),F=()=>{s.name&&s.description&&(R("testimonials",n,s),t({name:"",image:"",rating:5,description:""}),o(!1))};return e.jsxs(_,{open:v,onOpenChange:o,children:[e.jsx(q,{asChild:!0,children:e.jsx(j,{children:"Add Testimonial"})}),e.jsxs(P,{className:"max-w-2xl",children:[e.jsx(Q,{children:e.jsx(W,{children:"Add New Testimonial"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"name",children:"Name *"}),e.jsx(N,{id:"name",placeholder:"Enter name",value:s.name,onChange:c=>t(x(m({},s),{name:c.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"image",children:"Image URL"}),e.jsx(N,{id:"image",placeholder:"/assets/images/users/user-1.jpg",value:s.image,onChange:c=>t(x(m({},s),{image:c.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"rating",children:"Rating"}),e.jsx(N,{id:"rating",type:"number",min:"1",max:"5",value:s.rating,onChange:c=>t(x(m({},s),{rating:parseInt(c.target.value)||5}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"description",children:"Description *"}),e.jsx(X,{id:"description",placeholder:"Enter testimonial description",rows:4,value:s.description,onChange:c=>t(x(m({},s),{description:c.target.value}))})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(j,{onClick:F,disabled:!s.name||!s.description,children:"Add Testimonial"})]})]})]})]})};return e.jsxs(z,{className:"relative",children:[e.jsxs(J,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(G,{className:"text-xl font-bold",children:"Testimonials"}),e.jsx(Y,{value:`api/collections/testimonials/${g}`})]}),e.jsx(E,{category:g})]}),e.jsx(K,{children:e.jsxs(M,{defaultValue:"top",className:"w-full",value:g,onValueChange:S,children:[e.jsxs(U,{className:"grid w-full grid-cols-2",children:[e.jsx(C,{value:"top",className:"cursor-pointer",children:"Top Testimonials"}),e.jsx(C,{value:"new",className:"cursor-pointer",children:"New Testimonials"})]}),e.jsx(b,{value:"top",children:e.jsxs(y,{children:[e.jsx(D,{children:e.jsxs(h,{children:[e.jsx(r,{children:"Image"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Rating"}),e.jsx(r,{children:"Description"}),e.jsx(r,{children:"Action"})]})}),e.jsx(A,{children:a.top&&a.top.length>0?a.top.map((n,s)=>T(n,"top",s)):e.jsx(h,{children:e.jsx(d,{colSpan:5,className:"text-muted-foreground text-center",children:"No top testimonials added"})})})]})}),e.jsx(b,{value:"new",children:e.jsxs(y,{children:[e.jsx(D,{children:e.jsxs(h,{children:[e.jsx(r,{children:"Image"}),e.jsx(r,{children:"Name"}),e.jsx(r,{children:"Rating"}),e.jsx(r,{children:"Description"}),e.jsx(r,{children:"Action"})]})}),e.jsx(A,{children:a.new&&a.new.length>0?a.new.map((n,s)=>T(n,"new",s)):e.jsx(h,{children:e.jsx(d,{colSpan:5,className:"text-muted-foreground text-center",children:"No new testimonials added"})})})]})})]})})]})};export{re as default};
