PageSourceSearch

https://warranteed.ai/assets/history-DzjFhrim.js

js warranteed.ai collected 2026-10-05 13:17:49 UTC 3,914 bytes, 1 lines download raw bytes

1import{c as f,d as y,t as N,aD as v,v as b,w as m,x as F,j as e,F as S,h as u,i as h,k as x,l as j,B as o,m as g,p as w,L as R,aq as C,C as l,D,z as k,A as q,E as L,G as T}from"./index-CvNMmaeN.js";import{T as I}from"./textarea-BNGjiRHn.js";import{S as E}from"./star-drmHQwEB.js";function z({rating:r,showResponse:i=!0}){return null}function A({repairId:r,manufacturerId:i,installerId:s,onSuccess:p}){const{toast:d}=f(),n=y({resolver:N(v),defaultValues:{repairId:r,manufacturerId:i,installerId:s,rating:5,comment:""}}),c=b({mutationFn:async a=>(await F("POST","/api/ratings",a)).json(),onSuccess:()=>{m.invalidateQueries({queryKey:["/api/ratings"]}),m.invalidateQueries({queryKey:["/api/repairs/history"]}),d({title:"Rating submitted",description:"Thank you for your feedback!"}),p?.()},onError:a=>{d({title:"Failed to submit rating",description:a.message,variant:"destructive"})}});return e.jsx(S,{...n,children:e.jsxs("form",{onSubmit:n.handleSubmit(a=>c.mutate(a)),className:"space-y-6",children:[e.jsx(u,{control:n.control,name:"rating",render:({field:a})=>e.jsxs(h,{children:[e.jsx(x,{children:"Rating"}),e.jsx(j,{children:e.jsx("div",{className:"flex items-center gap-2",children:[1,2,3,4,5].map(t=>e.jsx(o,{type:"button",variant:"ghost",size:"sm",className:`p-2 ${a.value>=t?"text-primary":"text-muted-foreground"}`,onClick:()=>a.onChange(t),children:e.jsx(E,{className:`h-6 w-6 ${a.value>=t?"fill-primary":""}`})},t))})}),e.jsx(g,{})]})}),e.jsx(u,{control:n.control,name:"comment",render:({field:a})=>e.jsxs(h,{children:[e.jsx(x,{children:"Comments"}),e.jsx(j,{children:e.jsx(I,{placeholder:"Share your experience with the service...",...a,value:a.value||""})}),e.jsx(g,{})]})}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.jsx(o,{type:"submit",className:"w-full",disabled:c.isPending,children:c.isPending?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-background border-t-foreground"}),"Submitting..."]}):"Submit Rating"})})]})})}function P(){const{data:r,isLoading:i}=w({queryKey:["/api/repairs/history"],queryFn:async()=>{const s=await fetch("/api/repairs/history");if(!s.ok)throw new Error("Failed to fetch repair history");return s.json()}});return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 py-16",children:[e.jsxs("div",{className:"flex items-center mb-8",children:[e.jsx(R,{href:"/consumer",children:e.jsxs(o,{variant:"ghost",className:"mr-4",children:[e.jsx(C,{className:"mr-2 h-4 w-4"}),"Back"]})}),e.jsx("h1",{className:"text-4xl font-bold",children:"Service History"})]}),e.jsx("div",{className:"grid gap-6",children:i?e.jsx(l,{className:"p-6",children:e.jsx("p",{className:"text-muted-foreground",children:"Loading repair history..."})}):r?.length?r.map(s=>e.jsx(l,{className:"p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-medium",children:["Repair #",s.id]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Description"}),e.jsx("p",{className:"mt-1",children:s.description})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Status"}),e.jsx("p",{className:"mt-1 capitalize",children:s.status})]}),s.status==="completed"&&e.jsx("div",{className:"pt-4 border-t",children:s.rating?e.jsx(z,{rating:s.rating}):e.jsxs(D,{children:[e.jsx(k,{asChild:!0,children:e.jsx(o,{children:"Rate Service"})}),e.jsxs(q,{children:[e.jsx(L,{children:e.jsx(T,{children:"Rate Your Service"})}),e.jsx(A,{repairId:s.id,manufacturerId:s.manufacturerId,installerId:s.installerId})]})]})})]})},s.id)):e.jsx(l,{className:"p-6",children:e.jsx("p",{className:"text-muted-foreground",children:"No service history found."})})})]})})}export{P 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.