import{_ as P,R as D,az as U,aA as O,Y as V,f as m,b as j,E as z,r as u,o as c,c as S,a as t,w as e,G as w,h as H,l as p,t as r,i as M,k as A,M as I,j as G,ay as q,aB as F,aC as J,q as R,aM as T,aD as K,be as Q,J as W,aG as X}from"./app-DyK1k-lL.js";import{h as Z}from"./hrmManagement-2iw22uhk.js";import{A as $}from"./AdminPageHeader-DvckKcMF.js";import{L as ee}from"./LeaveSidebar-EMlOD5ZD.js";import"./index-IxYN3YHr.js";import"./TabletOutlined-BSmxn9lp.js";import"./UnderlineOutlined-CWU6djax.js";import"./ScheduleOutlined-BgXa0dBI.js";import"./FundViewOutlined-fZiHFEV8.js";const ae={components:{PlusOutlined:D,EditOutlined:U,DeleteOutlined:O,AdminPageHeader:$,LeaveSidebar:ee},setup(){const{t:o}=V(),{getMonthNameByNumber:d}=Z(),k=[{title:o("leave.leave_type"),dataIndex:"name"},{title:o("menu.remaining_leaves"),dataIndex:"remaining_leaves"}],a=m([]),f=m(!0),{dayjs:Y,user:y,permsArray:b}=j(),s=m({year:Y(),user_id:void 0}),g=m([]),h=m([]),x="users?limit=10000";z(()=>{const i=axiosAdmin.get(x);Promise.all([i]).then(([_])=>{h.value=_.data,s.value={...s.value,user_id:y.value.xid},l()})});const l=()=>{f.value=!0;var i=s.value.year.format("YYYY");axiosAdmin.get(`leaves/remaining-leaves?year=${i}&user_id=${s.value.user_id}`).then(_=>{a.value=_.data.data,g.value=_.data.month_year,f.value=!1})};return{columns:k,remainingLeaves:a,selectedYearStartEndMonths:g,getMonthNameByNumber:d,filters:s,tableLoading:f,setUrlData:l,allUsers:h,permsArray:b}}},te={class:"table-responsive"};function ne(o,d,k,a,f,Y){const y=q,b=u("router-link"),s=F,g=J,h=u("AdminPageHeader"),x=u("LeaveSidebar"),l=R,i=T,_=X,C=K,E=Q,v=H,N=u("admin-page-filters"),B=W,L=u("admin-page-table-content");return c(),S(w,null,[t(h,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},8,["to"])]),_: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(v,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(N,null,{default:e(()=>[t(v,{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?(c(),M(i,{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})):A("",!0)]),_:1}),t(l,{xs:24,sm:24,md:12,lg:14,xl:14},{default:e(()=>[t(v,{gutter:[16,16],justify:"end"},{default:e(()=>[a.permsArray.includes("admin")||a.permsArray.includes("leaves_assign_to_all")?(c(),M(l,{key:0,xs:24,sm:24,md:12,lg:6,xl:6},{default:e(()=>[t(C,{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(()=>[(c(!0),S(w,null,I(a.allUsers,n=>(c(),M(_,{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})):A("",!0),t(l,{xs:24,sm:24,md:12,lg:12,xl:8},{default:e(()=>[t(E,{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(L,null,{default:e(()=>[t(v,null,{default:e(()=>[t(l,{span:24},{default:e(()=>[G("div",te,[t(B,{"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};
