PageSourceSearch

https://medarion.ai/assets/ArionPerformancePage-B0bSDaSS.js

js medarion.ai collected 2026-10-05 12:16:02 UTC 6,115 bytes, 1 lines download raw bytes

1import{F as T,r as i,c as C,j as a,dC as $,S as p,de as h,ei as H,dF as f,e2 as q,dJ as w,L as B,ap as y,dK as G,dL as V,dG as J,d6 as K,dM as O,U as Q,dI as g,cZ as U}from"./index-Dp6uzjnE.js";import{A as W,a as Z}from"./arionCharts-D6TxoLcV.js";import{u as z}from"./useArionWorkforce-D6Tu5PR3.js";const X=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],Y=T("clipboard-check",X),S={employee_id:"",review_period:"",rating:"",comments:""};function se(){const{orgId:n,stats:R,isManager:o}=z(),[s,A]=i.useState([]),[M,P]=i.useState([]),[b,j]=i.useState(!0),[N,k]=i.useState(!1),[L,v]=i.useState(!1),[r,c]=i.useState(S);i.useEffect(()=>{document.title="Arion — Performance — Medarion"},[]);const m=i.useCallback(async()=>{if(n){j(!0);try{const[e,t]=await Promise.all([C(`/api/v1/workforce/performance?org_profile_id=${n}`),C(`/api/v1/workforce/employees?org_profile_id=${n}`).catch(()=>({results:[]}))]);A(e.results||[]),P(t.results||[])}finally{j(!1)}}},[n]);i.useEffect(()=>{m()},[m]);function d(){c(S),v(!1)}async function E(e){if(e.preventDefault(),!(!n||!r.employee_id)){k(!0);try{await Q("/api/v1/workforce/performance",{org_profile_id:Number(n),employee_id:Number(r.employee_id),review_period:r.review_period||void 0,rating:r.rating?Number(r.rating):void 0,comments:r.comments||void 0}),d(),await m(),g("Review created")}catch{g("Could not create review","error")}finally{k(!1)}}}async function F(e){try{await U(`/api/v1/workforce/performance/${e}`,{status:"submitted"}),await m(),g("Review submitted")}catch{g("Could not submit review","error")}}const D=i.useMemo(()=>{const e={draft:"Draft",submitted:"Submitted",acknowledged:"Acknowledged"},t=new Map;for(const l of s){const u=e[l.status]||l.status;t.set(u,(t.get(u)||0)+1)}return Array.from(t.entries()).map(([l,u])=>({name:l,value:u}))},[s]),I=i.useMemo(()=>{const e=[{name:"1★",value:0},{name:"2★",value:0},{name:"3★",value:0},{name:"4★",value:0},{name:"5★",value:0}];for(const t of s){if(t.rating==null)continue;const l=Math.min(4,Math.max(0,Math.round(Number(t.rating))-1));e[l].value+=1}return e},[s]),x=s.filter(e=>e.rating!=null),_=x.length?Math.round(x.reduce((e,t)=>e+Number(t.rating),0)/x.length*10)/10:0;return a.jsxs($,{title:"Performance Reviews",lead:"Review cycles, ratings, and employee development.",badge:"HR",icon:h,loading:b&&!s.length,stats:[{icon:Y,label:"Reviews",value:s.length,color:p.indigo},{icon:h,label:"Due",value:R?.reviewsDue??0,color:p.amber},{icon:H,label:"Avg rating",value:_?`${_}★`:"—",color:p.emerald}],actions:o?a.jsxs("button",{type:"button",onClick:()=>{d(),v(!0)},className:"medarion-btn-primary text-xs inline-flex items-center gap-1.5",children:[a.jsx(y,{className:"w-3.5 h-3.5"})," New review"]}):void 0,children:[s.length>0&&a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[a.jsx(f,{title:"Rating distribution",lead:"How the team is performing",children:a.jsx(W,{data:I,singleColor:p.emerald,emptyMessage:"No ratings yet"})}),a.jsx(f,{title:"Review status",lead:"Cycle progress across the team",children:a.jsx(Z,{data:D,centerValue:s.length,centerLabel:"Reviews",emptyMessage:"No reviews"})})]}),o&&L&&a.jsx(f,{title:"New performance review",lead:"Start a review cycle for a team member.",actions:a.jsx("button",{type:"button",onClick:d,className:"text-xs text-ink-500 hover:text-ink-950",children:"Cancel"}),children:a.jsxs("form",{onSubmit:E,className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[a.jsxs("select",{required:!0,className:q,value:r.employee_id,onChange:e=>c(t=>({...t,employee_id:e.target.value})),children:[a.jsx("option",{value:"",children:"Select employee…"}),M.map(e=>a.jsx("option",{value:e.id,children:e.full_name},e.id))]}),a.jsx("input",{className:w,placeholder:"Review period (e.g. Q3 2026)",value:r.review_period,onChange:e=>c(t=>({...t,review_period:e.target.value}))}),a.jsx("input",{className:w,type:"number",min:"0",max:"5",step:"0.5",placeholder:"Rating (0–5)",value:r.rating,onChange:e=>c(t=>({...t,rating:e.target.value}))}),a.jsx("input",{className:w,placeholder:"Summary comments",value:r.comments,onChange:e=>c(t=>({...t,comments:e.target.value}))}),a.jsxs("button",{type:"submit",disabled:N||!r.employee_id,className:"sm:col-span-2 medarion-btn-primary inline-flex items-center justify-center gap-2 disabled:opacity-50",children:[N?a.jsx(B,{className:"w-4 h-4 animate-spin"}):a.jsx(y,{className:"w-4 h-4"})," Create review"]})]})}),a.jsx(G,{columns:["Employee","Reviewer","Period","Rating","Status",...o?[""]:[]],loading:b&&!s.length,children:s.length?s.map(e=>a.jsxs("tr",{className:"hover:bg-surface-muted/40",children:[a.jsx("td",{className:"px-3 py-2.5 font-medium text-ink-950",children:e.employee_name}),a.jsx("td",{className:"px-3 py-2.5 text-ink-600",children:e.reviewer_name||"—"}),a.jsx("td",{className:"px-3 py-2.5 text-ink-600",children:e.period_label||e.review_period||"—"}),a.jsx("td",{className:"px-3 py-2.5 w-40",children:e.rating!=null?a.jsx(V,{label:"Rating",value:Number(e.rating),max:5,showLabel:!1}):a.jsx("span",{className:"text-ink-400",children:"—"})}),a.jsx("td",{className:"px-3 py-2.5",children:a.jsx(J,{status:e.status})}),o&&a.jsx("td",{className:"px-3 py-2.5",children:a.jsx("div",{className:"flex justify-end",children:e.status==="draft"&&a.jsxs("button",{type:"button",onClick:()=>{F(e.id)},className:"px-2 py-1 rounded-lg text-xs font-medium text-emerald-700 hover:bg-emerald-50 inline-flex items-center gap-1",title:"Submit review",children:[a.jsx(K,{className:"w-3.5 h-3.5"})," Submit"]})})})]},e.id)):a.jsx(O,{icon:h,title:"No performance reviews",description:o?"Start a review cycle for a team member.":"Review cycles and ratings will appear here once created.",action:o?a.jsxs("button",{type:"button",onClick:()=>{d(),v(!0)},className:"medarion-btn-primary text-xs inline-flex items-center gap-1.5",children:[a.jsx(y,{className:"w-3.5 h-3.5"})," New review"]}):void 0})})]})}export{se as ArionPerformancePage};

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.