import{d as N,m as B,s as j,C as A,r as $,N as I,V as y,z as U,o as i,c as u,b as t,e as f,E as x,f as o,F as g,p as b,q as w,G as h,H,t as p,y as P,i as k,g as O,x as R,v as C,w as z,h as W,j as S,_ as T,bc as F,k as q}from"./index-2a6c9271.js";import{C as G}from"./index-6b026e9e.js";const J={class:"flex justify-between"},K={class:"flex justify-end align-items-center mt-4 mb-8"},Q=["onClick"],X={key:0,class:"text-start my-4 w-100"},Y=t("h1",{class:"text-xl text-gray-700 font-semibold"},"Instrument Matrix / Load",-1),Z=t("hr",{class:"my-2"},null,-1),ee={key:0},te={key:1,class:"flex justify-start"},se={class:"mr-4 font-bold text-gray-600 text-xl"},oe={class:"font-semibold text-gray-400 text-l"},re=W('

User Matrix / Load


',3),ae=t("h3",null,"Custom Filter Date Range",-1),ne={action:"post",class:"p-1"},ie={class:"grid grid-cols-2 gap-x-4 mb-4"},le={class:"block col-span-2 mb-2"},de=t("span",{class:"text-gray-700"},"Date From",-1),ce={class:"block col-span-2 mb-2"},ue=t("span",{class:"text-gray-700"},"Date To",-1),me=t("hr",null,null,-1),pe=N({__name:"Resource",setup(ve){const V=S(()=>T(()=>import("./SimpleModal-0c0664c5.js"),["assets/SimpleModal-0c0664c5.js","assets/index-2a6c9271.js","assets/index-88806377.css","assets/SimpleModal-f645a074.css"])),E=S(()=>T(()=>import("./LoadingMessage-72d34fcf.js"),["assets/LoadingMessage-72d34fcf.js","assets/index-2a6c9271.js","assets/index-88806377.css"])),c=B(),{dashboard:r}=j(c),m=A({range:{from:"",to:""}});let l=$(!1);const M=()=>{c.setFilterRange(F(m.range.from),F(m.range.to)),l.value=!1};I(async()=>{_(),c.setShowFilters(!0),c.getResourceStats()}),y(()=>r.value.filterRange.from,(d,s)=>{_(),c.getResourceStats()}),y(()=>r.value.resourceStats?.samples,(d,s)=>{r.value.resourceStats?.samples?.forEach(n=>{let e=[],v=0;n.counts?.forEach(a=>v+=a.count),n.counts?.forEach(a=>{e.push({item:a.group,count:a.count,percent:a.count/v})}),L(e,n.group,n.group)})});const D=d=>{let s=0;return r.value.resourceStats?.instruments?.forEach(e=>s+=e.count),(d/s*100).toFixed(2)+" %"},L=(d,s,n)=>{const e=new G({container:s,autoFit:!0,height:250,width:500,localRefresh:!1});e.coordinate("theta",{radius:.75,innerRadius:.5}),e.data(d),e.scale("percent",{formatter:a=>(a=(a*100).toFixed(2)+"%",a)}),e.tooltip({showTitle:!1,showMarkers:!1}),e.legend(!1),e.interval().position("percent").color("item").label("percent",{layout:[{type:"pie-spider"},{type:"hide-overlap"}],offset:8,labelHeight:38,content:a=>`${a.item} (${a.count})`,labelLine:{style:{lineWidth:.5}}}).adjust("stack"),e.createView().annotation().text({position:["50%","50%"],content:n,style:{fill:"#262626",textAlign:"center"}}),e.interaction("element-active"),e.render()},_=()=>{document.getElementById("user-matrix").innerHTML="";const d=`
`;document.getElementById("user-matrix").innerHTML=d};return(d,s)=>{const n=U("VTooltip");return i(),u(g,null,[t("section",J,[f(t("div",K,[(i(!0),u(g,null,b(o(r).filters,(e,v)=>f((i(),w(n,{key:v,placements:["right-start"]},{popper:h(()=>[H(p(o(c).filterToolTip(e)),1)]),default:h(()=>[t("button",{onClick:a=>o(c).setCurrentFilter(e),type:"button",class:P(["px-2 py-1 mr-2 border-gray-800 border text-gray-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none",{"bg-sky-800 text-white":o(r).currentFilter===e}])},p(e),11,Q)]),_:2},1024)),[[x,e!==o(r).filters[o(r).filters.length]]])),128)),t("button",{onClick:s[0]||(s[0]=e=>k(l)?l.value=!0:l=!0),class:"ml-4 mr-1 px-2 py-1 border-gray-500 border text-gray-500 rounded-sm transition duration-300 hover:bg-gray-700 hover:text-white focus:outline-none"},p(o(r).filterRange.from)+" - "+p(o(r).filterRange.to),1)],512),[[x,o(r).showFilters]])]),o(r).fetchingResourceStats?(i(),u("div",X,[O(o(E),{message:"fetching resource stats ..."})])):R("",!0),t("section",null,[Y,Z,o(r).resourceStats?.instruments?.length===0?(i(),u("div",ee,"NO DATA")):(i(),u("div",te,[(i(!0),u(g,null,b(o(r).resourceStats?.instruments,e=>(i(),u("div",{key:e.group,class:"flex items-center bg-white shadow rounded-sm px-6 pt-3 pb-5 border border-white mr-8"},[t("span",se,p(D(e?.count)),1),t("span",oe,p(e.group),1)]))),128))])),re]),o(l)?(i(),w(o(V),{key:1,onClose:s[4]||(s[4]=e=>k(l)?l.value=!1:l=!1),contentWidth:"w-1/4"},{header:h(()=>[ae]),body:h(()=>[t("form",ne,[t("div",ie,[t("label",le,[de,f(t("input",{type:"datetime-local",class:"form-input mt-1 block w-full",autocomplete:"off","onUpdate:modelValue":s[1]||(s[1]=e=>m.range.from=e),placeholder:"Name ..."},null,512),[[C,m.range.from]])]),t("label",ce,[ue,f(t("input",{type:"datetime-local",class:"form-input mt-1 block w-full","onUpdate:modelValue":s[2]||(s[2]=e=>m.range.to=e),placeholder:"Name ..."},null,512),[[C,m.range.to]])])]),me,t("button",{type:"button",onClick:s[3]||(s[3]=z(e=>M(),["prevent"])),class:"-mb-4 w-full border border-sky-800 bg-sky-800 text-white rounded-sm px-4 py-2 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Save Form ")])]),_:1})):R("",!0)],64)}}}),ge=q(pe,[["__file","/home/aurthur/Documents/Development/felicity-lims/webapp/views/dashboard/Resource.vue"]]);export{ge as default};