Files

1 line
8.2 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,143,e=>{"use strict";async function t(e,s={}){let a=localStorage.getItem("amos_token"),l=await fetch(`/api/v1${e}`,{...s,headers:{"Content-Type":"application/json",...a?{Authorization:`Bearer ${a}`}:{},...s.headers}});if(!l.ok)throw Error((await l.json().catch(()=>({}))).error||`HTTP ${l.status}`);return l.json()}e.s(["api",0,{auth:{login:(e,s)=>t("/auth/login",{method:"POST",body:JSON.stringify({email:e,password:s})}),me:()=>t("/auth/me")},crm:{customers:()=>t("/crm/customers")},sales:{deals:()=>t("/sales/deals")},finance:{balance:()=>t("/finance/balance"),accounts:()=>t("/finance/accounts")},hr:{employees:()=>t("/hr/employees")},legal:{contracts:()=>t("/legal/contracts")}}])},93370,e=>{"use strict";var t=e.i(1624),s=e.i(30573);e.s(["Skeleton",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,s.cn)("animate-pulse rounded-md bg-muted",e),...a})}])},54883,e=>{"use strict";var t=e.i(1624),s=e.i(62714),a=e.i(34772),l=e.i(143),r=e.i(43673),c=e.i(80063),i=e.i(93370),d=e.i(71672),x=e.i(64828);let n=(0,x.default)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),o=(0,x.default)("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]),m=(0,x.default)("briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);var h=e.i(91054);e.s(["default",0,function(){let[e,x]=(0,s.useState)([]),[p,b]=(0,s.useState)(!0),[j,u]=(0,s.useState)("");(0,s.useEffect)(()=>{l.api.hr.employees().then(e=>{x(e.employees),b(!1)}).catch(e=>{u(e.message),b(!1)})},[]);let g=e.filter(e=>"active"===e.status).length,N=e.filter(e=>"on-leave"===e.status).length,y={active:"bg-emerald-50 text-emerald-700 border-emerald-200","on-leave":"bg-amber-50 text-amber-700 border-amber-200",inactive:"bg-slate-50 text-slate-600 border-slate-200"},f={Executive:"bg-blue-50 text-blue-700",Finance:"bg-emerald-50 text-emerald-700",Engineering:"bg-violet-50 text-violet-700",Sales:"bg-amber-50 text-amber-700",HR:"bg-pink-50 text-pink-700",Legal:"bg-slate-50 text-slate-700",Marketing:"bg-cyan-50 text-cyan-700"};return(0,t.jsx)(a.DashboardShell,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-xl font-bold text-[#111827]",children:"HR"}),(0,t.jsx)("p",{className:"text-sm text-[#6B7280] mt-0.5",children:"Employee management and directory"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[(0,t.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-xl bg-blue-50 flex items-center justify-center",children:(0,t.jsx)(d.Users,{className:"w-5 h-5 text-blue-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Total Employees"}),(0,t.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:e.length})]})]})}),(0,t.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-xl bg-emerald-50 flex items-center justify-center",children:(0,t.jsx)(n,{className:"w-5 h-5 text-emerald-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Active"}),(0,t.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:g})]})]})}),(0,t.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-xl bg-amber-50 flex items-center justify-center",children:(0,t.jsx)(o,{className:"w-5 h-5 text-amber-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"On Leave"}),(0,t.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:N})]})]})}),(0,t.jsx)(r.Card,{className:"p-5 bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)]",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-xl bg-violet-50 flex items-center justify-center",children:(0,t.jsx)(m,{className:"w-5 h-5 text-violet-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs text-[#6B7280] uppercase tracking-wider",children:"Departments"}),(0,t.jsx)("p",{className:"text-xl font-bold text-[#111827]",children:new Set(e.map(e=>e.department)).size})]})]})})]}),(0,t.jsxs)(r.Card,{className:"bg-white rounded-2xl border border-[#E5E7EB] shadow-[0_2px_8px_rgba(0,0,0,0.04)] overflow-hidden",children:[(0,t.jsx)("div",{className:"p-5 border-b border-[#E5E7EB]",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-[#111827]",children:"Employee Directory"})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-[#E5E7EB]",children:[(0,t.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Employee"}),(0,t.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Role"}),(0,t.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Department"}),(0,t.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Status"}),(0,t.jsx)("th",{className:"text-left text-xs font-semibold text-[#6B7280] uppercase tracking-wider px-5 py-3",children:"Start Date"})]})}),(0,t.jsx)("tbody",{children:p?Array.from({length:5}).map((e,s)=>(0,t.jsxs)("tr",{className:"border-b border-[#E5E7EB]/50",children:[(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(i.Skeleton,{className:"h-4 w-32"})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(i.Skeleton,{className:"h-4 w-24"})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(i.Skeleton,{className:"h-5 w-20"})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(i.Skeleton,{className:"h-5 w-16"})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(i.Skeleton,{className:"h-4 w-20"})})]},s)):j?(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:5,className:"px-5 py-8 text-center text-sm text-[#DC2626]",children:j})}):e.map((e,s)=>(0,t.jsxs)(h.motion.tr,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2,delay:.03*s},className:"border-b border-[#E5E7EB]/50 hover:bg-[#F7F9FC] transition-colors",children:[(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-9 h-9 rounded-xl bg-[#1E3A5F] flex items-center justify-center text-white text-xs font-bold",children:e.name.split(" ").map(e=>e[0]).join("")}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-sm font-medium text-[#111827]",children:e.name}),(0,t.jsx)("p",{className:"text-[11px] text-[#9CA3AF]",children:e.email})]})]})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)("span",{className:"text-sm text-[#6B7280]",children:e.role})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(c.Badge,{className:`${f[e.department]||"bg-slate-50 text-slate-600"} text-[10px] font-semibold rounded-full border-0`,children:e.department})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)(c.Badge,{variant:"outline",className:`${y[e.status]} text-[10px] font-semibold uppercase rounded-full`,children:e.status})}),(0,t.jsx)("td",{className:"px-5 py-4",children:(0,t.jsx)("span",{className:"text-xs text-[#6B7280]",children:e.startDate})})]},e.id))})]})})]})]})})}],54883)}]);