1import{u as _,r as i,j as e,o as S,B as C,w as D,y as H,z as F,G as I,t as w}from"./index-B4vai22a.js";import{M as P}from"./mobile-layout-Bmuto0w4.js";import{I as v}from"./input-DlMHU0Ev.js";import{S as m,a as g,b as h,c as x,d as u}from"./select-KZikfNXQ.js";import{L as B}from"./loader-circle-WTzHWAfW.js";import"./textarea-Cdf1odz6.js";import"./mic-Co-_qjzF.js";import"./trash-2-BxMqLowg.js";import"./side-drawer-Cnn8imIa.js";import"./switch-soK7zSUu.js";import"./house-CJTCX2z6.js";import"./building-2-DyEjKMLZ.js";import"./calendar-COfpOaVI.js";import"./clock-C5j9QDZ1.js";import"./users-C8c5UPG9.js";import"./message-circle-BtRnzpAZ.js";import"./bell-BUt8jL1O.js";import"./settings-BstpG9vK.js";import"./share-2-DMvIPU6p.js";import"./log-out-C7ADdkot.js";import"./chevron-left-a_939oTF.js";import"./index-DTzj6d5i.js";import"./index-mTg41uKE.js";import"./chevron-down-L-2xvOZ0.js";const f=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],p=["06:00","06:30","07:00","07:30","08:00","08:30","09:00","09:30","10:00","10:30","11:00","11:30","12:00","12:30","13:00","13:30","14:00","14:30","15:00","15:30","16:00","16:30","17:00","17:30","18:00","18:30","19:00","19:30","20:00","20:30","21:00","21:30","22:00"];function b(o){if(!o)return"--:--";const[c,d]=o.split(":"),n=parseInt(c),l=n>=12?"PM":"AM";return`${n>12?n-12:n===0?12:n}:${d} ${l}`}function de(){const[,o]=_(),[c,d]=i.useState(!1),[n,l]=i.useState(!1),[j,E]=i.useState(""),[y,k]=i.useState(""),[M,T]=i.useState(""),[a,L]=i.useState(()=>{const s={};return f.forEach(t=>{s[t]={morningEnabled:!1,morningStart:"",morningEnd:"",eveningEnabled:!1,eveningStart:"",eveningEnd:""}}),s}),r=(s,t,$)=>{L(N=>({...N,[s]:{...N[s],[t]:$}}))},V=async()=>{if(!j){w({title:"Required Field",description:"Please enter clinic name",variant:"destructive"});return}d(!0);try{await new Promise(s=>setTimeout(s,1500)),l(!0)}catch{w({title:"Error",description:"Failed to save time slots. Please try again.",variant:"destructive"})}finally{d(!1)}};return e.jsx(P,{title:"Clinic Time Slot",showBack:!0,children:e.jsxs("div",{className:"bg-gray-50 min-h-screen pb-24",children:[e.jsxs("div",{className:"p-4",children:[e.jsx("h2",{className:"text-lg font-bold text-[#004aad] mb-4",children:"Add Time Slot"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(v,{value:j,onChange:s=>E(s.target.value),placeholder:"Clinic Name",className:"h-12 border-gray-300 rounded-xl bg-white","data-testid":"input-clinic-name"}),e.jsx(v,{value:y,onChange:s=>k(s.target.value),placeholder:"Morning Maximum Visitor",type:"number",className:"h-12 border-gray-300 rounded-xl bg-white","data-testid":"input-morning-max"}),e.jsx(v,{value:M,onChange:s=>T(s.target.value),placeholder:"Evening Maximum Visitor",type:"number",className:"h-12 border-gray-300 rounded-xl bg-white","data-testid":"input-evening-max"})]})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-lg font-bold text-[#004aad] mb-3",children:"Morning Time Slot"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr_1fr] gap-2 mb-2 text-sm text-gray-500 font-medium",children:[e.jsx("span",{children:"Days"}),e.jsx("span",{className:"text-center",children:"Starting Hours"}),e.jsx("span",{className:"text-center",children:"Closing Hours"})]}),f.map(s=>e.jsxs("div",{className:"grid grid-cols-[100px_1fr_1fr] gap-2 items-center py-3 border-b border-gray-100",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(S,{checked:a[s].morningEnabled,onCheckedChange:t=>r(s,"morningEnabled",!!t),className:"w-5 h-5 border-2 border-[#004aad] data-[state=checked]:bg-[#003a8c] data-[state=checked]:border-[#003a8c]","data-testid":`checkbox-morning-${s.toLowerCase()}`}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:s})]}),e.jsxs(m,{value:a[s].morningStart,onValueChange:t=>r(s,"morningStart",t),disabled:!a[s].morningEnabled,children:[e.jsx(g,{className:"h-10 border-gray-200 rounded-lg bg-white disabled:opacity-50","data-testid":`select-morning-start-${s.toLowerCase()}`,children:e.jsx(h,{placeholder:"--:--"})}),e.jsx(x,{children:p.slice(0,12).map(t=>e.jsx(u,{value:t,children:b(t)},t))})]}),e.jsxs(m,{value:a[s].morningEnd,onValueChange:t=>r(s,"morningEnd",t),disabled:!a[s].morningEnabled,children:[e.jsx(g,{className:"h-10 border-gray-200 rounded-lg bg-white disabled:opacity-50","data-testid":`select-morning-end-${s.toLowerCase()}`,children:e.jsx(h,{placeholder:"--:--"})}),e.jsx(x,{children:p.slice(0,14).map(t=>e.jsx(u,{value:t,children:b(t)},t))})]})]},`morning-${s}`))]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-lg font-bold text-[#004aad] mb-3",children:"Evening Time Slot"}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr_1fr] gap-2 mb-2 text-sm text-gray-500 font-medium",children:[e.jsx("span",{children:"Days"}),e.jsx("span",{className:"text-center",children:"Starting Hours"}),e.jsx("span",{className:"text-center",children:"Closing Hours"})]}),f.map(s=>e.jsxs("div",{className:"grid grid-cols-[100px_1fr_1fr] gap-2 items-center py-3 border-b border-gray-100",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(S,{checked:a[s].eveningEnabled,onCheckedChange:t=>
1r(s,"eveningEnabled",!!t),className:"w-5 h-5 border-2 border-[#004aad] data-[state=checked]:bg-[#003a8c] data-[state=checked]:border-[#003a8c]","data-testid":`checkbox-evening-${s.toLowerCase()}`}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:s})]}),e.jsxs(m,{value:a[s].eveningStart,onValueChange:t=>r(s,"eveningStart",t),disabled:!a[s].eveningEnabled,children:[e.jsx(g,{className:"h-10 border-gray-200 rounded-lg bg-white disabled:opacity-50","data-testid":`select-evening-start-${s.toLowerCase()}`,children:e.jsx(h,{placeholder:"--:--"})}),e.jsx(x,{children:p.slice(12).map(t=>e.jsx(u,{value:t,children:b(t)},t))})]}),e.jsxs(m,{value:a[s].eveningEnd,onValueChange:t=>r(s,"eveningEnd",t),disabled:!a[s].eveningEnabled,children:[e.jsx(g,{className:"h-10 border-gray-200 rounded-lg bg-white disabled:opacity-50","data-testid":`select-evening-end-${s.toLowerCase()}`,children:e.jsx(h,{placeholder:"--:--"})}),e.jsx(x,{children:p.slice(14).map(t=>e.jsx(u,{value:t,children:b(t)},t))})]})]},`evening-${s}`))]}),e.jsx("div",{className:"h-24"}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 p-4 bg-white/95 backdrop-blur-sm border-t shadow-2xl z-50 safe-area-bottom",children:e.jsx(C,{className:"w-full h-12 bg-[#7cbf43] hover:bg-[#6da83a] text-white font-semibold rounded-full text-lg shadow-lg glow-button",onClick:V,disabled:c,"data-testid":"button-submit-clinic",children:c?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"w-5 h-5 mr-2 animate-spin"}),"Saving..."]}):"Submit"})}),e.jsx(D,{open:n,onOpenChange:l,children:e.jsxs(H,{className:"max-w-xs text-center rounded-2xl",children:[e.jsx(F,{children:e.jsx(I,{className:"text-xl font-bold text-gray-900",children:"FastPrescribe Doctor"})}),e.jsx("p",{className:"text-gray-600 py-2",children:"Clinic Time Slot created successfully"}),e.jsx(C,{className:"mt-2 bg-[#004aad] hover:bg-[#003a8c] rounded-full",onClick:()=>{l(!1),o("/timeslots")},children:"Ok"})]})})]})})}export{de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.