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-CgV11GBz.js";import{h as V}from"./hrmManagement-DSu-pZ5D.js";import{A as j,B as F,a as H,_ as I}from"./AdminPageHeader-BbLazqh2.js";import{D as z}from"./DeleteOutlined-CzplmvFG.js";import{E as q}from"./EditOutlined-CDoHc2FT.js";import{P as G}from"./index-B7-RTJOc.js";import{T as J}from"./Text-BEWt5-6S.js";import{S as K,a as Q}from"./index-GcUTOa9d.js";import{D as R}from"./dayjs-1hJdMHbK.js";import{_ as W,a as X}from"./index-CyQQxPex.js";import{_ as Z}from"./index-vRSySr5e.js";import"./dropdown-C8TPWlvJ.js";import"./useFlexGapSupport-CWWB0EO1.js";import"./move-DC4W0EQt.js";import"./index-BnFAf-Nu.js";import"./transButton-BBsxYOSm.js";import"./useDestroyed-DU9zWypE.js";import"./index-4wtx7HnJ.js";import"./index-MBDGOAKp.js";import"./Base-CoAoxKFd.js";import"./TextArea-CiAld6jk.js";import"./pickAttrs-6g5FyZe9.js";import"./index-CJx7RGCD.js";import"./index-BiYulQUu.js";import"./index-Oi0DGWnW.js";import"./CalendarOutlined-DlxTbIcy.js";import"./index-E6lmxuug.js";import"./index-DtCc1bFm.js";import"./index-DEQO-jTQ.js";import"./Checkbox-tUwuA94o.js";import"./index-DFoCNTvZ.js";import"./RadioButton-BPv4-qI8.js";import"./MinusSquareOutlined-Cd4pIAZ_.js";import"./FolderOpenOutlined-5lmK0J8L.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};
