1import{r as n,j as e}from"./vendor-react-BWvq9y5P.js";import{a as T}from"./store-Cg4LWeet.js";import{L as y}from"./vendor-router-DVldiQe8.js";import{c as o}from"./index-BPE8txG8.js";import{C as $}from"./container-BU2D06Rg.js";import{A as Y}from"./arrow-left-GS72ZbEq.js";import{U as H}from"./users-CVUIxyz5.js";import{c as q}from"./createLucideIcon-DMLoKmu_.js";import{A as k}from"./arrow-right-JdGVCw9C.js";import{C as J}from"./calendar-days-9iqJh0Zm.js";import{C as V}from"./check-DktJuZcP.js";import{C as _}from"./circle-check-BU-iHJyq.js";import{U as X}from"./upload-DiiN_dyb.js";const W=[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]],K=q("accessibility",W),Q=[{Icon:H,title:"Family Insurance",body:"Coverage for family members and dependents"},{Icon:K,title:"Disability / Parental authority",body:"Special coverage for disability or authority members"}],Z=["Men","Female"],ee=["Single","Married","Divorced","Widowed"],te=["DNI / NIE Tutor - Front face*","DNI / NIE Tutor - Back face*","Birth certificate or family record book*"],P=10,S=[".jpg",".jpeg",".png",".pdf"];function se(a){const s=a.replace(/\D/g,"").slice(0,8);return[s.slice(0,2),s.slice(2,4),s.slice(4,8)].filter(Boolean).join("/")}function ae(a){const s=/^(\d{2})\/(\d{2})\/(\d{4})$/.exec(a);return s?`${s[3]}-${s[2]}-${s[1]}`:""}function re(a){const[s,r,c]=a.split("-");return s&&r&&c?`${c}/${r}/${s}`:""}function f({children:a}){return e.jsx("section",{className:"mx-auto w-full max-w-190 rounded-2xl border border-border-soft bg-white p-6 shadow-[0_10px_15px_-3px_rgba(15,23,43,0.06),0_4px_6px_-4px_rgba(15,23,43,0.06)] sm:p-8",children:a})}function E({step:a}){return e.jsxs("div",{className:"mb-6 flex items-center justify-center",children:[e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-primary text-xs font-semibold text-white",children:"1"}),e.jsx("span",{className:o("h-0.5 w-24",a===2?"bg-primary":"bg-[#DBEAFE]")}),e.jsx("span",{className:o("flex size-6 items-center justify-center rounded-full text-xs font-semibold",a===2?"bg-primary text-white":"bg-[#DBEAFE] text-primary"),children:"2"})]})}function w({label:a,selected:s,onClick:r}){return e.jsx("button",{type:"button",onClick:r,"aria-pressed":s,className:o("h-11 rounded-full border text-sm font-medium transition-colors",s?"border-primary bg-[#F3F8FE] text-primary":"border-border bg-white text-text-strong hover:border-primary/40"),children:a})}function v({children:a,disabled:s,onClick:r}){return e.jsx("button",{type:"button",disabled:s,onClick:r,className:o("mt-7 inline-flex h-12 w-full items-center justify-center gap-2 rounded-xl text-sm font-medium transition-colors",s?"pointer-events-none bg-[#CBD9EA] text-white":"bg-primary text-white shadow-[0_4px_6px_-4px_rgba(21,93,252,0.25),0_10px_15px_-3px_rgba(21,93,252,0.25)] hover:bg-primary-hover"),children:a})}function ne({label:a,file:s,onFile:r}){const c=n.useRef(null),[m,x]=n.useState("");function p(i){const l=`.${i.name.split(".").pop()?.toLowerCase()}`;if(!S.includes(l)){x("Only JPG, PNG or PDF files are accepted.");return}if(i.size>P*1024*1024){x(`Maximum file size is ${P}MB.`);return}x(""),r(i)}return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:a}),e.jsx("button",{type:"button",onClick:()=>c.current?.click(),className:o("flex flex-col items-center gap-1.5 rounded-xl border border-dashed px-6 py-6 transition-colors",s?"border-[#00C950]/60 bg-[#F0FDF4]":"border-border bg-white hover:border-primary/50"),children:s?e.jsxs(e.Fragment,{children:[e.jsx(_,{size:20,className:"text-[#00A63E]"}),e.jsx("span",{className:"text-xs font-medium text-[#00A63E]",children:"Document Uploaded"}),e.jsx("span",{className:"max-w-full truncate text-[11px] text-muted",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{size:20,className:"text-primary"}),e.jsx("span",{className:"text-xs font-medium text-primary",children:"Upload document"})]})}),m&&e.jsx("span",{className:"text-xs text-[#E11D48]",children:m}),e.jsx("input",{ref:c,type:"file",accept:S.join(","),className:"hidden",onChange:i=>{const l=i.target.files?.[0];l&&p(l),i.target.value=""}})]})}function ie(){const[a,s]=n.useState("guardianship"),[r,c]=n.useState(""),[m,x]=n.useState(""),[p,i]=n.useState(""),[l,I]=n.useState(""),[g,A]=n.useState(""),[b,z]=n.useState(""),[j,F]=n.useState(""),C=n.useRef(null),[D,M]=n.useState([null,
1null,null]);function B(){const t=C.current;if(t)try{t.showPicker()}catch{t.click()}}const O=m!==""&&p.trim()!==""&&l.trim()!==""&&g!==""&&b.trim()!=="",R=D.every(t=>t!==null);function U(){T({name:p.trim(),guardianship:r,gender:m,idNumber:l.trim(),maritalStatus:g,phone:b.trim(),birthDate:j||void 0}),s("success")}const h="h-11 w-full rounded-full border border-border bg-white px-4 text-sm text-heading outline-none transition-colors placeholder:text-muted/70 focus:border-primary";return e.jsx("div",{className:"min-h-full",style:{background:"linear-gradient(180deg,rgba(239,246,255,0.6) 0%,rgba(255,255,255,0) 40%)"},children:e.jsxs($,{className:"flex flex-col gap-5 py-8",children:[e.jsxs(y,{to:a==="success"?"/home":"/patients",className:"flex w-fit items-center gap-2 text-sm font-medium text-text transition-colors hover:text-primary",children:[e.jsx(Y,{size:15}),a==="success"?"Back to Home":"Switch Patient"]}),a==="guardianship"&&e.jsxs(f,{children:[e.jsx("h1",{className:"text-xl font-bold text-heading",children:"Select the type of guardianship"}),e.jsx("p",{className:"mt-1 text-sm text-muted",children:"Manage your patient information"}),e.jsx("div",{className:"mt-6 grid grid-cols-1 gap-4 sm:grid-cols-2",children:Q.map(({Icon:t,title:d,body:N})=>{const u=r===d;return e.jsxs("button",{type:"button","aria-pressed":u,onClick:()=>c(d),className:o("flex flex-col items-start gap-3 rounded-xl border p-4 text-left transition-colors",u?"border-primary bg-[#F3F8FE]":"border-border-soft bg-white hover:border-primary/40"),children:[e.jsx("span",{className:"flex size-9 items-center justify-center rounded-full bg-[#EFF6FF] text-primary",children:e.jsx(t,{size:17})}),e.jsx("span",{className:o("text-sm font-semibold",u?"text-primary":"text-heading"),children:d}),e.jsx("span",{className:"text-xs leading-relaxed text-muted",children:N})]},d)})}),e.jsxs(v,{disabled:!r,onClick:()=>s("personal"),children:["Next",e.jsx(k,{size:15})]})]}),a==="personal"&&e.jsxs(f,{children:[e.jsx(E,{step:1}),e.jsx("h1",{className:"text-xl font-bold text-heading",children:"Personal Information"}),e.jsx("p",{className:"mt-1 text-sm text-muted",children:"Please provide your basic information"}),e.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"Gender*"}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Z.map(t=>e.jsx(w,{label:t,selected:m===t,onClick:()=>x(t)},t))})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"Full Name*"}),e.jsx("input",{type:"text",value:p,onChange:t=>i(t.target.value),placeholder:"Enter full name",className:h})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"ID Number*"}),e.jsx("input",{type:"text",value:l,onChange:t=>I(t.target.value),placeholder:"Enter ID number",className:h})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"Marital Status*"}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:ee.map(t=>e.jsx(w,{label:t,selected:g===t,onClick:()=>A(t)},t))})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"Phone Number*"}),e.jsx("input",{type:"tel",value:b,onChange:t=>z(t.target.value),placeholder:"Phone number",className:h})]}),e.jsxs("label",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-heading",children:"Birth of date"}),e.jsxs("span",{className:"relative",children:[e.jsx("input",{type:"text",value:j,onChange:t=>F(se(t.target.value)),placeholder:"DD/MM/YYYY",inputMode:"numeric",maxLength:10,className:o(h,"pr-11")}),e.jsx("button",{type:"button","aria-label":"Open date picker",onClick:B,className:"absolute top-1/2 right-4 -translate-y-1/2 text-muted transition-colors hover:text-primary",children:e.jsx(J,{size:16})}),e.jsx("input",{ref:C,type:"date",tabIndex:-1,"aria-hidden":!0,value:ae(j),onChange:t=>F(re(t.target.value)),className:"pointer-events-none absolute right-4 bottom-0 size-0 opacity-0"})]})]})]}),e.jsxs(v,{disabled:!O,onClick:()=>s("uploads"),children:["Next",e.jsx(k,{size:15})]})]}),a==="uploads"&&e.jsxs(f,{children:[e.jsx(E,{step:2}),e.jsx("h1",{className:"text-xl font-bold text-heading",children:"Upload Cards"}),e.jsx("p",{className:"mt-1 text-sm text-muted",children:"Please upload a clear photo or PDF of your insurance card"}),e.jsxs("div",{className:"mt-5 rounded-xl border border-[#DBEAFE] bg-[#F3F8FE] p-4",children:[e.jsx("p",{className:"text-xs font-semibold text-primary",children:"Upload Requirements:"}),e.jsx("ul",{className:"mt-1.5 flex flex-col gap-1",children:["Clear, readable image or PDF","All c
1ard details must be visible","Maximum file size: 10MB","Supported formats: JPG, PNG, PDF"].map(t=>e.jsxs("li",{className:"flex items-center gap-2 text-xs text-text",children:[e.jsx("span",{className:"size-1 shrink-0 rounded-full bg-text"}),t]},t))})]}),e.jsx("div",{className:"mt-5 flex flex-col gap-5",children:te.map((t,d)=>e.jsx(ne,{label:t,file:D[d],onFile:N=>M(u=>u.map((G,L)=>L===d?N:G))},t))}),e.jsxs(v,{disabled:!R,onClick:U,children:["Complete Registration",e.jsx(V,{size:15})]})]}),a==="success"&&e.jsx(f,{children:e.jsxs("div",{className:"flex flex-col items-center py-4 text-center",children:[e.jsx("span",{className:"flex size-16 items-center justify-center rounded-full bg-[#EFF6FF]",children:e.jsx(_,{size:30,className:"text-primary"})}),e.jsx("h1",{className:"mt-5 text-xl font-bold text-heading",children:"Patient Added!"}),e.jsx("p",{className:"mt-2 text-sm text-muted",children:"The new patient has been registered and is now active."}),e.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[e.jsx(y,{to:"/patients",className:"inline-flex h-11 items-center rounded-lg border border-[#D7E6FB] bg-white px-5 text-sm font-medium text-primary transition-colors hover:bg-blue-50",children:"Back to Patients"}),e.jsx(y,{to:"/home",className:"inline-flex h-11 items-center rounded-lg bg-primary px-5 text-sm font-medium text-white transition-colors hover:bg-primary-hover",children:"Go to Home"})]})]})})]})})}const Ne=ie;export{Ne as component};
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.