import{_ as O}from"./InfoCard.vue_vue_type_script_setup_true_lang-CWF_aA31.js";import{_ as D}from"./LineChart.vue_vue_type_script_setup_true_lang-r8tM6cyh.js";import{_ as R}from"./LoadingIndicator-BUC-Eplr.js";import{_ as A}from"./WhiteButton.vue_vue_type_script_setup_true_lang-DlfUhvlb.js";import{_ as T}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{M as I,o as e,c as w,a as n,B as l,E as _,m as s,w as o,f as i,F as b,h as B,P as $,t as c,i as S,r as x,g as U,Q as V,n as L,b as E,R as W,G as H}from"./index-Bb2UEb_P.js";import{_ as K}from"./IconReload-BJt7Kils.js";import{_ as M}from"./ServerStatusBadge.vue_vue_type_script_setup_true_lang-DDAMgezp.js";import{u as P}from"./services-DEZoSah0.js";import{u as F}from"./orders-B7i92Ara.js";import{a as Y}from"./time-CsiTV-I2.js";import{v as j}from"./bootstrap-vue-next-C0pyDr3k.js";import{I as z}from"./IconSettings-DQC_fNf7.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Q={class:"xl:tw-col-span-2 tw-border tw-rounded tw-border-gray-200 tw-p-4"},q={class:"tw-flex tw-flex-col sm:tw-flex-row sm:tw-items-center tw-gap-2 sm:tw-gap-4"},J={class:"tw-flex tw-items-center tw-gap-2"},X={class:"tw-text-lg lg:tw-text-xl tw-text-gray-400"},vt=I({__name:"ChartCards",props:{data:{},period:{},loading:{type:Boolean}},emits:["update"],setup(y,{emit:f}){const p=f;return(a,t)=>{const r=T,u=A,C=R,g=D,v=O;return a.data&&a.data.length?(e(),w(b,{key:0},[n("div",Q,[n("h2",q,[t[12]||(t[12]=n("div",{class:"tw-text-2xl"},"Статистика за",-1)),n("div",J,[a.period===l(_).DAY?(e(),s(r,{key:0,type:"small",disabled:!0},{default:o(()=>t[4]||(t[4]=[i(" день ",-1)])),_:1,__:[4]})):(e(),s(u,{key:1,type:"small",onClick:t[0]||(t[0]=d=>p("update",l(_).DAY))},{default:o(()=>t[5]||(t[5]=[i(" день ",-1)])),_:1,__:[5]})),a.period===l(_).WEEK?(e(),s(r,{key:2,type:"small",disabled:!0},{default:o(()=>t[6]||(t[6]=[i(" неделю ",-1)])),_:1,__:[6]})):(e(),s(u,{key:3,type:"small",onClick:t[1]||(t[1]=d=>p("update",l(_).WEEK))},{default:o(()=>t[7]||(t[7]=[i(" неделю ",-1)])),_:1,__:[7]})),a.period===l(_).MONTH?(e(),s(r,{key:4,type:"small",disabled:!0},{default:o(()=>t[8]||(t[8]=[i(" месяц ",-1)])),_:1,__:[8]})):(e(),s(u,{key:5,type:"small",onClick:t[2]||(t[2]=d=>p("update",l(_).MONTH))},{default:o(()=>t[9]||(t[9]=[i(" месяц ",-1)])),_:1,__:[9]})),a.period===l(_).ALL?(e(),s(r,{key:6,type:"small",disabled:!0},{default:o(()=>t[10]||(t[10]=[i(" всё время ",-1)])),_:1,__:[10]})):(e(),s(u,{key:7,type:"small",onClick:t[3]||(t[3]=d=>p("update",l(_).ALL))},{default:o(()=>t[11]||(t[11]=[i(" всё время ",-1)])),_:1,__:[11]}))])])]),(e(!0),w(b,null,B(a.data,(d,k)=>(e(),s(v,{key:k,title:d.Name},{action:o(()=>[n("div",X,c(d.Limit)+" "+c(d.Units),1)]),body:o(()=>[a.loading?(e(),s(C,{key:0})):(e(),s(g,{key:1,data:d.Data,color:l($)[k%l($).length],class:"tw-mt-4"},null,8,["data","color"]))]),_:2},1032,["title"]))),128))],64)):S("",!0)}}}),Z={class:"tw-flex tw-items-center tw-gap-2"},h={class:"tw-text-sm tw-text-gray-500"},tt={class:"tw-py-2"},et={class:"tw-font-bold"},kt=I({__name:"LastValueCard",props:{order:{}},setup(y){const f=y,p=P(),a=F(),t=x(!1),r=x(),u=U(()=>Object.values(r.value?.Stat?.Last||{}));V(()=>{r.value=f.order});async function C(){t.value=!0,(await p.updateResourcesUsed(f.order.OrderID)).Status===W&&(r.value=await a.fetchOneOrder(f.order.OrderID)),t.value=!1}return(g,v)=>{const d=M,k=K,N=O;return r.value&&u.value.length?(e(),s(N,{key:0,title:"Ресурсы","body-padding":!1},{badge:o(()=>[E(d,{indicators:r.value.Stat.Last},null,8,["indicators"])]),action:o(()=>[n("div",Z,[n("div",h,c(l(Y)(r.value.Stat.UpdateDate)),1),g.order?(e(),s(k,{key:0,class:L(["tw-cursor-pointer tw-flex-none",{"tw-animate-spin":t.value}]),onClick:v[0]||(v[0]=m=>C())},null,8,["class"])):S("",!0)])]),body:o(()=>[n("div",tt,[(e(!0),w(b,null,B(u.value,m=>(e(),w("div",{key:m.Name,class:L(["tw-grid tw-grid-cols-2 tw-gap-4 hover:tw-bg-sky-100 tw-px-4 tw-py-2",{"tw-text-red-500":m.Status==="Critical","tw-text-orange-500":m.Status==="Warning"}])},[n("div",et,c(m.Name),1),n("div",null,[i(c(m.Used)+" ",1),m.Limit?(e(),w(b,{key:0},[i("/ "+c(m.Limit),1)],64)):S("",!0),i(" "+c(m.Units),1)])],2))),128))])]),_:1})):S("",!0)}}}),ot={},st={class:"btn btn--dots"};function at(y,f){const p=z,a=j;return e(),s(a,{class:"dropdown-dots engine",right:""},{"button-content":o(()=>[n("span",null,[n("div",st,[E(p)])])]),default:o(()=>[H(y.$slots,"default",{},void 0,!0)]),_:3})}const St=G(ot,[["render",at],["__scopeId","data-v-c3dbb3d3"]]);export{kt as _,vt as a,St as b};
