1import{j as e}from"./vendor-data-Z5doMMu-.js";import{r,L as d}from"./vendor-react-zNM0AU50.js";import{u as I,a as H,c as i}from"./index-D1K3lVhu.js";import{s as C}from"./staffReportService-CDFbV8rg.js";import{s as X,S as q,a as W}from"./staff-calendar-Dk9XScWa.js";import{s as J}from"./staffApprovalService-DRZchZHW.js";import{p as Q,c as j,A as V,P as D,q as u,i as Z,a as b,ai as ee,U as se,aF as R,K as te,B as ae}from"./vendor-ui-CW5bJ11U.js";import{R as k,B as re,X as le,Y as ne,T as _,a as A,P as ie,f as ce,g as oe}from"./vendor-charts-08G1rM8P.js";import"./vendor-firebase-Da9KY1q_.js";const L={ì¬ë°©:"#3b82f6",ì ë:"#22c55e",ê´ë¦¬:"#f97316",목í:"#a855f7",êµì¡:"#14b8a6",기í:"#9ca3af"};function be(){const{user:x,isRole:E}=I(),P=E("ë´ì목ì¬","ìµê³ ê´ë¦¬ì"),[f,B]=r.useState([]),[g,O]=r.useState(0),[p,K]=r.useState(0),[l,T]=r.useState([]),[y,M]=r.useState([]),[c,N]=r.useState(!0);r.useEffect(()=>{U()},[]);async function U(){try{N(!0);const[s,t]=await Promise.all([X.getTodaySchedules(),C.getUnconfirmedCount()]);B(s),O(t),x&&J.getPendingCount(x.uid).then(K).catch(()=>{}),H.getAll().then(n=>M(n.slice(0,3))).catch(()=>{});const a=new Date,o=a.getDay(),F=o===0?-6:1-o,h=new Date(a);h.setDate(a.getDate()+F);const w=new Date(h);w.setDate(h.getDate()+5);const S=n=>`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`,G=await C.getReportsByDateRange(S(h),S(w));T(G.filter(n=>n.status!=="draft"))}catch(s){console.error("ëìë³´ë ë°ì´í° ë¡ë ì¤í¨:",s)}finally{N(!1)}}const Y=r.useMemo(()=>{const s=l.length,t=l.filter(o=>o.status==="submitted").length,a=l.filter(o=>o.status==="confirmed").length;return{total:s,submitted:t,confirmed:a}},[l]),v=r.useMemo(()=>{const s={};for(const t of l)s[t.author_id]||(s[t.author_id]={name:t.author_name,submitted:0,confirmed:0}),t.status==="confirmed"?s[t.author_id].confirmed++:s[t.author_id].submitted++;return Object.values(s)},[l]),m=r.useMemo(()=>{const s={};for(const t of l)for(const a of t.categories)s[a]=(s[a]||0)+1;return Object.entries(s).map(([t,a])=>({name:t,value:a}))},[l]),$=[{icon:u,title:"ì
ë¬´ë³´ê³ ",description:"ì¼ì¼ ì
ë¬´ë³´ê³ ìì± ë° ì£¼ê° íí©",to:"/staff/reports"},{icon:j,title:"ìºë¦°ë",description:"êµìì ì¼ì ê´ë¦¬ ë° ê³µì ",to:"/staff/calendar"},{icon:R,title:"ìíµ",description:"ê³µì§ì¬í, ê²ìí, ì림",to:"/staff/announcements"},{icon:D,title:"ê²°ì¬",description:"ê²°ì¬ ìì² ë° ì¹ì¸ ì²ë¦¬",to:"/staff/approvals"}],z=new Date().toLocaleDateString("ko-KR",{year:"numeric",month:"long",day:"numeric",weekday:"long"});return e.jsxs("div",{className:"p-3 sm:p-6 max-w-6xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("div",{className:"w-9 h-9 sm:w-10 sm:h-10 bg-blue-50 rounded-xl flex items-center justify-center",children:e.jsx(Q,{className:"w-4 h-4 sm:w-5 sm:h-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg sm:text-2xl font-bold text-gray-900",children:"êµììì¤"}),e.jsxs("p",{className:"text-xs sm:text-sm text-gray-500",children:[(x==null?void 0:x.name)||"êµìì","ë, íìí©ëë¤"]})]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2 ml-12 sm:ml-[52px]",children:z})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(j,{className:"w-4 h-4 text-emerald-500"}),e.jsx("span",{className:"text-xs text-gray-500",children:"ì¤ë ì¼ì "})]}),e.jsxs("p",{className:"text-2xl font-bold text-emerald-600",children:[c?"-":f.length,e.jsx("span",{className:"text-sm font-normal text-gray-400 ml-1",children:"ê±´"})]})]}),e.jsxs(d,{to:"/staff/reports",className:"bg-white rounded-xl border border-gray-200 p-4 hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(V,{className:i("w-4 h-4",g>0?"text-orange-500":"text-green-500")}),e.jsx("span",{className:"text-xs text-gray-500",children:"미íì¸ ë³´ê³ "})]}),e.jsxs("p",{className:i("text-2xl font-bold",g>0?"text-orange-500":"text-green-600"),children:[c?"-":g,e.jsx("span",{className:"text-sm font-normal text-gray-400 ml-1",children:"ê±´"})]})]}),e.jsxs(d,{to:"/staff/approvals",className:"bg-white rounded-xl border border-gray-200 p-4 hover:shadow-sm transition-shadow",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(D,{className:i("w-4 h-4",p>0?"text-amber-500":"text-green-500")}),e.jsx("span",{className:"text-xs text-gray-500",children:"ë기 ê²°ì¬"})]}),e.jsxs("p",{className:i("text-2xl font-bold",p>0?"text-amber-500":"text-green-600"),children:[c?"-":p,e.jsx("span",{className:"text-sm font-normal text-gray-400 ml-1",children:"ê±´"})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(u,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-xs text-gray-500",children:"ì´ë² 주 ë³´ê³ "})]}),e.jsxs("p",{className:"text-2xl font-bold text-blue-600",children:[c?"-":Y.total,e.jsx("span",{className:"text-sm font-normal text-gray-400 ml-1",children:"ê±´"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-4 h-4 text-emerald-500"}),e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:"ì¤ëì ì¼ì "})]}),e.jsxs(d,{to:"/staff/calendar",className:"text-xs text-blue-600 hover:text-blue-700 flex items-center gap-0.5",children:["ì ì²´ 보기 ",e.jsx(b,{className:"w-3 h-3"})]})]}),c?e.jsx("div",{className:"p-8 text-center",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-emerald-600 mx-auto"})}):f.length===0?e.jsxs("div",{className:"p-8 text-center text-gray-400",children:[e.jsx(j,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"ì¤ë ìì ë ì¼ì ì´ ììµëë¤"})]}):e.jsx("div",{className:"divide-y divide-gray-50",children:f.slice(0,5).map(s=>{const t=q[s.category];return e.jsxs("div",{className:"px-5 py-3 flex items-start gap-3",children:[e.jsx("div",{className:i("w-2 h-2 rounded-full mt-1.5 flex-shrink-0",t.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900 truncate",children:s.title}),e.jsx("span",{className:i("px-1.5 py-0.5 text-[10px] font-medium rounded-full",t.bg,t.text),children:W[s.category]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-0.5 text-xs text-gray-500",children:[s.all_day?e.jsx("span",{children:"ì¢
ì¼"}):e.jsxs("span",{children:[s.start_time,s.end_time?` ~ ${s.end_time}`:""]}),s.location&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(ee,{className:"w-3 h-3"}),s.location]})]}),s.staff_names.length>0&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-[10px] text-gray-400",children:[e.jsx(se,{className:"w-3 h-3"}
1),s.staff_names.join(", ")]})]})]},s.id)})})]}),e.jsx("div",{className:"space-y-3",children:$.map(s=>e.jsxs(d,{to:s.to,className:"group flex items-center gap-3 bg-white rounded-xl border border-gray-200 p-4 hover:shadow-sm transition-all duration-200",children:[e.jsx("div",{className:"w-10 h-10 bg-blue-50 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(s.icon,{className:"w-5 h-5 text-blue-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:s.title}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:s.description})]}),e.jsx(b,{className:"w-4 h-4 text-gray-300 group-hover:text-gray-500 transition-colors"})]},s.to))})]}),P&&!c&&l.length>0&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6",children:[v.length>0&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-blue-500"}),e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:"êµììë³ ì´ë² 주 ë³´ê³ "})]}),e.jsx("div",{className:"p-4",style:{height:200},children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(re,{data:v,layout:"vertical",margin:{left:0,right:10},children:[e.jsx(le,{type:"number",tickLine:!1,axisLine:!1,fontSize:11}),e.jsx(ne,{type:"category",dataKey:"name",width:60,fontSize:11,tickLine:!1,axisLine:!1}),e.jsx(_,{contentStyle:{fontSize:12,borderRadius:8,border:"1px solid #e5e7eb"},formatter:(s,t)=>[s,t==="confirmed"?"íì¸":"ì ì¶"]}),e.jsx(A,{dataKey:"confirmed",stackId:"a",fill:"#22c55e",radius:[0,0,0,0],name:"confirmed"}),e.jsx(A,{dataKey:"submitted",stackId:"a",fill:"#3b82f6",radius:[0,4,4,0],name:"submitted"})]})})})]}),m.length>0&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center gap-2",children:[e.jsx(u,{className:"w-4 h-4 text-blue-500"}),e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:"ì
무 ì¹´í
ê³ ë¦¬ ë¹ì¨"})]}),e.jsxs("div",{className:"p-4 flex items-center",children:[e.jsx("div",{style:{width:140,height:140},children:e.jsx(k,{width:"100%",height:"100%",children:e.jsxs(ie,{children:[e.jsx(ce,{data:m,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:60,innerRadius:30,paddingAngle:2,children:m.map(s=>e.jsx(oe,{fill:L[s.name]||"#9ca3af"},s.name))}),e.jsx(_,{contentStyle:{fontSize:12,borderRadius:8,border:"1px solid #e5e7eb"},formatter:s=>[`${s}ê±´`]})]})})}),e.jsx("div",{className:"flex-1 ml-4 space-y-1.5",children:m.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:L[s.name]||"#9ca3af"}}),e.jsx("span",{className:"text-xs text-gray-600 flex-1",children:s.name}),e.jsxs("span",{className:"text-xs font-medium text-gray-800",children:[s.value,"ê±´"]})]},s.name))})]})]})]}),y.length>0&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4 text-blue-500"}),e.jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:"ìµê·¼ ê³µì§"})]}),e.jsxs(d,{to:"/staff/announcements",className:"text-xs text-blue-600 hover:text-blue-700 flex items-center gap-0.5",children:["ì ì²´ 보기 ",e.jsx(b,{className:"w-3 h-3"})]})]}),e.jsx("div",{className:"divide-y divide-gray-50",children:y.map(s=>e.jsxs(d,{to:"/staff/announcements",className:"px-5 py-3 flex items-center gap-3 hover:bg-gray-50 transition-colors",children:[e.jsx(R,{className:"w-4 h-4 text-blue-400 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-gray-900 truncate block",children:s.title}),e.jsxs("span",{className:"text-xs text-gray-400",children:[s.author_name," · ",new Date(s.created_at).toLocaleDateString("ko-KR")]})]}),s.priority!=="normal"&&e.jsx("span",{className:i("px-1.5 py-0.5 text-[10px] font-medium rounded-full",s.priority==="urgent"?"bg-red-50 text-red-600":"bg-blue-50 text-blue-600"),children:s.priority==="urgent"?"긴ê¸":"ì¤ì"})]},s.id))})]})]})}export{be as StaffDashboard};
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.