PageSourceSearch

https://cdn.joinhomebase.com/assets/BalanceDetailView-chunk-CHiSNZo_.js

js joinhomebase.com collected 2026-09-24 08:34:50 UTC 15,390 bytes, 2 lines download raw bytes

1import{reactExports as u,jsxRuntimeExports as t}from"./react-core-chunk-B2r03cU8.js";import{useSelector as ie}from"./redux-core-chunk-DgWMjMkF.js";import{Text_default as s,Box_default as c,Tooltip_default as A,Icon_default as se,useQuery as U,employeeBalanceLogRoute as ce,normalizeTableColumns as W,SegmentedPicker_default as de,TableWrapper as Q,EmptyState as S,PTO as j,PAID_SICK_LEAVE as v,UNPAID_TIME_OFF as E,TileContainer_default as _e,employeeRequestHistoryRoute as ue,IconButton_default as me,Pill_default as fe,PageWithSubcomponents as x,buildPolicyWizardEditPath as pe,withUxRoot as be,useHistory as he,getPolicyCreationWizardEnabled as ye,Button_default as D,ErrorGeneric as ge,PTO_POLICY_ROUTES as P,Avatar_default as xe,Grid as je,Link_default as X,CircularInfinite_default as ve}from"./app-init-chunk-kk_CZVyp.js";import{Paperwork as we}from"./Paperwork-chunk-BmBo1NCw.js";import{useTeamTimeOffBalances as Te}from"./useTeamTimeOffBalances-chunk-D_nlZOGN.js";import{toI18n as n,formatDatePrettyShortWithYear as Z,df as k,hooks as Se}from"./tracking-chunk-Cdw_Cfie.js";import{fetchJSON as J,EVENT_CATEGORIES as Ee,PRODUCT_AREAS as Le}from"./app-bundle-B0YfsjKz.js";import{TimeOff as ee}from"./TimeOff-chunk-BvRXdo_p.js";import{usePagination as ae}from"./usePagination-chunk-uexSobAT.js";import{STEP_ASSIGN_TEAM as Pe}from"./types-chunk-Bkn_oBV9.js";try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="edfaba08-a0cb-444e-a30e-487c5edd2dd1",e._sentryDebugIdIdentifier="sentry-dbid-edfaba08-a0cb-444e-a30e-487c5edd2dd1")})()}catch{}const g=e=>t.jsx(c,{pv:"xs",children:e}),B=e=>e.toFixed(2),Ce={assigned_to:"starting_balance",approved:"approved",deleted:"deleted",edited:"edited",accrual:"accrual",timecard_adjusted:"accrual",hire_date_anniversary:"accrual",carryover:"carryover",annual_accrual_and_carryover:"accrual_and_carryover",annual_accrual_and_carryover_adjustment:"accrual_and_carryover",balance_adjusted:"balance_adjusted",error_adjustments:"balance_adjusted",category_change:"time_off_type_changed",removed_from:"removed_from_policy"},Ie=new Set(["approved","edited","deleted","category_change"]),Re=new Set(["approved","edited","deleted","balance_adjusted"]),Ve=/\d{1,2}\/\d{1,2}\/\d{2}/g,Ae="MM/DD/YY",I=e=>{const a=Math.abs(e);return Number.isInteger(a)?String(a):B(a)},Be=e=>(e.match(Ve)??[]).map(r=>Se(r,Ae,!0)).filter(r=>r.isValid()),R=e=>{const a=Be(e);if(a.length===0)return e;const r=a[0],o=a[a.length-1],l=k("pretty_no_wday_stripped"),i=k("month_day_short");return r.isSame(o,"day")?r.format(l):r.isSame(o,"month")?`${r.format(i)} - ${o.format("D, YYYY")}`:r.isSame(o,"year")?`${r.format(i)} - ${o.format(l)}`:`${r.format(l)} - ${o.format(l)}`},K=e=>e===null?n("time_off.balances_index.no_value"):n("time_off.balance_detail.balance_log.hours",{props:{hours:B(e)}}),N=e=>{const a=B(e.hours_delta);return e.starting_balance||e.hours_delta===0?{text:n("time_off.balance_detail.balance_log.hours",{props:{hours:a}})}:e.hours_delta>0?{text:n("time_off.balance_detail.balance_log.hours_added",{props:{hours:a}}),color:"success"}:{text:n("time_off.balance_detail.balance_log.hours",{props:{hours:a}}),color:"error"}},M=e=>{const a=e.action_type?Ce[e.action_type]:void 0;return a?n(`time_off.balance_detail.balance_log.type.${a}`):e.action_label},H=e=>!e.action_type||!Re.has(e.action_type)||!e.actor_name?null:n("time_off.balance_detail.balance_log.type.by",{props:{name:e.actor_name}}),Oe={approved:"approved",edited:"updated",deleted:"deleted",category_change:"updated"},De=({metadata:e},a)=>!e?.dates||!e.update_dates||e.approved_hours==null||e.update_hours==null?null:{heading:a,body:n("time_off.balance_detail.balance_log.type.tooltip.approved_line",{props:{dates:R(e.dates),hours:I(e.approved_hours)}}),detail:n("time_off.balance_detail.balance_log.type.tooltip.update_line",{props:{dates:R(e.update_dates),hours:I(e.update_hours)}})},Y=e=>{if(!e.action_type||!Ie.has(e.action_type))return null;const a=Oe[e.action_type];if(!a)return null;const r=n(`time_off.balance_detail.balance_log.type.tooltip.${a}`);if(e.action_type==="category_change")return e.metadata?.detail?{heading:r,body:n("time_off.balance_detail.balance_log.type.tooltip.category_change",{props:{detail:e.metadata.detail}})}:null;if(!e.metadata?.dates)return null;if(e.action_type==="edited"){const o=De(e,r);if(o)return o}return{heading:r,body:n("time_off.balance_detail.balance_log.type.tooltip.dates",{props:{dates:R(e.metadata.dates),hours:I(e.hours_delta)}})}},$=e=>
1[e.heading,e.body,e.detail].filter(Boolean).join(" "),ke=e=>t.jsxs(c,{column:!0,children:[t.jsx(s,{color:"primary300",variant:"bodySm",children:e.heading}),t.jsx(s,{variant:"bodySm",children:e.body}),e.detail&&t.jsx(s,{variant:"bodySm",children:e.detail})]}),Ke=e=>Z(e),Ne=(e,{showBalance:a})=>u.useMemo(()=>{const r=[{headerKey:"date",headerLabel:n("time_off.balance_detail.balance_log.columns.date"),rowValues:e.map(o=>g(t.jsx(s,{variant:"bodySmTight",children:Ke(o.posted_at)}))),rawRowValues:e.map(o=>o.posted_at)},{headerKey:"policy",headerLabel:n("time_off.balance_detail.balance_log.columns.policy"),rowValues:e.map(o=>g(t.jsx(s,{variant:"bodySmTight",children:o.policy_name}))),rawRowValues:e.map(o=>o.policy_name)},{headerKey:"type",headerLabel:n("time_off.balance_detail.balance_log.columns.type"),rowValues:e.map(o=>{const l=M(o),i=H(o),_=Y(o);return g(t.jsxs(c,{column:!0,children:[t.jsxs(c,{row:!0,vcenter:!0,children:[t.jsx(s,{variant:"bodySmTight",children:l}),_&&t.jsx(A,{content:ke(_),placement:"bottom",children:t.jsx(se,{iconName:"Info",size:"xsmall",color:"secondary",ml:4,"aria-label":$(_)})})]}),i&&t.jsx(s,{variant:"bodySmTight",color:"secondary",children:i})]}))}),rawRowValues:e.map(o=>{const l=H(o),i=Y(o);return[M(o),l,i&&$(i)].filter(Boolean).join(" ")})},{headerKey:"change",headerLabel:n("time_off.balance_detail.balance_log.columns.change"),rowValues:e.map(o=>{const{text:l,color:i}=N(o);return g(t.jsx(s,{variant:"bodySmTight",color:i,children:l}))}),rawRowValues:e.map(o=>N(o).text)}];return a&&r.push({headerKey:"balance",headerLabel:n("time_off.balance_detail.balance_log.columns.balance"),rowValues:e.map(o=>g(t.jsx(s,{variant:"bodySmTight",children:K(o.balance_after)}))),rawRowValues:e.map(o=>K(o.balance_after))}),r},[e,a]),Me=5,He=100,Ye=(e,a)=>["employeeBalanceLog",e,a],$e=(e,a)=>{const r=U({queryKey:Ye(e,a),queryFn:()=>J(ce(e,{category_name:a,page_size:He})),enabled:!!e&&!!a});return{entries:r.data?.entries??[],isLoading:r.isLoading}},ze={[j]:"time_off.balance_detail.balance_log.tabs.pto",[v]:"time_off.balance_detail.balance_log.tabs.paid_sick_leave",[E]:"time_off.balance_detail.balance_log.tabs.unpaid_time_off"},Fe=e=>{const a=[];return e.policies.some(r=>r.key===j)&&a.push(j),e.policies.some(r=>r.key===v)&&a.push(v),a.push(E),a},qe=({employeeId:e,employee:a})=>{const r=u.useId(),o=u.useMemo(()=>Fe(a),[a]),[l,i]=u.useState(o[0]),{entries:_,isLoading:d}=$e(e,l),{pageItems:h,currentPage:y,numberPages:p,setCurrentPage:b,resetPagination:f}=ae(_,{perPage:Me}),O=Ne(h,{showBalance:l!==E}),ne=u.useMemo(()=>W(O),[O]);u.useEffect(()=>{o.includes(l)||i(o[0])},[l,o]);const oe=u.useCallback((L,le)=>{i(String(le)),f()},[f]),re=u.useMemo(()=>o.map(L=>({value:L,label:n(ze[L])})),[o]);return t.jsxs(c,{column:!0,gap:12,component:"section","aria-labelledby":r,children:[t.jsxs(c,{row:!0,vcenter:!0,gap:8,children:[t.jsx(c,{grow:1,basis:0,children:t.jsx(s,{variant:"heading4",component:"h2",id:r,children:n("time_off.balance_detail.balance_log.heading")})}),t.jsx(de,{options:re,tabValue:l,onChange:oe}),t.jsx(c,{grow:1,basis:0})]}),t.jsx(Q,{columns:ne,loading:d,hideUnsortedSortArrows:!0,wrapInPageCard:!1,emptyState:t.jsx(c,{flex:!0,vcenter:!0,hcenter:!0,pv:"xl",children:t.jsx(S,{illustration:t.jsx(ee,{}),title:n("time_off.balance_detail.balance_log.empty.title"),content:n("time_off.balance_detail.balance_log.empty.content")})}),...p>1&&{pagination:{currentPage:y,numberPages:p,onPage:b}}})]})},w=({value:e,label:a,labelTooltip:r=!1,action:o,ariaLabelledBy:l})=>{const i=a&&t.jsx(s,{variant:"bodySmBold",color:"tertiary",noWrap:!0,children:a});return t.jsxs(_e,{p:"md",column:!0,minw:0,justifyContentSpaceBetween:!0,"aria-labelledby":l,children:[t.jsx(s,{variant:"heading2",children:e}),t.jsxs(c,{column:!0,gap:"xs",mt:"md",children:[t.jsx(c,{h:18,minw:0,children:i&&r?t.jsx(A,{content:a,children:i}):i}),t.jsx(c,{h:18,children:o})]})]})},Ge=5,Ue=100,We=e=>["employeeRequestHistory",e],Qe=e=>{const a=U({queryKey:We(e),queryFn:()=>J(ue(e,{page_size:Ue})),enabled:!!e});return{requests:a.data?.requests??[],isLoading:a.isLoading}},V=30,Xe={[j]:"time_off.balances_index.pto",[v]:"time_off.balances_index.paid_sick_leave",[E]:"time_off.balances_index.unpaid_time_off"},Ze={pending:{variant:"warning",icon:"Warning"},approved:{variant:"success"},rejected:{variant:"error"},cancelled:{variant:"mono"}},Je=()=>{},m=e=>t.jsx(c,{pv:"xs",children:e}),ea=e=>e.length>V?`${e.slice(0,V)}…`:e,z=e=>{if(!e)return n("time_off.balances_index.no_value");const a=Xe[e];return a?n(a):e},aa=e=>n("time_off.balances_index.hours",{props:{hours:e.toFixed(2)}}),te=e=>{if(e.expired)return{label:n("time_off.balance_detail.request_history.status.expired"),variant:"mono"};const a=`time_off.balance_detail.request_history.status.${e.state}`,r=n(a),o=Ze[e.state];return{label:r===a?e.state:r,variant:o?.variant??"mono",...o?.icon?{icon:o.icon}:{}}},ta=e=>te(e).label,T=e=>e?.trim()?e:n("time_off.balances_index.no_value"),C=e=>Z(e),na=e=>u.useMemo(()=>[{headerKey:"requestedOn",headerLabel:n("time_off.balance_detail.request_history.columns.requested_on"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:C(a.created_at)}))),rawRowValues:e.map(a=>a.created_at)},{headerKey:"startDate",headerLabel:n("time_off.balance_detail.request_history.columns.start_date"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:C(a.start_at)}))),rawRowValues:e.map(a=>a.start_at)},{headerKey:"endDate",headerLabel:n("time_off.balance_detail.request_history.columns.end_date"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:C(a.end_at)}))),rawRowValues:e.map(a=>a.end_at)},{headerKey:"duration",headerLabel:n("time_off.balance_detail.request_history.columns.duration"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:aa(a.duration_in_hours)}))),rawRowValues:e.map(a=>a.duration_in_hours)},{headerKey:"policyName",headerLabel:n("time_off.balance_detail.request_history.columns.policy_name"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:z(a.category_name)}))),rawRowValues:e.map(a=>z(a.category_name))},{headerKey:"notes",headerLabel:n("time_off.balance_detail.request_history.columns.reason"),rowValues:e.map(a=>{const r=T(a.notes),o=ea(r);return m(t.jsx(A,{content:r.length>V?r:null,children:t.jsx(c,{children:t.jsx(s,{variant:"bodySmTight",children:o})})}))}),rawRowValues:e.map(a=>T(a.notes))},{headerKey:"reviewer",headerLabel:n("time_off.balance_detail.request_history.columns.reviewer"),rowValues:e.map(a=>m(t.jsx(s,{variant:"bodySmTight",children:T(a.reviewer_name)}))),rawRowValues:e.map(a=>T(a.reviewer_name))},{headerKey:"status",headerLabel:n("time_off.balance_detail.request_history.columns.status"),rowValues:e.map(a=>{const{label:r,variant:o,icon:l}=te(a);return m(t.jsx(fe,{variant:o,icon:l,children:r}))}),rawRowValues:e.map(a=>ta(a))},{headerKey:"actions",headerLabel:"",rowValues:e.map(()=>m(t.jsx(me,{icon:"MoreVertical",size:"small",label:n("time_off.balance_detail.request_history.overflow_label"),onClick:Je,uxElement:"request_history_overflow"}))),rawRowValues:e.map(a=>a.id)}],[e]),oa=({employeeId:e})=>{const{requests:a,isLoading:r}=Qe(e),{pageItems:o,currentPage:l,numberPages:i,setCurrentPage:_}=ae(a,{perPage:Ge}),d=na(o),h=u.useMemo(()=>W(d),[d]);return t.jsx(x.Section,{title:n("time_off.balance_detail.request_history.heading"),children:t.jsx(Q,{columns:h,loading:r,hideUnsortedSortArrows:!0,wrapInPageCard:!1,emptyState:t.jsx(c,{flex:!0,vcenter:!0,hcenter:!0,pv:"xl",children:t.jsx(S,{illustration:t.jsx(ee,{}),title:n("time_off.balance_detail.request_history.empty.title"),content:n("time_off.balance_detail.request_history.empty.c
1ontent")})}),...i>1&&{pagination:{currentPage:l,numberPages:i,onPage:_}}})})},F=e=>e?e.balanceHrs===null?n("time_off.balance_detail.unlimited"):n("time_off.balances_index.hours",{props:{hours:e.balanceHrs.toFixed(2)}}):n("time_off.balances_index.no_value"),q=(e,a)=>a?`${e} • ${a.label}`:e,ra=(e,a)=>e?.policyId&&a?`${pe(e.policyId)}?step=${Pe}`:null,G=({policy:e,policyCreationWizardEnabled:a})=>{const r=ra(e,a);return r?t.jsx(X,{size:"small",href:r,children:n("time_off.balance_detail.edit_balance")}):t.jsx(s,{variant:"bodySmBold",color:"disabled",children:n("time_off.balance_detail.edit_balance")})},la=({employeeId:e})=>{const a=he(),{employees:r,isLoading:o,isError:l,retry:i}=Te(),_=ie(ye),d=u.useMemo(()=>r.find(({id:f})=>String(f)===e),[e,r]),h=d?n("time_off.balance_detail.heading",{props:{name:d.name}}):null,y=d?.policies.find(f=>f.key===j),p=d?.policies.find(f=>f.key===v);let b;return l?b=t.jsx(c,{flex:!0,vcenter:!0,hcenter:!0,minh:"60vh",children:t.jsx(S,{illustration:t.jsx(ge,{}),title:n("time_off.balances_index.error.title"),content:n("time_off.balances_index.error.content"),action:t.jsx(D,{variant:"primary",onClick:i,uxElement:"balance_detail_retry_button",children:n("time_off.balances_index.error.retry")})})}):!o&&!d?b=t.jsx(c,{flex:!0,vcenter:!0,hcenter:!0,minh:"60vh",children:t.jsx(S,{illustration:t.jsx(we,{}),title:n("time_off.balance_detail.not_found.title"),content:n("time_off.balance_detail.not_found.content"),action:t.jsx(D,{variant:"primary",href:P.BALANCES_INDEX,uxElement:"balance_detail_not_found_back_button",children:n("common.back")})})}):o?b=t.jsx(c,{hcenter:!0,vcenter:!0,p:"lg",children:t.jsx(ve,{variant:"dark",size:"large"})}):b=t.jsxs(c,{column:!0,gap:"lg",p:"md",children:[t.jsxs(c,{row:!0,vcenter:!0,gap:"lg",children:[t.jsx(xe,{image:d?.avatarUrl,alt:d?.name??"",size:"large"}),h&&t.jsx(s,{variant:"heading1",component:"h2",children:h})]}),t.jsxs(je,{columns:{sm:1,md:2,lg:4},gap:"md",children:[t.jsx(w,{value:d?.pendingCount??0,label:n("time_off.balance_detail.pending_requests"),action:t.jsx(X,{size:"small",href:P.TIME_OFFS_HUB,children:n("time_off.balance_detail.review")})}),t.jsx(w,{value:F(y),label:q(n("time_off.categories.pto"),y),labelTooltip:!!y,action:t.jsx(G,{policy:y,policyCreationWizardEnabled:_})}),t.jsx(w,{value:F(p),label:q(n("time_off.categories.paid_sick_leave"),p),labelTooltip:!!p,action:t.jsx(G,{policy:p,policyCreationWizardEnabled:_})}),t.jsx(w,{value:n("time_off.balances_index.no_value"),action:t.jsx(s,{id:"unpaid-time-off-tile-label",variant:"bodySmBold",color:"tertiary",noWrap:!0,children:n("time_off.balances_index.unpaid_time_off")}),ariaLabelledBy:"unpaid-time-off-tile-label"})]}),t.jsx(x.Card,{children:t.jsx(oa,{employeeId:e})}),d&&t.jsx(x.Card,{children:t.jsx(qe,{employeeId:e,employee:d})})]}),t.jsx(x,{title:n("time_off.balance_detail.title"),subpageOpts:{hideHeader:!0},children:t.jsx(x.Subpage,{back:{hideLabelInToolbar:!0,onClick:()=>a.push(P.BALANCES_INDEX)},children:b})},e)},ha=be({productArea:Le.PTO,eventCategory:Ee.TIME_OFFS})(la);export{ha as default};
2//# sourceMappingURL=BalanceDetailView-chunk-CHiSNZo_.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.