import{d as C,s as f,c as $,h as i,o as u,g as v,u as _,i as w,w as m,j as s,l as d,b as c,k as l,F as x,p as S,S as N}from"./app-Cb9hmj6k.js";import{a as B}from"./AppLayout.vue_vue_type_script_setup_true_lang-CteAxl0C.js";import{_ as j}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./AppLogoIcon.vue_vue_type_script_setup_true_lang-DKWl2XLX.js";import"./index-hboZUdbT.js";import"./RovingFocusGroup-CP1IPgEn.js";import"./index-bRFR14ax.js";const I={class:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4"},V={class:"w-full text-sm text-left text-gray-700"},F={class:"text-xs text-gray-500 uppercase bg-gray-50 border-b border-gray-200"},L={class:"flex items-center gap-1"},A={key:0},M={class:"flex items-center gap-1"},D={key:0},E={class:"flex items-center gap-1"},H={key:0},K={class:"flex items-center gap-1"},T={key:0},q={class:"flex items-center gap-1"},z={key:0},G={class:"divide-y divide-gray-100"},J={class:"px-4 py-3 font-medium text-gray-800 whitespace-nowrap"},O={class:"px-4 py-3"},P={class:"px-4 py-3"},Q={class:"px-4 py-3"},R={class:"px-4 py-3"},U=C({__name:"Stats",props:["installers"],setup(y){const g=[{title:"Статистика монтажников",href:"/installers/stats"}],h=y,r=f("name"),n=f(!0),b=$(()=>[...h.installers].sort((a,t)=>{let e=a[r.value],o=t[r.value];return e==null&&(e=r.value==="name"?"":-1/0),o==null&&(o=r.value==="name"?"":-1/0),typeof e=="string"&&typeof o=="string"?(e=e.toLowerCase(),o=o.toLowerCase(),e<o?n.value?-1:1:e>o?n.value?1:-1:0):typeof e=="number"&&typeof o=="number"?n.value?e-o:o-e:(e=String(e),o=String(o),e<o?n.value?-1:1:e>o?n.value?1:-1:0)}));function p(a){r.value===a?n.value=!n.value:(r.value=a,n.value=!0)}function k(a){if(a==null||isNaN(a))return"—";const t=Math.floor(a),e=Math.round((a-t)*60);return`${t}ч ${e}м`}return(a,t)=>(u(),i(x,null,[v(_(w),{title:"Статистика монтажников"}),v(B,{breadcrumbs:g},{default:m(()=>[s("div",I,[t[10]||(t[10]=s("h1",{class:"text-2xl font-bold mb-4"},"Статистика по монтажникам",-1)),s("table",V,[s("thead",F,[s("tr",null,[s("th",{onClick:t[0]||(t[0]=e=>p("name")),class:"px-4 py-3 cursor-pointer select-none"},[s("div",L,[t[5]||(t[5]=d(" Имя ")),r.value==="name"?(u(),i("span",A,l(n.value?"▲":"▼"),1)):c("",!0)])]),s("th",{onClick:t[1]||(t[1]=e=>p("ratings_received_avg")),class:"px-4 py-3 cursor-pointer select-none"},[s("div",M,[t[6]||(t[6]=d(" Рейтинг ")),r.value==="ratings_received_avg"?(u(),i("span",D,l(n.value?"▲":"▼"),1)):c("",!0)])]),s("th",{onClick:t[2]||(t[2]=e=>p("completed_count")),class:"px-4 py-3 cursor-pointer select-none"},[s("div",E,[t[7]||(t[7]=d(" Завершено ")),r.value==="completed_count"?(u(),i("span",H,l(n.value?"▲":"▼"),1)):c("",!0)])]),s("th",{onClick:t[3]||(t[3]=e=>p("rejected_count")),class:"px-4 py-3 cursor-pointer select-none"},[s("div",K,[t[8]||(t[8]=d(" Отказов ")),r.value==="rejected_count"?(u(),i("span",T,l(n.value?"▲":"▼"),1)):c("",!0)])]),s("th",{onClick:t[4]||(t[4]=e=>p("avg_hours")),class:"px-4 py-3 cursor-pointer select-none"},[s("div",q,[t[9]||(t[9]=d(" Ср. время ")),r.value==="avg_hours"?(u(),i("span",z,l(n.value?"▲":"▼"),1)):c("",!0)])])])]),s("tbody",G,[(u(!0),i(x,null,S(b.value,e=>{var o;return u(),i("tr",{key:e.id,class:"hover:bg-gray-50 transition-colors"},[s("td",J,[v(_(N),{href:`/installers/${e.id}`,class:"text-blue-600 hover:underline"},{default:m(()=>[d(l(e.name),1)]),_:2},1032,["href"])]),s("td",O,l(((o=e.ratings_received_avg)==null?void 0:o.toFixed(1))??"—"),1),s("td",P,l(e.completed_count),1),s("td",Q,l(e.rejected_count),1),s("td",R,l(k(e.avg_hours)),1)])}),128))])])])]),_:1})],64))}}),oe=j(U,[["__scopeId","data-v-e4455394"]]);export{oe as default};
