import{_ as P,Z as D,am as U,aq as O,b as V,r as _,a as j,E as z,e as c,o as u,g as Y,c as t,w as e,F as w,v as H,i as p,t as r,f as k,J as E,h as I,j as F,az as T,aD as q,aE as J,n as Z,av as G,a3 as K,ap as Q,aw as R,a2 as W}from"./app-DNXD_-wA.js";import{h as X}from"./hrmManagement-BX7Gl_1P.js";import{A as $}from"./AdminPageHeader-D0JgvBut.js";import{L as ee}from"./LeaveSidebar-BIeKXVZ-.js";import"./index-GwS-7oj1.js";import"./ScheduleOutlined-C_C4geDm.js";import"./TabletOutlined-BgNkFXPR.js";import"./FundViewOutlined-BmZPkH4x.js";import"./UnderlineOutlined-CRmBUSFa.js";const ae={components:{PlusOutlined:D,EditOutlined:U,DeleteOutlined:O,AdminPageHeader:$,LeaveSidebar:ee},setup(){const{t:o}=V(),{getMonthNameByNumber:d}=X(),M=[{title:o("leave.leave_type"),dataIndex:"name"},{title:o("menu.remaining_leaves"),dataIndex:"remaining_leaves"}],a=_([]),f=_(!0),{dayjs:S,user:y,permsArray:b}=j(),s=_({year:S(),user_id:void 0}),g=_([]),v=_([]),x="users?limit=10000";z(()=>{const m=axiosAdmin.get(x);Promise.all([m]).then(([i])=>{v.value=i.data,s.value={...s.value,user_id:y.value.xid},l()})});const l=()=>{f.value=!0;var m=s.value.year.format("YYYY");axiosAdmin.get(`leaves/remaining-leaves?year=${m}&user_id=${s.value.user_id}`).then(i=>{a.value=i.data.data,g.value=i.data.month_year,f.value=!1})};return{columns:M,remainingLeaves:a,selectedYearStartEndMonths:g,getMonthNameByNumber:d,filters:s,tableLoading:f,setUrlData:l,allUsers:v,permsArray:b}}},te={class:"table-responsive"};function ne(o,d,M,a,f,S){const y=T,b=c("router-link"),s=q,g=J,v=c("AdminPageHeader"),x=c("LeaveSidebar"),l=Z,m=G,i=W,N=K,A=Q,h=H,C=c("admin-page-filters"),L=R,B=c("admin-page-table-content");return u(),Y(w,null,[t(v,null,{header:e(()=>[t(y,{title:o.$t("menu.leave_types"),class:"p-0"},null,8,["title"])]),breadcrumb:e(()=>[t(g,{separator:"-",style:{"font-size":"12px"}},{default:e(()=>[t(s,null,{default:e(()=>[t(b,{to:{name:"admin.dashboard.index"}},{default:e(()=>[p(r(o.$t("menu.dashboard")),1)]),_:1})]),_:1}),t(s,null,{default:e(()=>[p(r(o.$t("menu.hrm")),1)]),_:1}),t(s,null,{default:e(()=>[p(r(o.$t("menu.remaining_leaves")),1)]),_:1})]),_:1})]),_:1}),t(h,null,{default:e(()=>[t(l,{xs:24,sm:24,md:24,lg:4,xl:4,class:"bg-setting-sidebar"},{default:e(()=>[t(x)]),_:1}),t(l,{xs:24,sm:24,md:24,lg:20,xl:20},{default:e(()=>[t(C,null,{default:e(()=>[t(h,{gutter:[16,16],align:"middle"},{default:e(()=>[t(l,{xs:24,sm:24,md:12,lg:10,xl:10},{default:e(()=>[a.selectedYearStartEndMonths&&a.selectedYearStartEndMonths.start_month?(u(),k(m,{key:0,strong:""},{default:e(()=>[p(r(a.getMonthNameByNumber(a.selectedYearStartEndMonths.start_month))+" "+r(a.selectedYearStartEndMonths.start_year)+" - "+r(a.getMonthNameByNumber(a.selectedYearStartEndMonths.end_month))+" "+r(a.selectedYearStartEndMonths.end_year),1)]),_:1})):E("",!0)]),_:1}),t(l,{xs:24,sm:24,md:12,lg:14,xl:14},{default:e(()=>[t(h,{gutter:[16,16],justify:"end"},{default:e(()=>[a.permsArray.includes("admin")||a.permsArray.includes("leaves_assign_to_all")?(u(),k(l,{key:0,xs:24,sm:24,md:12,lg:6,xl:6},{default:e(()=>[t(N,{value:a.filters.user_id,"onUpdate:value":d[0]||(d[0]=n=>a.filters.user_id=n),onChange:a.setUrlData,"show-search":"",style:{width:"100%"},placeholder:o.$t("common.select_default_text",[o.$t("leave.user")])},{default:e(()=>[(u(!0),Y(w,null,I(a.allUsers,n=>(u(),k(i,{key:n.xid,value:n.xid,title:n.name},{default:e(()=>[p(r(n.name),1)]),_:2},1032,["value","title"]))),128))]),_:1},8,["value","onChange","placeholder"])]),_:1})):E("",!0),t(l,{xs:24,sm:24,md:12,lg:12,xl:8},{default:e(()=>[t(A,{value:a.filters.year,"onUpdate:value":d[1]||(d[1]=n=>a.filters.year=n),placeholder:o.$t("common.select_default_text",[o.$t("holiday.year")]),picker:"year",onChange:a.setUrlData,style:{width:"100%"}},null,8,["value","placeholder","onChange"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(B,null,{default:e(()=>[t(h,null,{default:e(()=>[t(l,{span:24},{default:e(()=>[F("div",te,[t(L,{"row-selection":{getCheckboxProps:n=>({disabled:!1,name:n.xid})},columns:a.columns,"row-key":n=>n.xid,"data-source":a.remainingLeaves,pagination:!1,loading:a.tableLoading,bordered:"",size:"middle"},{bodyCell:e(({column:n,record:oe})=>[]),_:1},8,["row-selection","columns","row-key","data-source","loading"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})],64)}const pe=P(ae,[["render",ne]]);export{pe as default};
