1import{c5 as z,u as W,a as G,r as a,d as L,e as J,j as e,H as h,B as c,bm as j,x as U,dA as X,f as Z,g as ee,h as te,z as se,i as ae,L as b,p as ne,q as ie,s as re,t as de,v as T,a4 as A,a8 as ce,O as oe,Q as le,S as w,aW as F,ag as me,al as P,a_ as ue}from"./index-DKbmQBBZ.js";function g({value:t,onChange:v,label:n,description:f,testId:o}){const[p,i]=a.useState(0);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx(b,{className:"text-base font-medium",children:n}),e.jsx("p",{className:"text-sm text-muted-foreground",children:f})]}),e.jsx("div",{className:"flex gap-1","data-testid":o,children:[1,2,3,4,5].map(r=>e.jsx("button",{type:"button",onClick:()=>v(r),onMouseEnter:()=>i(r),onMouseLeave:()=>i(0),className:"p-1 transition-transform hover:scale-110","data-testid":`${o}-star-${r}`,children:e.jsx(ue,{className:`h-8 w-8 ${r<=(p||t)?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`})},r))}),t>0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t," of 5 stars"]})]})}function xe(){return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-2xl",children:[e.jsx(w,{className:"h-6 w-32 mb-6"}),e.jsx(w,{className:"h-10 w-3/4 mb-4"}),e.jsx(w,{className:"h-64 w-full rounded-lg"})]})})}function he(){return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center","data-testid":"container-event-not-found",children:[e.jsx(me,{className:"h-20 w-20 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Event Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"The event you're looking for doesn't exist or may have been removed."}),e.jsx(h,{href:"/events",children:e.jsxs(c,{"data-testid":"button-back-to-events",children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),"Back to Events"]})})]})})}function ge(){const t=()=>{window.location.href="/api/login"};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md","data-testid":"container-not-authenticated",children:[e.jsx(F,{className:"h-20 w-20 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Sign In Required"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"You need to be signed in to submit feedback. Please sign in to continue."}),e.jsxs(c,{onClick:t,"data-testid":"button-sign-in",children:[e.jsx(F,{className:"mr-2 h-4 w-4"}),"Sign In"]})]})})}function be({event:t}){return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md","data-testid":"container-already-submitted",children:[e.jsx(P,{className:"h-20 w-20 mx-auto text-green-500 mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Feedback Already Submitted"}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['You have already submitted feedback for "',t.name,'". Thank you for your input!']}),e.jsx(h,{href:`/events/${t.id}`,children:e.jsxs(c,{variant:"outline","data-testid":"button-back-to-event",children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),"Back to Event Details"]})})]})})}function je({event:t}){return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center max-w-md","data-testid":"container-success",children:[e.jsx(P,{className:"h-20 w-20 mx-auto text-green-500 mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You!"}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['Your feedback for "',t.name,'" has been submitted successfully. We appreciate you taking the time to help us improve.']}),e.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[e.jsx(h,{href:"/dashboard",children:e.jsxs(c,{"data-testid":"button-back-to-dashboard",children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),"Back to Dashboard"]})}),e.jsx(h,{href:`/events/${t.id}`,children:e.jsx(c,{variant:"outline","data-testid":"button-back-to-event",children:"View Event Details"})})]})]})})}function Ne(){const[t,v]=z("/events/:id/feedback"),n=v?.id,{toast:f}=W(),{isAuthenticated:o,isLoading:p}
1=G(),[i,r]=a.useState(""),[l,q]=a.useState(0),[m,I]=a.useState(0),[u,B]=a.useState(0),[x,H]=a.useState(0),[N,Y]=a.useState(""),[S,D]=a.useState(""),[$,V]=a.useState(!1),{data:s,isLoading:M,error:_}=L({queryKey:["/api/academy-events",n],enabled:!!n}),{data:K,isLoading:O}=L({queryKey:["/api/events",n,"feedback"],enabled:!!n&&o}),y=J({mutationFn:async d=>(await le("POST",`/api/events/${n}/feedback`,d)).json(),onSuccess:()=>{V(!0),oe.invalidateQueries({queryKey:["/api/events",n,"feedback"]})},onError:d=>{f({title:"Submission Failed",description:d.message||"Failed to submit feedback. Please try again.",variant:"destructive"})}}),k=l>0&&l<3||m>0&&m<3||u>0&&u<3||x>0&&x<3,C=l>0&&m>0&&u>0&&x>0,R=k&&!N.trim(),E=C&&!!i&&!R&&!y.isPending,Q=()=>{E&&y.mutate({overallEventRating:l,coachRating:m,communicationRating:u,learningRating:x,comments:N.trim()||null,suggestions:S.trim()||null,feedbackType:i})};return p||M||O?e.jsx(xe,{}):o?_||!s?e.jsx(he,{}):K?e.jsx(be,{event:s}):$?e.jsx(je,{event:s}):e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-2xl",children:[e.jsx(h,{href:`/events/${s.id}`,children:e.jsxs(c,{variant:"ghost",className:"mb-6","data-testid":"button-back-to-event",children:[e.jsx(j,{className:"mr-2 h-4 w-4"}),"Back to Event Details"]})}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2","data-testid":"text-page-title",children:"Event Feedback"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-2","data-testid":"text-event-name",children:s.name}),s.eventType&&e.jsx(U,{variant:"secondary","data-testid":"badge-event-type",children:X[s.eventType]||s.eventType}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2","data-testid":"text-event-description",children:s.description})]}),e.jsxs(Z,{"data-testid":"card-feedback-form",children:[e.jsxs(ee,{children:[e.jsx(te,{children:"Rate Your Experience"}),e.jsx(se,{children:"Your feedback helps us improve future events. Please rate each aspect below."})]}),e.jsxs(ae,{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{className:"text-base font-medium",children:"I am providing feedback as"}),e.jsxs(ne,{value:i,onValueChange:r,children:[e.jsx(ie,{"data-testid":"select-feedback-type",children:e.jsx(re,{placeholder:"Select your role"})}),e.jsxs(de,{children:[e.jsx(T,{value:"ATHLETE","data-testid":"select-item-athlete",children:"As Athlete"}),e.jsx(T,{value:"PARENT","data-testid":"select-item-parent",children:"As Parent/Guardian"})]})]})]}),e.jsx(g,{value:l,onChange:q,label:"Overall Event Rating",description:"How would you rate the overall event experience?",testId:"rating-event"}),e.jsx(g,{value:m,onChange:I,label:"Coach Rating",description:"How would you rate the coach's instruction and interaction?",testId:"rating-coach"}),e.jsx(g,{value:u,onChange:B,label:"Communication Rating",description:"How would you rate the pre-event communication and organization?",testId:"rating-communication"}),e.jsx(g,{value:x,onChange:H,label:"Learning/Development Rating",description:"How much did the athlete learn and improve?",testId:"rating-learning"}),e.jsxs("div",{className:"space-y-2","data-testid":"container-comments",children:[e.jsxs(b,{htmlFor:"comments",className:"text-base font-medium",children:["Comments",k&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),k&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Required when any rating is below 3 stars"}),e.jsx(A,{id:"comments",value:N,onChange:d=>Y(d.target.value),placeholder:"Please share your feedback on what could be improved...",rows:4,"data-testid":"textarea-comments"}),R&&e.jsx("p",{className:"text-sm text-destructive","data-testid":"text-comments-required",children:"Please provide feedback for ratings below 3 stars"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"suggestions",className:"text-base font-medium",children:"Any other comments or suggestions?"}),e.jsx(A,{id:"suggestions",value:S,onChange:d=>D(d.target.value),placeholder:"Share any additional thoughts, suggestions, or praise...",rows:4,"data-testid":"textarea-suggestions"})]}),e.jsxs("div",{className:"pt-4",children:[e.jsx(c,{onClick:Q,disabled:!E,className:"w-full","data-testid":"button-submit-feedback",children:y.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit Feedback"}),(!C||!i)&&e.jsx("p",{className:"text-sm text-muted-foreground text-center mt-2","data-testid":"text-submit-hint",children:i?"Please provide all ratings to submit":"Please select your feedback type"})]})]})]})]})}):e.jsx(ge,{})}export{Ne 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.