import{_ as B,c as Y,g as a,w as t,b as v,i as _,t as m,e as k,h as S,F as C,j as D,f as L,u as U,k as u,a as O,T,o as c}from"./app-Bei_nIK3.js";import{h as V}from"./hrmManagement-WhRWDXRM.js";import{A as j,B as F,a as H,_ as I}from"./AdminPageHeader-WwDCl03o.js";import{D as z}from"./DeleteOutlined-nnS6HyhI.js";import{E as q}from"./EditOutlined-C24c-ELW.js";import{P as G}from"./index-DFCCKFU7.js";import{T as J}from"./Text-BCxJY8y8.js";import{S as K,a as Q}from"./index-CEPCv2e6.js";import{D as R}from"./dayjs-BAPEkz6Y.js";import{_ as W,a as X}from"./index-DxFi17QQ.js";import{_ as Z}from"./index-CxUMr-Uk.js";import"./dropdown-tYpzS8tQ.js";import"./useFlexGapSupport-I9-A4OAO.js";import"./move-DBemPNhW.js";import"./index-GfpYLola.js";import"./transButton-ukl3COpm.js";import"./useDestroyed-C4XoNj3j.js";import"./index-BSQT_3Ti.js";import"./index-BE0aTWss.js";import"./Base-B7aUwkBZ.js";import"./TextArea-BzmabrVb.js";import"./pickAttrs-CZ9Y5KtR.js";import"./index-Cx28gitG.js";import"./index-C4lvqdg3.js";import"./index-DSkyyvpT.js";import"./CalendarOutlined-CSYNYcxM.js";import"./index-DjXFZler.js";import"./index-D-beVDG-.js";import"./index-Cjf_Tk6m.js";import"./Checkbox-B6oQ4UO2.js";import"./index-NeuLv1Cr.js";import"./RadioButton-CUjJYpWn.js";import"./MinusSquareOutlined-Dt9SF9dS.js";import"./FolderOpenOutlined-DEQuly_h.js";const $={components:{PlusOutlined:G,EditOutlined:q,DeleteOutlined:z,AdminPageHeader:j},setup(){const{t:o}=U(),{getMonthNameByNumber:l}=V(),M=[{title:o("leave.leave_type"),dataIndex:"name"},{title:o("menu.remaining_leaves"),dataIndex:"remaining_leaves"}],e=u([]),p=u(!0),{dayjs:w,user:h,permsArray:y}=O(),r=u({year:w(),user_id:void 0}),f=u([]),g=u([]),b="users";T(()=>{const d=axiosAdmin.get(b);Promise.all([d]).then(([i])=>{g.value=i.data,r.value={...r.value,user_id:h.value.xid},s()})});const s=()=>{p.value=!0;var d=r.value.year.format("YYYY");axiosAdmin.get(`leaves/remaining-leaves?year=${d}&user_id=${r.value.user_id}`).then(i=>{e.value=i.data.data,f.value=i.data.month_year,p.value=!1})};return{columns:M,remainingLeaves:e,selectedYearStartEndMonths:f,getMonthNameByNumber:l,filters:r,tableLoading:p,setUrlData:s,allUsers:g,permsArray:y}}},ee={class:"table-responsive"};function te(o,l,M,e,p,w){const h=I,y=v("router-link"),r=H,f=F,g=v("AdminPageHeader"),b=J,s=X,d=Q,i=K,E=R,x=W,N=v("admin-page-filters"),P=Z,A=v("admin-page-table-content");return c(),Y(C,null,[a(g,null,{header:t(()=>[a(h,{title:o.$t("menu.remaining_leaves"),class:"p-0"},null,8,["title"])]),breadcrumb:t(()=>[a(f,{separator:"-",style:{"font-size":"12px"}},{default:t(()=>[a(r,null,{default:t(()=>[a(y,{to:{name:"admin.dashboard.index"}},{default:t(()=>[_(m(o.$t("menu.dashboard")),1)]),_:1})]),_:1}),a(r,null,{default:t(()=>[_(m(o.$t("menu.leaves")),1)]),_:1}),a(r,null,{default:t(()=>[_(m(o.$t("menu.remaining_leaves")),1)]),_:1})]),_:1})]),_:1}),a(N,null,{default:t(()=>[a(x,{gutter:[16,16],align:"middle"},{default:t(()=>[a(s,{xs:24,sm:24,md:12,lg:10,xl:10},{default:t(()=>[e.selectedYearStartEndMonths&&e.selectedYearStartEndMonths.start_month?(c(),k(b,{key:0,strong:""},{default:t(()=>[_(m(e.getMonthNameByNumber(e.selectedYearStartEndMonths.start_month))+" "+m(e.selectedYearStartEndMonths.start_year)+" - "+m(e.getMonthNameByNumber(e.selectedYearStartEndMonths.end_month))+" "+m(e.selectedYearStartEndMonths.end_year),1)]),_:1})):S("",!0)]),_:1}),a(s,{xs:24,sm:24,md:12,lg:14,xl:14},{default:t(()=>[a(x,{gutter:[16,16],justify:"end"},{default:t(()=>[e.permsArray.includes("admin")||e.permsArray.includes("leaves_view")?(c(),k(s,{key:0,xs:24,sm:24,md:12,lg:6,xl:6},{default:t(()=>[a(i,{value:e.filters.user_id,"onUpdate:value":l[0]||(l[0]=n=>e.filters.user_id=n),onChange:e.setUrlData,"show-search":"",style:{width:"100%"},placeholder:o.$t("common.select_default_text",[o.$t("leave.user")]),optionFilterProp:"title"},{default:t(()=>[(c(!0),Y(C,null,D(e.allUsers,n=>(c(),k(d,{key:n.xid,value:n.xid,title:n.name},{default:t(()=>[_(m(n.name),1)]),_:2},1032,["value","title"]))),128))]),_:1},8,["value","onChange","placeholder"])]),_:1})):S("",!0),a(s,{xs:24,sm:24,md:12,lg:12,xl:8},{default:t(()=>[a(E,{value:e.filters.year,"onUpdate:value":l[1]||(l[1]=n=>e.filters.year=n),placeholder:o.$t("common.select_default_text",[o.$t("holiday.year")]),picker:"year",onChange:e.setUrlData,style:{width:"100%"},allowClear:!1},null,8,["value","placeholder","onChange"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),a(A,null,{default:t(()=>[a(x,null,{default:t(()=>[a(s,{span:24},{default:t(()=>[L("div",ee,[a(P,{"row-selection":{getCheckboxProps:n=>({disabled:!1,name:n.xid})},columns:e.columns,"row-key":n=>n.xid,"data-source":e.remainingLeaves,pagination:!1,loading:e.tableLoading,bordered:"",size:"middle"},{bodyCell:t(({column:n,record:ae})=>l[2]||(l[2]=[])),_:1},8,["row-selection","columns","row-key","data-source","loading"])])]),_:1})]),_:1})]),_:1})],64)}const Te=B($,[["render",te]]);export{Te as default};
