PageSourceSearch

https://mycase.careremedy.com/assets/InitialAssessmentForm-LN5bf8t9.js

js careremedy.com collected 2026-10-04 22:52:17 UTC 143,133 bytes, 275 lines download raw bytes

1import{ai as vt,j as e,b4 as A,ay as ye,ax as U,aD as z,J as g,B as S,aA as c,Q as Nt,k as ia,R as Ta,V as q,W as Ve,C as Ne,a as Ce,n as ca,i as ze,F as da,_ as we,Y as Ct,e as wt,c as St,b as Pa,I as ge,ah as je,bo as Ue,br as kt,av as y,aC as B,aF as La,a2 as $t,H as Dt}from"./index-SYQM90QS.js";import{r as W}from"./vendor-charts-BPWpdejw.js";import{g as qe,a as m,b as u,c as h,e as f,d as x,f as Ba,u as At,t as Et,F as Tt}from"./form-BkHmC2j0.js";import{T as R}from"./textarea-C7lSvrqA.js";import{S as M,a as F,b as _,c as H,d as b}from"./select-BDNu_m1Z.js";import{A as Pt,a as ne,b as re,c as oe}from"./accordion-Bm1ZGN5X.js";import{S as Lt}from"./StaffCombobox-BAWmsuOw.js";import{T as It}from"./trophy-Cy18LKuG.js";import{D as Pe}from"./download-Cti7qiHf.js";import{S as Ia}from"./save-DVHb9oJ0.js";import{T as Rt}from"./trending-up-CrVu7Xhw.js";import{U as Ye}from"./upload-DJLV_oyq.js";import{U as Ot}from"./user-Cq-jc68k.js";import{A as Mt}from"./accessibility-C-GkNqD8.js";import{P as Ft}from"./phone-CnVwM4Ly.js";import"./index-BompFPCB.js";import"./chevron-up-Bu0uOApn.js";import"./index-C1kOzw4l.js";import"./chevrons-up-down-CED7-_-4.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const _t=vt("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]),E=c().optional(),Le=U(["","yes","no"]).optional(),Ht=ye({bankBranchAddress:E,bankAccountType:E,bankStatementOnFile:Le,emergencyName:E,emergencyRelationship:E,emergencyPhone:E,emergencyStreet:E,emergencyCity:E,emergencyState:E,emergencyZip:E,childrenElsewhereCount:E,childrenElsewhereAges:E,childrenCustody:E,overnightVisitation:Le,overnightVisitationDetails:E,acceptableBedroomSizes:z(U(["studio","1_bedroom","2_bedroom","3_bedroom"])).optional(),rentAssistedOnly:Le,hasDisability:Le,disabilityVerifiedBy:E,applicationPhoneSource:U(["","client","staff","custom"]).optional(),applicationPhone:E,applicationEmailSource:U(["","client","staff","custom"]).optional(),applicationEmail:E,identityVerificationEmail:E,employmentStatus:E,lastWorkedDate:E,lastEmployer:E,notEmployedSince:E,inFacility:Le,facilityName:E,facilityContact:E,facilityAdmitDate:E}).passthrough().default({}),pa={bankBranchAddress:"Bank branch address",bankAccountType:"Bank account type",bankStatementOnFile:"Bank statement on file",emergencyName:"Emergency contact name",emergencyRelationship:"Emergency contact relationship",emergencyPhone:"Emergency contact phone",emergencyStreet:"Emergency contact street",emergencyCity:"Emergency contact city",emergencyState:"Emergency contact state",emergencyZip:"Emergency contact ZIP",childrenElsewhereCount:"Number of children living elsewhere",childrenElsewhereAges:"Ages of children living elsewhere",childrenCustody:"Custody arrangement",overnightVisitation:"Overnight visitation",overnightVisitationDetails:"Overnight visitation details",acceptableBedroomSizes:"Acceptable bedroom sizes",rentAssistedOnly:"Rent-assisted housing only",hasDisability:"Client reports a disability",disabilityVerifiedBy:"Disability verified by",applicationPhoneSource:"Application phone source",applicationPhone:"Application phone",applicationEmailSource:"Application email source",applicationEmail:"Application email",identityVerificationEmail:"Identity-verification email",employmentStatus:"Employment status",lastWorkedDate:"Last worked date",lastEmployer:"Last employer",notEmployedSince:"Not employed since",inFacility:"Currently in a facility",facilityName:"Facility name",facilityContact:"Facility contact",facilityAdmitDate:"Facility admission date"};function me({title:j,description:n,children:T}){return e.jsxs("fieldset",{className:"ta-detail-group",children:[e.jsx("legend",{children:j}),e.jsx("p",{children:n}),e.jsx("div",{className:"ta-detail-grid",children:T})]})}function I({name:j,type:n="text",multiline:T=!1}){const{control:N}=qe();return e.jsx(m,{control:N,name:`applicationDetails.${j}`,render:({field:P})=>e.jsxs(u,{children:[e.jsx(h,{children:pa[j]}),e.jsx(x,{children:T?e.jsx(R,{...P,value:typeof P.value=="string"?P.value:"","data-testid":`input-application-${j}`}):e.jsx(g,{...P,type:n,value:typeof P.value=="string"?P.value:"","data-testid":`input-application-${j}`})}),e.jsx(f,{})]})})}function Ie({name:j}){const{control:n}=qe();
6return e.jsx(m,{control:n,name:`applicationDetails.${j}`,render:({field:T})=>e.jsxs(u,{children:[e.jsx(h,{children:pa[j]}),e.jsx(x,{children:e.jsxs(M,{value:typeof T.value=="string"&&T.value?T.value:"unanswered",onValueChange:N=>T.onChange(N==="unanswered"?"":N),children:[e.jsx(F,{"data-testid":`select-application-${j}`,children:e.jsx(_,{})}),e.jsxs(H,{children:[e.jsx(b,{value:"unanswered",children:"Not answered"}),e.jsx(b,{value:"yes",children:"Yes"}),e.jsx(b,{value:"no",children:"No"})]})]})}),e.jsx(f,{})]})})}function Ra({kind:j,clientValue:n}){const{control:T,watch:N,setValue:P}=qe(),V=`applicationDetails.application${j}Source`,K=`applicationDetails.application${j}`,O=N(V);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{control:T,name:V,render:({field:Z})=>e.jsxs(u,{children:[e.jsxs(h,{children:["Application ",j.toLowerCase()," source"]}),e.jsx(x,{children:e.jsxs(M,{value:Z.value||"unanswered",onValueChange:C=>{Z.onChange(C==="unanswered"?"":C),P(K,"",{shouldDirty:!0})},children:[e.jsx(F,{"data-testid":`select-application-${j.toLowerCase()}-source`,children:e.jsx(_,{})}
6),e.jsxs(H,{children:[e.jsx(b,{value:"unanswered",children:"Not selected"}),e.jsx(b,{value:"client",children:"Client"}),e.jsx(b,{value:"staff",children:"Staff"}),e.jsx(b,{value:"custom",children:"Custom contact"})]})]})}),e.jsx(Ba,{children:O==="staff"||O==="custom"?"Enter the intended contact explicitly below. No signed-in staff information is used.":"Choose whose contact belongs on the housing application."})]})}),e.jsx(I,{name:`application${j}`,type:j==="Phone"?"tel":"email"}),O==="client"&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs(S,{type:"button",size:"sm",variant:"outline",disabled:!n,onClick:()=>P(K,n||"",{shouldDirty:!0}),children:["Use client profile ",j.toLowerCase()]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n||`No ${j.toLowerCase()} is recorded in the client profile.`})]})]})}function ua(j,n=new Date){if(!j||!/^\d{4}-\d{2}-\d{2}$/.test(j))return null;const[T,N,P]=j.split("-").map(Number),V=new Date(Date.UTC(T,N-1,P));if(V.getUTCFullYear()!==T||V.getUTCMonth()!==N-1||V.getUTCDate()!==P)return null;const K=n.getFullYear(),O=n.getMonth()+1,Z=n.getDate();return T>K||T===K&&(N>O||N===O&&P>Z)?null:K-T-(O<N||O===N&&Z<P?1:0)>=62}function Bt({dob:j}){const n=ua(j);return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-4 py-3 mb-4","data-testid":"assessment-senior-status",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Senior age indicator (62+): ",n===null?"Unable to determine":n?"Yes":"No"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n===null?"A valid client date of birth is needed.":"Automatically derived from the client’s date of birth as of today."," Program eligibility still requires review."]})]})}function be({section:j,clientPhone:n,clientEmail:T}){const{control:N}=qe();switch(j){case"bank":return e.jsxs(me,{title:"Bank documentation",description:"Record branch and document information only. Do not enter account numbers. Client possession of statements is recorded in the existing question above.",children:[e.jsx(I,{name:"bankBranchAddress",multiline:!0}),e.jsx(I,{name:"bankAccountType"}),e.jsx(Ie,{name:"bankStatementOnFile"})]});case"contacts":return e.jsxs(e.Fragment,{children:[e.jsxs(me,{title:"Application & identity contact",description:"Confirm the phone and email to use on applications. Staff and custom contact details must be entered explicitly.",children:[e.jsx(Ra,{kind:"Phone",clientValue:n}),e.jsx(Ra,{kind:"Email",clientValue:T}),e.jsx(I,{name:"identityVerificationEmail",type:"email"})]}),e.jsxs(me,{title:"Emergency contact",description:"A dedicated emergency contact, separate from the application contact and existing secondary contact.",children:[e.jsx(I,{name:"emergencyName"}),e.jsx(I,{name:"emergencyRelationship"}),e.jsx(I,{name:"emergencyPhone",type:"tel"}),e.jsx(I,{name:"emergencyStreet"}),e.jsx(I,{name:"emergencyCity"}),e.jsx(I,{name:"emergencyState"}),e.jsx(I,{name:"emergencyZip"})]})]});case"household":return e.jsxs(me,{title:"Children living elsewhere",description:"Document custody and visitation for housing program review. Children do not automatically qualify a household for a two-bedroom unit; occupancy decisions depend on the program’s rules and supporting documentation.",children:[e.jsx(I,{name:"childrenElsewhereCount",type:"number"}),e.jsx(I,{name:"childrenElsewhereAges"}),e.jsx(I,{name:"childrenCustody",multiline:!0}),e.jsx(Ie,{name:"overnightVisitation"}),e.jsx(I,{name:"overnightVisitationDetails",multiline:!0})]});case"housing":return e.jsxs(me,{title:"Application housing preferences",description:"Choose all acceptable sizes, separately from the preferred unit size. These are preferences, not an occupancy or eligibility determination.",children:[e.jsx(m,{control:N,name:"applicationDetails.acceptableBedroomSizes",render:({field:P})=>e.jsxs(u,{children:[e.jsx(h,{children:"Acceptable bedroom sizes"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:[["studio","Studio"],["1_bedroom","1 bedroom"],["2_bedroom","2 bedrooms"],["3_bedroom","3 bedrooms"]].map(([V,K])=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md border bg-background p-3 text-sm",children:[e.jsx(A,{checked:(P.value||[]).includes(V),onCheckedChange:O=>P.onChange(O===!0?[...P.value||[],V]:(P.value||[]).filter(Z=>Z!==V)),"data-testid":`checkbox-acceptable-${V}`}),K]},V))}),e.jsx(f,{})]})}),e.jsx(Ie,{name:"rentAssistedOnly"})]});case"accessibility":return e.jsxs(me,{title:"Disability verification",description:"Record reported status and the verification contact. Reasonable accommodation requests remain in the existing housing application questions; disability does not automatically mean an accommodation is needed.",children:[e.jsx(Ie,{name:"hasDisability"}),e.jsx(I,{name:"disabilityVerifiedBy"})]});case"employment":return e.jsxs(me,{title:"Employment history",description:"Capture current status and the most recent employment details. Leave dates blank when unknown.",children:[e.jsx(I,{name:"employmentStatus"}),e.jsx(I,{name:"lastEmployer"}),e.jsx(I,{name:"lastWorkedDate",type:"date"}),e.jsx(I,{name:"notEmployedSince",type:"date"})]});case"facility":return e.jsxs(me,{title:"Current facility placement",description:"If applicable, record the facility and the contact who can help coordinate the housing transition. Unknown is not No.",children:[e.jsx(Ie,{name:"inFacility"}),e.jsx(I,{name:"facilityName"}),e.jsx(I,{name:"facilityContact"}),e.jsx(I,{name:"facilityAdmitDate",type:"date"})]})}}const Oa=ye({clientId:c(),staffId:c().optional(),assessmentDate:c().optional(),middleName:c().optional(),sex:c().optional(),maritalStatus:c().optional(),applicationDetail
6s:Ht,currentAddress:c().optional(),previousAddress:c().optional(),yearsAtPreviousAddress:c().optional(),needsWheelchairTransport:B().default(!1),needsHousing:B().default(!0),housingStatus:c().optional(),housingSetting:c().optional(),preferredTown1:c().optional(),preferredTown2:c().optional(),preferredTown3:c().optional(),preferredTowns:z(c()).optional(),transportationPreference:c().optional(),walkToPreferences:c().optional(),unitSize:c().optional(),housingType:c().optional(),floorPreference:c().optional(),accessibilityFeatures:z(c()).optional(),needsElevator:B().default(!1),needsNoStairs:B().default(!1),needsAccessibleBathroom:B().default(!1),amenities:z(c()).optional(),otherHouseholdMembers:c().optional(),currentRent:c().optional(),housingBarriers:z(c()).optional(),housingHistoryNotes:c().optional(),longTermWaitlistInterest:B().default(!1),owesMoneyToPreviousLandlord:B().default(!1),previousEviction:B().default(!1),previousHousingAssistance:B().default(!1),previousLandlordInfo:c().optional(),hasPreviousLandlord:U(["","yes","no"]).optional(),previousLandlordName:c().optional(),previousLandlordPhone:c().optional(),notApplicableSections:z(c()).optional(),hasId:B().default(!1),hasBirthCertificate:B().default(!1),placeOfBirth:c().optional(),motherName:c().optional(),motherMaidenName:c().optional(),fatherName:c().optional(),hasSocialSecurityCard:B().default(!1),socialSecurityNumber:c().optional(),hasBankAccount:B().default(!1),bankName:c().optional(),hasBankStatements:U(["","yes","no"]).optional(),monthlyIncome:c().optional(),hasProofOfIncome:B().default(!1),isVeteran:B().default(!1),disabilityTypes:z(c()).optional(),disabilityNotes:c().optional(),socialWorkerContact:c().optional(),topPriorities:c().optional(),planOfAction:c().optional(),recommendations:c().optional(),householdMembers:z(ye({name:c().optional().default(""),relationship:c().optional().default(""),dob:c().optional().default(""),ssnLast4:c().optional().default(""),ftStudent:U(["yes","no","na"]).default("na"),gender:c().optional().default(""),placeOfBirth:c().optional().default(""),disabled:U(["yes","no","na"]).default("na"),citizen:U(["yes","no","na"]).default("na"),race:c().optional().default(""),ethnicity:c().optional().default(""),occupation:c().optional().default("")})).optional().default([]),householdChangesExpected:c().optional(),householdChangesNotes:c().optional(),hasFullTimeStudent:c().optional(),studentChangesExpected:c().optional(),primarySpokenLanguage:c().optional(),primaryWrittenLanguage:c().optional(),incomeDetails:La(ye({status:U(["yes","no","na"]).default("na"),amount:c().optional(),frequency:c().optional(),sourceName:c().optional(),sourceAddress:c().optional()})).optional().default({}),assetDetails:La(ye({status:U(["yes","no","na"]).default("na"),value:c().optional()})).optional().default({}),taxReturnFiledLastYear:c().optional(),incomeChangesExpected:c().optional(),incomeChangesNotes:c().optional(),closedAccountsLastYear:c().optional(),disposedAssetsLast2Years:c().optional(),noIncomeAffidavit:c().optional(),noAssetsAffidavit:c().optional(),race:z(c()).optional().default([]),ethnicity:c().optional(),citizenshipStatus:c().optional(),livingSituationType:c().optional(),monthlyUtilities:c().optional(),everConvicted:c().optional(),convictionType:c().optional(),convictionYears:c().optional(),currentlyUsingIllegalDrugs:c().optional(),sexOffenderRegistry:c().optional(),otherNamesUsed:c().optional(),statesLived:z(c()).optional().default([]),domesticViolenceSurvivor:c().optional(),forcedToLeaveResidence:c().optional(),priorityReasons:z(c()).optional().default([]),homelessCertifications:z(c()).optional().default([]),residenceLeftAddress:c().optional(),localPreferenceChoice:c().optional(),dateLeftResidence:c().optional(),currentHousingSituationDetails:c().optional(),secondaryContactName:c().optional(),secondaryContactAddress:c().optional(),secondaryContactPhone:c().optional(),secondaryContactEmail:c().optional(),employmentLocation:c().optional(),childrenSchoolLocation:c().optional(),veteranDatesOfService:c().optional(),veteranServiceConnectedDisability:c().optional(),veteranFamilyMember:c().optional(),deceasedVeteranServiceDeath:c().optional(),housingAgencyEmployee:c().optional(),housingAgencyEmployeeDetails:c().optional(),reasonableAccommodationNeeded:c().optional(),reasonableAccommodationDetail
6s:c().optional(),needsSensoryAccessibleUnit:B().default(!1),householdExpenses:z(c()).optional().default([]),assetTransferLast3Years:c().optional(),assetTransferAmount:c().optional(),assetTransferValue:c().optional(),assetTransferDate:c().optional(),realEstateDetails:c().optional(),previousResidences:z(ye({address:c().optional().default(""),city:c().optional().default(""),state:c().optional().default(""),zip:c().optional().default(""),dateMovedIn:c().optional().default(""),dateMovedOut:c().optional().default(""),leaseholderFirstName:c().optional().default(""),leaseholderLastName:c().optional().default(""),leaseholderPhone:c().optional().default(""),landlordName:c().optional().default(""),landlordAddress:c().optional().default(""),landlordPhone:c().optional().default(""),landlordCourtAction:U(["yes","no","na"]).default("na"),securityDepositReturned:U(["yes","no","na"]).default("na"),rent:c().optional().default(""),utilitiesIncluded:U(["","yes","no"]).optional().default(""),reasonForLeaving:c().optional().default("")}).passthrough()).optional().default([]),personalReferences:z(ye({name:c().optional().default(""),relationship:c().optional().default(""),phone:c().optional().default(""),address:c().optional().default("")})).optional().default([]),pendingCriminalMatters:c().optional(),pendingCriminalMattersExplain:c().optional(),drugViolentCrimeConviction:c().optional(),drugViolentCrimeExplain:c().optional(),owesMoneyHousingProgram:c().optional(),owesMoneyExplain:c().optional(),evictionHousingProgram:c().optional(),evictionExplain:c().optional(),priorSubsidyDetails:c().optional()}),We=[{value:"white",label:"White"},{value:"black",label:"Black / African American"},{value:"asian",label:"Asian"},{value:"american_indian",label:"American Indian / Alaska Native"},{value:"native_hawaiian",label:"Native Hawaiian / Pacific Islander"},{value:"other",label:"Other"},{value:"decline",label:"Declined to answer"}],ma=[{key:"salary",label:"Salary or pay from job"},{key:"overtime",label:"Overtime / shift pay"},{key:"bonus",label:"Bonus / commission"},{key:"secondJob",label:"Second job"},{key:"seasonal",label:"Seasonal / sporadic work"},{key:"tips",label:"Tips"},{key:"cash",label:"Cash pay"},{key:"selfEmployment",label:"Self-employment income"},{key:"periodicGifts",label:"Periodic gift income"},{key:"nonCashContributions",label:"Non-cash contributions"},{key:"formalChildSupport",label:"Formal child support"},{key:"childSupportUnpaid",label:"Child support awarded but unpaid"},{key:"informalChildSupport",label:"Informal child support"},{key:"formalSpousalSupport",label:"Formal spousal support"},{key:"spousalSupportUnpaid",label:"Spousal support awarded but unpaid"},{key:"informalSpousalSupport",label:"Informal spousal support"},{key:"socialSecurity",label:"Social Security"},{key:"ssiSsp",label:"SSI / MA SSP"},{key:"tanf",label:"TANF / AFDC / EAEDC"},{key:"unemployment",label:"Unemployment benefits"},{key:"workersComp",label:"Worker's compensation"},{key:"severance",label:"Severance pay"},{key:"pension",label:"Pension income"},{key:"retirement",label:"Retirement acct payments (incl. RMDs)"},{key:"investment",label:"Investment acct payments"},{key:"annuity",label:"Annuity acct payments"},{key:"trust",label:"Trust acct payments"},{key:"disabilityBenefits",label:"Disability / death benefits"},{key:"realEstateRent",label:"Real estate rent income"},{key:"military",label:"Military pay"},{key:"va",label:"Veterans / VA income"},{key:"gig",label:"Uber / Lyft / DoorDash"},{key:"other",label:"Other income"}],ha=[{key:"checking",label:"Checking account"},{key:"checking2",label:"2nd checking account"},{key:"savings",label:"Savings account"},{key:"savings2",label:"2nd savings account"},{key:"debitCard",label:"Debit / direct deposit card"},{key:"prepaidCard",label:"2nd prepaid debit card"},{key:"cashOnHand",label:"Cash on hand"},{key:"cd",label:"Certificate of Deposit"},{key:"otherBank",label:"Other bank account"},{key:"mutualFund",label:"Mutual Fund"},{key:"stocks",label:"Stocks"},{key:"brokerage",label:"Portfolio / brokerage"},{key:"ira",label:"IRA / 401K / etc."},{key:"ira2",label:"2nd IRA / 401K / etc."},{key:"bonds",label:"Bonds"},{key:"annuity",label:"Annuity"},{key:"trust",label:"Trust"},{key:"specialNeedsTrust",label:"Special Needs Trust"},{key:"realEstate",label:"Real estate"}],Ma=[{value:"fire",label:"Fire"},{value:"natural_forces",label:"Natural forces (flood, storm, etc.)"}
6,{value:"urban_renewal_eminent_domain",label:"Urban renewal – eminent domain"},{value:"urban_renewal_lha_redevelopment",label:"Urban renewal – LHA redevelopment"},{value:"code_violations",label:"Code violations / condemned"},{value:"court_ordered_eviction",label:"Court-ordered eviction (no fault)"},{value:"severe_medical_emergency",label:"Severe medical emergency"},{value:"abusive_situation",label:"Abusive situation"},{value:"homeless_no_match",label:"Homeless, but none of the above"}],Fa=[{value:"no_place_to_live",label:"I do not have a place to live"},{value:"displaced",label:"I have been displaced from my home"},{value:"did_not_cause",label:"I did not cause the situation"},{value:"tried_to_avoid",label:"I tried to avoid becoming homeless"},{value:"court_ordered_eviction",label:"I have a court-ordered eviction (no fault)"}],_a=[{value:"medical",label:"Medical expenses"},{value:"child_support",label:"Child support paid"},{value:"work_daycare",label:"Work-related daycare"},{value:"disability_personal_care",label:"Disability-related personal care"},{value:"disability_travel",label:"Disability-related travel"},{value:"tuition_fees",label:"Non-reimbursable tuition / fees"},{value:"none",label:"None"}],Ha=[{value:"employed",label:"Employed"},{value:"retired",label:"Retired"},{value:"at_home",label:"At home"},{value:"student",label:"Student"},{value:"decline",label:"Decline to answer"}];function G({value:j,onChange:n,testid:T}){return e.jsx("div",{className:"flex gap-1 mt-1",children:["yes","no"].map(N=>e.jsx("button",{type:"button",onClick:()=>n(j===N?"":N),className:`flex-1 px-3 py-1.5 rounded text-xs font-medium border transition-colors ${j===N?N==="yes"?"bg-emerald-600 text-white border-emerald-600":"bg-rose-600 text-white border-rose-600":"bg-background hover:bg-muted"}`,"data-testid":`tri-${T}-${N}`,children:N.toUpperCase()},N))})}const Vt=[{value:"needs_housing",label:"Needs Housing"},{value:"searching",label:"Searching"},{value:"waitlist",label:"On Waitlist"},{value:"housed",label:"Housed"}],zt=[{value:"urban",label:"Urban"},{value:"suburban",label:"Suburban"},{value:"rural",label:"Rural"},{value:"no_preference",label:"No Preference"}],Ut=[{value:"studio",label:"Studio"},{value:"1_bedroom",label:"1 Bedroom"},{value:"2_bedroom",label:"2 Bedroom"},{value:"3_bedroom",label:"3+ Bedroom"}],Yt=[{value:"small_multi_family",label:"Small Multi-Family (2-4 units)"},{value:"large_multi_family",label:"Large Multi-Family (5+ units)"},{value:"single_family",label:"Single Family Home"},{value:"open_to_all",label:"Open to All Types"}],Wt=["wheelchair_accessible","grab_bars","roll_in_shower","elevator_access","wide_doorways","ramp_access","visual_alerts","hearing_aids_compatible"],qt=["mobility","vision","hearing","cognitive","mental_health","developmental","chronic_illness"];function ps({clientId:j,existingAssessment:n,onSuccess:T}){const{toast:N}=Nt(),[P,V]=W.useState(["participant","documents","housing","history","income","accessibility","contacts","application","plan"]),{data:K=[]}=ia({queryKey:["/api/staff"]}),{data:O}=ia({queryKey:["/api/clients",j]}),{data:Z=[]}=ia({queryKey:["/api/clients",j,"documents"]}),C=a=>Z.find(t=>t.documentType===a&&t.status!=="expired"&&t.objectPath),[le,xa]=W.useState(null);W.useState(null);const Re=async(a,t)=>{xa(t);try{const r=Z.find(te=>te.documentType===t);let l;if(r)l=r.id;else{const te=await fetch("/api/documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:j,documentType:t,documentName:a.name,status:"pending"}),credentials:"include"});if(!te.ok){const $a=await te.json().catch(()=>({}));throw new Error($a.error||"Failed to create document record")}const ve=await te.json();if(!ve||!ve.id)throw new Error("Invalid document response from server");l=ve.id}const o=new FormData;o.append("file",a);const v=await fetch(`/api/documents/${l}/upload`,{method:"POST",body:o,credentials:"include"});if(!v.ok){const te=await v.json().catch(()=>({}));throw new Error(te.error||"Failed to upload file")}q.invalidateQueries({queryKey:["/api/clients",j,"documents"]}
6),q.invalidateQueries({queryKey:["/api/clients",j,"profile-bundle"]}),q.invalidateQueries({queryKey:["/api/documents"]}),q.invalidateQueries({queryKey:["/api/clients",j,"core-documents"]}),q.invalidateQueries({queryKey:["/api/clients",j,"core-document-files"]}),N({title:"Document uploaded",description:`${a.name} has been uploaded successfully.`})}catch(r){console.error("Document upload error:",r),N({title:"Upload failed",description:r.message||"An unexpected error occurred",variant:"destructive"})}finally{xa(null)}},ie=(a,t)=>{const r=`/api/documents/${encodeURIComponent(a)}/download-url?disposition=${t}`;if(t==="inline"){window.open(r,"_blank","noopener,noreferrer");return}const l=document.createElement("a");l.href=r,l.download="",document.body.appendChild(l),l.click(),l.remove()},i=At({resolver:Et(Oa),defaultValues:{clientId:j,staffId:n?.staffId||void 0,assessmentDate:n?.assessmentDate?new Date(n.assessmentDate).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],middleName:n?.middleName||"",sex:n?.sex||"",maritalStatus:n?.maritalStatus||"",applicationDetails:n?.applicationDetails||{},currentAddress:n?.currentAddress||"",previousAddress:n?.previousAddress||"",yearsAtPreviousAddress:n?.yearsAtPreviousAddress||"",needsWheelchairTrans
6port:n?.needsWheelchairTransport||!1,needsHousing:n?n?.needsHousing??!0:!0,housingStatus:n?.housingStatus||"",housingSetting:n?.housingSetting||"",preferredTown1:n?.preferredTown1||"",preferredTown2:n?.preferredTown2||"",preferredTown3:n?.preferredTown3||"",preferredTowns:n?.preferredTowns||[],transportationPreference:n?.transportationPreference||"",walkToPreferences:n?.walkToPreferences||"",unitSize:n?.unitSize||"",housingType:n?.housingType||"",floorPreference:n?.floorPreference||"",accessibilityFeatures:n?.accessibilityFeatures||[],needsElevator:n?.needsElevator||!1,needsNoStairs:n?.needsNoStairs||!1,needsAccessibleBathroom:n?.needsAccessibleBathroom||!1,amenities:n?.amenities||[],otherHouseholdMembers:n?.otherHouseholdMembers||"",currentRent:n?.currentRent||"",housingBarriers:n?.housingBarriers||[],housingHistoryNotes:n?.housingHistoryNotes||"",longTermWaitlistInterest:n?.longTermWaitlistInterest||!1,owesMoneyToPreviousLandlord:n?.owesMoneyToPreviousLandlord||!1,previousEviction:n?.previousEviction||!1,previousHousingAssistance:n?.previousHousingAssistance||!1,previousLandlordInfo:n?.previousLandlordInfo||"",hasPreviousLandlord:n?.hasPreviousLandlord||(n?.previousLandlordInfo?"yes":""),previousLandlordName:n?.previousLandlordName||"",previousLandlordPhone:n?.previousLandlordPhone||"",notApplicableSections:n?.notApplicableSections||[],hasId:n?.hasId||!1,hasBirthCertificate:n?.hasBirthCertificate||!1,placeOfBirth:n?.placeOfBirth||"",motherName:n?.motherName||"",motherMaidenName:n?.motherMaidenName||"",fatherName:n?.fatherName||"",hasSocialSecurityCard:n?.hasSocialSecurityCard||!1,socialSecurityNumber:n?.socialSecurityNumber||"",hasBankAccount:n?.hasBankAccount||!1,bankName:n?.bankName||"",hasBankStatements:n?.hasBankStatements||"",monthlyIncome:n?.monthlyIncome||"",hasProofOfIncome:n?.hasProofOfIncome||!1,isVeteran:n?.isVeteran||!1,disabilityTypes:n?.disabilityTypes||[],disabilityNotes:n?.disabilityNotes||"",socialWorkerContact:n?.socialWorkerContact||"",topPriorities:n?.topPriorities||"",planOfAction:n?.planOfAction||"",recommendations:n?.recommendations||"",householdMembers:n?.householdMembers||[],householdChangesExpected:n?.householdChangesExpected||"",householdChangesNotes:n?.householdChangesNotes||"",hasFullTimeStudent:n?.hasFullTimeStudent||"",studentChangesExpected:n?.studentChangesExpected||"",primarySpokenLanguage:n?.primarySpokenLanguage||"",primaryWrittenLanguage:n?.primaryWrittenLanguage||"",incomeDetails:n?.incomeDetails||{},assetDetails:n?.assetDetails||{},taxReturnFiledLastYear:n?.taxReturnFiledLastYear||"",incomeChangesExpected:n?.incomeChangesExpected||"",incomeChangesNotes:n?.incomeChangesNotes||"",closedAccountsLastYear:n?.closedAccountsLastYear||"",disposedAssetsLast2Years:n?.disposedAssetsLast2Years||"",noIncomeAffidavit:n?.noIncomeAffidavit||"",noAssetsAffidavit:n?.noAssetsAffidavit||"",race:n?.race||[],ethnicity:n?.ethnicity||"",citizenshipStatus:n?.citizenshipStatus||"",livingSituationType:n?.livingSituationType||"",monthlyUtilities:n?.monthlyUtilities||"",everConvicted:n?.everConvicted||"",convictionType:n?.convictionType||"",convictionYears:n?.convictionYears||"",currentlyUsingIllegalDrugs:n?.currentlyUsingIllegalDrugs||"",sexOffenderRegistry:n?.sexOffenderRegistry||"",otherNamesUsed:n?.otherNamesUsed||"",statesLived:n?.statesLived||[],domesticViolenceSurvivor:n?.domesticViolenceSurvivor||"",forcedToLeaveResidence:n?.forcedToLeaveResidence||"",priorityReasons:n?.priorityReasons||[],homelessCertifications:n?.homelessCertifications||[],residenceLeftAddress:n?.residenceLeftAddress||"",localPreferenceChoice:n?.localPreferenceChoice||"",dateLeftResidence:n?.dateLeftResidence||"",currentHousingSituationDetails:n?.currentHousingSituationDetails||"",secondaryContactName:n?.secondaryContactName||"",secondaryContactAddress:n?.secondaryContactAddress||"",secondaryContactPhone:n?.secondaryContactPhone||"",secondaryContactEmail:n?.secondaryContactEmail||"",employmentLocation:n?.employmentLocation||"",childrenSchoolLocation:n?.childrenSchoolLocation||"",veteranDatesOfService:n?.veteranDatesOfService||"",veteranServiceConnectedDisability:n?.veteranServiceConnectedDisability||"",veteranFamilyMember:n?.veteranFamilyMember||"",deceasedVeteranServiceDeath:n?.deceasedVeteranServiceDeath||"",housingAgencyEmployee:n?.housingAgencyEmployee||"",housingAgencyEmployeeDetails:n?.housingAgencyEmployeeDetails||"",reasonableAccommodationNeeded:n?.reasonableAccommodationNeeded||"",reasonableAccommodationDetail
6s:n?.reasonableAccommodationDetails||"",needsSensoryAccessibleUnit:n?.needsSensoryAccessibleUnit||!1,householdExpenses:n?.householdExpenses||[],assetTransferLast3Years:n?.assetTransferLast3Years||"",assetTransferAmount:n?.assetTransferAmount||"",assetTransferValue:n?.assetTransferValue||"",assetTransferDate:n?.assetTransferDate||"",realEstateDetails:n?.realEstateDetails||"",previousResidences:n?.previousResidences||[],personalReferences:n?.personalReferences||[],pendingCriminalMatters:n?.pendingCriminalMatters||"",pendingCriminalMattersExplain:n?.pendingCriminalMattersExplain||"",drugViolentCrimeConviction:n?.drugViolentCrimeConviction||"",drugViolentCrimeExplain:n?.drugViolentCrimeExplain||"",owesMoneyHousingProgram:n?.owesMoneyHousingProgram||"",owesMoneyExplain:n?.owesMoneyExplain||"",evictionHousingProgram:n?.evictionHousingProgram||"",evictionExplain:n?.evictionExplain||"",priorSubsidyDetails:n?.priorSubsidyDetails||""}}),ga=Ta({mutationFn:async a=>(await Ve("POST","/api/assessments",a)).json(),onSuccess:()=>{q.invalidateQueries({queryKey:["/api/clients",j,"assessments"]}),q.invalidateQueries({queryKey:["/api/tasks"]}),N({title:"Assessment saved",description:"Initial assessment has been saved and tasks have been created for missing documents."}),T?.()},onError:a=>{N({title:"Error",description:"Failed to save assessment. Please try again.",variant:"destructive"})}}),ja=Ta({mutationFn:async({id:a,data:t})=>(await Ve("PATCH",`/api/assessments/${a}`,t)).json(),onSuccess:()=>{q.invalidateQueries({queryKey:["/api/clients",j,"assessments"]}),N({title:"Assessment updated",description:"Initial assessment has been updated."}),q.invalidateQueries({queryKey:["/api/tasks"]}),T?.()},onError:a=>{N({title:"Error",description:"Failed to update assessment. Please try again.",variant:"destructive"})}}),Va=a=>{he.current&&clearTimeout(he.current),ke.current=!1,ce.current?ja.mutate({id:ce.current,data:a}):ga.mutate(a)},Se=ga.isPending||ja.isPending,[fe,Ge]=W.useState({status:"idle"}),he=W.useRef(null),ce=W.useRef(n?.id),[ba,za]=W.useState();W.useEffect(()=>{n?.id&&(ce.current=n.id)},[n?.id]);const Ke=W.useRef(!1);Ke.current=Se;const ue=W.useRef(!0),ya=W.useRef(Promise.resolve()),ke=W.useRef(!1),Ua=()=>{const a=ce.current;Ke.current||(ke.current=!1,ya.current=ya.current.then(async()=>{if(Ke.current||a&&ce.current!==a||!a&&ce.current)return;const t=i.getValues(),r=Oa.safeParse(t);if(r.success){ue.current&&Ge({status:"saving"});try{if(a)await Ve("PATCH",`/api/assessments/${a}`,r.data);else{const o=await(await Ve("POST","/api/assessments?autosave=true",r.data)).json();ce.current=o.id,ue.current?za(o.id):q.invalidateQueries({queryKey:["/api/clients",j,"assessments"]})}q.invalidateQueries({queryKey:["/api/tasks"]}),ue.current&&Ge({status:"saved",at:new Date})}catch{ue.current&&Ge({status:"error"})}ue.current&&ke.current&&(ke.current=!1,fa())}}))},fa=()=>{he.current&&clearTimeout(he.current),he.current=setTimeout(Ua,3e3)};W.useEffect(()=>{ue.current=!0;const a=i.watch(()=>{ke.current=!0,fa()});return()=>{ue.current=!1,a.unsubscribe(),he.current&&clearTimeout(he.current),ce.current&&!n?.id&&q.invalidateQueries({queryKey:["/api/clients",j,"assessments"]})}},[i]);const va=fe.status==="saving"?"Auto-saving…":fe.status==="saved"?`Auto-saved ${fe.at?.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}`:fe.status==="error"?"Auto-save failed — use Save":"Auto-save on",Oe=i.watch("hasId"),Me=i.watch("hasBirthCertificate"),Fe=i.watch("hasSocialSecurityCard"),Qe=i.watch("hasBankAccount"),Na=i.watch("hasBankStatements"),Ya=i.watch("hasProofOfIncome"),Xe={id:Oe||!!C("id"),birthCertificate:Me||!!C("birth"),socialSecurity:Fe||!!C("ssn"),bankAccount:!Qe||Na==="yes"||!!C("bank_statements"),proofOfIncome:Ya},$e=Object.entries(Xe).filter(([a,t])=>!t),Ca=async(a="docx")=>{const t=i.getValues(),r=K?.find(s=>s.id===t.staffId),l=O?$t(O):"N/A",o=O?.dateOfBirth||"",v=O?.phone||"",te=O?.email||"",ve=O?.program?.replace(/_/g," ")||"",p=s=>s==null?"":String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),J=s=>s?"Yes":"No",De=s=>s?.length?s.map(k=>p(k.replace(/_/g," ").replace(/\b\w/g,D=>D.toUpperCase()))).join(", "):"None",xe=s=>s?p(s.replace(/_/g," ").replace(/\b\w/g,k=>k.toUpperCase())):"Not specified",Za=t.assessmentDate?new Date(t.assessmentDate).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"Not specified",Ja=r?`${r.firstName} ${r.lastName}`:"Not assigned",et=`${window.location.origin}/careremedy-logo.webp`,d=(s,k)=>`
7      <tr>
8        <td style="width:220px;background-color:#f8fafc;font-weight:bold;color:#374151;font-size:11px;padding:6px 12px;border:1px solid #e5e7eb;vertical-align:top;">${p(s)}</td>
9        <td style="color:#111827;font-size:11px;padding:6px 12px;border:1px solid #e5e7eb;vertical-align:top;">${k||'<span style="color:#9ca3af;">Not provided</span>'}</td>
10      </tr>`,Da=[{value:"hispanic",label:"Hispanic or Latino"},{value:"non_hispanic",label:"Not Hispanic or Latino"},{value:"decline",label:"Declined to answer"}],at=[{value:"us_citizen",label:"U.S. Citizen"},{value:"eligible_noncitizen",label:"Eligible Non-Citizen"},{value:"other",label:"Other"},{value:"decline",label:"Declined to answer"}],tt=[{value:"permanent",label:"Permanent residence"},{value:"temporary",label:"Temporary / doubled-up"},{value:"shelter",label:"Emergency shelter / hotel-motel"},{value:"not_for_housing",label:"Place not meant for habitation"}],st=[{value:"none",label:"None"},{value:"misdemeanor",label:"Misdemeanor"},{value:"felony",label:"Felony"},{value:"both",label:"Felony and misdemeanor"}],nt=[{value:"current_town",label:"Resident of the current town/city"},{value:"displaced_town",label:"Displaced from the town/city"}],rt=[{value:"male",label:"Male"},{value:"female",label:"Female"},{value:"non_binary",label:"Non-binary"},{value:"other",label:"Other"},{value:"prefer_not_to_say",label:"Prefer not to say"}],se=(s,k)=>{const D=s.find(L=>L.value===k);return D?p(D.label):k?xe(k):""},_e=(s,k)=>k&&k.length?k.map(D=>{const L=s.find(Te=>Te.value===D);return p(L?L.label:String(D).replace(/_/g," "))}).join(", "):"None",w=s=>s==="yes"?"Yes":s==="no"?"No":s==="na"?"N/A":'<span style="color:#9ca3af;">Not asked</span>',ta=s=>{const k=Number(String(s??"").replace(/[^0-9.]/g,""));return isNaN(k)?0:k},He=s=>
10"$"+s.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),ot=(s,k)=>{const D=ta(s);if(!D)return 0;const L=String(k||"monthly").toLowerCase();return L.includes("annual")||L.includes("year")?D/12:L.includes("biweek")||L.includes("bi-week")||L.includes("bi week")?D*26/12:L.includes("semi")?D*2:L.includes("week")?D*52/12:L.includes("quarter")?D/3:L.includes("daily")||L.includes("/day")?D*30:D},Q=s=>`<td style="text-align:left;background-color:#eef2f7;font-weight:bold;padding:6px 10px;font-size:11px;color:#374151;border:1px solid #e5e7eb;">${s}</td>`,$=s=>`<td style="padding:6px 10px;font-size:11px;color:#111827;border:1px solid #e5e7eb;vertical-align:top;">${s}</td>`,Y=s=>`<table style="width:100%;border-collapse:collapse;margin:18px 0 0 0;"><tr><td style="background-color:#0f766e;color:#ffffff;font-weight:bold;padding:7px 12px;font-size:12px;">${s}</td></tr></table>`,X=(s,k)=>`<table style="width:100%;border-collapse:collapse;margin:6px 0 0 0;"><tr><td style="border:1px solid #e5e7eb;background-color:#f8fafc;padding:8px 12px;font-size:11px;color:#374151;"><span style="font-weight:bold;color:#374151;">${s}</span><br>${k}</td></tr></table>`,Ae=s=>s?'<span style="color:#0f766e;font-weight:bold;">&#9745; Yes</span>':'<span style="color:#6b7280;">&#9744; No</span>',sa=s=>`<table style="width:100%;border-collapse:collapse;margin:14px 0 0 0;"><tr><td style="background-color:#f0fdfa;border:1px solid #99f6e4;color:#115e59;font-weight:bold;padding:5px 12px;font-size:11px;">${s}</td></tr></table>`,lt='<table style="width:100%;border-collapse:collapse;margin:0;">',it=t.incomeDetails||{},Be=ma.map(s=>({label:s.label,r:it[s.key]})).filter(s=>s.r&&s.r.status),ct=Be.filter(s=>s.r.status==="yes");let na=0;ct.forEach(s=>{na+=ot(s.r.amount,s.r.frequency)});const dt=t.assetDetails||{},ra=ha.map(s=>({label:s.label,r:dt[s.key]})).filter(s=>s.r&&s.r.status),mt=ra.filter(s=>s.r.status==="yes");let Aa=0;mt.forEach(s=>{Aa+=ta(s.r.value)});const Ee=s=>s&&s!=="na",Ea=(t.householdMembers||[]).filter(s=>s&&(s.name||s.relationship||s.dob||s.ssnLast4||s.gender||s.placeOfBirth||s.race||s.ethnicity||s.occupation||Ee(s.ftStudent)||Ee(s.disabled)||Ee(s.citizen))),oa=(t.previousResidences||[]).filter(s=>s&&(s.address||s.city||s.state||s.zip||s.dateMovedIn||s.dateMovedOut||s.landlordName||s.landlordPhone||s.landlordAddress||s.leaseholderFirstName||s.leaseholderLastName||s.rent||s.utilitiesIncluded||s.reasonForLeaving||Ee(s.landlordCourtAction)||Ee(s.securityDepositReturned))),la=(t.personalReferences||[]).filter(s=>s&&(s.name||s.phone||s.relationship||s.address)),ht=[t.forcedToLeaveResidence,t.residenceLeftAddress,t.dateLeftResidence,t.localPreferenceChoice,t.currentHousingSituationDetails,t.secondaryContactName,t.secondaryContactPhone,t.secondaryContactAddress,t.secondaryContactEmail,t.employmentLocation,t.childrenSchoolLocation,t.veteranFamilyMember,t.veteranDatesOfService,t.veteranServiceConnectedDisability,t.deceasedVeteranServiceDeath,t.reasonableAccommodationNeeded,t.reasonableAccommodationDetails,t.housingAgencyEmployee,t.housingAgencyEmployeeDetails,t.realEstateDetails,t.assetTransferLast3Years,t.assetTransferAmount,t.assetTransferValue,t.assetTransferDate].some(s=>s!=null&&String(s).trim()!==""&&String(s)!=="na")||[t.priorityReasons,t.homelessCertifications,t.householdExpenses].some(s=>Array.isArray(s)&&s.length>0)||oa.length>0||la.length>0,ut=`
11        ${Y("DEMOGRAPHICS &amp; LANGUAGE")}
12        ${lt}
13            ${d("Race",_e(We,t.race))}
14            ${d("Ethnicity",t.ethnicity?se(Da,t.ethnicity):"")}
15            ${d("Citizenship / Immigration Status",t.citizenshipStatus?se(at,t.citizenshipStatus):"")}
16            ${d("Primary Spoken Language",p(t.primarySpokenLanguage))}
17            ${d("Primary Written Language",p(t.primaryWrittenLanguage))}
18        </table>`,pt=`
19        ${Y("INCOME SOURCES")}
20          ${Be.length?`
21          <table style="width:100%;border-collapse:collapse;margin:0;">
22            <tr>${Q("Source")}${Q("Status")}${Q("Reported Amount")}${Q("Frequency")}${Q("Payer Name / Address")}</tr>
23            ${Be.map(s=>`<tr>${$(p(s.label))}${$(s.r.status==="yes"?"Yes":s.r.status==="no"?"No":"N/A")}${$(s.r.status==="yes"&&s.r.amount?"$"+p(String(s.r.amount).replace(/[^0-9.,]/g,"")):"&mdash;")}${$(s.r.status==="yes"?s.r.frequency?p(s.r.frequency):"Monthly":"&mdash;")}
23${$(p([s.r.sourceName,s.r.sourceAddress].filter(Boolean).join(" — "))||"&mdash;")}</tr>`).join("")}
24            <tr><td style="padding:7px 10px;font-size:11px;font-weight:bold;color:#115e59;background-color:#f0fdfa;border:1px solid #e5e7eb;">Estimated Total Monthly Income</td><td colspan="4" style="padding:7px 10px;font-size:11px;font-weight:bold;color:#115e59;background-color:#f0fdfa;border:1px solid #e5e7eb;">${He(na)}</td></tr>
25          </table>`:'<table style="width:100%;border-collapse:collapse;margin:0;"><tr><td style="border:1px solid #e5e7eb;padding:8px 12px;font-size:11px;color:#9ca3af;">No income sources reported.</td></tr></table>'}`,xt=`
26        ${Y("ASSETS")}
27          ${ra.length?`
28          <table style="width:100%;border-collapse:collapse;margin:0;">
29            <tr>${Q("Asset")}${Q("Status")}${Q("Approx. Value")}</tr>
30            ${ra.map(s=>`<tr>${$(p(s.label))}${$(s.r.status==="yes"?"Yes":s.r.status==="no"?"No":"N/A")}${$(s.r.status==="yes"&&s.r.value?He(ta(s.r.value)):"&mdash;")}</tr>`).join("")}
31            <tr><td style="padding:7px 10px;font-size:11px;font-weight:bold;color:#115e59;background-color:#f0fdfa;border:1px solid #e5e7eb;">Total Assets</td><td colspan="2" style="padding:7px 10px;font-size:11px;font-weight:bold;color:#115e59;background-color:#f0fdfa;border:1px solid #e5e7eb;">${He(Aa)}</td></tr>
32          </table>`:'<table style="width:100%;border-collapse:collapse;margin:0;"><tr><td style="border:1px solid #e5e7eb;padding:8px 12px;font-size:11px;color:#9ca3af;">No assets reported.</td></tr></table>'}`,gt=`
33        ${Y("HOUSEHOLD MEMBERS")}
34          ${Ea.length?`
35          <table style="width:100%;border-collapse:collapse;margin:0;">
36            <tr>${["Name","Relationship","DOB","SSN (last 4)","FT Student","Disabled","Citizen"].map(Q).join("")}</tr>
37            ${Ea.map(s=>{const k=[s.gender?`Gender: ${p(s.gender)}`:"",s.placeOfBirth?`Place of Birth: ${p(s.placeOfBirth)}`:"",s.race?`Race: ${p(se(We,s.race))}`:"",s.ethnicity?`Ethnicity: ${p(se(Da,s.ethnicity))}`:"",s.occupation?`Occupation: ${p(se(Ha,s.occupation))}`:""].filter(Boolean).join(" &bull; ");return`<tr>${$(p(s.name))}${$(p(s.relationship))}${$(p(s.dob))}${$(p(s.ssnLast4))}${$(w(s.ftStudent))}${$(w(s.disabled))}${$(w(s.citizen))}</tr>`+(k?`<tr><td colspan="7" style="border:1px solid #e5e7eb;padding:5px 10px;font-size:10px;color:#4b5563;">${k}</td></tr>`:"")}).join("")}
38          </table>`:'<table style="width:100%;border-collapse:collapse;margin:0;"><tr><td style="border:1px solid #e5e7eb;padding:8px 12px;font-size:11px;color:#9ca3af;">No additional household members reported.</td></tr></table>'}`,jt=`
39        ${Y("BACKGROUND &amp; SCREENING")}
40          <table style="width:100%;border-collapse:collapse;margin:0;">
41            ${d("Ever Convicted of a Crime",w(t.everConvicted))}
42            ${d("Conviction Type",t.convictionType?se(st,t.convictionType):"")}
43            ${d("Conviction Year(s)",p(t.convictionYears))}
44            ${d("On Sex-Offender Registry",w(t.sexOffenderRegistry))}
45            ${d("Currently Using Illegal Drugs",w(t.currentlyUsingIllegalDrugs))}
46            ${d("Convicted of Drug-Related / Violent Crime",w(t.drugViolentCrimeConviction))}
47            ${t.drugViolentCrimeExplain?d("Drug / Violent Crime Explanation",p(t.drugViolentCrimeExplain)):""}
48            ${d("Pending Criminal Matters",w(t.pendingCriminalMatters))}
49            ${t.pendingCriminalMattersExplain?d("Pending Criminal Matters Explanation",p(t.pendingCriminalMattersExplain)):""}
50            ${d("Survivor of Domestic Violence (VAWA)",w(t.domesticViolenceSurvivor))}
51            ${d("Other Names Used",p(t.otherNamesUsed))}
52            ${d("States Lived In",t.statesLived&&t.statesLived.length?p(t.statesLived.join(", ")):"None")}
53            ${d("Household Changes Expected (12 mo)",w(t.householdChangesExpected))}
54            ${d("Anyone 18+ a Full-Time Student",w(t.hasFullTimeStudent))}
55            ${d("Student Status Changes Expected",w(t.studentChangesExpected))}
56            ${d("Income Changes Expected (12 mo)",w(t.incomeChangesExpected))}
57            ${d("Filed Tax Return Last Year",w(t.taxReturnFiledLastYear))}
58            ${d("Bank Accounts Closed Last Year",w(t.closedAccountsLastYear))}
59            ${d("Disposed / Gifted Assets (2 yr)",w(t.disposedAssetsLast2Years))}
60            ${d("Needs Zero-Income Affidavit",w(t.noIncomeAffidavit))}
61            ${d("Needs No-Assets Certification",w(t.noAssetsAffidavit))}
62          </table>
63          ${t.householdChangesNotes?X("Household Change Notes:",p(t.householdChangesNotes)):""}
64          ${t.incomeChangesNotes?X("Income Change Notes:",p(t.incomeChangesNotes)):""}`,bt=ht?`
65        ${Y("CHAMP APPLICATION DETAILS")}
66          <table style="width:100%;border-collapse:collapse;margin:0;">
67            ${d("Forced to Leave Last Residence",w(t.forcedToLeaveResidence))}
68            ${d("Priority Situation",_e(Ma,t.priorityReasons))}
69            ${d("Homeless Certifications",_e(Fa,t.homelessCertifications))}
70            ${d("Address of Residence Left",p(t.residenceLeftAddress))}
71            ${d("Date Left Residence",p(t.dateLeftResidence))}
72            ${d("Local Preference Claimed As",t.localPreferenceChoice?se(nt,t.localPreferenceChoice):"")}
73            ${d("Household Expenses",_e(_a,t.householdExpenses))}
74            ${d("Employment Location",p(t.employmentLocation))}
75            ${d("Child's School Location",p(t.childrenSchoolLocation))}
76            ${d("Relationship to Veteran",p(t.veteranFamilyMember))}
77            ${d("Veteran Dates of Service",p(t.veteranDatesOfService))}
78            ${d("Service-Connected Disability",w(t.veteranServiceConnectedDisability))}
79            ${d("Deceased Veteran (Service-Connected Death)",w(t.deceasedVeteranServiceDeath))}
80            ${d("Needs Reasonable Accommodation",w(t.reasonableAccommodationNeeded))}
81            ${d("Board Member / Employee of Housing Agency",w(t.housingAgencyEmployee))}
82            ${t.housingAgencyEmployeeDetails?d("Agency & Role Detail",p(t.housingAgencyEmployeeDetails)):""}
83            ${d("Disposed / Transferred Assets (3 yr)",w(t.assetTransferLast3Years))}
84            ${d("Asset Transfer Amount",t.assetTransferAmount?"$"+p(t.assetTransferAmount):"")}
85            ${d("Asset Transfer Value",t.assetTransferValue?"$"+p(t.assetTransferValue):"")}
86            ${d("Asset Transfer Date",p(t.assetTransferDate))}
87            ${d("Real Estate Details",p(t.realEstateDetails))}
88          </table>
89          ${t.currentHousingSituationDetails?X("Current Housing Situation Detail:",p(t.currentHousingSituationDetails)):""}
90          ${t.reasonableAccommodationDetails?X("Accommodation Detail:",p(t.reasonableAccommodationDetails)):""}
91          ${t.secondaryContactName||t.secondaryContactPhone||t.secondaryContactEmail||t.secondaryContactAddress?`
92          ${sa("Secondary / Emergency Contact")}
93          <table style="width:100%;border-collapse:collapse;margin:0;">
94            ${d("Name",p(t.secondaryContactName))}
95            ${d("Phone",p(t.secondaryContactPhone))}
96            ${d("Email",p(t.secondaryContactEmail))}
97            ${d("Address",p(t.secondaryContactAddress))}
98          </table>`:""}
99          ${oa.length?`
100          ${sa("Previous Residences — Last 3 Addresses (Legacy Entries Retained)")}
101          <table style="width:100%;border-collapse:collapse;margin:0;">
102            <tr>${["Address","Move In &ndash; Out","Leaseholder","Landlord","Court Action","Deposit Returned"].map(Q).join("")}</tr>
103            ${oa.map(s=>`<tr>${$(p([s.address,s.city,s.state,s.zip].filter(Boolean).join(", "))+"<br>Monthly rent: "+p(s.rent||"Not answered")+"<br>Utilities included: "+p(s.utilitiesIncluded==="yes"?"Yes":s.utilitiesIncluded==="no"?"No":"Not answered")+"<br>Reason for leaving: "+p(s.reasonForLeaving||"Not answered"))}${$(p([s.dateMovedIn,s.dateMovedOut].filter(Boolean).join(" – ")))}${$(p([s.leaseholderFirstName,s.leaseholderLastName].filter(Boolean).join(" ")))}${$(p([s.landlordName,s.landlordPhone,s.landlordAddress].filter(Boolean).join(", ")))}${$(w(s.landlordCourtAction))}${$(w(s.securityDepositReturned))}</tr>`).join("")}
104          </table>`:""}
105          ${la.length?`
106          ${sa("Personal References")}
107          <table style="width:100%;border-collapse:collapse;margin:0;">
108            <tr>${["Name","Relationship","Phone","Address"].map(Q).join("")}</tr>
109            ${la.map(s=>`<tr>${$(p(s.name))}${$(p(s.relationship))}${$(p(s.phone))}${$(p(s.address))}</tr>`).join("")}
110          </table>`:""}`:"",yt=ut+pt+xt+gt+jt+bt,ft=`
111      <!DOCTYPE html>
112      <html>
113      <head>
114        <meta charset="utf-8">
115        <title>Initial Assessment - ${p(l)}</title>
116        <style>
117          @page { margin: 0.6in; }
118          body { font-family: 'Segoe UI', Arial, sans-serif; margin: 0; padding: 28px; line-height: 1.45; color: #111827; }
119          table { border-collapse: collapse; }
120        </style>
121      </head>
122      <body>
123        <table style="width:100%;border-collapse:collapse;margin:0;">
124          <tr>
125            <td style="background-color:#0f766e;padding:14px 18px;width:76px;vertical-align:middle;">
126              <table style="border-collapse:collapse;"><tr><td style="background-color:#ffffff;padding:6px 8px;"><img src="${et}" alt="CareRemedy Inc." style="height:44px;width:auto;" /></td></tr></table>
127            </td>
128            <td style="background-color:#0f766e;vertical-align:middle;padding:8px 12px;">
129              <table style="border-collapse:collapse;">
130                <tr><td style="background-color:#0f766e;font-size:21px;color:#ffffff;font-weight:bold;padding:0;">Initial Assessment</td></tr>
131                <tr><td style="background-color:#0f766e;font-size:11px;color:#ccfbf1;padding:0;">Care Remedy Inc. &nbsp;|&nbsp; Confidential Record</td></tr>
132                <tr><td style="background-color:#0f766e;font-size:9px;color:#99f6e4;padding:0;">Generated ${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})} at ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}</td></tr>
133              </table>
134            </td>
135            <td style="background-color:#0f766e;text-align:right;vertical-align:middle;font-size:11px;color:#ccfbf1;padding:14px 18px;">
136              Housing Assistance Program<br>Case Management Services
137            </td>
138          </tr>
139        </table>
140        <table style="width:100%;border-collapse:collapse;margin:0 0 14px 0;">
141          <tr><td style="background-color:#14b8a6;font-size:1px;line-height:1px;height:3px;padding:0;">&nbsp;</td></tr>
142        </table>
143
144        <table style="width:100%;border-collapse:collapse;margin:0;">
145          <tr><td style="background-color:#f0fdfa;border:1px solid #99f6e4;padding:9px 14px;font-size:16px;color:#115e59;font-weight:bold;">${p(l)}</td></tr>
146        </table>
147        <table style="width:100%;border-collapse:collapse;margin:0 0 4px 0;">
148          ${d("Middle Name",p(t.middleName))}
149          ${d("Sex",t.sex?se(rt,t.sex):"")}
150          ${d("Marital Status",p(t.maritalStatus||"Not answered"))}
151          ${d("Date of Birth",o?p(new Date(o+"T00:00:00").toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})):"")}
152          ${d("Senior Age Indicator (62+)",ua(o)===null?"Unable to determine":ua(o)?"Yes — program review required":"No — program review required")}
153          ${d("Phone",p(v))}
154          ${d("Email",p(te))}
155          ${d("Program",ve?xe(ve):"")}
156          ${d("Assessment Date",p(Za))}
157          ${d("Conducted By",p(Ja))}
158        </table>
159
160        ${Y("CURRENT LIVING SITUATION")}
161          <table style="width:100%;border-collapse:collapse;margin:0;">
162            ${d("Current Address",p(t.currentAddress))}
163            ${d("Previous Address",p(t.previousAddress))}
164            ${d("Years at Previous Address",p(t.yearsAtPreviousAddress))}
165            ${d("Living Situation",t.livingSituationType?se(tt,t.livingSituationType):"")}
166            ${d("Monthly Utilities (out of pocket)",t.monthlyUtilities?"$"+p(t.monthlyUtilities):"")}
167            ${d("Needs Wheelchair Transport",J(t.needsWheelchairTrans
167port))}
168          </table>
169
170        ${Y("HOUSING PREFERENCES")}
171          <table style="width:100%;border-collapse:collapse;margin:0;">
172            ${d("Housing Status",xe(t.housingStatus))}
173            ${d("Housing Setting",xe(t.housingSetting))}
174            ${d("Preferred Towns",De(t.preferredTowns?.length?t.preferredTowns:[t.preferredTown1,t.preferredTown2,t.preferredTown3].filter(Boolean)))}
175            ${d("Transportation Preference",p(t.transportationPreference))}
176            ${d("Walk-to Preferences",p(t.walkToPreferences))}
177            ${d("Unit Size",xe(t.unitSize))}
178            ${d("Housing Type",xe(t.housingType))}
179            ${d("Floor Preference",xe(t.floorPreference))}
180            ${d("Accessibility Features",De(t.accessibilityFeatures))}
181            ${d("Elevator Required",J(t.needsElevator))}
182            ${d("No Stairs Required",J(t.needsNoStairs))}
183            ${d("Accessible Bathroom Required",J(t.needsAccessibleBathroom))}
184            ${d("Sensory-Accessible Unit Required",J(t.needsSensoryAccessibleUnit))}
185            ${d("Amenities",De(t.amenities))}
186            ${d("Other Household Members",p(t.otherHouseholdMembers))}
187          </table>
188
189        ${Y("HOUSING HISTORY")}
190          <table style="width:100%;border-collapse:collapse;margin:0;">
191            ${d("Current Rent",p(t.currentRent))}
192            ${d("Housing Barriers",De(t.housingBarriers))}
193            ${d("Long-Term Waitlist Interest",J(t.longTermWaitlistInterest))}
194            ${d("Owes Previous Landlord",J(t.owesMoneyToPreviousLandlord))}
195            ${d("Owes Money to a Housing Program",w(t.owesMoneyHousingProgram))}
196            ${t.owesMoneyExplain?d("Money Owed Explanation",p(t.owesMoneyExplain)):""}
197            ${d("Previous Eviction",J(t.previousEviction))}
198            ${d("Evicted from a Housing Program",w(t.evictionHousingProgram))}
199            ${t.evictionExplain?d("Eviction Explanation",p(t.evictionExplain)):""}
200            ${d("Previous Housing Assistance",J(t.previousHousingAssistance))}
201            ${d("Has a Previous Landlord",t.hasPreviousLandlord==="yes"?"Yes":t.hasPreviousLandlord==="no"?"No":"Not answered")}
202            ${t.hasPreviousLandlord==="yes"?d("Previous Landlord Name",p(t.previousLandlordName))+d("Previous Landlord Phone",p(t.previousLandlordPhone))+d("Previous Landlord Contact Details",p(t.previousLandlordInfo)):""}
203          </table>
204          ${t.priorSubsidyDetails?X("Prior Subsidy Details:",p(t.priorSubsidyDetails)):""}
205          ${t.housingHistoryNotes?X("Notes:",p(t.housingHistoryNotes)):""}
206
207        ${Y("DOCUMENTATION STATUS")}
208          <table style="width:100%;border-collapse:collapse;margin:0;">
209            ${d("Valid ID",Ae(t.hasId))}
210            ${d("Birth Certificate",Ae(t.hasBirthCertificate))}
211            ${d("Social Security Card",Ae(t.hasSocialSecurityCard))}
212            ${d("Social Security Number",p(t.socialSecurityNumber))}
213            ${d("Has a Bank Account",Ae(t.hasBankAccount))}
214            ${t.hasBankAccount?d("Bank Name",p(t.bankName)):""}
215            ${t.hasBankAccount?d("Has Copies of Bank Statements",t.hasBankStatements==="yes"?"Yes":t.hasBankStatements==="no"?"No":"Not answered"):""}
216            ${d("Proof of Income",Ae(t.hasProofOfIncome))}
217            ${d("Place of Birth",p(t.placeOfBirth))}
218            ${d("Mother's Name",p(t.motherName))}
219            ${d("Mother's Maiden Name",p(t.motherMaidenName))}
220            ${d("Father's Name",p(t.fatherName))}
221            ${d("Monthly Income",p(t.monthlyIncome)||(Be.length?He(na):""))}
222          </table>
223
224        ${Y("PERSONAL INFORMATION")}
225          <table style="width:100%;border-collapse:collapse;margin:0;">
226            ${d("Veteran Status",J(t.isVeteran))}
227            ${d("Disability Types",De(t.disabilityTypes))}
228            ${d("Social Worker Contact",p(t.socialWorkerContact))}
229          </table>
230          ${t.disabilityNotes?X("Disability Notes:",p(t.disabilityNotes)):""}
231
232        ${yt}
233
234        ${Y("HOUSING APPLICATION READINESS")}
235          <table style="width:100%;border-collapse:collapse;margin:0;">
236            ${Object.entries(pa).map(([s,k])=>
236{const D=t.applicationDetails?.[s],L=Array.isArray(D)?D.map(Te=>String(Te).replace(/_/g," ")).join(", "):D==="yes"?"Yes":D==="no"?"No":D;return d(k,p(L||"Not answered"))}).join("")}
237          </table>
238          ${X("Occupancy review:","Acceptable bedroom sizes are preferences only. Children and overnight visitation do not automatically qualify a household for a two-bedroom unit. Housing program review and supporting documentation are required.")}
239
240        ${Y("ASSESSMENT SUMMARY")}
241          ${X("Top Priorities:",t.topPriorities?p(t.topPriorities):'<span style="color:#9ca3af;">Not specified</span>')}
242          ${X("Plan of Action:",t.planOfAction?p(t.planOfAction):'<span style="color:#9ca3af;">Not specified</span>')}
243          ${X("Recommendations:",t.recommendations?p(t.recommendations):'<span style="color:#9ca3af;">None</span>')}
244
245        <table style="width:100%;border-collapse:collapse;margin-top:44px;">
246          <tr>
247            <td style="width:290px;border-bottom:1px solid #374151;height:28px;padding:0;">&nbsp;</td>
248            <td style="width:60px;padding:0;">&nbsp;</td>
249            <td style="width:290px;border-bottom:1px solid #374151;height:28px;padding:0;">&nbsp;</td>
250          </tr>
251          <tr>
252            <td style="font-size:11px;color:#6b7280;padding:4px 0 0 0;">Staff Signature / Date</td>
253            <td style="padding:0;">&nbsp;</td>
254            <td style="font-size:11px;color:#6b7280;padding:4px 0 0 0;">Participant Signature / Date</td>
255          </tr>
256        </table>
257
258        <table style="width:100%;border-collapse:collapse;margin-top:28px;">
259          <tr><td style="border-top:1px solid #e5e7eb;padding:10px 0 0 0;font-size:8px;color:#9ca3af;">CONFIDENTIALITY NOTICE: This document contains Protected Health Information (PHI) subject to HIPAA regulations (45 CFR Parts 160 and 164). Unauthorized disclosure, copying, or distribution is strictly prohibited. If you received this document in error, please destroy it immediately and notify Care Remedy Inc.</td></tr>
260        </table>
261        <table style="width:100%;margin-top:12px;padding-top:16px;border-top:2px solid #e5e7eb;" cellpadding="0" cellspacing="0">
262          <tr>
263            <td style="font-size:11px;color:#9ca3af;vertical-align:top;">
264              CareRemedy Inc. - Confidential<br>
265              Generated ${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})} at ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}
266            </td>
267            <td style="font-size:11px;color:#9ca3af;text-align:right;vertical-align:top;">
268              Assessment ID: ${n?.id?.substring(0,8)||"Draft"}<br>
269              Client ID: ${j.substring(0,8)}
270            </td>
271          </tr>
272        </table>
273      </body>
274      </html>
275    `;try{const s=await fetch("/api/assessments/download",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({htmlContent:ft,clientId:j,format:a,clientName:l})});if(!s.ok)throw new Error("Download failed");const k=await s.blob(),D=window.URL.createObjectURL(k),L=document.createElement("a");L.href=D;const Te=l.replace(/[^a-zA-Z0-9]/g,"_");L.download=`Initial_Assessment_${Te}_${new Date().toISOString().split("T")[0]}.${a}`,document.body.appendChild(L),L.click(),window.URL.revokeObjectURL(D),document.body.removeChild(L),N({title:"Assessment Downloaded",description:a==="docx"?"Word document downloaded successfully.":"Open the file and use Ctrl+P to save as PDF."})}catch(s){console.error("Download error:",s),N({title:"Download Failed",description:"Please try again or contact support.",variant:"destructive"})}},wa=i.watch(),Wa={participant:["staffId","assessmentDate","currentAddress"],documents:["hasId","hasBirthCertificate","hasSocialSecurityCard"],housing:["housingStatus","housingSetting","preferredTown1","unitSize","housingType"],history:["previousAddress","yearsAtPreviousAddress"],income:["monthlyIncome","hasProofOfIncome","hasBankAccount","bankName","hasBankStatements"],accessibility:["disabilityTypes"],contacts:["socialWorkerContact"],application:["primarySpokenLanguage","householdChangesExpected","incomeChangesExpected"],plan:["topPriorities","planOfAction","recommendations"]},qa=a=>
275a==null?!1:typeof a=="string"?a.trim().length>0:typeof a=="boolean"?a===!0:Array.isArray(a)?a.length>0:typeof a=="number"?!0:!!a,Ze=new Set(wa.notApplicableSections||[]),pe=Object.entries(Wa).map(([a,t])=>{if(Ze.has(a))return{name:a,total:t.length,filled:t.length,complete:!0,started:!0,na:!0};const r=t.filter(l=>qa(wa[l])).length;return{name:a,total:t.length,filled:r,complete:r===t.length,started:r>0,na:!1}}),Ga=a=>{const t=i.getValues("notApplicableSections")||[],r=t.includes(a)?t.filter(l=>l!==a):[...t,a];i.setValue("notApplicableSections",r,{shouldDirty:!0})},de=a=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md border border-dashed px-3 py-2 mb-4 text-sm text-muted-foreground cursor-pointer select-none",children:[e.jsx(A,{checked:Ze.has(a),onCheckedChange:()=>Ga(a),"data-testid":`checkbox-na-${a}`}),e.jsxs("span",{children:["Not applicable — this section doesn't apply to this client",Ze.has(a)&&e.jsx("span",{className:"ml-2 text-emerald-600 font-medium",children:"(counted as complete)"})]})]}),Je=pe.reduce((a,t)=>a+t.total,0),ea=pe.reduce((a,t)=>a+t.filled,0),ee=Math.round(ea/Math.max(Je,1)*100),Ka=pe.filter(a=>a.complete).length,Qa=Math.max(1,Math.round((Je-ea)*.4)),aa={participant:{title:"Participant Information",subtitle:"Who this assessment is for"},documents:{title:"Identity & Financial Documents",subtitle:"Document availability, bank details, and verification"},housing:{title:"Housing Needs & Preferences",subtitle:"Unit preferences, assistance needs, and current facility"},history:{title:"Housing History",subtitle:"Rental background and housing barr
275iers"},income:{title:"Employment, Income & Benefits",subtitle:"Employment history, income, and supporting documents"},accessibility:{title:"Disability & Accessibility",subtitle:"Reported disability, verification, and access needs"},contacts:{title:"Application & Support Contacts",subtitle:"Application contact, identity verification, and emergency support"},application:{title:"Household & Housing Application",subtitle:"Household composition, occupancy review, and previous addresses"},plan:{title:"Plan of Action",subtitle:"Priorities and next steps"}},Sa=Object.keys(aa),ka=a=>{P.includes(a)||V([...P,a]),setTimeout(()=>{document.querySelector(`[data-section="${a}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})},50)},ae=(a,t)=>{const r=aa[a],l=pe.find(v=>v.name===a),o=Sa.indexOf(a)+1;return e.jsxs("span",{className:"flex items-center gap-3 text-left w-full",children:[e.jsx("span",{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-bold ${l?.complete?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/50 dark:text-emerald-300":"bg-muted text-muted-foreground"}`,children:l?.complete?e.jsx(ge,{className:"h-4 w-4"}):o}),e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block font-semibold text-base leading-tight",children:r.title}),e.jsx("span",{className:"block text-xs text-muted-foreground font-normal mt-0.5",children:r.subtitle})]}),l&&l.total>0&&!l.complete&&l.started&&e.jsxs("span",{className:"ml-auto mr-2 shrink-0 text-xs text-muted-foreground tabular-nums",children:[l.filled,"/",l.total]})]})},Xa=ee>=100?"from-teal-800 to-emerald-800":"from-teal-900 to-teal-700";return e.jsx(Tt,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(Va),className:"space-y-6",children:[e.jsxs(Ne,{className:`relative overflow-hidden border-0 shadow-lg bg-gradient-to-br ${Xa} text-white`,"data-testid":"card-assessment-hero",children:[e.jsxs("div",{className:"absolute inset-0 opacity-10 pointer-events-none","aria-hidden":!0,children:[e.jsx("div",{className:"absolute -right-12 -top-12 w-56 h-56 rounded-full bg-white blur-3xl"}),e.jsx("div",{className:"absolute -left-16 -bottom-16 w-64 h-64 rounded-full bg-white blur-3xl"})]}),e.jsxs(Ce,{className:"relative p-6 md:p-7",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-5",children:[e.jsxs("div",{className:"flex items-start gap-4 min-w-0",children:[e.jsx("div",{className:"rounded-2xl bg-white/15 p-3 shrink-0 ring-1 ring-white/20",children:ee>=100?e.jsx(It,{className:"h-7 w-7","data-testid":"icon-assessment-complete"}):e.jsx(ca,{className:"h-7 w-7"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight","data-testid":"text-assessment-title",children:"Initial Assessment"}),n&&e.jsx(ze,{className:"bg-white/20 text-white border-white/30 hover:bg-white/25",children:"In progress"})]}),e.jsx("p",{className:"text-sm text-white/90 max-w-xl",children:ee>=100?"Looks great — every section is filled in. Review and save to finalize.":ee>=67?"You're almost there. A few more details and you're done.":ee>=34?"Nice progress. Keep going — each section helps secure better housing matches.":"Start with what you know. Save anytime — your work auto-fills as you go."})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[va&&e.jsx("span",{className:"text-xs text-white/80","data-testid":"text-autosave-status",children:va}),e.jsxs(S,{type:"button",variant:"secondary",className:"bg-white/15 hover:bg-white/25 text-white border-0",onClick:()=>Ca("docx"),"data-testid":"button-download-assessment-docx",children:[e.jsx(da,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2",children:"Word"})]}),e.jsxs(S,{type:"button",variant:"secondary",size:"sm",className:"bg-white/10 hover:bg-white/20 text-white border-0",onClick:()=>Ca("html"),"data-testid":"button-download-assessment-html",children:[e.jsx(Pe,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2",children:"HTML"})]}),e.jsxs(S,{type:"submit",disabled:Se||fe.status==="saving",className:"bg-white text-slate-900 hover:bg-white/90 shadow-md","data-testid":"button-save-assessment",children:[Se?e.jsx(we,{className:"h-4 w-4 animate-spin"}):e.jsx(Ia,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2 font-semibold",children:n||ba?"Update":"Save"})]})]})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx("span",{children:"Completion"})]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums","data-testid":"text-completion-percent",children:[ee,"%"]})]}),e.jsx("div",{className:"h-3 w-full rounded-full bg-white/20 overflow-hidden",children:e.jsx("div",{className:"h-full bg-white transition-all duration-500 ease-out rounded-full",style:{width:`${ee}%`},"data-testid":"bar-completion"})})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"rounded-xl bg-white/10 px-3 py-2.5 ring-1 ring-white/15",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/80 mb-0.5",children:[e.jsx(wt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Sections done"})]}),e.jsxs("div",{className:"text-lg font-semibold tabular-nums","data-testid":"text-sections-done",children:[Ka," ",e.jsxs("span",{className:"text-white/70 text-sm font-normal",children:["/ ",pe.length]})]})]}),e.jsxs("div",{className:"rounded-xl bg-white/10 px-3 py-2.5 ring-1 ring-white/15",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/80 mb-0.5",children:[e.jsx(Rt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Fields filled"})]}),e.jsxs("div",{className:"text-lg font-semibold tabular-nums","data-testid":"text-fields-filled",children:[ea," ",e.jsxs("span",{className:"text-white/70 text-sm font-normal",children:["/ ",Je]})]})]}),e.jsxs("div",{className:"rounded-xl bg-white/10 px-3 py-2.5 ring-1 ring-white/15",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/80 mb-0.5",children:[e.jsx(St,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:ee>=100?"Status":"Est. left"})]}),e.jsx("div",{className:"text-lg font-semibold tabular-nums","data-testid":"text-time-left",children:ee>=100?"Ready":`~${Qa} min`})]}),e.jsxs("div",{className:"rounded-xl bg-white/10 px-3 py-2.5 ring-1 ring-white/15",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-white/80 mb-0.5",children:[e.jsx(Pa,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Missing docs"})]}),e.jsx("div",{className:"text-lg font-semibold tabular-nums","data-testid":"text-missing-docs",children:$e.length})]})]}),e.jsx("div",{className:"mt-5 flex flex-wrap gap-1.5","data-testid":"row-section-chips",children:pe.map(a=>e.jsxs("button",{type:"button",onClick:()=>ka(a.name),className:`px-3 py-1 rounded-full text-xs font-medium capitalize transition-colors ring-1 ${a.complete?"bg-white text-emerald-700 ring-white":a.started?"bg-white/25 text-white ring-white/40 hover:bg-white/35":"bg-transparent text-white/85 ring-white/30 hover:bg-white/15"}`,"data-testid":`chip-section-${a.name}`,children:[a.complete&&e.jsx(ge,{className:"h-3 w-3 inline mr-1 -mt-0.5"}),a.name]},a.name))})]})]}),$e.length>0&&e.jsx(Ne,{className:"border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950/30",children:e.jsx(Ce,{className:"pt-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Pa,{className:"h-5 w-5 text-amber-600 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-200",children:"Missing Documents Detected"}),e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300 mt-1",children:"When you save this assessment, tasks will be automatically created for the following missing documents:"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:$e.map(([a])=>e.jsx(ze,{variant:"outline",className:"border-amber-400 text-amber-700 dark:text-amber-300",children:a==="id"?"Valid ID":a==="birthCertificate"?"Birth Certificate":a==="socialSecurity"?"Social Security Card":a==="bankAccount"?"Bank Statements":"Proof of Income"},a))})]})]})})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(m,{control:i.control,name:"staffId",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Assessment Conducted By"}),e.jsx(x,{children:e.jsx(Lt,{staff:K,value:a.value||"",onValueChange:a.onChange,placeholder:"Select staff member","data-testid":"select-staff"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"assessmentDate",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Assessment Date"}),e.jsx(x,{children:e.jsx(g,{type:"date",...a,"data-testid":"input-assessment-date"})}),e.jsx(f,{})]})})]}),e.jsx("div",{className:"sticky top-0 z-20 -mx-1 px-1 py-2 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 border-b","data-testid":"nav-section-jump",children:e.jsx("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:Sa.map((a,t)=>{const r=pe.find(l=>
275l.name===a);return e.jsxs("button",{type:"button",onClick:()=>ka(a),className:`shrink-0 whitespace-nowrap px-3 py-1.5 rounded-full text-xs font-medium ring-1 transition-colors ${r?.complete?"bg-emerald-50 text-emerald-700 ring-emerald-200 dark:bg-emerald-950/40 dark:text-emerald-300 dark:ring-emerald-900":"bg-muted/50 text-foreground ring-border hover:bg-muted"}`,"data-testid":`jump-section-${a}`,children:[r?.complete?e.jsx(ge,{className:"h-3 w-3 inline mr-1 -mt-0.5"}):e.jsxs("span",{className:"mr-1 text-muted-foreground",children:[t+1,"."]}),aa[a].title]},a)})})}),e.jsxs(Pt,{type:"multiple",value:P,onValueChange:V,className:"space-y-4",children:[e.jsxs(ne,{value:"participant","data-section":"participant",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("participant",e.jsx(Ot,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[e.jsx(Bt,{dob:O?.dateOfBirth}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(m,{control:i.control,name:"middleName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Middle Name"}),e.jsx(x,{children:e.jsx(g,{placeholder:"Enter middle name",...a,"data-testid":"input-middle-name"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"sex",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Sex"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-sex",children:e.jsx(_,{placeholder:"Select sex"})})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"male",children:"Male"}),e.jsx(b,{value:"female",children:"Female"}),e.jsx(b,{value:"non_binary",children:"Non-binary"}),e.jsx(b,{value:"other",children:"Other"}),e.jsx(b,{value:"prefer_not_to_say",children:"Prefer not to say"})]})]}),e.jsx(f,{})]})})]}),e.jsx(m,{control:i.control,name:"maritalStatus",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Marital Status"}),e.jsxs(M,{value:a.value||"",onValueChange:a.onChange,children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-marital-status",children:e.jsx(_,{placeholder:"Select marital status"})})}),e.jsx(H,{children:["Single","Married","Separated","Divorced","Widowed","Domestic partnership","Other","Prefer not to say"].map(t=>e.jsx(b,{value:t,children:t},t))})]}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"currentAddress",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Current Address"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Enter current address",...a,"data-testid":"input-current-address"})}),e.jsx(f,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(m,{control:i.control,name:"previousAddress",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Previous Address"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Enter previous address",...a,"data-testid":"input-previous-address"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"yearsAtPreviousAddress",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Years at Previous Address"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g., 3 years",...a,"data-testid":"input-years-previous"})}),e.jsx(f,{})]})})]}
275),e.jsx(m,{control:i.control,name:"needsWheelchairTransport",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-wheelchair-transport"})}),e.jsx(h,{className:"font-normal",children:"Requires wheelchair accessible transportation"})]})})]})]})]}),e.jsxs(ne,{value:"documents","data-section":"documents",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:e.jsxs("span",{className:"flex items-center gap-2 w-full",children:[ae("documents",e.jsx(da,{className:"h-4 w-4"})),$e.length>0&&e.jsxs(ze,{variant:"secondary",className:"ml-2 shrink-0",children:[$e.length," missing"]})]})}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("documents"),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ne,{className:`${Oe||C("id")?"border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-950/30":"border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950/30"}`,children:e.jsxs(Ce,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Oe||C("id")?e.jsx(ge,{className:"h-5 w-5 text-green-600"}):e.jsx(je,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium",children:"Valid ID"})]}),e.jsx(m,{control:i.control,name:"hasId",render:({field:a})=>e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-has-id"})})]}),e.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:C("id")?e.jsxs(e.Fragment,{children:[e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("id").id,"inline"),"data-testid":"button-view-id-doc",children:[e.jsx(Ue,{className:"h-3 w-3 mr-1"}),"View"]}
275),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("id").id,"attachment"),"data-testid":"button-download-id-doc",children:[e.jsx(Pe,{className:"h-3 w-3 mr-1"}),"Download"]})]}):e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.heic,.heif,.bmp,.tiff,.tif,image/*,application/pdf",className:"hidden",onChange:a=>{const t=a.target.files?.[0];t&&Re(t,"id"),a.target.value=""},"data-testid":"input-upload-id"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",disabled:le==="id",asChild:!0,children:e.jsxs("span",{children:[le==="id"?e.jsx(we,{className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ye,{className:"h-3 w-3 mr-1"}),"Upload"]})})]})}),!Oe&&!C("id")&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"RMV Contact: 857-368-8005"})]})}),e.jsx(Ne,{className:`${Fe||C("ssn")?"border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-950/30":"border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950/30"}`,children:e.jsxs(Ce,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Fe||C("ssn")?e.jsx(ge,{className:"h-5 w-5 text-green-600"}):e.jsx(je,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium",children:"Social Security Card"})]}),e.jsx(m,{control:i.control,name:"hasSocialSecurityCard",render:({field:a})=>e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-has-ss-card"})})]}),e.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:C("ssn")?e.jsxs(e.Fragment,{children:[e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("ssn").id,"inline"),"data-testid":"button-view-ssn-doc",children:[e.jsx(Ue,{className:"h-3 w-3 mr-1"}),"View"]}
275),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("ssn").id,"attachment"),"data-testid":"button-download-ssn-doc",children:[e.jsx(Pe,{className:"h-3 w-3 mr-1"}),"Download"]})]}):e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.heic,.heif,.bmp,.tiff,.tif,image/*,application/pdf",className:"hidden",onChange:a=>{const t=a.target.files?.[0];t&&Re(t,"ssn"),a.target.value=""},"data-testid":"input-upload-ssn"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",disabled:le==="ssn",asChild:!0,children:e.jsxs("span",{children:[le==="ssn"?e.jsx(we,{className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ye,{className:"h-3 w-3 mr-1"}),"Upload"]})})]})}),!Fe&&!C("ssn")&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"SSA Contact: 1-800-772-1213"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(Ne,{className:`${Me||C("birth")?"border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-950/30":"border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950/30"}`,children:e.jsxs(Ce,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Me||C("birth")?e.jsx(ge,{className:"h-5 w-5 text-green-600"}):e.jsx(je,{className:"h-5 w-5 text-amber-600"}),e.jsx("span",{className:"font-medium",children:"Birth Certificate"})]}),e.jsx(m,{control:i.control,name:"hasBirthCertificate",render:({field:a})=>e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-has-birth-cert"})})]}),e.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:C("birth")?e.jsxs(e.Fragment,{children:[e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("birth").id,"inline"),"data-testid":"button-view-birth-doc",children:[e.jsx(Ue,{className:"h-3 w-3 mr-1"}),"View"]}
275),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("birth").id,"attachment"),"data-testid":"button-download-birth-doc",children:[e.jsx(Pe,{className:"h-3 w-3 mr-1"}),"Download"]})]}):e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.heic,.heif,.bmp,.tiff,.tif,image/*,application/pdf",className:"hidden",onChange:a=>{const t=a.target.files?.[0];t&&Re(t,"birth"),a.target.value=""},"data-testid":"input-upload-birth"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",disabled:le==="birth",asChild:!0,children:e.jsxs("span",{children:[le==="birth"?e.jsx(we,{className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ye,{className:"h-3 w-3 mr-1"}),"Upload"]})})]})}),!Me&&!C("birth")&&e.jsx("div",{className:"text-xs text-muted-foreground space-y-2",children:e.jsxs("a",{href:"https://www.vitalchek.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:underline",children:["Order via VitalChek",e.jsx(kt,{className:"h-3 w-3"})]})})]})}),e.jsx(Ne,{className:`${Xe.bankAccount?"border-green-200 bg-green-50 dark:border-green-900 dark:bg-green-950/30":"border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950/30"}`,children:e.jsxs(Ce,{className:"pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Xe.bankAccount?e.jsx(ge,{className:"h-5 w-5 text-green-600"}):e.jsx(je,{className:"h-5 w-5 text-amber-600"}),e.jsx("label",{htmlFor:"assessment-bank-account",className:"font-medium",children:"Does the client have a bank account?"})]}),e.jsx(m,{control:i.control,name:"hasBankAccount",render:({field:a})=>e.jsx(A,{id:"assessment-bank-account",checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-has-bank-account"})})]}),Qe&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{control:i.control,name:"bankName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Bank name"}),e.jsx(x,{children:e.jsx(g,{...a,placeholder:"Enter bank name","data-testid":"input-bank-name"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"hasBankStatements",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Does the client have copies of their bank statements?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"has-bank-statements"}),e.jsx(f,{})]})}),e.jsx(be,{section:"bank"}),Na==="no"&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"A “Get bank statements” task will be added automatically when this assessment is saved."})]}),e.jsx("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:C("bank_statements")?e.jsxs(e.Fragment,{children:[e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("bank_statements").id,"inline"),"data-testid":"button-view-bank-statements-doc",children:[e.jsx(Ue,{className:"h-3 w-3 mr-1"}),"View"]}
275),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>ie(C("bank_statements").id,"attachment"),"data-testid":"button-download-bank-statements-doc",children:[e.jsx(Pe,{className:"h-3 w-3 mr-1"}),"Download"]})]}):Qe?null:e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.heic,.heif,.bmp,.tiff,.tif,image/*,application/pdf",className:"hidden",onChange:a=>{const t=a.target.files?.[0];t&&Re(t,"bank_statements"),a.target.value=""},"data-testid":"input-upload-bank-statements"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",disabled:le==="bank_statements",asChild:!0,children:e.jsxs("span",{children:[le==="bank_statements"?e.jsx(we,{className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ye,{className:"h-3 w-3 mr-1"}),"Upload"]})})]}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{i.setValue("hasBankAccount",!1,{shouldDirty:!0}),i.setValue("hasBankStatements","",{shouldDirty:!0})},"data-testid":"button-mark-na-bank-statements",children:"Mark N/A"})]})})]})})]}),e.jsxs("div",{className:"space-y-4 p-4 bg-muted/50 rounded-md",children:[e.jsx("p",{className:"text-sm font-medium",children:"Identity Details (used to auto-fill forms and order birth certificates)"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(m,{control:i.control,name:"placeOfBirth",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Place of Birth"}),e.jsx(x,{children:e.jsx(g,{placeholder:"City, State",...a,"data-testid":"input-place-of-birth"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"motherName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Mother's Full Name"}),e.jsx(x,{children:e.jsx(g,{placeholder:"Full name",...a,"data-testid":"input-mother-name"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"motherMaidenName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Mother's Maiden Name"}),e.jsx(x,{children:e.jsx(g,{placeholder:"Last name prior to marriage",...a,"data-testid":"input-mother-maiden-name"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"fatherName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Father's Full Name"}),e.jsx(x,{children:e.jsx(g,{placeholder:"Full name",...a,"data-testid":"input-father-name"})}),e.jsx(f,{})]})})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsx(m,{control:i.control,name:"socialSecurityNumber",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Social Security Number (if known)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"XXX-XX-XXXX",...a,"data-testid":"input-ssn"})}),e.jsx(Ba,{children:"Last 4 digits may be helpful for verification"}),e.jsx(f,{})]})})})]})]})]}),e.jsxs(ne,{value:"housing","data-section":"housing",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("housing",e.jsx(Dt,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("housing"),e.jsx(be,{section:"housing"}),e.jsx(be,{section:"facility"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(m,{control:i.control,name:"needsHousing",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-needs-housing"})}),e.jsx(h,{className:"font-normal",children:"Client needs housing assistance"})]})}),e.jsx(m,{control:i.control,name:"housingStatus",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Housing Status"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value,children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-housing-status",children:e.jsx(_,{placeholder:"Select status"})})}),e.jsx(H,{children:Vt.map(t=>e.jsx(b,{value:t.value,children:t.label},t.value))})]}),e.jsx(f,{})]})})]}),i.watch("needsHousing")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t pt-4",children:[e.jsx(h,{className:"text-base font-medium",children:"Preferred Towns (up to 3)"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-2",children:[e.jsx(m,{control:i.control,name:"preferredTown1",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Town 1 (Primary)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g., Boston",...a,"data-testid":"input-preferred-town-1"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"preferredTown2",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Town 2"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g., Cambridge",...a,"data-testid":"input-preferred-town-2"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"preferredTown3",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Town 3"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g., Somerville",...a,"data-testid":"input-preferred-town-3"})}),e.jsx(f,{})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(m,{control:i.control,name:"unitSize",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Bedroom Count"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value,children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-unit-size",children:e.jsx(_,{placeholder:"Select size"})})}),e.jsx(H,{children:Ut.map(t=>e.jsx(b,{value:t.value,children:t.label},t.value))})]}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"housingSetting",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Preferred Setting"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value,children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-housing-setting",children:e.jsx(_,{placeholder:"Select setting"})})}),e.jsx(H,{children:zt.map(t=>e.jsx(b,{value:t.value,children:t.label},t.value))})]}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"housingType",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Housing Type"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value,children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-housing-type",children:e.jsx(_,{placeholder:"Select type"})})}),e.jsx(H,{children:Yt.map(t=>e.jsx(b,{value:t.value,children:t.label},t.value))})]}),e.jsx(f,{})]})})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx(h,{className:"text-base font-medium",children:"Accessibility Requirements"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-2",children:[e.jsx(m,{control:i.control,name:"needsWheelchairTrans
275port",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-wheelchair-accessible"})}),e.jsx(h,{className:"font-normal",children:"Wheelchair Accessible Unit"})]})}),e.jsx(m,{control:i.control,name:"needsElevator",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-needs-elevator"})}),e.jsx(h,{className:"font-normal",children:"Elevator Required"})]})}),e.jsx(m,{control:i.control,name:"needsNoStairs",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-no-stairs"})}),e.jsx(h,{className:"font-normal",children:"No Stairs"})]})}),e.jsx(m,{control:i.control,name:"needsAccessibleBathroom",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-accessible-bathroom"})}),e.jsx(h,{className:"font-normal",children:"Accessible Bathroom"})]})})]})]})]}),!i.watch("needsHousing")&&e.jsx("p",{className:"text-sm text-muted-foreground italic",children:'Check "Client needs housing assistance" above to show housing preferences.'})]})]})]}),e.jsxs(ne,{value:"history","data-section":"history",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("history",e.jsx(ca,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("history"),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{control:i.control,name:"longTermWaitlistInterest",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-waitlist-interest"})}),e.jsx(h,{className:"font-normal",children:"Interested in long-term housing waitlists"})]})}),e.jsx(m,{control:i.control,name:"previousHousingAssistance",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-previous-assistance"})}),e.jsx(h,{className:"font-normal",children:"Previously received housing assistance"})]})}),e.jsx(m,{control:i.control,name:"owesMoneyToPreviousLandlord",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-owes-landlord"})}),e.jsx(h,{className:"font-normal text-amber-700 dark:text-amber-400",children:"Owes money to previous landlord"})]})}),e.jsx(m,{control:i.control,name:"previousEviction",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-previous-eviction"})}),e.jsx(h,{className:"font-normal text-amber-700 dark:text-amber-400",children:"Previous eviction on record"})]})})]}),e.jsx(m,{control:i.control,name:"hasPreviousLandlord",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Does the client have a previous landlord?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"has-previous-landlord"}),e.jsx(f,{})]})}),i.watch("hasPreviousLandlord")==="yes"&&e.jsxs("div",{className:"space-y-4 rounded-md border p-4",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx(m,{control:i.control,name:"previousLandlordName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Previous landlord’s name"}),e.jsx(x,{children:e.jsx(g,{...a,placeholder:"Landlord or property manager name","data-testid":"input-previous-landlord-name"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"previousLandlordPhone",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Previous landlord’s phone number"}),e.jsx(x,{children:e.jsx(g,{...a,type:"tel",placeholder:"Phone number","data-testid":"input-previous-landlord-phone"})}),e.jsx(f,{})]})})]}),e.jsx(m,{control:i.control,name:"previousLandlordInfo",render:({field:a})=>
275e.jsxs(u,{children:[e.jsx(h,{children:"Other contact details"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Email, mailing address, alternate contact, or existing landlord notes",...a,"data-testid":"input-previous-landlord"})}),e.jsx(f,{})]})})]}),e.jsx(m,{control:i.control,name:"housingHistoryNotes",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Additional Housing History Notes"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Any additional context about housing history",...a,"data-testid":"input-housing-history-notes"})}),e.jsx(f,{})]})})]})]})]}),e.jsxs(ne,{value:"income","data-section":"income",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("income",e.jsx(_t,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("income"),e.jsx(be,{section:"employment"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsx(m,{control:i.control,name:"monthlyIncome",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Monthly Income"}),e.jsx(x,{children:e.jsx(g,{placeholder:"$0.00",...a,"data-testid":"input-monthly-income"})}),e.jsx(f,{})]})})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(m,{control:i.control,name:"hasProofOfIncome",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-proof-income"})}),e.jsx(h,{className:"font-normal",children:"Has proof of income documentation"})]})}),e.jsx(m,{control:i.control,name:"isVeteran",render:({field:a})=>e.jsxs(u,{className:"flex flex-row items-center gap-3 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-veteran"})}),e.jsx(h,{className:"font-normal",children:"Veteran status"})]})})]})]})]})]}),e.jsxs(ne,{value:"accessibility","data-section":"accessibility",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("accessibility",e.jsx(Mt,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("accessibility"),e.jsx(be,{section:"accessibility"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{control:i.control,name:"disabilityTypes",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Disability Types"}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:qt.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`disability-${t}`,checked:a.value?.includes(t),onCheckedChange:r=>{const l=a.value||[];r?a.onChange([...l,t]):a.onChange(l.filter(o=>o!==t))},"data-testid":`checkbox-disability-${t}`}),e.jsx(y,{htmlFor:`disability-${t}`,className:"text-sm font-normal capitalize",children:t.replace("_"," ")})]},t))}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"disabilityNotes",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Additional Notes"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Any additional information about disabilities or accommodation needs",...a,"data-testid":"input-disability-notes"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"accessibilityFeatures",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Required Accessibility Features"}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:Wt.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`feature-${t}`,checked:a.value?.includes(t),onCheckedChange:r=>{const l=a.value||[];r?a.onChange([...l,t]):a.onChange(l.filter(o=>o!==t))},"data-testid":`checkbox-feature-${t}`}),e.jsx(y,{htmlFor:`feature-${t}`,className:"text-sm font-normal capitalize",children:t.replace(/_/g," ")})]},t))}),e.jsx(f,{})]})})]})]})]}),e.jsxs(ne,{value:"contacts","data-section":"contacts",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("contacts",e.jsx(Ft,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("contacts"),e.jsx(be,{section:"contacts",clientPhone:O?.phone,clientEmail:O?.email}),e.jsx(m,{control:i.control,name:"socialWorkerContact",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Social Worker / Support Contact"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Name, organization, phone, email",...a,"data-testid":"input-social-worker"})}),e.jsx(f,{})]})})]})]}),e.jsxs(ne,{value:"application","data-section":"application",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:e.jsxs("span",{className:"flex items-center gap-2 w-full",children:[ae("application",e.jsx(da,{className:"h-4 w-4"})),e.jsx(ze,{variant:"secondary",className:"ml-2 text-xs shrink-0",children:"N/A friendly"})]})}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("application"),e.jsx(be,{section:"household"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/40 rounded-md p-3 border",children:["Tap ",e.jsx("span",{className:"font-semibold",children:"N/A"})," on anything that doesn't apply. Nothing is required — fill what you know."]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Household members"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a=i.getValues("householdMembers")||[];i.setValue("householdMembers",[...a,{name:"",relationship:"",dob:"",ssnLast4:"",ftStudent:"na",gender:"",placeOfBirth:"",disabled:"na",citizen:"na",race:"",ethnicity:"",occupation:""}],{shouldDirty:!0})},"data-testid":"button-add-household-member",children:"+ Add member"})]}),e.jsx(m,{control:i.control,name:"householdMembers",render:({field:a})=>e.jsxs("div",{className:"space-y-2",children:[(a.value||[]).length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No additional members yet."}),(a.value||[]).map((t,r)=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-2 items-end border rounded-md p-3","data-testid":`row-household-member-${r}`,children:[e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Name"}),e.jsx(g,{value:t.name||"",onChange:l=>{const o=[...a.value];o[r]={...o[r],name:l.target.value},a.onChange(o)},"data-testid":`input-member-name-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Relationship"}),e.jsx(g,{value:t.relationship||"",onChange:l=>{const o=[...a.value];o[r]={...o[r],relationship:l.target.value},a.onChange(o)},"data-testid":`input-member-rel-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"DOB"}),e.jsx(g,{type:"date",value:t.dob||"",onChange:l=>{const o=[...a.value];o[r]={...o[r],dob:l.target.value},a.onChange(o)},"data-testid":`input-member-dob-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Last 4 SSN"}),e.jsx(g,{value:t.ssnLast4||"",maxLength:4,onChange:l=>{const o=[...a.value];o[r]={...o[r],ssnLast4:l.target.value.replace(/\D/g,"").slice(0,4)},a.onChange(o)},"data-testid":`input-member-ssn-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"FT Student?"}),e.jsx("div",{className:"flex gap-1",children:["yes","no","na"].map(l=>e.jsx("button",{type:"button",onClick:()=>{const o=[...a.value];o[r]={...o[r],ftStudent:l},a.onChange(o)},className:`px-2 py-1 rounded text-xs border ${t.ftStudent===l?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted"}`,"data-testid":`tri-member-student-${r}-${l}`,children:l==="na"?"N/A":l.toUpperCase()},l))})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Gender"}),e.jsx(g,{value:t.gender||"",onChange:l=>{const o=[...a.value];o[r]={...o[r],gender:l.target.value},a.onChange(o)},"data-testid":`input-member-gender-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Place of birth"}),e.jsx(g,{value:t.placeOfBirth||"",onChange:l=>{const o=[...a.value];o[r]={...o[r],placeOfBirth:l.target.value},a.onChange(o)},"data-testid":`input-member-pob-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Disabled?"}),e.jsx("div",{className:"flex gap-1",children:["yes","no","na"].map(l=>e.jsx("button",{type:"button",onClick:()=>{const o=[...a.value];o[r]={...o[r],disabled:l},a.onChange(o)},className:`px-2 py-1 rounded text-xs border ${t.disabled===l?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted"}`,"data-testid":`tri-member-disabled-${r}-${l}`,children:l==="na"?"N/A":l.toUpperCase()},l))})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"U.S. citizen / eligible?"}),e.jsx("div",{className:"flex gap-1",children:["yes","no","na"].map(l=>e.jsx("button",{type:"button",onClick:()=>{const o=[...a.value];o[r]={...o[r],citizen:l},a.onChange(o)},className:`px-2 py-1 rounded text-xs border ${t.citizen===l?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted"}`,"data-testid":`tri-member-citizen-${r}-${l}`,children:l==="na"?"N/A":l.toUpperCase()},l))})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Race"}),e.jsxs(M,{value:t.race||"",onValueChange:l=>{const o=[...a.value];o[r]={...o[r],race:l},a.onChange(o)},children:[e.jsx(F,{className:"h-9","data-testid":`select-member-race-${r}`,children:e.jsx(_,{placeholder:"Select…"})}),e.jsx(H,{children:We.map(l=>e.jsx(b,{value:l.value,children:l.label},l.value))})]})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Ethnicity"}),e.jsxs(M,{value:t.ethnicity||"",onValueChange:l=>{const o=[...a.value];o[r]={...o[r],ethnicity:l},a.onChange(o)},children:[e.jsx(F,{className:"h-9","data-testid":`select-member-ethnicity-${r}`,children:e.jsx(_,{placeholder:"Select…"})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"hispanic",children:"Hispanic or Latino"}),e.jsx(b,{value:"non_hispanic",children:"Not Hispanic or Latino"}),e.jsx(b,{value:"decline",children:"Declined to answer"})]})]})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Occupation"}),e.jsxs(M,{value:t.occupation||"",onValueChange:l=>{const o=[...a.value];o[r]={...o[r],occupation:l},a.onChange(o)},children:[e.jsx(F,{className:"h-9","data-testid":`select-member-occupation-${r}`,children:e.jsx(_,{placeholder:"Select…"})}),e.jsx(H,{children:Ha.map(l=>e.jsx(b,{value:l.value,children:l.label},l.value))})]})]}),e.jsx("div",{className:"md:col-span-1 flex justify-end",children:e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const l=[...a.value];l.splice(r,1),a.onChange(l)},"data-testid":`button-remove-member-${r}`,children:e.jsx(je,{className:"h-4 w-4"})})})]},r))]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Demographics"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Collected for fair-housing reporting. Applicants may decline any item."}),e.jsx(m,{control:i.control,name:"race",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Race (select all that apply)"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 mt-1",children:We.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`race-${t.value}`,checked:a.value?.includes(t.value),onCheckedChange:r=>{const l=a.value||[];a.onChange(r?[...l,t.value]:l.filter(o=>o!==t.value))},"data-testid":`checkbox-race-${t.value}`}),e.jsx(y,{htmlFor:`race-${t.value}`,className:"text-sm font-normal",children:t.label})]},t.value))}),e.jsx(f,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"ethnicity",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Ethnicity"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-ethnicity",children:e.jsx(_,{placeholder:"Select…"})})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"hispanic",children:"Hispanic or Latino"}),e.jsx(b,{value:"non_hispanic",children:"Not Hispanic or Latino"}),e.jsx(b,{value:"decline",children:"Declined to answer"})]})]})]})}),e.jsx(m,{control:i.control,name:"citizenshipStatus",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Citizenship / immigration status"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-citizenship",children:e.jsx(_,{placeholder:"Select…"})})}),e.jsxs(H,{children:[e.jsx(b,{value:"us_citizen",children:"U.S. Citizen"}),e.jsx(b,{value:"eligible_noncitizen",children:"Eligible Non-Citizen"}),e.jsx(b,{value:"other",children:"Other"}),e.jsx(b,{value:"decline",children:"Declined to answer"})]})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Current living situation"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"livingSituationType",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Living situation type"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-living-situation",children:e.jsx(_,{placeholder:"Select…"})})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"permanent",children:"Permanent residence"}),e.jsx(b,{value:"temporary",children:"Temporary / doubled-up"}),e.jsx(b,{value:"shelter",children:"Emergency shelter / hotel-motel"}),e.jsx(b,{value:"not_for_housing",children:"Place not meant for habitation"})]})]})]})}),e.jsx(m,{control:i.control,name:"monthlyUtilities",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Monthly utilities (out of pocket)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. 180",...a,"data-testid":"input-monthly-utilities"})})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Background"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Some housing applications ask these screening questions. Tap N/A on anything not asked — unanswered items stay blank on the legal form."}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[{name:"everConvicted",label:"Ever convicted of a crime?"},{name:"sexOffenderRegistry",label:"On a sex-offender registry?"},{name:"currentlyUsingIllegalDrugs",label:"Currently using illegal drugs?"},{name:"domesticViolenceSurvivor",label:"Survivor of domestic violence (VAWA)?"}].map(a=>e.jsx(m,{control:i.control,name:a.name,render:({field:t})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:a.label}),e.jsx("div",{className:"flex gap-1 mt-1",children:["yes","no","na"].map(r=>e.jsx("button",{type:"button",onClick:()=>t.onChange(r),className:`flex-1 px-3 py-1.5 rounded text-xs font-medium border transition-colors ${t.value===r?r==="yes"?"bg-emerald-600 text-white border-emerald-600":r==="no"?"bg-rose-600 text-white border-rose-600":"bg-slate-500 text-white border-slate-500":"bg-background hover:bg-muted"}`,"data-testid":`tri-${a.name}-${r}`,children:r==="na"?"N/A":r.toUpperCase()},r))})]})},a.name))}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"convictionType",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Conviction type (if any)"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-conviction-type",children:e.jsx(_,{placeholder:"Select…"})})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"none",children:"None"}),e.jsx(b,{value:"misdemeanor",children:"Misdemeanor"}),e.jsx(b,{value:"felony",children:"Felony"}),e.jsx(b,{value:"both",children:"Felony and misdemeanor"})]})]})]})}),e.jsx(m,{control:i.control,name:"convictionYears",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Conviction year(s)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. 2015",...a,"data-testid":"input-conviction-years"})})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"otherNamesUsed",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Other names used (aliases, maiden name)"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-other-names"})})]})}),e.jsx(m,{control:i.control,name:"statesLived",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"States lived in (comma-separated)"}),e.jsx(x,{children:e.jsx(g,{value:(a.value||[]).join(", "),onChange:t=>a.onChange(t.target.value.split(",").map(r=>r.trim()).filter(Boolean)),placeholder:"MA, NH, RI","data-testid":"input-states-lived"})})]})})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[{name:"householdChangesExpected",label:"Household changes expected in next 12 months?"},{name:"hasFullTimeStudent",label:"Anyone 18+ a full-time student?"},{name:"studentChangesExpected",label:"Student status changes expected?"},{name:"incomeChangesExpected",label:"Income changes expected in next 12 months?"},{name:"taxReturnFiledLastYear",label:"Filed a tax return last year?"},{name:"closedAccountsLastYear",label:"Any bank accounts closed in the past year?"},{name:"disposedAssetsLast2Years",label:"Disposed/gifted assets in past 2 years?"},{name:"noIncomeAffidavit",label:"Need a Zero-Income Affidavit?"},{name:"noAssetsAffidavit",label:"Need a No-Assets Certification?"}].map(a=>e.jsx(m,{control:i.control,name:a.name,render:({field:t})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:a.label}),e.jsx("div",{className:"flex gap-1 mt-1",children:["yes","no","na"].map(r=>e.jsx("button",{type:"button",onClick:()=>t.onChange(r),className:`flex-1 px-3 py-1.5 rounded text-xs font-medium border transition-colors ${t.value===r?r==="yes"?"bg-emerald-600 text-white border-emerald-600":r==="no"?"bg-rose-600 text-white border-rose-600":"bg-slate-500 text-white border-slate-500":"bg-background hover:bg-muted"}`,"data-testid":`tri-${a.name}-${r}`,children:r==="na"?"N/A":r.toUpperCase()},r))})]})},a.name))}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"primarySpokenLanguage",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Primary spoken language"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. English",...a,"data-testid":"input-primary-spoken-language"})})]})}),e.jsx(m,{control:i.control,name:"primaryWrittenLanguage",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Primary written language"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. English",...a,"data-testid":"input-primary-written-language"})})]})}),e.jsx(m,{control:i.control,name:"householdChangesNotes",render:({field:a})=>e.jsxs(u,{className:"md:col-span-2",children:[e.jsx(h,{children:"Household change notes (if YES)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain...",...a,"data-testid":"input-household-changes-notes"})})]})}),e.jsx(m,{control:i.control,name:"incomeChangesNotes",render:({field:a})=>e.jsxs(u,{className:"md:col-span-2",children:[e.jsx(h,{children:"Income change notes (if YES)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain...",...a,"data-testid":"input-income-changes-notes"})})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Income sources"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a={};ma.forEach(t=>{a[t.key]={status:"na"}}),i.setValue("incomeDetails",a,{shouldDirty:!0})},"data-testid":"button-income-all-na",children:"All N/A"}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{i.setValue("incomeDetails",{},{shouldDirty:!0})},"data-testid":"button-income-reset",children:"Reset"})]})]}),e.jsx(m,{control:i.control,name:"incomeDetails",render:({field:a})=>{const t=a.value||{},r=(l,o)=>a.onChange({...t,[l]:{...t[l]||{status:"na"},...o}});return e.jsx("div",{className:"rounded-md border divide-y",children:ma.map(l=>{const o=t[l.key]||{status:""};return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-2 items-center px-3 py-2","data-testid":`row-income-${l.key}`,children:[e.jsx("div",{className:"md:col-span-5 text-sm",children:l.label}),e.jsx("div",{className:"md:col-span-3 flex gap-1",children:["yes","no","na"].map(v=>e.jsx("button",{type:"button",onClick:()=>r(l.key,{status:v}),className:`flex-1 px-2 py-1 rounded text-xs font-medium border ${o.status===v?v==="yes"?"bg-emerald-600 text-white border-emerald-600":v==="no"?"bg-rose-600 text-white border-rose-600":"bg-slate-500 text-white border-slate-500":"bg-background hover:bg-muted"}`,"data-testid":`tri-income-${l.key}-${v}`,children:v==="na"?"N/A":v.toUpperCase()},v))}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(g,{placeholder:"$ Amount",value:o.amount||"",disabled:o.status!=="yes",onChange:v=>r(l.key,{amount:v.target.value}),"data-testid":`input-income-amount-${l.key}`})}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(g,{placeholder:"Frequency",value:o.frequency||"",disabled:o.status!=="yes",onChange:v=>r(l.key,{frequency:v.target.value}),"data-testid":`input-income-freq-${l.key}`})})]},l.key)})})}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Assets"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a={};
275ha.forEach(t=>{a[t.key]={status:"na"}}),i.setValue("assetDetails",a,{shouldDirty:!0})},"data-testid":"button-assets-all-na",children:"All N/A"}),e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{i.setValue("assetDetails",{},{shouldDirty:!0})},"data-testid":"button-assets-reset",children:"Reset"})]})]}),e.jsx(m,{control:i.control,name:"assetDetails",render:({field:a})=>{const t=a.value||{},r=(l,o)=>a.onChange({...t,[l]:{...t[l]||{status:"na"},...o}});return e.jsx("div",{className:"rounded-md border divide-y",children:ha.map(l=>{const o=t[l.key]||{status:""};return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-2 items-center px-3 py-2","data-testid":`row-asset-${l.key}`,children:[e.jsx("div",{className:"md:col-span-6 text-sm",children:l.label}),e.jsx("div",{className:"md:col-span-3 flex gap-1",children:["yes","no","na"].map(v=>e.jsx("button",{type:"button",onClick:()=>r(l.key,{status:v}),className:`flex-1 px-2 py-1 rounded text-xs font-medium border ${o.status===v?v==="yes"?"bg-emerald-600 text-white border-emerald-600":v==="no"?"bg-rose-600 text-white border-rose-600":"bg-slate-500 text-white border-slate-500":"bg-background hover:bg-muted"}`,"data-testid":`tri-asset-${l.key}-${v}`,children:v==="na"?"N/A":v.toUpperCase()},v))}),e.jsx("div",{className:"md:col-span-3",children:e.jsx(g,{placeholder:"$ Approx. value",value:o.value||"",disabled:o.status!=="yes",onChange:v=>r(l.key,{value:v.target.value}),"data-testid":`input-asset-value-${l.key}`})})]},l.key)})})}})]}),e.jsx("div",{className:"pt-2 border-t",children:e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"CHAMP application details"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Current housing situation & priority status"}),e.jsx(m,{control:i.control,name:"forcedToLeaveResidence",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Were you forced to leave (or about to be forced to leave) your last primary residence?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"forced-to-leave"})]})}),e.jsx(m,{control:i.control,name:"priorityReasons",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Priority situation (select all that apply)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mt-1",children:Ma.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`priority-${t.value}`,checked:a.value?.includes(t.value),onCheckedChange:r=>{const l=a.value||[];a.onChange(r?[...l,t.value]:l.filter(o=>o!==t.value))},"data-testid":`checkbox-priority-${t.value}`}),e.jsx(y,{htmlFor:`priority-${t.value}`,className:"text-sm font-normal",children:t.label})]},t.value))})]})}),e.jsx(m,{control:i.control,name:"homelessCertifications",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Homeless certification statements (check any that apply)"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 mt-1",children:Fa.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`homeless-${t.value}`,checked:a.value?.includes(t.value),onCheckedChange:r=>{const l=a.value||[];a.onChange(r?[...l,t.value]:l.filter(o=>o!==t.value))},"data-testid":`checkbox-homeless-${t.value}`}),e.jsx(y,{htmlFor:`homeless-${t.value}`,className:"text-sm font-normal",children:t.label})]},t.value))})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"residenceLeftAddress",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Address of residence you left"}),e.jsx(x,{children:e.jsx(g,{placeholder:"Street, city, state, zip",...a,"data-testid":"input-residence-left-address"})})]})}),e.jsx(m,{control:i.control,name:"dateLeftResidence",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Date you left the residence"}),e.jsx(x,{children:e.jsx(g,{type:"date",...a,"data-testid":"input-date-left-residence"})})]})}),e.jsx(m,{control:i.control,name:"localPreferenceChoice",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Local preference claimed as"}),e.jsxs(M,{onValueChange:a.onChange,value:a.value||"",children:[e.jsx(x,{children:e.jsx(F,{"data-testid":"select-local-preference",children:e.jsx(_,{placeholder:"Select…"})})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"current_town",children:"Resident of the current town/city"}),e.jsx(b,{value:"displaced_town",children:"Displaced from the town/city"})]})]})]})}),e.jsx(m,{control:i.control,name:"currentHousingSituationDetails",render:({field:a})=>e.jsxs(u,{className:"md:col-span-2",children:[e.jsx(h,{className:"text-sm",children:"Additional detail about your current housing situation"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain…",...a,"data-testid":"input-current-housing-situation-details"})})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Secondary / emergency contact"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"secondaryContactName",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Contact name"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-secondary-contact-name"})})]})}),e.jsx(m,{control:i.control,name:"secondaryContactPhone",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Contact phone"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-secondary-contact-phone"})})]})}),e.jsx(m,{control:i.control,name:"secondaryContactAddress",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Contact address"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-secondary-contact-address"})})]})}),e.jsx(m,{control:i.control,name:"secondaryContactEmail",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Contact email"}),e.jsx(x,{children:e.jsx(g,{type:"email",...a,"data-testid":"input-secondary-contact-email"})})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Employment, school & veteran detail"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"employmentLocation",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Employment location (city/town)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"City/town or 'not employed'",...a,"data-testid":"input-employment-location"})})]})}),e.jsx(m,{control:i.control,name:"childrenSchoolLocation",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Child's school location (city/town)"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-children-sch
275ool-location"})})]})}),e.jsx(m,{control:i.control,name:"veteranFamilyMember",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Relationship to veteran (if claiming veteran preference)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. spouse, surviving spouse, dependent",...a,"data-testid":"input-veteran-family-member"})})]})}),e.jsx(m,{control:i.control,name:"veteranDatesOfService",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Veteran dates of service"}),e.jsx(x,{children:e.jsx(g,{placeholder:"e.g. 1990–1994",...a,"data-testid":"input-veteran-dates-of-service"})})]})}),e.jsx(m,{control:i.control,name:"veteranServiceConnectedDisability",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Service-connected disability?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"veteran-service-disability"})]})}),e.jsx(m,{control:i.control,name:"deceasedVeteranServiceDeath",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Deceased veteran whose death was service-connected?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"deceased-veteran-death"})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Accommodation & housing-agency relationship"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"reasonableAccommodationNeeded",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Does anyone in the household need a reasonable accommodation for a disability?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"reasonable-accommodation"})]})}),e.jsx(m,{control:i.control,name:"housingAgencyEmployee",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Are you a board member or employee of a housing agency?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"housing-agency-employee"})]})}),e.jsx(m,{control:i.control,name:"reasonableAccommodationDetails",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Accommodation requested (if yes)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Describe the accommodation…",...a,"data-testid":"input-reasonable-accommodation-details"})})]})}),e.jsx(m,{control:i.control,name:"housingAgencyEmployeeDetails",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Agency & role (if yes)"}),e.jsx(x,{children:e.jsx(g,{...a,"data-testid":"input-housing-agency-employee-details"})})]})})]}),e.jsx(m,{control:i.control,name:"needsSensoryAccessibleUnit",render:({field:a})=>e.jsxs(u,{className:"flex items-center space-x-2 space-y-0",children:[e.jsx(x,{children:e.jsx(A,{checked:!!a.value,onCheckedChange:a.onChange,"data-testid":"checkbox-sensory-accessible-unit"})}),e.jsx(h,{className:"text-sm font-normal",children:"Requires a sensory-accessible unit (for vision/hearing disability)"})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Household expenses (deductions)"}),e.jsx(m,{control:i.control,name:"householdExpenses",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Does the household pay any of these? (check all that apply)"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mt-1",children:_a.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(A,{id:`expense-${t.value}`,checked:a.value?.includes(t.value),onCheckedChange:r=>{const l=a.value||[];a.onChange(r?[...l,t.value]:l.filter(o=>o!==t.value))},"data-testid":`checkbox-expense-${t.value}`}),e.jsx(y,{htmlFor:`expense-${t.value}`,className:"text-sm font-normal",children:t.label})]},t.value))})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Asset transfer & real estate"}),e.jsx(m,{control:i.control,name:"assetTransferLast3Years",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Sold, transferred, or gave away property/assets in the last 3 years?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"asset-transfer"})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsx(m,{control:i.control,name:"assetTransferAmount",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Amount received (if yes)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"$",...a,"data-testid":"input-asset-transfer-amount"})})]})}),e.jsx(m,{control:i.control,name:"assetTransferValue",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Fair-market value (if yes)"}),e.jsx(x,{children:e.jsx(g,{placeholder:"$",...a,"data-testid":"input-asset-transfer-value"})})]})}),e.jsx(m,{control:i.control,name:"assetTransferDate",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Date of transfer (if yes)"}),e.jsx(x,{children:e.jsx(g,{type:"date",...a,"data-testid":"input-asset-transfer-date"})})]})})]}),e.jsx(m,{control:i.control,name:"realEstateDetails",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Real estate owned (address & approximate value)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Describe any real estate owned…",...a,"data-testid":"input-real-estate-details"})})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Previous residences — last 3 addresses"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",disabled:(i.watch("previousResidences")||[]).length>=3,onClick:()=>{const a=i.getValues("previousResidences")||[];a.length>=3||i.setValue("previousResidences",[...a,{address:"",city:"",state:"",zip:"",dateMovedIn:"",dateMovedOut:"",leaseholderFirstName:"",leaseholderL
275astName:"",leaseholderPhone:"",landlordName:"",landlordAddress:"",landlordPhone:"",landlordCourtAction:"na",securityDepositReturned:"na",rent:"",utilitiesIncluded:"",reasonForLeaving:""}],{shouldDirty:!0})},"data-testid":"button-add-previous-residence",children:"+ Add residence"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the most recent address first, followed by up to two earlier addresses. Existing records with more than three entries are retained and remain editable. Some programs may request a longer history."}),e.jsx(m,{control:i.control,name:"previousResidences",render:({field:a})=>e.jsxs("div",{className:"space-y-2",children:[(a.value||[]).length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No previous residences added."}),(a.value||[]).map((t,r)=>{const l=o=>{const v=[...a.value];v[r]={...v[r],...o},a.onChange(v)};return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-2 items-end border rounded-md p-3","data-testid":`row-previous-residence-${r}`,children:[e.jsxs("h5",{className:"md:col-span-12 text-sm font-semibold",children:["Residence ",r+1,r===0?" · Most recent":r>=3?" · Retained legacy entry":""]}),e.jsxs("div",{className:"md:col-span-6",children:[e.jsx(y,{className:"text-xs",children:"Address"}),e.jsx(g,{value:t.address||"",onChange:o=>l({address:o.target.value}),"data-testid":`input-prevres-address-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"City"}),e.jsx(g,{value:t.city||"",onChange:o=>l({city:o.target.value}),"data-testid":`input-prevres-city-${r}`})]}),e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(y,{className:"text-xs",children:"State"}),e.jsx(g,{value:t.state||"",onChange:o=>l({state:o.target.value}),"data-testid":`input-prevres-state-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Zip"}),e.jsx(g,{value:t.zip||"",onChange:o=>l({zip:o.target.value}),"data-testid":`input-prevres-zip-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Moved in"}),e.jsx(g,{type:"date",value:t.dateMovedIn||"",onChange:o=>l({dateMovedIn:o.target.value}),"data-testid":`input-prevres-movedin-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Moved out"}),e.jsx(g,{type:"date",value:t.dateMovedOut||"",onChange:o=>l({dateMovedOut:o.target.value}),"data-testid":`input-prevres-movedout-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{htmlFor:`prevres-rent-${r}`,className:"text-xs",children:"Monthly rent ($)"}),e.jsx(g,{id:`prevres-rent-${r}`,inputMode:"decimal",value:t.rent||"",onChange:o=>l({rent:o.target.value}),"data-testid":`input-prevres-rent-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{htmlFor:`prevres-utilities-${r}`,className:"text-xs",children:"Utilities included?"}),e.jsxs(M,{value:t.utilitiesIncluded||"unanswered",onValueChange:o=>l({utilitiesIncluded:o==="unanswered"?"":o}),children:[e.jsx(F,{id:`prevres-utilities-${r}`,"data-testid":`select-prevres-utilities-${r}`,children:e.jsx(_,{})}
275),e.jsxs(H,{children:[e.jsx(b,{value:"unanswered",children:"Not answered"}),e.jsx(b,{value:"yes",children:"Yes"}),e.jsx(b,{value:"no",children:"No"})]})]})]}),e.jsxs("div",{className:"md:col-span-12",children:[e.jsx(y,{htmlFor:`prevres-reason-${r}`,className:"text-xs",children:"Reason for leaving"}),e.jsx(R,{id:`prevres-reason-${r}`,value:t.reasonForLeaving||"",onChange:o=>l({reasonForLeaving:o.target.value}),"data-testid":`input-prevres-reason-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Leaseholder first"}),e.jsx(g,{value:t.leaseholderFirstName||"",onChange:o=>l({leaseholderFirstName:o.target.value}),"data-testid":`input-prevres-lhfirst-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Leaseholder last"}),e.jsx(g,{value:t.leaseholderLastName||"",onChange:o=>l({leaseholderLastName:o.target.value}),"data-testid":`input-prevres-lhlast-${r}`})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Leaseholder phone"}),e.jsx(g,{value:t.leaseholderPhone||"",onChange:o=>l({leaseholderPhone:o.target.value}),"data-testid":`input-prevres-lhphone-${r}`})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Landlord name"}),e.jsx(g,{value:t.landlordName||"",onChange:o=>l({landlordName:o.target.value}),"data-testid":`input-prevres-llname-${r}`})]}),e.jsxs("div",{className:"md:col-span-4",children:[e.jsx(y,{className:"text-xs",children:"Landlord phone"}),e.jsx(g,{value:t.landlordPhone||"",onChange:o=>l({landlordPhone:o.target.value}),"data-testid":`input-prevres-llphone-${r}`})]}),e.jsxs("div",{className:"md:col-span-8",children:[e.jsx(y,{className:"text-xs",children:"Landlord address"}),e.jsx(g,{value:t.landlordAddress||"",onChange:o=>l({landlordAddress:o.target.value}),"data-testid":`input-prevres-lladdress-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Court action?"}),e.jsx("div",{className:"flex gap-1",children:["yes","no","na"].map(o=>e.jsx("button",{type:"button",onClick:()=>l({landlordCourtAction:o}),className:`px-2 py-1 rounded text-xs border ${t.landlordCourtAction===o?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted"}`,"data-testid":`tri-prevres-court-${r}-${o}`,children:o==="na"?"N/A":o.toUpperCase()},o))})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Security deposit returned?"}),e.jsx("div",{className:"flex gap-1",children:["yes","no","na"].map(o=>e.jsx("button",{type:"button",onClick:()=>l({securityDepositReturned:o}),className:`px-2 py-1 rounded text-xs border ${t.securityDepositReturned===o?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted"}`,"data-testid":`tri-prevres-deposit-${r}-${o}`,children:o==="na"?"N/A":o.toUpperCase()},o))})]}),e.jsx("div",{className:"md:col-span-1 flex justify-end",children:e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const o=[...a.value];o.splice(r,1),a.onChange(o)},"data-testid":`button-remove-previous-residence-${r}`,children:e.jsx(je,{className:"h-4 w-4"})})})]},r)})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Personal references"}),e.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:()=>{const a=i.getValues("personalReferences")||[];i.setValue("personalReferences",[...a,{name:"",relationship:"",phone:"",address:""}],{shouldDirty:!0})},"data-testid":"button-add-personal-reference",children:"+ Add reference"})]}),e.jsx(m,{control:i.control,name:"personalReferences",render:({field:a})=>e.jsxs("div",{className:"space-y-2",children:[(a.value||[]).length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No personal references added."}),(a.value||[]).map((t,r)=>{const l=o=>{const v=[...a.value];v[r]={...v[r],...o},a.onChange(v)};return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-2 items-end border rounded-md p-3","data-testid":`row-personal-reference-${r}`,children:[e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Name"}),e.jsx(g,{value:t.name||"",onChange:o=>l({name:o.target.value}),"data-testid":`input-ref-name-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Relationship"}),e.jsx(g,{value:t.relationship||"",onChange:o=>l({relationship:o.target.value}),"data-testid":`input-ref-rel-${r}`})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx(y,{className:"text-xs",children:"Phone"}),e.jsx(g,{value:t.phone||"",onChange:o=>l({phone:o.target.value}),"data-testid":`input-ref-phone-${r}`})]}),e.jsxs("div",{className:"md:col-span-3",children:[e.jsx(y,{className:"text-xs",children:"Address"}),e.jsx(g,{value:t.address||"",onChange:o=>l({address:o.target.value}),"data-testid":`input-ref-address-${r}`})]}),e.jsx("div",{className:"md:col-span-1 flex justify-end",children:e.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:()=>{const o=[...a.value];o.splice(r,1),a.onChange(o)},"data-testid":`button-remove-personal-reference-${r}`,children:e.jsx(je,{className:"h-4 w-4"})})})]},r)})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Criminal record follow-ups"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"pendingCriminalMatters",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Any pending criminal matters?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"pending-criminal"})]})}),e.jsx(m,{control:i.control,name:"drugViolentCrimeConviction",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Ever convicted of a drug-related or violent crime?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"drug-violent-crime"})]})}),e.jsx(m,{control:i.control,name:"pendingCriminalMattersExplain",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Explanation (if yes)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain…",...a,"data-testid":"input-pending-criminal-explain"})})]})}),e.jsx(m,{control:i.control,name:"drugViolentCrimeExplain",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Explanation (if yes)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain…",...a,"data-testid":"input-drug-violent-crime-ex
275plain"})})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-sm font-semibold",children:"Rental history — housing programs"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(m,{control:i.control,name:"owesMoneyHousingProgram",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Do you owe money to any housing program?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"owes-money"})]})}),e.jsx(m,{control:i.control,name:"evictionHousingProgram",render:({field:a})=>e.jsxs(u,{className:"border rounded-md p-3 bg-card",children:[e.jsx(h,{className:"text-sm",children:"Ever evicted from a housing program?"}),e.jsx(G,{value:a.value,onChange:a.onChange,testid:"eviction-program"})]})}),e.jsx(m,{control:i.control,name:"owesMoneyExplain",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Explanation (if yes)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain…",...a,"data-testid":"input-owes-money-explain"})})]})}),e.jsx(m,{control:i.control,name:"evictionExplain",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{className:"text-sm",children:"Explanation (if yes)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Explain…",...a,"data-testid":"input-eviction-explain"})})]})}),e.jsx(m,{control:i.control,name:"priorSubsidyDetails",render:({field:a})=>e.jsxs(u,{className:"md:col-span-2",children:[e.jsx(h,{className:"text-sm",children:"Prior subsidy detail (head-of-household name at the time, agency, still living there, move-out date, lease compliance)"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Provide details…",...a,"data-testid":"input-prior-subsidy-details"})})]})})]})]})]})]})]}),e.jsxs(ne,{value:"plan","data-section":"plan",className:"border rounded-md",children:[e.jsx(re,{className:"px-4 hover:no-underline",children:ae("plan",e.jsx(ca,{className:"h-4 w-4"}))}),e.jsxs(oe,{className:"px-4 pb-4 cv-auto",children:[de("plan"),e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{control:i.control,name:"topPriorities",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Top Priorities"}),e.jsx(x,{children:e.jsx(R,{placeholder:"What are the immediate priorities for this client?",...a,"data-testid":"input-top-priorities"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"planOfAction",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Plan of Action"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Outline the steps to help this client achieve housing",...a,"data-testid":"input-plan-of-action"})}),e.jsx(f,{})]})}),e.jsx(m,{control:i.control,name:"recommendations",render:({field:a})=>e.jsxs(u,{children:[e.jsx(h,{children:"Recommendations"}),e.jsx(x,{children:e.jsx(R,{placeholder:"Any additional recommendations or notes for the case",...a,"data-testid":"input-recommendations"})}),e.jsx(f,{})]})})]})]})]})]}),e.jsx("div",{className:"flex justify-end pt-4 border-t",children:e.jsxs(S,{type:"submit",disabled:Se||fe.status==="saving","data-testid":"button-save-assessment-bottom",children:[Se?e.jsx(we,{className:"h-4 w-4 animate-spin"}):e.jsx(Ia,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2",children:n||ba?"Update Assessment":"Save Assessment"})]})})]})})}export{ps as InitialAssessmentForm};

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.