import{_ as v,i as f,s as g,f as r,k as D,d as o,e as l,g as t,l as u,t as a,w as h,v as p,F as d,h as _,j as k,n as S,p as w,q as $}from"./app-ad835f92.js";import{a as m}from"./swal-23a4a8dd.js";const x={data(){return{datas:[],isAdmin:f(),systemRole:g(),dataTable:null,subSystems:[],permissions:[],optionType:this.$t("global.none"),startDate:"",endDate:"",newData:[]}},computed:{filteredSubSystems(){let s=this.subSystems.filter(e=>this.systemRole[e.id])||[];return this.optionType=s.length>0?s[0].name:this.$t("global.none"),s},filteredSystem(){return this.datas.find(s=>s.name==this.optionType)||null},filteredData(){var e;return((e=this.filteredSystem)==null?void 0:e.plans)||[]}},mounted(){this.fetchData()},methods:{fetchData:async function(){const s=this;await r.get("/api/subSystem").then(e=>{s.subSystems=e.data.data}).catch(m),s.searchData()},searchData:async function(){const s=this;await r.post("/api/getSubSystemWithStatistics",{startDate:s.startDate,endDate:s.endDate}).then(e=>{s.datas=e.data.data}).catch(m),await r.post("/api/getUserPermissionStatistics",{startDate:s.startDate,endDate:s.endDate}).then(e=>{s.permissions=e.data.data}).catch(m),await r.post("/api/getSubSystemWithStatisticsDetail",{plan_id:4,sub_system_id:2}).then(e=>{s.newData=e.data.data}).catch(m)}}},T={class:"main-view px-4 pt-2"},C={class:"d-flex align-items-center mb-3"},V={style:{"--bs-breadcrumb-divider":"'>'"},"aria-label":"breadcrumb"},L={class:"breadcrumb m-0"},N={class:"breadcrumb-item"},B={href:"#"},F={class:"breadcrumb-item active","aria-current":"page"},I={class:"p-4 mt-2 bg-color"},R={class:"date-range-container"},U=["min"],A={class:"system-statistics mt-3"},W={class:"sub-title"},j={class:"py-3 ms-4"},q=["onClick"],z={key:0,class:"table table-hover w-50 ms-5",id:"table",ref:"table"},E={class:"text-center"},M={class:"text-center"},P={class:"text-center"},G={class:"text-center"},H={class:"text-center"},J={class:"text-center"},K={class:"text-center"},O={class:"text-center"},Q={key:1,class:"text-center"},X={class:"permission-statistics"},Y={class:"sub-title"},Z={class:"table table-hover w-50 ms-5",id:"table",ref:"table"},tt={class:"text-center w-50"},st={class:"text-center w-50"},et={class:"text-center"},at={class:"text-center"},nt={key:0},it={colspan:"2",class:"text-center"};function ot(s,e,lt,ct,i,c){const y=D("router-link");return o(),l(d,null,[t("div",T,[t("div",C,[t("button",{class:"btn-goback me-2",onClick:e[0]||(e[0]=n=>s.$router.back())},[e[4]||(e[4]=t("i",{class:"bi bi-chevron-left me-1"},null,-1)),u(a(s.$t("global.go_back")),1)]),t("nav",V,[t("ol",L,[t("li",N,[t("a",B,a(s.$t("global.homepage")),1)]),t("li",F,a(s.$t("sidebar.activation_statistics")),1)])])]),t("h1",null,a(s.$t("sidebar.activation_statistics")),1)]),t("div",I,[t("div",R,[t("span",null,a(s.$t("backend.statistics.date_range")),1),h(t("input",{class:"form-control",type:"date","onUpdate:modelValue":e[1]||(e[1]=n=>i.startDate=n)},null,512),[[p,i.startDate]]),t("span",null,a(s.$t("backend.statistics.to")),1),h(t("input",{class:"form-control",type:"date","onUpdate:modelValue":e[2]||(e[2]=n=>i.endDate=n),min:i.startDate!=""?i.startDate:null},null,8,U),[[p,i.endDate]]),t("button",{class:"btn btn-search",onClick:e[3]||(e[3]=(...n)=>c.searchData&&c.searchData(...n))},a(s.$t("global.search")),1)]),t("div",A,[t("p",W,a(s.$t("backend.statistics.plan_activation_statistics")),1),t("div",j,[(o(!0),l(d,null,_(c.filteredSubSystems,n=>(o(),l("button",{key:n.id,class:S(["btn-option px-4 py-2 mx-1",{active:i.optionType==n.name}]),onClick:b=>i.optionType=n.name},a(n.name),11,q))),128))]),c.filteredSubSystems.length>0?(o(),l("table",z,[t("thead",null,[t("tr",null,[t("th",E,a(s.$t("global.serial_number")),1),t("th",M,a(s.$t("global.system")),1),t("th",P,a(s.$t("global.plan")),1),t("th",G,a(s.$t("backend.statistics.activation_count")),1)])]),t("tbody",null,[(o(!0),l(d,null,_(c.filteredData,(n,b)=>(o(),l("tr",{key:n.id},[t("td",H,a(b+1),1),t("td",J,a(i.optionType),1),t("td",K,a(n.name),1),t("td",O,[w(y,{to:`/statistics/detail/${n.sub_system_id}/${n.id}`},{default:$(()=>[u(a(n.active_num),1)]),_:2},1032,["to"])])]))),128))])],512)):(o(),l("p",Q,a(s.$t("backend.statistics.no_systems_available")),1))]),e[5]||(e[5]=t("hr",{class:"mt-5 mb-3"},null,-1)),t("div",X,[t("p",Y,a(s.$t("backend.statistics.account_permission_statistics")),1),t("table",Z,[t("thead",null,[t("tr",null,[t("th",tt,a(s.$t("backend.statistics.account_permission")),1),t("th",st,a(s.$t("global.count")),1)])]),t("tbody",null,[(o(!0),l(d,null,_(i.permissions,n=>(o(),l("tr",{key:n.permission},[t("td",et,a(n.name),1),t("td",at,a(n.num),1)]))),128)),i.permissions.length===0?(o(),l("tr",nt,[t("td",it,a(s.$t("global.none")),1)])):k("",!0)])],512)])])],64)}const mt=v(x,[["render",ot],["__scopeId","data-v-099b1dba"]]);export{mt as default};
