PageSourceSearch

https://hawthorneplaceop.com/assets/FormSubmissions-DAYfKfkO.js

js hawthorneplaceop.com collected 2026-09-29 07:15:51 UTC 7,753 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-motion-BCZB3-z1.js";import{a as c}from"./vendor-sentry-DP0LZMSq.js";import{a as W,dd as k,C as M,f as N,aB as G,I as H,k as J,B as X}from"./index-ByyljyvC.js";import{S as A,a as L,b as V,c as I,d as S}from"./select-DH3IGvLw.js";import{S as Y}from"./sliding-pill-tabs-7M78CjgG.js";import{P as Z}from"./PortalPage-C7fYkBhT.js";import{S as ee}from"./SubmissionStatusBadge-DXMoFdJV.js";import{e as se}from"./useForms-j4gKAgTJ.js";import{f as te}from"./formatDate-wEQv7dlP.js";import{a as re}from"./formSubmissionPayload-D1bMNVKN.js";import{u as ie,L as ae}from"./vendor-react-D0KsNtg2.js";import{C as ne}from"./clock-3-DQWJ6sJC.js";import{R as oe}from"./rotate-ccw-DlhkPO_y.js";import{C as le}from"./circle-check-DiqVfHN0.js";import{A as de}from"./archive-DlL4VG5b.js";import"./vendor-supabase-D_im1pln.js";import"./index-DpwtpmPA.js";import"./arrow-left-vLnC6qBM.js";import"./undo-2-MXSJ6M9u.js";import"./circle-x-BCrOv7B1.js";import"./circle-check-big-BZZRYSRP.js";import"./clock-Cv5gjkaH.js";const ce=[{value:"active",label:"All",icon:M},{value:"needs_review",label:"Needs review",icon:ne},{value:"awaiting_resident",label:"Awaiting resident",icon:oe},{value:"completed",label:"Completed",icon:le},{value:"archived",label:"Archived",icon:de}];function R(t,i){switch(i){case"needs_review":return t.status==="pending"||t.status==="in_review";case"awaiting_resident":return t.status==="revision_requested";case"completed":return t.status==="approved"||t.status==="denied";default:return!0}}function me(t,i){if(i)return"No submissions match your filters.";switch(t){case"needs_review":return"No submissions need review right now.";case"awaiting_resident":return"No submissions are waiting on a resident revision.";case"completed":return"No approved or denied submissions yet.";case"archived":return"No submissions have been archived.";default:return"No submitted forms yet."}}function $(t,i){const a=t[i];if(typeof a!="string")return null;const n=a.trim();return n.length>0?n:null}function ue(t){const i=t.owner_address;if(!i||typeof i!="object"||Array.isArray(i))return null;const a=i.street;if(typeof a!="string")return null;const n=a.trim();return n.length>0?n:null}function fe(t){const i=m=>m.map(f=>$(t,f)).filter(f=>!!f),a=i(["roofing_type","roofing_color"]);if(a.length>0)return a.join(" · ");const n=i(["paint_brand","paint_color_name"]);return n.length>0?n.join(" · "):$(t,"structure_type")}const De=()=>{const t=ie(),{isAdmin:i}=W(),[a,n]=c.useState(null),[m,f]=c.useState("all"),[h,D]=c.useState(""),v=m!=="all"?m:void 0,P=c.useMemo(()=>({formId:v,archived:!1}),[v]),B=c.useMemo(()=>({formId:v,archived:!0}),[v]),{data:j,isLoading:E}=k(P),{data:w,isLoading:T}=k(B),{data:O}=se(),q=m!=="all"||h.trim().length>0,p=c.useMemo(()=>{const s=j??[],r=w??[];return ce.filter(o=>o.value==="active"?!0:o.value==="archived"?r.length>0:s.some(l=>R(l,o.value)))},[j,w]),K=p.some(s=>s.value==="needs_review")?"needs_review":"active",d=a&&p.some(s=>s.value===a)?a:K,y=n,_=d==="archived"?w:j,Q=d==="archived"?T:E,C=c.useMemo(()=>{let s=_??[];if(s=s.filter(r=>R(r,d)),h.trim()){const r=h.trim().toLowerCase();s=s.filter(o=>{var x;const l=o.profiles,u=o.forms,g=l?`${l.first_name} ${l.last_name}`.toLowerCase():"",b=((x=u==null?void 0:u.title)==null?void 0:x.toLowerCase())??"";return g.includes(r)||b.includes(r)})}return s},[_,d,h]),F=s=>{t(`/admin/form-submissions/${s}`)},U=(s,r)=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),F(r))};return e.jsxs(Z,{width:"wide",back:!0,title:"Form submissions",actions:i&&e.jsx(X,{asChild:!0,variant:"outline",children:e.jsx(ae,{to:"/admin/forms",children:"Manage forms"})}),children:[e.jsxs("div",{className:"mb-6 grid gap-4 sm:grid-cols-2 xl:grid-cols-[max-content_14rem_minmax(14rem,16rem)] xl:items-end",children:[e.jsxs("div",{className:"w-full sm:col-span-2 xl:col-span-1 xl:w-auto",children:[e.jsx(N,{htmlFor:"submission-status-filter",className:"text-sm font-medium mb-1.5 block",children:"Status"}),e.jsx("div",{className:"xl:hidden",children:e.jsxs(A,{value:d,onValueChange:s=>y(s),children:[e.jsx(L,{id:"submission-status-filter",children:e.jsx(V,{})}),e.jsx(I,{children:p.map(({value:s,label:r})=>e.jsx(S,{value:s,children:r},s))})]})}),e.jsx(Y,{tabs:p,value:d,onChange:s=>y(s),layoutId:"form-submissions-status-pill","aria-label":"Submission status",size:"sm",fitContent:!0,className:"hidden w-auto xl:inline-grid"})]}),e.jsxs("div",{className:"w-full",children:[e.jsx(N,{htmlFor:"submission-form-filter",className:"text-sm font-medium mb-1.5 block",children:"Form type"}),e.jsxs(A,{value:m,onValueChange:f,children:[e.jsx(L,{id:"submission-form-filter",children:e.jsx(V,{})}),e.jsxs(I,{children:[e.jsx(S,{value:"all",children:"All forms"}),(O??[]).map(s=>e.jsx(S,{value:s.id,children:s.title},s.id))]})]})]}),e.jsxs("div",{className:"w-full sm:col-span-2 xl:col-span-1",children:[e.jsx(N,{htmlFor:"submission-search",className:"text-sm font-medium mb-1.5 block",children:"Search"}),e.jsxs("div",{className:"relative",children:[e.jsx(G,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(H,{id:"submission-search",placeholder:"Name or form title...",value:h,onChange:s=>D(s.target.value),className:"pl-9"})]})]})]}
1),Q?e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",role:"status","aria-label":"Loading submissions",children:[Array.from({length:6}).map((s,r)=>e.jsxs("div",{"aria-hidden":"true",className:"rounded-xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:"h-5 w-2/3 animate-pulse rounded bg-muted"}),e.jsx("div",{className:"h-5 w-16 animate-pulse rounded-full bg-muted"})]}),e.jsx("div",{className:"mt-4 h-4 w-1/2 animate-pulse rounded bg-muted"}),e.jsx("div",{className:"mt-2 h-3.5 w-2/5 animate-pulse rounded bg-muted"}),e.jsx("div",{className:"mt-4 h-3.5 w-3/4 animate-pulse rounded bg-muted"}),e.jsx("div",{className:"mt-4 border-t border-border pt-3",children:e.jsx("div",{className:"h-3.5 w-1/3 animate-pulse rounded bg-muted"})})]},r)),e.jsx("span",{className:"sr-only",children:"Loading submissions"})]}):C.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx(M,{className:"h-12 w-12 text-muted-foreground/40 mx-auto mb-4"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:me(d,q)})]}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:C.map(s=>{const r=s.profiles,o=s.forms,l=r?`${r.first_name} ${r.last_name}`:"Unknown Resident",u=(o==null?void 0:o.title)??"Unknown Form",g=re(s.data),b=ue(g),x=fe(g);return e.jsxs("div",{className:J("hover-lift flex cursor-pointer flex-col rounded-xl border border-border bg-card p-5 text-left outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),tabIndex:0,role:"button","aria-label":`${u} from ${l}`,onClick:()=>F(s.id),onKeyDown:z=>U(z,s.id),children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 text-base font-semibold leading-snug text-foreground",children:u}),e.jsx("div",{className:"shrink-0",children:e.jsx(ee,{status:s.status})})]}),e.jsxs("div",{className:"mt-3 min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:l}),b&&e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:b})]}),x&&e.jsx("p",{className:"mt-3 truncate text-sm text-muted-foreground",children:x})]}),e.jsx("div",{className:"mt-4 flex items-center justify-between border-t border-border pt-3 text-xs text-muted-foreground",children:e.jsxs("span",{children:["Submitted ",te(s.created_at)]})})]},s.id)})})]})};export{De 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.