PageSourceSearch

https://cdn.joinhomebase.com/assets/index-chunk-CVnp7Egn.js

js joinhomebase.com collected 2026-09-24 08:34:08 UTC 20,095 bytes, 2 lines download raw bytes

1import{jsxRuntimeExports as s,reactExports as c}from"./react-core-chunk-B2r03cU8.js";import{useDispatch as ne,useSelector as k,shallowEqual as Pe}from"./redux-core-chunk-DgWMjMkF.js";import{fetchJSON as B,getCookie as Ne,EVENT_ACTIONS as M,EVENT_CATEGORIES as L,setCookie as Ie,generateCsvFile as we,postJSON as Ae,resolveApiUrl as je,PRODUCT_AREAS as Me,TRACK_ACTION_TYPES as Le}from"./app-bundle-B0YfsjKz.js";import{toCurrency as Re,setNavigationLoading as Be,Box_default as O,EmptyState as ie,NoResults as $e,hasPayrollSettings as We,getHistoricalTimesheetsAccess as Ye,getThisWeek as Fe,getLastWeek as Ue,getToday as Ke,getYesterday as qe,flashNotice as $,BASIC_TIER_MAX_PAYROLL_DAYS as Ve,Button_default as W,PageWithSubcomponents as Q,CircularInfinite_default as ce,Select_default as de,Dialog_default as Je,Formik as Qe,Form as ze,Text_default as ue,List_default as Xe,RadioButtonGroup as Ge,RadioButtonField as te,ActionButtons_default as Ze,useIsMediumScreen as et,selectCompanyTimesheetLocationSettings as tt,selectLocationNamesMap as st,getCanViewWages as at,getCompanyTimesheetsEnabled as rt,getCompanyTimesheetsAccessTier as ot,selectCompanyTimesheetsStatus as lt,getCompanyTimesheetsPageTemplateEnabled as nt,fetchCompanyTimesheetsSettings as it,showPaywallsModal as ct,showGlobalLoader as dt,pollBatchStatus as se,hideGlobalLoader as ut}from"./app-init-chunk-kk_CZVyp.js";import{df as C,toI18n as u,addDays as mt,moment as I,STANDARD_DATE_FORMAT as ae,getNow as ht,momentWithCustomLocale as re,trackUxEvent as pt}from"./tracking-chunk-Cdw_Cfie.js";import{cxEl as f}from"./classNames-chunk-DiDFzDzl.js";import{FDBRangePicker as me}from"./FDBRangePicker-chunk-DwngoN0y.js";import{ONE_MONTH_MAX as he}from"./CommonPresetConstants-chunk-BNvXgbB8.js";import{TimeClock as ft}from"./TimeClock-chunk-CukDxI9z.js";try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e5ff7c0-5741-437f-878c-0ad804afe498",e._sentryDebugIdIdentifier="sentry-dbid-0e5ff7c0-5741-437f-878c-0ad804afe498")})()}catch{}const _t=[{key:"employee",label:"Employees"},{key:"location",label:"Location"},{key:"scheduledHours",label:"Scheduled Hours"},{key:"actualHours",label:"Actual Hours"},{key:"unpaidBreaksHours",label:"Unpaid Break"},{key:"timeOffHours",label:"PTO"},{key:"paidHours",label:"Paid Hours"},{key:"regularHours",label:"Regular"},{key:"overtimeHours",label:"Overtime",getTotal:({totals:e,formatted:t})=>s.jsx("span",{className:e.hasOvertimes?f("flag"):"",children:t.overtimeHours})}],yt=[{key:"variance",label:"Variance"},{key:"estimatedWages",label:"Est. Wages"},{key:"shifts",label:"Shifts (worked / scheduled)",getTotal:({totals:e})=>s.jsx("span",{className:e.missedShifts?f("flag"):"",children:`${e.timecards}/${e.shifts}`})},{key:"cashTips",label:"Cash Tips"},{key:"creditTips",label:"Credit Tips"}],bt=[{key:"holidayPay",label:"Holiday Pay"},{key:"doubleOvertimeHours",label:"Double OT Hours",getTotal:({totals:e,formatted:t})=>s.jsx("span",{className:e.hasDoubleOvertimes?f("flag"):"",children:t.doubleOvertimeHours})},{key:"qualifiedOvertime",label:"Qualified OT Hours",getTotal:({totals:e,formatted:t})=>s.jsx("span",{className:e.hasQualifiedOvertime?f("flag"):"",children:t.qualifiedOvertime})},{key:"spreadOfHours",label:"Spread of Hours"},{key:"blueLawsHours",label:"Blue"}],pe=(e,t)=>{const r=bt.filter(({key:o})=>{switch(o){case"doubleOvertimeHours":return e.hasDoubleOT;case"qualifiedOvertime":return e.hasQualifiedOtState;case"spreadOfHours":return e.hasSOH;case"blueLawsHours":return e.hasBlueLaws;case"holidayPay":return e.hasHolidayPay;default:return!1}}),a=yt.filter(({key:o})=>o==="estimatedWages"?t:!0);return[..._t,...r,...a]},fe=(e,t)=>{const r=pe(e,t),a=new Set(["employee","location","shifts"]);return r.filter(o=>!a.has(o.key))},_e=["location","shifts","employee"],Tt=["First Name","Last Name","ID","Payroll ID"],xt=["First Name","Last Name","Location","ID","Payroll ID","Wage Rate","Role"],z=e=>e==null?"":e.toString(),gt=e=>Array.from(new Set(e.map(r=>r.payrollId).filter(r=>r!=null&&r!==""))).join(" | "),ye=(e,t)=>{const r=e?.format(C("parsable_dashed")),a=t?.format(C("parsable_dashed"));return`${r} to ${a}`},be=(e,t)=>
1e.flatMap(({label:a,key:o})=>{const n=o==="estimatedWages"?"Pay Total":a;return o==="variance"&&t.hasBreakPenalty?["Penalty",n]:o==="creditTips"?[n,"Total Tips"]:[n]}),Ot=({sortedData:e,dateRange:t,locationSettings:r,canViewWages:a})=>{const o=fe(r,a).filter(p=>!_e.includes(p.key)),n=be(o,r),i=[...Tt,...n],l=["Payroll Period",ye(t?.startDate,t?.endDate),...Array(i.length-2).fill("")],d=e.map(p=>{const{user:m,formattedTotals:_}=p,h=_||p.jobs[0]?.formatted;if(!h)return null;const y=gt(p.jobs),x=[m.firstName||"",m.lastName||"",m.id.toString(),y||""],b=o.flatMap(E=>{const T=z(h[E.key]);return E.key==="variance"&&r.hasBreakPenalty?[z(h.breakPenalty),T]:E.key==="creditTips"?[T,z(h.totalTips)]:[T]});return[...x,...b]}).filter(p=>p!==null);return[l,i,...d]},Ct=({dateRange:e,locationSettings:t,canViewWages:r})=>{const a=fe(t,r).filter(l=>!_e.includes(l.key)),o=be(a,t),n=[...xt,...o];return[["Payroll Period",ye(e?.startDate,e?.endDate),...Array(n.length-2).fill("")],n]},Et=new Intl.Collator(void 0,{usage:"sort",sensitivity:"base",ignorePunctuation:!0,numeric:!1}),oe=(e,t)=>e===""&&t===""?0:e===""?-1:t===""?1:Et.compare(e,t),Dt=({data:e,sortOrder:t})=>{if(!e?.length)return e;const r=t==="first_name"?"firstName":"lastName",a=r==="firstName"?"lastName":"firstName";return[...e].sort((o,n)=>{const i=o.user?.[r]??"",l=n.user?.[r]??"",d=oe(i,l);if(d)return d;const p=o.user?.[a]??"",m=n.user?.[a]??"",_=oe(p,m);return _||o.user.id-n.user.id})},Te=["scheduledHours","paidHours","actualHours","regularHours","overtimeHours","doubleOvertimeHours","unpaidBreaksHours","qualifiedOvertime","breakPenalty","timeOffHours","spreadOfHours","blueLawsHours","variance","holidayPay"],xe=["estimatedWages","cashTips","creditTips","totalTips"],vt=[...Te,...xe],St=e=>({hasOvertimes:e.overtimeHours>0,hasDoubleOvertimes:e.doubleOvertimeHours>0,hasQualifiedOvertime:e.qualifiedOvertime>0}),ge=e=>({...e,...St(e)}),kt=e=>e.toFixed(2),Ht=e=>{const t={estimatedWages:e.costs,regularHours:e.regular_hours,overtimeHours:e.regular_overtime_hours,doubleOvertimeHours:e.combined_double_overtime_hours,qualifiedOvertime:e.qualified_overtime_hours,paidHours:e.paid_hours,scheduledHours:e.scheduled_hours,unpaidBreaksHours:e.unpaid_breaks_hours,breakPenalty:e.break_penalty_hours,timeOffHours:e.regular_time_off_hours+e.sick_time_hours,actualHours:e.worked_hours,cashTips:e.cash_tips,creditTips:e.credit_tips,totalTips:e.cash_tips+e.credit_tips,spreadOfHours:e.spread_of_hours,blueLawsHours:e.blue_law_hours,variance:e.paid_hours>0?e.paid_hours-e.scheduled_hours:0,holidayPay:e.holiday_pay_hours};return ge(t)},Pt=(e,t,r)=>({...Ht(e),shifts:t,timecards:r,missedShifts:r<t}),le=(e,t=[])=>{const r={};return Te.forEach(a=>{r[a]=e[a]!=null?kt(e[a]):"0"}),xe.forEach(a=>{r[a]=e[a]!=null?Re(e[a]):"$0.00"}),r.hasOvertimes=e.hasOvertimes,r.hasDoubleOvertimes=e.hasDoubleOvertimes,r.hasQualifiedOvertime=e.hasQualifiedOvertime,t.forEach(a=>{r[a]!==void 0&&delete r[a]}),r},Nt=(e,t)=>{const r={...e};return vt.forEach(a=>{r[a]=(e[a]??0)+(t[a]??0)}),ge(r)},It=(e,t)=>{const r=Nt(e,t),a=e.shifts+t.shifts,o=e.timecards+t.timecards;return{...r,shifts:a,timecards:o,missedShifts:o<a}},wt=e=>e?.users?.length?e.users.map(t=>{const r=Array.from(new Set(t.jobs.map(i=>i.payroll_id).filter(i=>i!=null&&i!==""))),a=t.jobs.map(i=>{const l=Pt(i.labor_totals,i.shifts_count,i.timecards_count);return{userId:t.id,userName:t.full_name,jobId:i.id,locationId:i.location_id,payrollId:i.payroll_id,parsed:l,formatted:le(l)}}).filter(i=>i.parsed.actualHours>0||i.parsed.paidHours>0);a.length>0&&r.length>0&&(a.some(l=>l.payrollId!=null&&l.payrollId!=="")||(a[0].payrollId=r.join(" | ")));const n=a.length>1?a.reduce((i,{parsed:l})=>i?It(i,l):l,void 0):void 0;return{user:{id:t.id,name:t.full_name,firstName:t.first_name,lastName:t.last_name},jobs:a,totals:n,formattedTotals:n?le(n):void 0}}).filter(t=>t.jobs.length>0):null,At=e=>({employee:t=>t.userName,location:t=>e[t.locationId]||"",shifts:t=>s.jsx("span",{className:t.parsed.missedShifts?f("flag"):"",children:`${t.parsed.timecards}/${t.parsed.shifts}`}),scheduledHours:t=>t.formatted.scheduledHours,actualHours:t=>t.formatted.actualHours,variance:t=>t.formatted.variance,unpaidBreaksHours:t=>t.formatted.unpaidBreaksHours,timeOffHours:t=>t.formatted.timeOffHours,paidHours:t=>t.formatted.paidHours,regularHours:t=>t.formatted.regularHours,overtimeHours:t=>s.jsx("span",{className:t.parsed.hasOvertimes?f("flag"):"",children:t.formatted.overt
1imeHours}),doubleOvertimeHours:t=>s.jsx("span",{className:t.parsed.hasDoubleOvertimes?f("flag"):"",children:t.formatted.doubleOvertimeHours}),qualifiedOvertime:t=>s.jsx("span",{className:t.parsed.hasQualifiedOvertime?f("flag"):"",children:t.formatted.qualifiedOvertime}),spreadOfHours:t=>t.formatted.spreadOfHours,blueLawsHours:t=>t.formatted.blueLawsHours,holidayPay:t=>t.formatted.holidayPay,cashTips:t=>t.formatted.cashTips,creditTips:t=>t.formatted.creditTips,estimatedWages:t=>t.formatted.estimatedWages}),jt=({row:e,cols:t,isFirstForUser:r,userJobCount:a,cellRenderers:o,currentDateRange:n})=>{const i=ne(),l=c.useCallback(()=>{if(!n?.startDate||!n?.endDate)return;i(Be(!0));const d=n.startDate.format(C("parsable_date")),p=n.endDate.format(C("parsable_date")),m=encodeURIComponent(d),h=`/timesheets/pay_period_review?endDate=${encodeURIComponent(p)}&filter=${e.jobId}&groupBy=employee&startDate=${m}`;window.location.href=h},[n,e.jobId,i]);return s.jsxs("tr",{className:f("row"),children:[r&&s.jsx("td",{className:f("employee-cell",{employee:!0}),rowSpan:a,children:s.jsx("div",{className:f("employee-info"),children:s.jsx("span",{className:f("employee-name"),children:e.userName})})}),t.filter(d=>d.key!=="employee").map(d=>s.jsx("td",{className:f("data-cell",{[d.key]:!0}),onClick:l,children:o[d.key]?.(e)??null},d.key))]})},Mt=({key:e,formatted:t})=>t[e]??null,Lt=(e,t,r)=>e.getTotal?e.getTotal({formatted:t,totals:r}):Mt({key:e.key,formatted:t}),Rt=({totals:e,formatted:t,cols:r})=>{const a=r.filter(o=>o.key!=="employee");return s.jsx("tr",{className:f("total-row"),children:a.map(o=>o.key==="location"?s.jsx("td",{className:f("total-label-cell",{location:!0}),children:"Total"},"total-label"):s.jsx("td",{className:f("total-data-cell",{[o.key]:!0}),children:Lt(o,t,e)},o.key))})},Oe=({data:e,locationSettings:t,canViewWages:r,locationNamesMap:a,currentDateRange:o})=>{const n=c.useMemo(()=>pe(t,r),[t,r]),i=c.useMemo(()=>At(a),[a]);return s.jsx("div",{className:f("container"),children:s.jsxs("table",{className:f("table"),children:[s.jsx("thead",{children:s.jsx("tr",{children:n.map(l=>s.jsx("th",{className:f("header-cell",{[l.key]:!0}),children:l.label},l.key))})}),s.jsx("tbody",{children:e.map(l=>{const d=l.jobs.length,m=d>1&&l.totals&&l.formattedTotals,_=m?d+1:d;return s.jsxs(c.Fragment,{children:[l.jobs.map((h,y)=>s.jsx(jt,{row:h,cols:n,isFirstForUser:y===0,userJobCount:_,cellRenderers:i,currentDateRange:o},`${h.userId}-${h.jobId}`)),m&&s.jsx(Rt,{totals:l.totals,formatted:l.formattedTotals,userName:l.user.name,cols:n},`total-${l.user.id}`)]},l.user.id)})})]})})},Ce=()=>s.jsx(O,{hcenter:!0,vcenter:!0,minh:"70vh",children:s.jsx(ie,{title:u("company_timesheets_react.no_results_title"),content:u("company_timesheets_react.no_results_content"),illustration:s.jsx($e,{w:140})})}),Ee=[{value:"first_name",label:u("company_timesheets_react.first_name")},{value:"last_name",label:u("company_timesheets_react.last_name")}],Bt=2,De=()=>{const[e,t]=c.useState([]),[r,a]=c.useState(!0),o=k(We),n=k(Ye);c.useEffect(()=>{if(!o){a(!1);return}(async()=>{try{a(!0);const h=I(),y=h.clone().subtract(Bt,"months").format(ae),x=h.format(ae),b=await B(`/locations/payroll_periods?start_date=${y}&end_date=${x}`);t(b)}catch{$.error(u("errors.generic"))}finally{a(!1)}})()},[o]);const i=[Fe(),Ue(),Ke(),qe()],l=()=>{const _=e[0],h=[{label:u("company_timesheets_react.current_pay_period"),startDate:I(_.start_date,C("parsable_date")),endDate:I(_.end_date,C("parsable_date"))}];if(e.length>=2){const y=e[1];h.push({label:u("company_timesheets_react.previous_pay_period"),startDate:I(y.start_date,C("parsable_date")),endDate:I(y.end_date,C("parsable_date"))})}return h},d=o&&e.length?[...l(),...i]:i,p=u(n?"fe_design_base.range_picker.custom_preset_text.month_max":"fe_design_base.range_picker.custom_preset_text.past_three_months"),m=n?void 0:mt(ht(),Ve*-1);return{presets:d,loadingPayrollPeriods:r,customPresetText:p,blockDatesBefore:m}},ve=({onRetrieve:e})=>s.jsx(O,{hcenter:!0,vcenter:!0,minh:"70vh",children:s.jsx(ie,{title:u(e?"company_timesheets_react.empty_state_title":"company_timesheets_react.zero_state_title"),content:u(e?"company_timesheets_react.empty_state_content":"company_timesheets_react.zero_state_content"),illustration:s.jsx(ft,{w:140}),action:e&&s.jsx(W,{onClick:e,children:u("company_timesheets_react.retrieve_timesheets")})})}),$t=({dateRange:e,onDateRangeChange:t,onRetrieveTimesheets:r,sortBy:a,onSortByChange:o,onExport:n,hasData:i,hasEmptyResults:l,timesheetData:d,sortedData:p,locationSettings:m,canViewWages:_,locationNamesMap:h,isLoadingLocations:y,isRetrieving:x,dialogs:b})=>{const{presets:E,loadingPayrollPeriods:T,customPresetText:D,blockDates
1Before:P}=De(),w=c.useCallback(v=>{t(v),r(v.startDate,v.endDate)},[t,r]),N=c.useCallback(v=>{o(v.target.value)},[o]),A=c.useCallback(()=>{r(e.startDate,e.endDate)},[r,e.startDate,e.endDate]),j=T||y||x;return s.jsx(Q,{title:u("company_timesheets_react.title"),actions:s.jsx(W,{disabled:!i||x,onClick:n,children:u("actions.export")}),dialogs:b,children:s.jsx(Q.FullWidth,{toolbar:s.jsx(Q.Toolbar,{filters:s.jsx(me,{name:"rangepicker",startOfWorkWeek:0,startDate:e.startDate,endDate:e.endDate,onApplyRange:w,disabled:x,maxRange:he,customPresetText:D,blockDatesBefore:P,presets:E}),viewOptions:s.jsx(O,{minw:130,maxw:200,children:s.jsx(de,{name:"sortBy",options:Ee,value:a,onChange:N,disabled:!i||x})})}),children:j?s.jsx(O,{hcenter:!0,vcenter:!0,minh:"70vh",children:s.jsx(ce,{variant:"dark",size:"large"})}):s.jsxs(s.Fragment,{children:[!d&&s.jsx(ve,{onRetrieve:A}),l&&s.jsx(Ce,{}),i&&p&&s.jsx(Oe,{data:p,locationSettings:m,canViewWages:_,locationNamesMap:h,currentDateRange:e})]})})})},H="company_timesheets_react.export_modal",Wt=[{primary:u(`${H}.list_item_1`)},{primary:u(`${H}.list_item_2`)}],Yt=({onClose:e,isOpen:t,onExportSummary:r,onExportByLocations:a,isExportingSummary:o,isExportingByLocations:n})=>{const i=c.useCallback(l=>l.exportType==="summary"?r():a(),[r,a]);return s.jsx(Je,{open:t,onClose:e,title:u(`${H}.title`),width:600,children:()=>s.jsx(Qe,{initialValues:{exportType:"summary"},onSubmit:i,children:({submitForm:l})=>{const d=o||n;return s.jsx(ze,{children:s.jsxs(O,{column:!0,gap:16,children:[s.jsx(ue,{children:u(`${H}.subtitle`)}),s.jsx(Xe,{data:Wt,asHTML:!0}),s.jsxs(Ge,{name:"exportType",label:u(`${H}.choose_type`),children:[s.jsx(te,{value:"summary",label:u(`${H}.company_summary`)}),s.jsx(te,{value:"byLocations",label:u(`${H}.by_locations`)})]}),s.jsx(Ze,{buttons:[{label:u(`${H}.export_timesheets`),variant:"primary",onClick:l,isLoading:d},{label:u("actions.cancel"),variant:"tertiary",onClick:e,disabled:d}]})]})})}})})},Ft=({dateRange:e,onDateRangeChange:t,onRetrieveTimesheets:r,sortBy:a,onSortByChange:o,shouldDisableActions:n,onExport:i,isLoadingLocations:l=!1})=>{const[d,p]=c.useState(!1),m=!et(),{presets:_,loadingPayrollPeriods:h,customPresetText:y,blockDatesBefore:x}=De();c.useEffect(()=>{if(h||l){const D=setTimeout(()=>{p(!0)},5e3);return()=>clearTimeout(D)}p(!1)},[h,l]);const b=c.useCallback(D=>{t(D)},[t]),E=c.useCallback(D=>{const P=D.target.value;o(P)},[o]),T=c.useCallback(()=>{r(e.startDate,e.endDate)},[r,e.startDate,e.endDate]);return h||l?s.jsx(O,{h:"100vh",hcenter:!0,vcenter:!0,children:s.jsxs(O,{column:!0,gap:16,hcenter:!0,vcenter:!0,children:[s.jsx(ce,{variant:"dark",size:"large"}),d&&s.jsx(ue,{variant:"heading4",children:u("company_timesheets_react.slow_load_message")})]})}):s.jsxs(O,{spacebetween:!m,column:m,gap:8,children:[s.jsxs(O,{flex:!0,column:m,gap:8,hcenter:m,children:[s.jsx(me,{name:"rangepicker",startOfWorkWeek:0,startDate:e.startDate,endDate:e.endDate,onApplyRange:b,maxRange:he,customPresetText:y,blockDatesBefore:x,presets:_}),s.jsx(W,{size:m?"medium":"small",fullWidth:m,onClick:T,children:u("company_timesheets_react.retrieve_timesheets")})]}),s.jsxs(O,{flex:!0,column:m,gap:8,children:[s.jsx(W,{size:m?"medium":"small",variant:"secondary",disabled:n,onClick:i,children:u("actions.export")}),s.jsx(O,{minw:130,maxw:m?"100%":200,children:s.jsx(de,{name:"sortBy",options:Ee,value:a,onChange:E,disabled:n})})]})]})},R=(e,t)=>{pt({productArea:Me.COMPANY_TIMESHEETS,eventCategory:e,eventAction:t,actionType:Le.CLICK})},Ut="company-timesheets-summary.csv",es=()=>{const e=ne(),[t,r]=c.useState(null),[a,o]=c.useState({startDate:re(0).startOf("week"),endDate:re(0).endOf("week")}),[n,i]=c.useState(()=>Ne("CompanyTimesheetsOrder")||"first_name"),[l,d]=c.useState(!1),[p,m]=c.useState(!1),[_,h]=c.useState(!1),[y,x]=c.useState(!1),b=k(tt,Pe),E=k(st),T=k(at),D=k(rt),P=k(ot),w=k(lt),N=k(nt);c.useEffect(()=>{e(it())},[e]);const A=c.useCallback(g=>{o({startDate:g.startDate,endDate:g.endDate})},[]),j=c.useCallback(async(g,F)=>{if(!y){D||e(ct({minTier:P,feature:"timesheet_approval_repackaging_1",locationProperty:void 0,serverKey:void 0,mppFocusViewProps:{focusedFeature:"laborCostManagement"}})),R(L.RETRIEVE_COMPANY_TIMESHEETS_DATE_RANGE,M.RETRIEVE_COMPANY_TIMESHEETS_DATE_RANGE_CLICKED);try{N?x(!0):dt();const U=g?.format(C("parsable_date")),K=F?.format(C("parsable_date")),{batch_id:q,cache_key:V}=await B(`/timesheets/company/generate_totals?start_date=${U}&end_date=${K}`);await se(q);
1const J=await B(`/timesheets/company/fetch_totals?cache_key=${V}`);r(J)}catch{$.error(u("errors.generic"))}finally{N?x(!1):ut()}}},[D,e,P,N,y]),v=c.useMemo(()=>wt(t),[t]),S=c.useMemo(()=>v?.length?Dt({data:v,sortOrder:n}):v,[v,n]),X=t&&(!S||S.length===0),Y=S&&S.length>0,G=c.useCallback(g=>{i(g),Ie("CompanyTimesheetsOrder",g)},[]),Se=c.useCallback(()=>{d(!1)},[]),Z=c.useCallback(()=>{R(L.EXPORT_COMPANY_TIMESHEETS,M.EXPORT_COMPANY_TIMESHEETS_CLICKED),d(!0)},[]),ke=c.useCallback(async()=>{if(R(L.DOWNLOAD_COMPANY_TIMESHEETS,M.DOWNLOAD_COMPANY_TIMESHEETS_SUMMARY_CLICKED),!!S?.length){m(!0);try{const g=Ot({sortedData:S,dateRange:a,locationSettings:b,canViewWages:T});await we(g,Ut),d(!1)}catch{$.error(u("errors.generic"))}finally{m(!1)}}},[S,a,b,T]),He=c.useCallback(async()=>{R(L.DOWNLOAD_COMPANY_TIMESHEETS,M.DOWNLOAD_COMPANY_TIMESHEETS_BY_LOCATION_CLICKED),h(!0);try{const g=a?.startDate?.format(C("parsable_date")),F=a?.endDate?.format(C("parsable_date")),{batch_id:U,cache_key:K}=await B(`/timesheets/generate_role_totals?start_date=${g}&end_date=${F}`);await se(U);const[q,V]=Ct({dateRange:a,locationSettings:b,canViewWages:T}),J=await Ae("/timesheets/generate_company_csv",{cache_key:K,header:q,columns:V,sort_by:n});window.location.href=je(`/csv_open/${J.id}.csv`),d(!1)}catch{$.error(u("errors.generic"))}finally{h(!1)}},[a,b,T,n]),ee=s.jsx(Yt,{onClose:Se,isOpen:l,onExportSummary:ke,onExportByLocations:He,isExportingSummary:p,isExportingByLocations:_});return N?s.jsx($t,{dateRange:a,onDateRangeChange:A,onRetrieveTimesheets:j,sortBy:n,onSortByChange:G,onExport:Z,hasData:!!Y,hasEmptyResults:!!X,timesheetData:t,sortedData:S,locationSettings:b,canViewWages:T,locationNamesMap:E,isLoadingLocations:w==="loading",isRetrieving:y,dialogs:ee}):s.jsxs(s.Fragment,{children:[s.jsxs(O,{column:!0,gap:16,p:16,children:[s.jsx(Ft,{dateRange:a,onDateRangeChange:A,onRetrieveTimesheets:j,sortBy:n,onSortByChange:G,shouldDisableActions:!Y,onExport:Z,isLoadingLocations:w==="loading"}),!t&&s.jsx(ve,{}),X&&s.jsx(Ce,{}),Y&&s.jsx(Oe,{data:S,locationSettings:b,canViewWages:T,locationNamesMap:E,currentDateRange:a})]}),ee]})};export{es as default};
2//# sourceMappingURL=index-chunk-CVnp7Egn.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.