PageSourceSearch

https://cdn.joinhomebase.com/assets/TimesheetsPage-chunk-yH7qeytp.js

js joinhomebase.com collected 2026-09-24 08:34:02 UTC 214,751 bytes, 2 lines download raw bytes

1import{jsxRuntimeExports as e,reactExports as a,React as Ro}from"./react-core-chunk-B2r03cU8.js";import{useDispatch as z,useSelector as j,connect as W,PropTypes as p,propTypesExports as Rt}from"./redux-core-chunk-DgWMjMkF.js";import{PRODUCT_AREAS as me,TRACK_ACTION_TYPES as w,EVENT_ACTIONS as A,EVENT_CATEGORIES as be,putJSON as le,datadogLogError as Ka,TRACK_STARTING_PATHS as Ua,getIsEmbedded as No,fetchJSON as Xs,getConfig as $a}from"./app-bundle-B0YfsjKz.js";import{Box_default as l,Text_default as E,Button_default as L,cxHelpers as D,withUxRoot as ae,useExtendUx as Oe,useIsEmbedded as he,useTrackUxOnMount as lt,actions$3 as Ct,DRAWER_COMPONENTS_NAME as Ft,setTimeSheetsGuidedSetupMaybeLaterInSession as Ao,getMissingClockOutRows as Ha,getUnscheduledShiftRows as Fa,getNoShowRows as Wa,getMissingBreaksRows as Va,isEmpty as Ga,ConfirmationSuccess as Ya,openAddTeamDrawer as za,getDailyReviewDate as xt,showTimecardModal as ue,NoResults as Qs,actions$13 as re,getIssuesFilterOptions as qa,Select_default as Be,getDailyReviewFilters as Wt,getRoleFilterOptions as Vt,getDailyReviewFilterMenuFiltersCount as Za,ContextMenu as Re,useTrackUx as q,Tooltip_default as oe,showTipPoolingTooltip as Ja,EVENT_ACTIONS as B,createOneTimeEvent as ot,hideTipPoolingTooltip as In,DRAWER_COMPONENTS_NAME$1 as Xa,ButtonTarget as Do,Link as Gt,getTimesheetsPageTemplateEnabled as Ke,getEmployeeFilterOptions as Yt,getDailyReviewSortBy as Qa,getDailyReviewViewMenuFiltersCount as el,getDailyReviewEmployeeFilter as tl,Autocomplete_default as zt,DAILY_REVIEW_SORT_BY_OPTIONS as sl,getTimecardReviewAssistantEnabled as pe,updateDate as Lo,IconButton_default as Ee,FDBDatePicker as nl,getDailyReviewFiltersCount as ol,SegmentedPicker_default as Mo,getIsSubscribedToTipPooling$1 as rt,getActiveTipPolicyId as qt,updateTimecardApprovals as Zt,getLockTimesheetPermission as Et,getDailyReviewRowsApprovalStatus as il,getPopulatedRows as al,getTimecardApprovalStatus as Bo,getTimecardLockVisibility as Po,trackTableRowClick as en,ImmutablePropTypes as se,Icon_default as ee,stringToBeTruncated as Jt,Avatar_default as bt,Pill_default as tn,WORKED_CELL_TIME_PLACEHOLDER as qe,TIME_FORMAT as Ce,getDailyReviewRowIds as Ko,getDailyReviewLoading as Xt,getShouldSeeTimesheetsEmptyState as Qt,getCurrentLocationIsCloverEmbedded as yt,getDailyReviewFilteredEmptyState as Uo,getDailyReviewSortedRows as ll,getHighlightedShiftIds as rl,isAfterToday as Tt,flashNotice as ct,PageWithSubcomponents as Le,getShowActionSuccessToastText as cl,getShowActionSuccessToast as dl,Toast as Ps,usePrefersReducedMotion as ul,useLocalStorage as ml,Dialog_default as $o,CircularInfinite_default as dt,DAILY_REVIEW_TABLE_COLUMNS as Ho,updateDailyReviewRow as Ne,SimpleMenuItem_default as J,fixDuplicate as sn,mergeShifts as nn,partial as de,addShiftNoShowReason as _l,timecardModalActions as Fo,NestedMenu_default as on,NO_SHOW_REASONS_LIST as hl,Divider_default as Pe,AlertText_default as Wo,getIssueMessage as pl,getIssueVariant as gl,TIME_PLACEHOLDER as jn,getPayrollIneligibleEmployeesRow as Cl,getDailyReviewRow as xl,showModal as es,PAYROLL_MISSING_DETAILS_MODAL as Vo,getDailyReviewNeedsReviewEmptyState as El,getPayrollIneligibleEmployeesRowIds as bl,getResolveIssuesSidebarDismissed as yl,getDailyReviewHasMissingClockOut as Tl,getDailyReviewHasAssistedClockOut as vl,NavIcon_default as fl,Alert_default as je,uniqueId as kl,useAppDispatch as an,getBreakPenaltyEnabled as Sl,useSpring as Go,animated as Ks,trackUxNavigationEvent as At,EVENT_CATEGORIES as ne,showGoToHomebaseModal as ln,PRODUCT_AREAS as _e,getShowIntroductoryManageTipsButton as Yo,getIsDailyTipOutPolicy as zo,CUSTOM_PAYROLL as Il,LAST_7_DAYS_PAYROLL as rn,parseDate as wn,exceedsMonthLimit as jl,exceedsBasicTierMaxPayrollDays as wl,colors as qo,Box as tt,getCompanyOnboardingSegment as Ol,browserHistory as On,getShowNav as cn,showPPRNav as Zo,CardContainer_default as Jo,Badge_default as dn,showMakeBreaksOptional as Rl,hideMakeBreaksOptional as Nl,getLocationMandatedBreaksMap as Al,dismissMandatedBreak as Dl,turnOffMandatedBreak as Ll,removeIssue as Ml,mandatedBreakText as Cs,dismissMissingBreakIssue as Bl,getRowsWithIssues as Pl,getPayrollNeedsReviewEmployees as Kl,getIsPayrollEnrolled as Ul,getEmployeeSortBy as ts,getEmployees as Xo,sortBy as $l,trackToggleIssuesSlider as Hl,downloadEmployeeTimesheetsPdf as Fl,printTimesheets as Wl,useHistory as Ve,FROM_PAY_PERIOD_REVIEW as un,downloadDetailedTimeCards as Qo,showEmbeddedUpgradePlanModal as ei,EXPORT_PERMISSIONS_MODAL as ti,EVENT_PROPERTY_VALUES as _t,TOOLS_MENU_DROPDOWN_EVENT_PROPERTIES as ce,getPayPeriodReviewHeaderRedesignEnabled as vt,getRolesFilter as ss,FILTERS_MENU_DROPDOWN_EVENT_PROPERTIES as Rn,updateRolesFilter as Vl,fetchTimesheetData as si,getEndDate as Gl,getStartDate as Yl,hasPayrollSettings as ft,getPayrollPeriods$1 as zl,getFeaturePermission as ni,BASIC_TIER_MAX_PAYROLL_DAYS as ql,REGIONS as ke,getEmployeeFilterOptions$1 as mn,getHideWithoutHours as _n,immutableExports as Me,updateFilters as hn,VIEW_MENU_DROPDOWN_EVENT_PROPERTIES as Ze,setSortColumn as ns,getColumnOptions$1 as pn,getPayrollProvider as oi,getCurrentLocation as Zl,getTimesheetsGuidedSetupComplete as os,getGroupKeys as ii,getCollapsedCards as ai,getCompanyHasTimecards as Jl,getPayrollFeatureEnabled as li,importCreditTips as Xl,getEditHistoryEnabled as ri,getCanManageLocation as is,canImportTimecards as ci,canImportCreditTips as Ql,getLoadingTotals as gn,getLoadingRows as Cn,toggleAllCards as di,importTimecards as ui,changeLocationSettings as er,timesheetsHistoryRoute as mi,trackFilterTableClick as tr,ToggleSwitch_default as sr,trackColumnHeaderClick as nr,trackColumnMenuActionClick as or,addQuery as Us,Link_default as xn,TextInput_default as ir,getCompanyIsDemo as ar,Drawer as lr,getSortColumn as rr,getColumns$1 as _i,updateColumn as cr,ROW_MENU_WIDTH as hi,getL
1oadingSummaries as dr,getFooterTotals as ur,getNonExcludedColumns as mr,HIDDEN_FOOTER_COLUMNS as _r,LoadingIndicator as pi,HELP_ARTICLE_URL as hr,showEnforcementDialog as pr,showAddEmployeeModal as gr,selectCanCloseEnforcementDialog as Cr,selectShouldShowEnforcementDialog as xr,MAX_LABEL_LENGTH$1 as Er,MAX_EMPLOYEE_GROUP_WIDTH as br,MAX_EMPLOYEE_GROUP_WIDTH_WITHOUT_ROLE_AND_WAGE as yr,MAX_ROLE_GROUP_WIDTH as Tr,showPhotosModal as vr,toggleMessengerShown as fr,createChannel as kr,getTimecardGroupApprovalStatus as En,getCurrentLocationId as Sr,getMinTierNameForMobileGpsPhotosFeatures as Ir,getTimecardPhotosEnabled as jr,getCurrentUser as wr,trackTableRowHeaderClick as Fe,getLockTimesheetRolePermission as Or,getTimesheetApprovalEnabled as Rr,ASSISTED_STATUSES as Nn,TIMECARD_ISSUE_TYPES as st,Icon as Nr,colors_default as An,FontAwesomeIcon as Ar,faExclamationCircleExports as $e,LEFT_WIDTH as Dr,collapseCard as Lr,getCardIsCollapsed as Mr,getSummaryRow as Br,getColumnExclusions as Pr,filterApprovableRowIds as Kr,getTableData as gi,getCanManageJobs as Ur,hidePPRNav as $r,getTipEngineAlert as Hr,Loader as Dn,getCanManageTimecards as as,getShouldUserSeeTimesheetsZeroState as Ci,getShouldSeeEmbeddedCTA as ls,getLoadingInitData as Fr,getSubmissionDeadlineAdjustedBanner as Wr,getLocationEmployees as Vr,getChangedShiftId as Gr,GROUP_BY_OPTIONS as Yr,fetchInitData as zr,changeEmployeeSortBy as qr,fetchInitData$2 as Zr,setCustomTimingObject as Jr,updateRow as Xr,getHasTimeCards as Qr,MediaQuery as ec,TS_TIMING_EVENTS as tc,showSetupPayrollPeriodModal as sc,cxFunction as nc,Tabs as oc,Tab as ic,getDailyReviewIssuesCount as ac,getResolveIssuesSidebarOpen as lc,getShowTimecardChangesSavedToast as rc,getShowTipChangesAlert as cc,getDailyReviewGuidedTimesheetsTooltipCompleted as dc,getCurrentUserIsArchived as uc,getUrlQuery as mc,closeTimecardChangesSavedToast as _c,dismissTipC
1hangesAlert as hc,fetchDailyReviewLocationData as pc,updateExperiments as gc,getTimesheetsTabValueFromUrl as Cc,TIMESHEETS_TAB as Se}from"./app-init-chunk-kk_CZVyp.js";import xc from"./index-chunk-Dm7vARDZ.js";import{SquareClock as Ec}from"./SquareClock-chunk-BNfg_vtY.js";import{EVENT_CATEGORIES as xi,PRODUCT_AREAS as bc}from"./tracking_constants-chunk-CIF6HT0Y.js";import{SidePanelRoot as ht}from"./Root-chunk-CMZsAsue.js";import{CloverFooter as Dt}from"./CloverFooter-chunk-CCp4Qhq6.js";import{toI18n as c,formatDate as yc,isFutureDate as Tc,addDays as $s,momentDate as Hs,moment as te,df as Fs,STANDARD_DATE_FORMAT as vc,momentInZone as Ws,isValidDate as Ln,momentWithCustomLocale as Je,getNow as fc,hooks as Lt,trackUxEvent as we}from"./tracking-chunk-Cdw_Cfie.js";import{Table as kc}from"./Table-chunk-BSfOEM21.js";import{FilterRoles as rs,FilterEmployee as bn}from"./FilterRoles-chunk-CW8ltcML.js";import{AssistedClockInTooltip as Ei,AssistedClockOutTooltip as bi,AutoClockOutTooltip as yi,AssistedClockOutIndicator as Sc,BackToTimesheets as Ic}from"./BackToTimesheets-chunk-BMyQ6n4U.js";import{CelebrateGeneric as jc}from"./CelebrateGeneric-chunk-BDvlcAjo.js";import{NavIcon as wc}from"./NavIcon-chunk-D2Ex4SW5.js";import{TimePicker as Oc}from"./TimePicker-chunk-5rnNyw1v.js";import{useUrlQuery as cs}from"./useUrlQuery-chunk-BQ4UxcVL.js";import{FooterComponent as Rc}from"./FooterComponent-chunk-CFv7UKha.js";import{GrowMoney as Nc}from"./GrowMoney-chunk-jI-hSJUf.js";import{FDBRangePicker as Ac}from"./FDBRangePicker-chunk-DwngoN0y.js";import{CUSTOM_PRESET_TEXT as Dc,ONE_MONTH_MAX as Lc}from"./CommonPresetConstants-chunk-BNvXgbB8.js";import{ColumnsSelect as Mc}from"./ColumnsSelect-chunk-e4kO4SKJ.js";import{Collapse as Bc}from"./Collapse-chunk-Ci8jfmuD.js";import{EnforcementTooltip as Pc}from"./EnforcementTooltip-chunk-DsJg0IMK.js";import{faCheckExports as Kc}from"./faCheck-chunk-9hfH_rtE.js";import{TipEngineErrorAlertComponent as Uc}from"./TipEngineErrorAlertComponent-chunk-CzHaND5v.js";import{withCx as $c}from"./withCx-chunk-2ED4uz6s.js";try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="c3dd3c8a-31b3-4927-a926-9edb604a737b",t._sentryDebugIdIdentifier="sentry-dbid-c3dd3c8a-31b3-4927-a926-9edb604a737b")})()}catch{}const{cxEl:De}=D("ZeroEmptyState"),yn=({image:t,header:s,body:n,emptyState:o,primaryCTA:i,secondaryCTA:d,primaryStartIcon:r})=>e.jsx(l,{className:De("wrapper",o?"empty-state":"zero-state"),justifyContentCenter:!0,alignItemsCenter:!0,children:e.jsxs(l,{column:!0,justifyContentCenter:!0,alignItemsCenter:!0,mb:40,className:De("component-wrapper"),absolute:!0,p:24,children:[t,e.jsxs(l,{column:!0,hcenter:!0,className:De("content"),mt:16,children:[e.jsx(E,{variant:"heading2",className:De("title"),children:s}),e.jsx(l,{mb:24,mt:8,children:e.jsx(E,{className:De("body"),textAlign:"center",children:n})}),e.jsxs(l,{className:De("button-wrapper"),column:!0,justifyContentCenter:!0,alignItemsCenter:!0,children:[e.jsx(L,{size:"medium",startIcon:r?"Add":void 0,variant:"primary",className:De("cta"),onClick:i.handleClickPrimaryCTA,"data-testId":"primary-cta",uxElement:i.uxElement,children:i.text}),e.jsx(l,{mt:8,children:e.jsx(L,{size:"medium",variant:"tertiary",className:De("secondaryCTA"),onClick:d.handleClickSecondaryCTA,"data-testId":"secondary-cta",uxElement:d.uxElement,children:d.text})})]})]})]})}),{cx:Hc}=D("ZeroState"),{TIME_CLOCK_DRAWER:Fc}=Ft,{TIMESHEETS:Wc}=me,{TIMESHEETS_ZERO_STATE:Vc}=xi,{PAGE_VIEWED:Gc}=A,{VIEW:Yc}=w,zc=()=>{const t=Oe(),s=he();t({first_time_use:!0});const n=z();lt(Gc,Yc);const o=a.useCallback(()=>{n(Ct.openBottomDrawer({drawerType:Fc}))},[n]),i=a.useCallback(()=>{n(Ao())},[n]);return e.jsxs(l,{column:!0,spacebetween:!0,children:[e.jsxs(l,{ph:32,gap:21,bgcolor:"mono100",className:Hc(),children:[e.jsx(l,{pb:12,pt:16,children:e.jsx(E,{variant:"heading1",children:c("timesheets.tab_menu.title")})}),e.jsx(yn,{image:e.jsx(Ec,{w:284}),header:c("ftu_timesheets.zero_state.header"),body:c("ftu_timesheets.zero_state.body"),primaryCTA:{text:c("ftu_timesheets.zero_state.primary_cta"),uxElement:"set_up_my_time_clock",handleClickPrimaryCTA:o},secondaryCTA:{text:c("ftu_timesheets.zero_state.secondary_cta"),uxElement:"set_up_later",handleClickSecondaryCTA:i}})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx(Dt,{productArea:"timesheets"}),e.jsx(ht,{})]})]})},qc=ae({productArea:Wc,eventCategory:Vc}
1)(zc),ds=()=>{const t=j(Ha),s=j(Fa),n=j(Wa),o=j(Va),i=t.length+s.length+n.length+o.length;return{missingClockOutRows:t,unscheduledShiftRows:s,noShowRows:n,missingBreaksRows:o,issuesCount:i,hasIssues:i>0}},{cxEl:He}=D("CloverZeroEmptyState"),Ti=({image:t,header:s,body:n,primaryCTA:o,secondaryCTA:i})=>e.jsx(l,{className:He("wrapper"),justifyContentCenter:!0,alignItemsCenter:!0,children:e.jsxs(l,{column:!0,justifyContentCenter:!0,alignItemsCenter:!0,mb:40,className:He("component-wrapper"),absolute:!0,p:24,children:[t,e.jsxs(l,{column:!0,hcenter:!0,mt:40,children:[e.jsx(E,{variant:"heading3",color:"mono900",className:He("title"),children:s}),e.jsx(l,{mb:24,mt:8,children:e.jsx(E,{className:He("body"),color:"mono700",textAlign:"center",children:n})}),e.jsxs(l,{className:He("button-wrapper"),column:!0,justifyContentCenter:!0,alignItemsCenter:!0,children:[e.jsx(L,{variant:"primary",className:He("cta"),onClick:o.handleClickPrimaryCTA,"data-testId":"primary-cta",uxElement:o.uxElement,children:o.text}),!Ga(i)&&e.jsx(l,{mt:8,children:e.jsx(L,{size:"medium",variant:"tertiary",className:He("secondaryCTA"),onClick:i.handleClickSecondaryCTA,"data-testId":"secondary-cta",uxElement:i.uxElement,children:i.text})})]})]})]})}),{cx:Zc}=D("FTUDailyReviewTabEmptyState"),Jc=()=>{const t=Oe(),s=a.useCallback(()=>{window.location.href="/clover/embedded/timesheets/step2?isFullScreenModal=true&calledfrom=dailyreview"},[]);return t({is_clover_embedded:!0}),lt(A.PAGE_VIEWED,w.VIEW),e.jsx(l,{ph:32,gap:21,bgcolor:"mono0",className:Zc(),children:e.jsx(Ti,{image:e.jsx(Ya,{w:120}),header:c("clover_embedded.timesheets.ftu_screen.daily_review.header"),body:c("clover_embedded.timesheets.ftu_screen.daily_review.body"),primaryCTA:{text:c("clover_embedded.timesheets.ftu_screen.daily_review.primary_cta"),uxElement:"connect_my_timeclock",handleClickPrimaryCTA:s}})})},Mt=ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS_DAILY_REVIEW_EMPTY_STATE})(Jc),Xc="https://cdn.joinhomebase.com/assets/shifts_bars-bundle-D8U-qfcm.png";var Qc=t=>e.jsx(l,{w:72,...t,minw:72,className:`FDBIllustration${t?.className?` ${t.className}`:""}`,children:e.jsx("img",{src:Xc,style:{width:"100%"},alt:"Shift Bars Illustration"})});const{cx:ed}=D("FTUDailyReviewTabEmptyState"),{TIME_PAY_CARD:td}=Ft,sd=({openBottomDrawer:t,openTeamDrawer:s,bgcolor:n="mono100"})=>{const o=a.useCallback(()=>{t({drawerType:td})},[t]),i=a.useCallback(()=>{s({calledFrom:"daily_review_ftu__empty_state"})},[s]);return Oe()({first_time_use:!0}),lt(A.PAGE_VIEWED,w.VIEW),e.jsx(l,{ph:"xl",gap:21,bgcolor:n,className:ed(),children:e.jsx(yn,{image:e.jsx(Qc,{w:284}),header:c("ftu_timesheets.daily_review_empty_state.header"),body:c("ftu_timesheets.daily_review_empty_state.body"),emptyState:!0,primaryCTA:{text:c("ftu_timesheets.daily_review_empty_state.primary_cta"),uxElement:"preview_clocking_in",handleClickPrimaryCTA:o},secondaryCTA:{text:c("ftu_timesheets.daily_review_empty_state.secondary_cta"),uxElement:"invite_my_team",handleClickSecondaryCTA:i}})})},Bt=W(()=>({}),{openBottomDrawer:Ct.openBottomDrawer,openTeamDrawer:za})(ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS_DAILY_REVIEW_EMPTY_STATE})(sd));function nd({variant:t="primary",date:s,openTimecardModal:n}){const o=a.useCallback(()=>{n(null,null,{date:yc(s,"parsable_date")},{context:"dailyReview"})},[n,s]);return Tc(s)?null:e.jsx(L,{startIcon:"Add",variant:t,dataTestId:"add_timecard",onClick:o,children:c("timesheets.daily_review.empty_state.button")})}const pt=W(t=>({date:xt(t)}),{openTimecardModal:ue})(nd);function Vs(){return e.jsx(l,{column:!0,alignItemsCenter:!0,w:"100%",pv:64,children:e.jsxs(l,{column:!0,alignItemsCenter:!0,w:440,children:[e.jsx(Qs,{w:120,h:120}),e.jsxs(l,{pv:32,column:!0,alignItemsCenter:!0,gap:8,children:[e.jsx(E,{variant:"heading3",children:c("timesheets.daily_review.empty_state.title")}),e.jsx(E,{variant:"body",color:"mono700",children:c("timesheets.daily_review.empty_state.subtitle")})]}),e.jsx(pt,{})]})})}const Gs=()=>{const t=z(),s=a.useCallback(()=>{t(re.setFilters({employee:null,roles:[],issues:[]}))},[t]);return e.jsx(l,{column:!0,alignItemsCenter:!0,w:"100%",pv:64,children:e.jsxs(l,{column:!0,alignItemsCenter:!0,w:440,children:[e.jsx(Qs,{w:120,h:120}),e.jsxs(l,{mt:40,column:!0,alignItemsCenter:!0,gap:8,w:400,children:[e.jsx(E,{variant:"heading3",textAlign:"center",children:c("timesheets.daily_review.filtered_empty_state.t
1itle")}),e.jsx(E,{variant:"body",color:"mono700",textAlign:"center",children:c("timesheets.daily_review.filtered_empty_state.subtitle")})]}),e.jsx(l,{pt:24,children:e.jsx(L,{variant:"primary",onClick:s,dataTestId:"clear_filters",children:c("timesheets.daily_review.filtered_empty_state.button")})})]})})},{cx:xs}=D("FilterIssues"),od=({issuesOptions:t,currentIssuesFilterValue:s,setFilters:n,labelLeft:o=!1})=>{const[i,d]=a.useState(s||[]);a.useEffect(()=>{d(s)},[s]);const r=a.useCallback(h=>{d(h.target.value)},[d]),m=a.useCallback(()=>{n({issues:i})},[n,i]),u=a.useCallback(()=>{d(s)},[d,s]),_=e.jsx(Be,{name:"issues",options:t,onApply:m,onCancel:u,onChange:r,multiple:!0,menuMaxHeight:600,value:i,showApplyActions:!0,displayAsText:!0,placeholder:c("timesheets.daily_review.filter.issues_placeholder")});return o?e.jsxs(l,{row:!0,vcenter:!0,gap:"xs",justifyContentSpaceBetween:!0,className:xs("wrapper"),"data-testid":"issues-filter",children:[e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.daily_review.filter.issues")}),e.jsx(l,{minw:188,children:_})]}):e.jsx(l,{className:xs("wrapper"),children:e.jsxs(l,{grow:!0,className:xs("inner-wrapper"),w:340,"data-testid":"issues-filter",children:[e.jsx(l,{mb:"xs",tleft:!0,children:e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.daily_review.filter.issues")})}),_]})})},vi=W(t=>({issuesOptions:qa(t)}))(od),fi=()=>{const t=z(),[s,n]=a.useState(null),o=!!s,i=j(Wt),d=j(Vt),r=j(Za),m=a.useCallback(h=>{n(h.currentTarget)},[]),u=a.useCallback(()=>{n(null)},[]),_=a.useCallback(h=>{t(re.setFilters(h))},[t]);return e.jsxs(l,{children:[e.jsx(L,{variant:"tertiary",size:"medium",onClick:m,endIcon:"CaretDown",dataTestId:"daily-review-filters-menu-button",children:r>0?c("timesheets.filters_menu.title_with_count",{props:{count:r}}):c("timesheets.filters_menu.title")}),e.jsx(Re,{open:o,anchorEl:s,onClose:u,children:e.jsxs(l,{column:!0,gap:"md",p:"md",minw:320,maxw:360,children:[e.jsx(rs,{currentRoleFilterValue:i?.get("roles")?.toJS(),setFilters:_,labelI18n:"timesheets.daily_review.filter.roles",width:288,roleFilterOptions:d,clearIcon:!0,labelLeft:!0,showApplyActions:!0}),e.jsx(vi,{currentIssuesFilterValue:i?.get("issues")?.toJS(),setFilters:_,labelLeft:!0})]})})]})},Es="timesheets.react_page.tip_pooling_tooltip",{TOOLTIP_VIEWED:id,DISMISS_CLICKED:ad,BUTTON_CLICKED:ld}=A,{VIEW:rd,CLICK:Mn}=w,cd=({children:t,createOTE:s,showTooltip:n,hideTooltip:o})=>{const i=q();a.useEffect(()=>{n&&i(id,rd)},[n,i]);const d=a.useCallback(()=>{i(ld,Mn),s("timesheets_tip_pooling_tooltip"),o()},[s,o,i]),r=a.useCallback(()=>{i(ad,Mn),s("timesheets_tip_pooling_tooltip"),o()},[s,o,i]);return n?e.jsx(oe,{open:!0,variant:"primary",buttonTitle:c(`${Es}.cta`),title:c(`${Es}.title`),content:c(`${Es}.desc`),onButtonClick:d,placement:"bottom",onDismissClick:r,children:t}):e.jsx(e.Fragment,{children:t})},dd=ae({productArea:me.TIMESHEETS,eventCategory:be.TIP_POOLING_TOOLTIP})(cd),{cx:ud}=D("CalculateTipOutsButton"),{openBottomDrawer:md}=Ct,{CALCULATE_TIP_OUTS_DRAWER:_d}=Xa,us=()=>{const t=z(),s=j(Ja),n=q(),o=a.useCallback(()=>{n(B.BUTTON_CLICKED,w.CLICK,{button_text:"Manage Tips"}),s&&(t(ot("timesheets_tip_pooling_tooltip")),t(In())),t(md({drawerType:_d}))},[t,s,n]),i=a.useCallback(r=>t(ot(r)),[t]),d=a.useCallback(()=>t(In()),[t]);return e.jsx(dd,{showTooltip:!!s,createOTE:i,hideTooltip:d,children:e.jsx(L,{variant:"secondary",onClick:o,className:ud(),dataTestId:"manage-tips-button",children:c("timesheets.react_page.calculate_tip_outs")})})},ms=()=>{const t=he(),s="/settings/tip_manager";return t?e.jsx(L,{variant:"secondary",href:s,target:Do.BLANK,children:c("timesheets.react_page.calculate_tip_outs")}):e.jsx(L,{variant:"secondary",component:Gt,to:s,children:c("timesheets.react_page.calculate_tip_outs")})},ki=()=>{const t=z(),[s,n]=a.useState(null),o=!!s,i=j(Ke),d=j(Yt),r=j(Qa),m=j(el),u=j(tl),_=a.useMemo(()=>{if(u)return d.find(T=>String(T.value)===String(u))?.label},[u,d]),h=a.useCallback(T=>{n(T.currentTarget)},[]),g=a.useCallback(()=>{n(null)},[]),x=a.useCallback((T,y)=>{let v=null;y&&typeof y=="object"&&!Array.isArray(y)&&(v=y.value??null),t(re.setFilters({employee:v}))},[t]),b=a.useCallback(T=>{t(re.setFilters({sortBy:T.target.value}))},[t]),C=!i&&m>0?c("timesheets.daily_review.view_menu.title_with_count",{props:{count:m}}):c("timesheets.daily_review.view_menu.title");return e.jsxs(l,{children:[e.jsx(L,{variant:"tertiary",size:"medium",onClick:h,endIcon:"CaretDown",dataTestId:"daily-review-view-menu-button",children:C}),e.jsx(Re,{open:o,anchorEl:s,onClose:g,children:e.jsxs(l,{column:!0,gap:"md",p:"md",minw:320,maxw:360,children:[!i&&e.jsx(zt,{name:"employeeFilter",options:d,onChange:x,value:_,placeholder:c("timesheets.daily_review.view_menu.search_placeholder"),startIcon:"Search",dataTestId:"daily-review-view-menu-search"}),e.jsxs(l,{row:!0,vcenter:!0,gap:"xs",justifyContentSpaceBetween:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.daily_review.view_menu.sort_by")}),e.jsx(l,{minw:188,children:e.jsx(Be,{name:"sortBy",options:sl,onChange:b,value:r,dataTestId:"daily-review-view-menu-sort-by"})})]})]})})]})},hd=({setFilters:t,filters:s,employeeFilterOptions:n,roleFilterOptions:o})=>e.jsx(e.Fragment,{children:e.jsxs(l,{row:!0,gap:16,children:[e.jsx(bn,{currentEmployeeFilterValue:s?.get("employee"),setFilters:t,employeeFilterOptions:n}),e.jsx(rs,{currentRoleFilterValue:s?.get("roles")?.toJS(),setFilters:t,labelI18n:"timesheets.daily_review.filter.roles",width:340,roleFilterOptions:o}),e.jsx(vi,{currentIssuesFilterValue:s?.get("issues")?.toJS(),setFilters:t})]})}),pd=W(t=>({filters:Wt(t),employeeFilterOptions:Yt(t),roleFilterOptions:Vt(t)}),{setFilters:re.setFilters})(hd),gd=({updateDate:t,getDailyReviewDate:s,isTimecardReviewAssistantEnabled:n})=>{const o=q();Oe()({eventCategory:be.DAILY_REVIEW});const d=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{button_text:"next_day"}),t({date:$s(Hs(s),1),consolidatedIssues:n})},[s,n,t,o]),r=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{button_text:"previous_day"}),t({date:$s(Hs(s),-1),consolidatedIssues:n})},[s,n,t,o]),m=a.useCallback(u=>{o(A.DATE_PICKER_CLICKED,w.CLICK),t({date:u.target.value,consolidatedIssues:n})},[n,t,o]);return e.jsxs(l,{row:!0,wrap:!0,alignItemsCenter:!0,gap:"md",children:[e.jsx(Ee,{dataTestId:"prev-date",icon:"ChevronLeft",onClick:r}),e.jsx(l,{minw:270,children:e.jsx(nl,{displayWeekday:!0,hideClearIcon:!0,value:s,onChange:m})}
1),e.jsx(Ee,{dataTestId:"next-date",icon:"ChevronRight",onClick:d})]})},Pt=W(t=>({getDailyReviewDate:xt(t),isTimecardReviewAssistantEnabled:pe(t)}),{updateDate:Lo})(gd),Cd=({filterCount:t,onClick:s,icon:n})=>e.jsx(L,{variant:"secondary",onClick:s,endIcon:n,children:c("timesheets.daily_review.filter.button_name",{props:{count:t}})}),xd=W(t=>({filterCount:ol(t)}))(Cd),Bn="timesheets.daily_review.review_filter",Ed=[{label:c(`${Bn}.all`),value:"all"},{label:c(`${Bn}.needs_review`),value:"needs_review"}],Si=()=>{const t=z(),s=j(o=>o.getIn(["dailyReview","filters","reviewFilter"])||"all"),n=a.useCallback((o,i)=>{t(re.setFilters({reviewFilter:i}))},[t]);return e.jsx(Mo,{tabValue:s,onChange:n,ariaName:"review-filter",dataTestId:"review-filter-segmented-picker",fullWidth:!0,options:Ed})},Ii=()=>{const t=z(),s=j(rt),n=j(qt),o=j(pe),[i,d]=a.useState(!1),{issuesCount:r,hasIssues:m}=ds(),u=a.useCallback(()=>{d(x=>!x)},[]),_=a.useCallback(()=>{t(re.setResolveIssuesSidebarOpen(!0))},[t]),h=s&&(n?e.jsx(us,{}):e.jsx(ms,{})),g=e.jsx(L,{variant:"secondary",startIcon:"Warning",onClick:_,uxElement:"daily_review_resolve_issues_button",children:c("timesheets.daily_review.resolve_issues.button",{props:{count:r}})});return o?e.jsxs(l,{row:!0,wrap:!0,alignItemsCenter:!0,justifyContentSpaceBetween:!0,gap:"lg",w:"100%",children:[e.jsxs(l,{row:!0,wrap:!0,alignItemsCenter:!0,gap:"lg",children:[e.jsx(Pt,{}),e.jsx(ki,{})]}),e.jsxs(l,{row:!0,wrap:!0,alignItemsCenter:!0,gap:"sm",shrink:0,children:[h&&e.jsx(l,{shrink:0,children:h}),m&&e.jsx(l,{shrink:0,children:g})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(l,{row:!0,wrap:!0,alignItemsCenter:!0,gap:"lg",children:[e.jsx(Pt,{}),e.jsx(l,{w:300,shrink:0,children:e.jsx(Si,{})}),h&&e.jsx(l,{shrink:0,children:h}),e.jsx(l,{shrink:0,children:e.jsx(xd,{onClick:u,icon:i?"CaretUp":"CaretDown"})})]}),i&&e.jsx(pd,{})]})},{cxEl:bd}=D("TableRowsGroup"),ji=({dailyReviewRows:t,updateTimecardApprovals:s,approvalStatus:n,lockTimesheetsPermission:o})=>{const i=n==="locked",d=i?"Lock":"Unlock",r=i?"unapprove_all":"approve_all",m=a.useCallback(()=>{const u=t.map(_=>_.get("id"));s(u,n!=="locked")},[t,s,n]);return!o||!t.size?null:e.jsx(l,{borderbox:!0,h:20,column:!0,w:40,children:e.jsx(oe,{content:c(`timesheets.react_page.tooltips.${r}`),children:e.jsx(Ee,{onClick:m,size:"small",icon:d,className:bd(`${n}-icon`)})})})};ji.propTypes={dailyReviewRows:p.object,updateTimecardApprovals:p.func,approvalStatus:p.string,lockTimesheetsPermission:p.bool};const yd=t=>({dailyReviewRows:al(t),approvalStatus:il(t),lockTimesheetsPermission:!!Et(t)}),wi=W(yd,{updateTimecardApprovals:Zt})(ji),{cxEl:Td}=D("LockIcon"),vd=(t,s,n)=>s==="disabled_locked"?e.jsxs(l,{children:[e.jsx(l,{children:n.get("locked_message")}),e.jsx(l,{children:c("timesheets.react_page.tooltips.no_permission_to_unlock")})]}):t==="locked"?c("timesheets.react_page.tooltips.unlock_timecard"):c("timesheets.react_page.tooltips.lock_timecard"),Oi=({lockTimesheetsPermission:t,onUpdateTimecardApprovals:s,timecard:n,timecardLockVisibility:o,timecardApprovalStatus:i})=>{const d=i==="locked"?"Lock":"Unlock",r=vd(i,o,n),m=a.useCallback(u=>{u.stopPropagation(),en({action:B.INDIVIDUAL_LOCK_CLICKED}),s([n.get("id")],!n.get("approved"))},[s,n]);return t?e.jsx(l,{pt:12,w:40,children:o!=="hidden"&&e.jsx(oe,{content:r,placement:"left",children:e.jsx(Ee,{onClick:m,size:"small",icon:d,className:Td(`${i}-icon`),disabled:o==="disabled_locked"})})}):null};Oi.propTypes={lockTimesheetsPermission:p.bool.isRequired,onUpdateTimecardApprovals:p.func,timecard:se.map};const Ri=W((t,s)=>({lockTimesheetsPermission:!!Et(t,s),timecardLockVisibility:Po(t,s),timecardApprovalStatus:Bo(t,s)}),{onUpdateTimecardApprovals:Zt})(Oi),fd={waived:"timesheets.daily_review.assisted_break_cell.description_waived",added:"timesheets.daily_review.assisted_break_cell.description_added"},Pn=(t,s)=>t<=0?null:c(fd[s],{props:{count:t}}),Kn=({data:t,waivedBreaksCount:s=0,employeeAddedBreaksCount:n=0})=>{const o=Pn(s,"waived"),i=Pn(n,"added");return o||i?e.jsx(oe,{uxElement:"assisted_break_tooltip",content:e.jsxs(l,{children:[e.jsx(E,{variant:"captions",color:"primary300",children:c("timesheets.daily_review.assisted_break_cell.label")}),o&&e.jsx(E,{variant:"bodySm",children:o}),i&&e.jsx(E,{variant:"bodySm",children:i})]}),placement:"bottom-start",children:e.jsxs(l,{pv:"2xs",row:!0,alignItems:"center",gap:2,children:[e.jsx(l,{vcenter:!0,children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),e.jsx(E,{color:"info",children:t})]})}):e.jsx(l,{pv:"2xs",children:e.jsx(E,{children:t})})},{cx:kd}=D("EmployeeCell"),Sd=({data:t,shiftId:s,highlighted:n})=>{const o=t.get("name"),i=Jt(o,"name");return e.jsxs(l,{className:kd({highlighted:n}
1),"data-shift-id":s,pv:"2xs",row:!0,vcenter:!0,children:[e.jsx(l,{mr:"xs",children:e.jsx(bt,{size:"small",image:t.get("avatar"),initials:t.get("initials")})}),e.jsxs(l,{children:[e.jsx(oe,{content:i?o:null,children:e.jsx(l,{vcenter:!0,w:160,children:e.jsx(E,{noWrap:!0,variant:"bodySmBold",children:o})})}),e.jsx(l,{w:160,children:e.jsx(E,{variant:"captions",children:t.get("role")})})]})]})},Id="missing_clock_out",jd="unscheduled_shift",wd="no_show",Od="missing_breaks",Rd=[Id,jd,wd,Od],Nd=t=>Rd.find(s=>t.includes(s))??null,Ad=({data:t})=>{if(!t)return null;const s=t.map(o=>o.get("type")),n=Nd(s);return n?e.jsx(l,{pv:"2xs",children:e.jsx(tn,{variant:"error",children:c(`timesheets.daily_review.issues_cell.${n}`)})}):null},Dd={late_clock_out:"timesheets.daily_review.notes_cell.assisted_clock_out",assisted_clock_out:"timesheets.daily_review.notes_cell.assisted_clock_out",assisted_clock_in:"timesheets.daily_review.notes_cell.assisted_clock_in"},Ld=t=>te(t).format(Fs("note_timestamp")),Kt=(t,s)=>{const n=s?.[0]??"";return n?`${t} ${n}.`:t},Md=t=>{const s=t.get("event_type"),i=s===null?`${c("timesheets.daily_review.notes_cell.manager_note")} • ${Kt(t.get("first_name"),t.get("last_name"))}`:s==="missed_break"?`${c("timesheets.daily_review.notes_cell.missed_break_note")} • ${Kt(t.get("first_name"),t.get("last_name"))}`:t.get("title");return{key:`note-${t.get("id")}`,label:i,body:t.get("body")??t.get("message")??null,timestamp:t.get("created_at")}},Bd=(t,s)=>{const n=c("timesheets.daily_review.notes_cell.star",{props:{count:t.get("rating")??0}}),o=Kt(t.get("first_name"),t.get("last_name"));return{key:"feedback",label:`${c("timesheets.daily_review.notes_cell.shift_feedback")} • ${n} • ${o}`,body:t.get("body")??null,timestamp:s}},Pd=(t,s,n)=>{const o=t.get("type"),i=c(Dd[o]),d=Kt(s,n);return{key:o,label:`${i} • ${d}`,body:t.getIn(["meta","comment"])??null,timestamp:t.getIn(["meta","submitted_at"])}},Kd=(t,s)=>!t.timestamp&&!s.timestamp?0:t.timestamp?s.timestamp?te(t.timestamp).diff(te(s.timestamp)):-1:1;function Ud(t,s,n,o=null){const i=t.get("feedback");return[...t.get("notes").toArray().map(Md),...i?[Bd(i,o)]:[],...t.get("assistedNotes").toArray().map(d=>Pd(d,s,n))].sort(Kd)}const $d=({label:t,body:s,timestamp:n})=>e.jsxs(l,{mb:12,pv:"2xs",children:[e.jsx(E,{variant:"captions",color:"primary300",children:t}),s&&e.jsx(l,{children:e.jsxs(E,{variant:"bodySmBold",children:['"',s,'"']})}),n&&e.jsx(l,{children:e.jsx(E,{variant:"captions",color:"primary300",children:Ld(n)})})]}),Hd=({notes:t})=>{const s=t[t.length-1],n=t.length-1;return e.jsxs(l,{column:!0,children:[e.jsx($d,{label:s.label,body:s.body,timestamp:s.timestamp},s.key),n>0&&e.jsx(E,{variant:"captionBold",color:"mono0",underline:!0,children:c("timesheets.daily_review.notes_cell.more_notes",{props:{count:n}})})]})},Fd=({count:t})=>e.jsxs(l,{row:!0,alignItemsCenter:!0,hcenter:!0,gap:4,w:33,h:23,bradiusfull:!0,pointer:!0,bgcolor:"mono300",children:[e.jsx(ee,{iconName:"Chat",size:"xsmall",color:"mono900"}),e.jsx(E,{variant:"captionBold",color:"primary",children:t})]}),Ni=({data:t,employeeFirstName:s,employeeLastName:n,clockOutAt:o})=>{if(!t)return null;const i=Ud(t,s,n,o);return i.length===0?null:e.jsx(l,{hcenter:!0,vcenter:!0,w:33,children:e.jsx(oe,{uxElement:"notes_cell_tooltip",content:e.jsx(Hd,{notes:i}),placement:"bottom-start",children:e.jsx(Fd,{count:i.length})})})},Wd=(t,s)=>!!t&&!!s&&s.date()!==t.date(),Un="approved",$n="pending",Vd=t=>{const s=Math.abs(t),n=Math.floor(s/60),o=s%60;return n>0&&o>0?`${n} hr${n!==1?"s":""} ${o} min`:n>0?`${n} hr${n!==1?"s":""}`:`${o} min`},Gd=({data:t})=>{if(!t)return null;const s=t.get("resolved_no_show_reason");if(s)return e.jsxs(l,{column:!0,gap:"2xs",pv:"2xs",children:[e.jsx(E,{variant:"bodySm",color:"mono900",children:qe}),e.jsxs(l,{row:!0,gap:4,alignItems:"center",children:[e.jsx(ee,{iconName:"Ban",size:"small",color:"info"}),e.jsx(E,{variant:"captionBold",color:"info",children:`${c("timecard_modal_v3.issues.no_show.content")} - ${s}`})]})]});const n=t.get("actual_start_at")?te(t.get("actual_start_at")):null,o=t.get("actual_end_at")?te(t.get("actual_end_at")):null,i=t.get("assisted_start_at")?te(t.get("assisted_start_at")):null,d=t.get("scheduled_start_at")?te(t.get("scheduled_start_at")):null,r=t.get("scheduled_end_at")?te(t.get("scheduled_end_at")):null,m=t.get("assisted_clock_out_status"),u=t.get("assisted_clock_out_submitted_at"),_=t.get("assisted_clock_in_status"),h=t.get("assisted_clock_in_submitted_at"),g=[$n,Un].includes(_),x=[$n,Un].includes(m),b=t.get("has_auto_clock_out"),C=te(h),y=C.isSame(te(),"day")?C.format("h:mm a"):C.format("h:mm a, ddd, MMM D"),v=te(u),R=v.isSame(te(),"day")?v.format("h:mm a"):v.format("h:mm a, ddd, MMM D"),S=g?i||n:n||i;let k=null;if(!t.get("unscheduled")&&n&&o&&d&&r){const N=o.diff(n,"minutes"),K=r.diff(d,"minutes");k=N-K}const f=k!==null&&k>0,O=k!==null&&k<0,P=f||O,M=Wd(S,o);return e.jsxs(l,{column:!0,gap:"2xs",pv:"2xs",children:[e.jsxs(l,{row:!0,gap:2,alignItems:"center",children:[e.jsxs(l,{row:!0,alignItems:"center",gap:2,children:[g&&e.jsx(l,{vcenter:!0,children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),g?e.jsx(Ei,{submittedAt:h,formattedStartAt:i?i.format(Ce):void 0,formattedTime:y,children:e.jsx(E,{variant:"bodySm",color:"info",children:S?S.format(Ce):qe})}):e.jsx(E,{variant:"bodySm",color:"mono900",children:S?S.format(Ce):qe})]}),e.jsx(E,{variant:"bodySm",color:"mono900",children:"-"}),e.jsxs(l,{row:!0,alignItems:"center",gap:2,children:[(x||b)&&e.jsx(l,{vcenter:!0,children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),x?e.jsx(bi,{submittedAt:u,formattedTime:R,formattedEndAt:o?o.format(Ce):void 0,children:e.jsx(E,{variant:"bodySm",color:"info",children:o?o.format(Ce):qe})}):b?e.jsx(yi,{children:e.jsx(E,{variant:"bodySm",color:"info",children:o?o.format(Ce):qe})}):e.jsx(E,{variant:"bodySm",color:"mono900",children:o?o.format(Ce):qe})]}),M&&e.jsx(E,{variant:"bodySm",color:"mono900",children:"(+1)"})]}),e.jsxs(l,{row:!0,gap:4,children:[e.jsx(E,{variant:"captions",color:"mono700",children:t.get("caption")}),P&&e.jsxs(l,{row:!0,baseline:!0,gap:4,children:[e.jsx(ee,{iconName:f?"SortUp":"SortDown",size:"xsmall",color:f?"w
1arning":"info"}),e.jsx(E,{variant:"captionBold",color:f?"warning":"info",children:`${Vd(k)} ${c(f?"timesheets.daily_review.worked_cell.over":"timesheets.daily_review.worked_cell.under")}`})]})]})]})};function Yd(t,s,n=[],o=!1){const i=new Set(n),d=[];return s&&d.push({headerKey:"lock",headerLabel:e.jsx(wi,{}),rowValues:t.map(r=>e.jsx(Ri,{timecard:r},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.get("approved")?1:0).toJS(),width:"40px",sortable:!1}),d.push({headerKey:"employee",headerLabel:c("timesheets.daily_review.table_columns.employee"),rowValues:t.map(r=>e.jsx(Sd,{data:r.get("employee"),shiftId:String(r.get("id")),highlighted:i.has(String(r.get("id")))},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.getIn(["employee","name"])||"").toJS(),width:"240px",sortable:!1},{headerKey:"notes",headerLabel:"",rowValues:t.map(r=>e.jsx(Ni,{data:r.get("timecardNotes"),employeeFirstName:r.getIn(["employee","first_name"])||"",employeeLastName:r.getIn(["employee","last_name"])||null,clockOutAt:r.get("actual_end_at")||null},r.get("id"))).toArray(),rawRowValues:t.map(()=>"").toJS(),width:"64px",sortable:!1},{headerKey:"worked",headerLabel:c("timesheets.daily_review.table_columns.worked"),rowValues:t.map(r=>e.jsx(Gd,{data:r.get("worked")},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.getIn(["worked","actual_start_at"])||"").toJS(),width:"240px",sortable:!1},{headerKey:"paid_breaks_hours",headerLabel:c(`timesheets.daily_review.table_columns.${o?"rest_breaks_hours":"paid_breaks_hours"}`),rowValues:t.map(r=>e.jsx(Kn,{data:r.get("paid_breaks_hours"),waivedBreaksCount:r.get("paid_waived_breaks_count"),employeeAddedBreaksCount:r.get("paid_employee_added_breaks_count")},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.get("paid_breaks_hours")||"").toJS(),width:"132px",sortable:!1},{headerKey:"unpaid_breaks_hours",headerLabel:c(`timesheets.daily_review.table_columns.${o?"meal_breaks_hours":"unpaid_breaks_hours"}`),rowValues:t.map(r=>e.jsx(Kn,{data:r.get("unpaid_breaks_hours"),waivedBreaksCount:r.get("unpaid_waived_breaks_count"),employeeAddedBreaksCount:r.get("unpaid_employee_added_breaks_count")},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.get("unpaid_breaks_hours")||"").toJS(),width:"132px",sortable:!1},{headerKey:"issues",headerLabel:c("timesheets.daily_review.table_columns.issues"),rowValues:t.map(r=>e.jsx(Ad,{data:r.get("issues")},r.get("id"))).toArray(),rawRowValues:t.map(r=>r.getIn(["issues",0,"type"])||"").toJS(),width:"212px",sortable:!1}),d}const{cx:zd}=D("DailyReviewTable"),qd="timeCardAdded",St="ftu",Hn="filtered",Fn="regular",Wn=()=>{const t=z(),s=q(),n=he(),o=j(Ko),i=j(Xt),d=j(Qt),r=j(yt),m=j(Uo),u=j(ll),_=j(Et),h=j(xt),g=j(rl),x=j(pe),b=j(Ke),C=j(Wt),T=j(Yt);a.useEffect(()=>{t(re.initializeFilters())},[t]);const y=a.useCallback(M=>{t(re.setFilters(M))},[t]),v=!i&&o.size===0,I=window.sessionStorage.getItem(qd)||!1,R=v&&d&&!I,S=R?St:m?Hn:v?Fn:null,k=n?"mono0":i?void 0:R?"mono100":"mono0",f=a.useMemo(()=>Yd(u,!!_,g,x),[u,_,g,x]),O=a.useCallback((M,N)=>{s(A.TIMECARD_CLICKED,w.CLICK);const K=u.get(N);K&&(Tt(h)?ct.error(c("timesheets.other_errors.future")):t(ue(K.get("id"),null,K,{context:"dailyReview",editMode:!0})))},[u,h,t,s]),P=()=>S===Hn?e.jsx(Gs,{}):S===Fn?e.jsx(Vs,{}):null;return b?e.jsx(Le.FullWidth,{toolbar:e.jsx(Le.Toolbar,{filters:e.jsxs(e.Fragment,{children:[e.jsx(bn,{employeeFilterOptions:T,currentEmployeeFilterValue:C?.get("employee"),setFilters:y,showLabel:!1}),e.jsx(fi,{})]}),context:e.jsx(Pt,{}),viewOptions:e.jsx(ki,{})}),children:S===St?e.jsx(l,{bgcolor:"mono0",p:"lg",children:r?e.jsx(Mt,{}):e.jsx(Bt,{bgcolor:"mono0"})}):e.jsxs(e.Fragment,{children:[e.jsx(l,{pt:"md",children:e.jsx(Le.FullWidthTable,{columns:f,loading:i,onRowClick:O,disableColumnHoverEffects:!0,emptyState:P(),hideUnsortedSortArrows:!0})}),o.size>0&&e.jsx(l,{w:"100%",p:"md",children:e.jsx(pt,{variant:"tertiary"})})]})}):e.jsxs(l,{column:!0,gap:24,pt:24,children:[e.jsx(Ii,{}
1),S===St&&e.jsx(l,{bgcolor:k,bradiusm:!0,pt:12,children:r?e.jsx(Mt,{}):e.jsx(Bt,{})}),S!==St&&e.jsxs(l,{bgcolor:"mono0",bradiusm:!0,pt:12,children:[e.jsx("div",{className:zd(),children:e.jsx(kc,{columns:f,loading:i,onRowClick:O,disableColumnHoverEffects:!0,emptyState:P(),hideUnsortedSortArrows:!0})}),o.size>0&&e.jsx(l,{w:"100%",pv:16,children:e.jsx(pt,{variant:"tertiary"})})]})]})},Zd=({showToast:t,toastText:s,hideToast:n})=>e.jsx(Ps,{open:t,onClose:n,variant:"success",hideCloseIcon:!0,children:s}),Vn=W(t=>({showToast:dl(t),toastText:cl(t)}),{hideToast:re.hideActionToast})(Zd),Jd="https://cdn.joinhomebase.com/assets/tca-demo-bundle-Bo5C0oxm.mp4",{cx:Xd,cxEl:bs}=D("DailyReviewAnnouncementDialog"),Qd="daily_review_tca_announcement_dismissed",eu=611,tu=Date.parse("2027-01-01T00:00:00Z"),Gn=()=>{const t=ul(),s=j(pe),[n,o]=ml(Qd,!1),i=Date.now()<tu,d=a.useCallback(()=>{o(!0)},[o]);return e.jsx($o,{open:!!(s&&!n&&i),onClose:d,width:eu,hideCloseIcon:!0,noPadding:!0,buttons:[],children:()=>e.jsxs(l,{className:Xd(),column:!0,w:"100%",children:[e.jsxs(l,{className:bs("media"),relative:!0,children:[e.jsx("video",{className:bs("video"),loop:!0,muted:!0,playsInline:!0,autoPlay:!t,preload:"auto","aria-label":c("timesheets.daily_review.announcement.video_label"),children:e.jsx("source",{src:Jd,type:"video/mp4"})}),e.jsx("button",{type:"button",className:bs("close"),onClick:d,"aria-label":c("timesheets.daily_review.announcement.close"),children:e.jsx(ee,{iconName:"Close",size:"small",color:"onMedia"})})]}),e.jsxs(l,{column:!0,ph:"xl",pt:"lg",pb:"xl",gap:"lg",children:[e.jsxs(l,{column:!0,gap:"xs",children:[e.jsx(E,{variant:"heading2",children:c("timesheets.daily_review.announcement.title")}),e.jsx(E,{variant:"body",children:c("timesheets.daily_review.announcement.body")})]}),e.jsx(l,{flex:!0,justifyContentEnd:!0,children:e.jsx(L,{variant:"primary",onClick:d,children:c("timesheets.daily_review.announcement.cta")})})]})]})})},Yn=()=>{const t=he();return e.jsx(l,{justifyContentCenter:!0,alignItemsCenter:!0,h:600,children:e.jsx(dt,{size:"large",variant:t?"clover":"dark"})})},zn=()=>e.jsx(l,{column:!0,alignItemsCenter:!0,w:"100%",pv:100,children:e.jsxs(l,{column:!0,alignItemsCenter:!0,w:440,children:[e.jsx(jc,{w:120,h:120}),e.jsxs(l,{mt:40,column:!0,alignItemsCenter:!0,gap:8,w:400,children:[e.jsx(E,{variant:"heading3",textAlign:"center",children:c("timesheets.daily_review.needs_review_empty_state.title")}),e.jsx(E,{variant:"body",color:"mono700",textAlign:"center",children:c("timesheets.daily_review.needs_review_empty_state.subtitle")})]})]})}),su="timesheets.daily_review.table_columns",qn=()=>e.jsxs(l,{row:!0,w:"100%",pv:8,bbw:1,bcolor:"mono400",minw:"fit-content",children:[e.jsx(wi,{}),Ho.map(t=>e.jsx(l,{borderbox:!0,column:!0,pv:10,ph:8,w:t.width,children:e.jsx(E,{variant:"captionBold",children:c(`${su}.${t.name}`)})},t.name))]}),Ai=({data:t})=>{const s=t.get("name"),n=Jt(s,"name");return e.jsxs(l,{className:"EmployeeCell",row:!0,pv:16,ph:8,children:[e.jsx(l,{mr:8,children:e.jsx(bt,{image:t.get("avatar"),initials:t.get("initials")})}),e.jsxs(l,{children:[e.jsx(oe,{content:n?s:null,children:e.jsx(l,{vcenter:!0,w:160,children:e.jsx(E,{className:"employeeName",ellipsis:!0,variant:"bodyBold",children:s})})}),e.jsx(l,{className:"roleDepartment",w:160,children:e.jsxs(E,{variant:"captions",children:[t.get("role"),t.get("department")&&" • ",t.get("department")]})})]})]})};Ai.propTypes={data:p.object.isRequired};const Ge=t=>{const s=z(),n=j(pe),o=a.useCallback(()=>s(Ne({shiftId:t,consolidatedIssues:n})),[s,t,n]),i=a.useCallback((g,x)=>le(`/timesheets/timecards/${t}/dismiss_missed_breaks`,{mandated_break_id:g,waived:x}).then(o),[o,t]),d=a.useCallback(g=>le(`/timesheets/timecards/${t}/update_auto_clock_out`,{clock_out_status:g}).then(o),[o,t]),r=a.useCallback(()=>le(`/timesheets/timecards/${t}/accept_assisted_clock_out`).then(o),[o,t]),m=a.useCallback(()=>le(`/timesheets/timecards/${t}/accept_assisted_clock_in`).then(o),[o,t]),u=a.useCallback(()=>le(`/timesheets/timecards/${t}/accept_shift_times`).then(o),[o,t]),_=a.useCallback(()=>le(`/timesheets/timecards/${t}/employee_clock_out`,{approve:!0}).then(o),[o,t]),h=a.useCallback(async g=>{const x=[];g.employeeEdit&&x.push(le(`/timesheets/timecards/${t}/employee_clock_out`,{approve:!0})),g.autoClockOut&&x.push(le(`/timesheets/timecards/${t}/update_auto_clock_out`,{clock_out_status:"dismissed"})),g.mandatedBreakIds?.forEach(b=>{x.push(le(`/timesheets/timecards/${t}/dismiss_missed_breaks`,{mandated_break_id:b}))}),await Promise.all(x),await o()},[o,t]);return{dispatch:s,dismissMissedBreaks:i,updateAutoClockOut:d,acceptAssistedClockOut:r,acceptAssistedClockIn:m,acceptShiftTimes:u,approveEmployeeEdit:_,acceptAllIssues:h}},nu="missing_breaks",ou="employee_edit",iu="auto_clock_out",au=t=>{const s=[];return t.forEach(n=>
1{n.type===nu&&n.meta.missing_breaks?.forEach(o=>{s.includes(o.mandated_break_id)||s.push(o.mandated_break_id)})}),s},lu=({data:t,shiftId:s,handleClose:n})=>{const{acceptAllIssues:o}=Ge(s),i=a.useCallback(async d=>{n(d);const r=t.meta.issues??[];await o({employeeEdit:r.some(m=>m.type===ou),autoClockOut:r.some(m=>m.type===iu),mandatedBreakIds:au(r)})},[o,t,n]);return e.jsx(e.Fragment,{children:e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_all_issues"),onClick:i})})},ru=({handleClose:t,shiftId:s,showToast:n})=>{const{dispatch:o,acceptShiftTimes:i}=Ge(s),d=q(),r=a.useCallback(u=>{d(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,dropdown_selection:"edit_timecard"}),t(u),o(ue(s,null,null,{context:"dailyReview",editMode:!1}))},[o,t,s,d]),m=a.useCallback(async u=>{d(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,dropdown_selection:"accept_shift_times"}),t(u),await i(),n(c("timesheets.daily_review.actions_cell.toasts.accept_shift_times"))},[i,t,s,n,d]);return[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_shift_times"),onClick:m},"accept"),e.jsx(J,{iconName:"Edit",label:c("timesheets.daily_review.actions_cell.menu_items.edit_timecard"),onClick:r},"edit-timecard")]},cu=({handleClose:t,shiftId:s,showToast:n})=>{const{dispatch:o,acceptAssistedClockIn:i}=Ge(s),d=q(),r=a.useCallback(u=>{d(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,assisted_clockin:!0,dropdown_selection:"change_clock_in"}),t(u),o(ue(s,null,null,{context:"dailyReview",editMode:!0}))},[o,t,s,d]),m=a.useCallback(async u=>{d(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,assisted_clockin:!0,dropdown_selection:"accept_clock_in"}),t(u),await i(),n(c("timesheets.daily_review.actions_cell.toasts.accept_clockin_time"))},[i,t,s,n,d]);return[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_clockin_time"),onClick:m},"accept"),e.jsx(J,{iconName:"Edit",label:c("timesheets.daily_review.actions_cell.menu_items.change_clockin_time"),onClick:r},"edit")]},du=({handleClose:t,shiftId:s,showToast:n})=>{const{dispatch:o,updateAutoClockOut:i}=Ge(s),d=a.useCallback(async m=>{t(m),await i("updated"),o(ue(s,null,null,{context:"dailyReview",editMode:!0}))},[o,t,s,i]),r=a.useCallback(async m=>{t(m),await i("dismissed"),n(c("timesheets.daily_review.actions_cell.toasts.accept_clockout_time"))},[t,n,i]);return e.jsxs(e.Fragment,{children:[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_clockout_time"),onClick:r}),e.jsx(J,{iconName:"Edit",label:c("timesheets.daily_review.actions_cell.menu_items.change_clockout_time"),onClick:d})]})},uu=({handleClose:t,shiftId:s,showToast:n})=>{const{dispatch:o,approveEmployeeEdit:i}=Ge(s),d=a.useCallback(async m=>{t(m),await i(),o(ue(s,null,null,{context:"dailyReview",editMode:!0}))},[i,o,t,s]),r=a.useCallback(async m=>{t(m),await i(),n(c("timesheets.daily_review.actions_cell.toasts.accept_clockout_time"))},[i,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_clockout_time"),onClick:r}),e.jsx(J,{iconName:"Edit",label:c("timesheets.daily_review.actions_cell.menu_items.change_clockout_time"),onClick:d})]})},mu=({handleClose:t,shiftId:s,showToast:n,isAssistedClockout:o=!1})=>{const{dispatch:i,acceptAssistedClockOut:d}=Ge(s),r=q(),m=a.useCallback(_=>{r(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,assisted_clockout:o,dropdown_selection:"change_clock_out"}),t(_),i(ue(s,null,null,{context:"dailyReview",editMode:!0,focusClockOut:!0}))},[i,t,s,r,o]),u=a.useCallback(async _=>{r(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:s,assisted_clockout:o,dropdown_selection:"accept_clock_out"}),t(_),await d(),n(c("timesheets.daily_review.actions_cell.toasts.accept_clockout_time"))},[d,t,o,s,n,r]);return[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_clockout_time"),onClick:u},"accept"),e.jsx(J,{iconName:"Edit",label:c("timesheets.daily_review.actions_cell.menu_items.change_clockout_time"),onClick:m},"edit")]},_u=({data:t,handleClose:s,shiftId:n,showToast:o})=>{const{dispatch:i,acceptAllIssues:d}=Ge(n),r=a.useCallback(u=>
1{s(u),i(ue(n,null,null,{context:"dailyReview",editMode:!0,autofillBreaks:!0,autofillBreaksInfo:t.meta.missing_breaks}))},[t,i,s,n]),m=a.useCallback(async u=>{s(u);const _=(t.meta.missing_breaks??[]).reduce((h,g)=>(h.includes(g.mandated_break_id)||h.push(g.mandated_break_id),h),[]);await d({mandatedBreakIds:_}),o(c("timesheets.daily_review.actions_cell.toasts.accept_missed_breaks"))},[d,t.meta.missing_breaks,s,o]);return e.jsxs(e.Fragment,{children:[e.jsx(J,{iconName:"Complete",label:c("timesheets.daily_review.actions_cell.menu_items.accept_missed_breaks"),onClick:m}),e.jsx(J,{iconName:"Add",label:c("timesheets.daily_review.actions_cell.menu_items.add_missing_breaks"),onClick:r})]})},hu=({showTimecard:t,handleClose:s,shiftId:n,isAssistedClockout:o=!1})=>{const i=q(),d=a.useCallback(r=>{s(r),i(A.DROPDOWN_CLICKED,w.CLICK,{shift_id:n,assisted_clockout:o,dropdown_selection:"add_clock_out"}),t(n,null,null,{context:"dailyReview",editMode:!0})},[s,n,t,i,o]);return e.jsx(e.Fragment,{children:e.jsx(J,{iconName:"Add",label:c("timesheets.daily_review.actions_cell.menu_items.add_clockout_time"),onClick:d})})},pu=W(null,{showTimecard:ue})(hu),gu=({shiftOptions:t,label:s,handleMergeShifts:n,fixDuplicateShift:o,handleClose:i,showToast:d})=>{const[r,m]=a.useState(!1),u=a.useCallback(async(_,h)=>{if(!r){m(!0),i(h);try{await n({scheduledShiftId:_.scheduledShiftId,unscheduledShiftId:_.unscheduledShiftId});const g=window.location.pathname;o(_.scheduledShiftId,_.unscheduledShiftId,g),d(c("timesheets.daily_review.actions_cell.toasts.shifts_combined"))}finally{m(!1)}}},[o,i,n,d,r]);return e.jsx(e.Fragment,{children:t.map((_,h)=>e.jsx(J,{iconName:"Merge",label:s,helperText:_.label,onClick:de(u,_),disabled:r},h))})},Di=W(null,{handleMergeShifts:nn,fixDuplicateShift:sn})(gu),Cu=c("timesheets.daily_review.actions_cell.menu_items.combine_with_unscheduled"),xu=({data:t,shiftId:s,showTimecard:n,handleClose:o,addNoShowReason:i,showToast:d})=>{const r=t.meta.unscheduled_shifts.map(h=>({scheduledShiftId:s,unscheduledShiftId:h.id,label:h.label})),m=a.useCallback(h=>{o(h),n(s,null,null,{context:"dailyReview",editMode:!0,autofillTimes:!0,autofillBreaks:!0,autofillBreaksInfo:t.meta.scheduled_breaks})},[o,s,n,t]),u=a.useCallback(h=>{o(h),n(s,null,null,{context:"dailyReview",editMode:!0})},[o,s,n]),_=a.useCallback(async(h,g)=>{o(g),await i({id:s,reason:h,originPath:window.location.pathname}),d(c("timesheets.daily_review.actions_cell.toasts.add_no_show_reason"))},[i,o,s,d]);return e.jsxs(e.Fragment,{children:[e.jsx(on,{parentMenuOpen:!0,iconName:"Add",label:c("timesheets.daily_review.actions_cell.menu_items.add_no_show_reason"),children:hl.map(h=>e.jsx(J,{label:h,onClick:de(_,h)},h))}),e.jsx(J,{iconName:"Add",label:c("timesheets.daily_review.actions_cell.menu_items.add_scheduled_times"),onClick:m}),e.jsx(J,{iconName:"Add",label:c("timesheets.daily_review.actions_cell.menu_items.add_new_times"),onClick:u}),e.jsx(Di,{shiftOptions:r,label:Cu,shiftId:s,handleClose:o,showToast:d})]})},Eu=W(null,{showTimecard:ue,setEditMode:Fo.setEditMode,addNoShowReason:_l})(xu),bu=c("timesheets.daily_review.actions_cell.menu_items.combine_with_scheduled"),yu=({data:t,shiftId:s,handleClose:n,showToast:o})=>{const i=t.meta.scheduled_shifts.map(d=>({scheduledShiftId:d.id,unscheduledShiftId:s,label:d.label}));return e.jsx(Di,{handleClose:n,shiftOptions:i,label:bu,shiftId:s,showToast:o})},Tu=["auto_clock_out","missing_breaks","employee_edit","late_clock_out","assisted_clock_in"],vu=t=>{const s=t.filter(n=>Tu.includes(n.type));return s.length>1?{meta:{issues:s},type:"accept_all"}:null},fu={unscheduled_shift:yu,no_show:Eu,missing_breaks:_u,auto_clock_out:du,missing_clock_out:pu,employee_edit:uu,accept_all:lu,late_clock_out:mu,assisted_clock_in:cu,accept_shift_times:ru},ku=({data:t})=>{const s=t.get("is_assisted_clock_out"),n=z(),o=a.useCallback(C=>{n(re.showActionToast(C))},[n]),[i,d]=a.useState(null),r=a.useCallback(C=>{C.stopPropagation(),d(C.currentTarget)},[]),m=a.useCallback(C=>{C.stopPropagation(),d(null)},[]),u=t.get("issues").toJS();if(u.length===0||u.some(C=>C.type==="missing_payroll_details"||C.type==="invalid_address"))return null;const _=u.filter(C=>
1C.type==="missing_paid_breaks"||C.type==="missing_unpaid_breaks"),h=u.some(C=>C.type==="assisted_clock_in"),g=u.some(C=>C.type==="late_clock_out"),x=u.filter(C=>C.type!=="missing_paid_breaks"&&C.type!=="missing_unpaid_breaks"&&!(h&&g&&(C.type==="assisted_clock_in"||C.type==="late_clock_out")));if(_.length>0){const C={type:"missing_breaks",meta:{missing_breaks:[]}};_.reduce((T,y)=>(T.meta.missing_breaks.push(...y.meta.missing_breaks),T),C),x.push(C)}h&&g&&x.push({type:"accept_shift_times",meta:{}});const b=vu(x);return b&&x.push(b),e.jsxs(l,{pv:6,children:[e.jsx(L,{variant:"tertiary",onClick:r,endIcon:"CaretDown",children:c("timesheets.daily_review.actions_cell.button_name")}),e.jsx(Re,{onClose:m,anchorEl:i,open:i!==null,children:x.map((C,T)=>{const y=fu[C.type];if(!y)return null;const v=e.jsx(y,{data:C,shiftId:t.get("shiftId"),handleClose:m,showToast:o,isAssistedClockout:s},C.type),I=x.length!==T+1?e.jsx(Pe,{},`divider-${T}`):null;return Array.isArray(v)?[...v,I].filter(Boolean):[v,I].filter(Boolean)}).flat()})]})},Su=t=>t<=0?null:c("timesheets.daily_review.assisted_break_cell.description_waived",{props:{count:t}}),Iu=t=>t<=0?null:c("timesheets.daily_review.assisted_break_cell.description_added",{props:{count:t}}),Zn=({data:t,waivedBreaksCount:s=0,employeeAddedBreaksCount:n=0})=>{const o=Su(s),i=Iu(n);return o||i?e.jsx(oe,{uxElement:"assisted_break_tooltip",content:e.jsxs(l,{children:[e.jsx(E,{variant:"captions",color:"primary300",children:c("timesheets.daily_review.assisted_break_cell.label")}),o&&e.jsx(E,{variant:"bodySm",children:o}),i&&e.jsx(E,{variant:"bodySm",children:i})]}),placement:"bottom-start",children:e.jsxs(l,{pv:"md",ph:"sm",row:!0,alignItems:"center",gap:2,children:[e.jsx(l,{vcenter:!0,children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),e.jsx(E,{color:"info",children:t})]})}):e.jsx(l,{pv:"md",ph:"sm",children:e.jsx(E,{children:t})})},Li="assisted_clock_out",ju="assisted_clock_in",wu="late_clock_out",Ou="rejected",Ru="approved",Jn={[ju]:1,[wu]:2,[Li]:3,default:0},Mi=({data:t,key:s})=>{const o=t.filter(m=>m.get("type")===Li?![Ou,Ru].includes(m.getIn(["meta","status"])):!0),i=m=>Jn[m]??Jn.default,r=o.sort((m,u)=>{const _=m.get("type"),h=u.get("type");return i(_)-i(h)}).map((m,u)=>e.jsx(Wo,{variant:gl(m),message:pl(m)},u));return e.jsx(l,{w:200,pv:21,ph:8,flex:!0,column:!0,gap:"8px",children:r},s)};Mi.propTypes={data:p.object.isRequired,key:p.string};function Nu({alerts:t}){if(!t)return null;const s=t.toJS();return e.jsx(l,{column:!0,gap:4,children:s.map(n=>e.jsx(Wo,{variant:n.variant,message:n.content},n.type))})}const Au=({comment:t,submittedAt:s,formattedTime:n})=>e.jsxs(l,{children:[e.jsx(E,{variant:"bodySmBold",children:c("timecard_modal_v3.issues.assisted_clock_in.tooltip.title")}),e.jsxs(E,{variant:"bodySm",children:['"',t,'"']}),e.jsx(l,{mt:16,children:s&&e.jsx(E,{variant:"bodySmBold",children:c("timecard_modal_v3.issues.assisted_clock_in.content",{props:{time:n}})})})]}),Du=({comment:t,submittedAt:s,formattedTime:n})=>e.jsx(oe,{uxElement:"assisted_clock_in_tooltip",content:e.jsx(Au,{comment:t,submittedAt:s,formattedTime:n}),placement:"bottom-start",children:e.jsx(l,{mt:4,ml:1,children:e.jsx(ee,{iconName:"Sparkle",size:"small",color:"primary500"})})}),Lu=({comment:t,submittedAt:s,formattedTime:n})=>e.jsxs(l,{children:[e.jsx(E,{variant:"bodySmBold",children:c("timecard_modal_v3.issues.assisted_clock_out.tooltip.title")}),e.jsxs(E,{variant:"bodySm",children:['"',t,'"']}),e.jsx(l,{mt:16,children:s&&e.jsx(E,{variant:"bodySmBold",children:c("timecard_modal_v3.issues.late_clock_out.content",{props:{time:n}})})})]}),Mu=({comment:t,submittedAt:s,formattedTime:n})=>e.jsx(oe,{uxElement:"assisted_clock_out_tooltip",content:e.jsx(Lu,{comment:t,submittedAt:s,formattedTime:n}),placement:"bottom-start",children:e.jsx(l,{mt:4,ml:1,children:e.jsx(ee,{iconName:"Sparkle",size:"small",color:"primary500"})})}),{cxEl:Bu}=D("WorkedCell");function mt({note:t}){t=t.toJS?t.toJS():t;const s=t.body||t.message;return e.jsxs(l,{column:!0,className:Bu("notesSection"),children:[e.jsx(E,{variant:"captionBold",children:t.title}),t.rating&&e.jsx(E,{variant:"caption",color:"mono900",children:c("timecard_modal_v3.note_section.rating",{props:{stars:t.rating}})}),s&&e.jsxs(E,{variant:"caption",color:"mono900",children:['"',s,'"']})]})}mt.propTypes={note:p.object};const Xn="approved",Qn="pending",Pu="initiated",Ku=({data:t})=>{if(!t)return null;const s=t.get("feedback"),n=t.get("actual_start_at")?te(t.get("actual_start_at")):null,o=t.get("actual_end_at")?te(t.get("actual_end_at")):null,i=t.get("assisted_start_at")?te(t.get("assisted_start_at")):null,d=t.get("assisted_clock_out_status"),r=t.get("assisted_clock_out_comment"),m=t.get("assisted_clock_out_submitted_at"),u=t.get("assisted_clock_out_past_due"),_=t.get("assisted_clock_in_status"),h=t.get("assisted_clock_in_comment"),g=t.get("assisted_clock_in_submitted_at"),x=[Qn,Xn].includes(d),b=[Qn,Xn].includes(_),C=te(g),y=C.isSame(te(),"day")?C.format("h:mm a"):C.format("h:mm a, ddd, MMM D"),v=te(m),R=v.isSame(te(),"day")?v.format("h:mm a"):v.format("h:mm a, ddd, MMM D");return e.jsxs(l,{column:!0,gap:4,pv:16,ph:8,children:[e.jsx(l,{inlineBlock:!0,children:e.jsxs(l,{row:!0,gap:2,children:[e.jsxs(l,{row:!0,gap:2,alignItems:"center",children:[e.jsx(E,{variant:"body",color:"mono900",children:n||i?(n||i).format(Ce):jn}),b&&e.jsx(Du,{comment:h,submittedAt:g,formattedTime:y})]}),e.jsx(E,{variant:"body",color:"mono900",children:"-"}),e.jsx(E,{variant:"body",color:"mono900",children:o?o.format(Ce):jn}),x&&e.jsx(Mu,{comment:r,submittedAt:m,formattedTime:R})]})}),d===Pu&&e.jsx(l,{mt:4,children:e.jsx(Sc,{status:d,pastDue:u})}),e.jsx(E,{variant:"caption",children:t.get("caption")}),b&&h&&e.jsx(mt,{note:{title:c("timecard_modal_v3.issues.assisted_clock_in.note_title"),body:h}}),x&&r&&e.jsx(mt,{note:{title:"Assisted clock out note:",body:r}}),(s?.get("rating")||s?.get("body"))&&e.jsx(mt,{note:s}),t.get("notes")?.map(S=>e.jsx(mt,{note:S},S.get("id"))),e.jsx(Nu,{alerts:t.get("alerts")})]})},{cxEl:Uu}=D("DailyReviewTable"),$u={employee:Ai,issues:Mi,worked:Ku,paid_breaks_hours:Zn,unpaid_breaks_hours:Zn,actions:ku},Bi=({row:t,onShowTimecardModal:s,onShowModal:n,isPayrollIssueRow:o,date:i,rowId:d=0})=>{const r=q(),m=a.useCallback(h=>{s(h.get("id"),null,h,{context:"dailyReview",editMode:!0})},[s]),u=a.useCallback((h,g)=>{n(Vo,{auto:!0,employeeId:h,employeeName:g})},[n]),_=a.useCallback(()=>{r(A.TIMECARD_CLICKED,w.CLICK),o?u(t.get("id"),t.get("full_name")):Tt(i)?ct.error(c("timesheets.other_errors.future")):m(t)},[o,t,m,u,r,i]);return e.jsxs(l,{pointer:!0,className:Uu("row"),row:!0,w:"100%",bbw:1,bcolor:"mono400",onClick:_,minw:"fit-content",role:"row",dataTestId:`timesheet-row-${d}`,children:[e.jsx(Ri,{timecard:t}),Ho.map(h=>{const g=$u[h.name];return e.jsx(l,{w:h.width,borderbox:!0,children:g&&e.jsx(g,{data:t?.get(h.name)})},h.name)})]})};Bi.propTypes={row:p.object.isRequired};const Hu=W((t,s)=>({row:s.isPayrollIssueRow?Cl(t,s):xl(t,s),date:xt(t)}),{onShowTimecardModal:ue,onShowModal:es})(Bi),Fu={FTU:"ftu",FILTERED:"filtered",REGULAR:"regular",NEEDS_REVIEW:"needs_review"},{FTU:ys,FILTERED:Ts,REGULAR:vs,NEEDS_REVIEW:fs}=Fu,Pi=({dailyReviewRowIds:t,payrollIneligibleEmployeeRowIds:s,dailyReviewLoading:n,shouldSeeTimesheetsEmptyState:o,isCloverEmbedded:i,setInitialFilterValues:d,setFilters:r,showFilteredEmptyState:m,showNeedsReviewEmptyState:u,isPageTemplateEnabled:_,employeeFilterOptions:h,dailyReviewFilters:g})=>{const x=he();a.useEffect(()=>{d()},[d]);const b=!n&&t.size===0,C=window.sessionStorage.getItem("timeCardAdded")||!1,T=b&&o&&!C,y=!n&&s.size===0,I=T?ys:m&&y?Ts:u&&y?fs:b?vs:null,R=x?"mono0":!n&&(T?"mono100":"mono0"),S=()=>I===fs?e.jsx(zn,{}):I===Ts?e.jsx(Gs,{}):I===vs?e.jsx(Vs,{}):null,k=()=>e.jsx(a.Fragment,{children:t.map(f=>e.jsx(Hu,{rowId:f},f))});return _?e.jsx(Le.FullWidth,{toolbar:e.jsx(Le.Toolbar,{filters:e.jsxs(e.Fragment,{children:[e.jsx(bn,{employeeFilterOptions:h,currentEmployeeFilterValue:g?.get("employee"),setFilters:r,showLabel:!1}),e.jsx(fi,{})]}),context:e.jsx(Pt,{}),viewOptions:e.jsx(l,{w:300,shrink:0,children:e.jsx(Si,{})})}),children:I===ys?e.jsx(l,{bgcolor:"mono0",p:"lg",children:i?e.jsx(Mt,{}):e.jsx(Bt,{bgcolor:"mono0"})}):e.jsx(l,{bgcolor:"mono0",pt:"md",children:e.jsxs(l,{overflow:"auto",ph:12,children:[n&&e.jsx(Yn,{}),!n&&e.jsx(qn,{}),S(),!n&&k(),t.size>0&&e.jsx(l,{w:"100%",pv:16,children:e.jsx(pt,{variant:"tertiary"})})]})})}):e.jsxs(l,{column:!0,gap:24,pt:24,children:[e.jsx(Ii,{}),e.jsx(l,{overflow:"auto",children:e.jsxs(l,{minw:"fit-content",bgcolor:R,bradiusm:!0,p:12,pb:0,children:[n&&e.jsx(Yn,{}),!n&&(T?null:e.jsx(qn,{})),I===ys&&e.jsx(e.Fragment,{children:i?e.jsx(Mt,{}):e.jsx(Bt,{})}),I===fs&&e.jsx(zn,{}),I===Ts&&e.jsx(Gs,{}),I===vs&&e.jsx(Vs,{}),!n&&k(),t.size>0&&e.jsx(l,{w:"100%",pv:16,children:e.jsx(pt,{variant:"tertiary"})})]})})]})};Pi.propTypes={dailyReviewRowIds:p.array.isRequired,dailyReviewLoading:p.bool.isRequired,setInitialFilterValues:p.func.isRequired,setFilters:p.func.isRequired,showFilteredEmptyState:p.bool.isRequired,isPageTemplateEnabled:p.bool};const Wu=t=>({dailyReviewRowIds:Ko(t),payrollIneligibleEmployeeRowIds:bl(t),dailyReviewLoading:Xt(t),shouldSeeTimesheetsEmptyState:Qt(t),isCloverEmbedded:yt(t),show
1FilteredEmptyState:Uo(t),showNeedsReviewEmptyState:El(t),isPageTemplateEnabled:Ke(t),employeeFilterOptions:Yt(t),dailyReviewFilters:Wt(t)}),Vu={setInitialFilterValues:re.initializeFilters,setFilters:re.setFilters},eo=W(Wu,Vu)(Pi),Gu=({getDailyReviewDaysRowData:t,date:s,urlQuery:n,setInitialDate:o,shouldSeeTimesheetsEmptyState:i,isCloverEmbedded:d,hasAssistedClockOut:r,hasMissingClockOut:m,isLoading:u,isTimecardReviewAssistantEnabled:_,isPageTemplateEnabled:h,isResolveIssuesSidebarDismissed:g,initializeResolveIssuesSidebar:x,setResolveIssuesSidebarOpen:b})=>{const C=a.useRef(),T=q(),y=Oe(),v=he(),{hasIssues:I}=ds();y({first_time_use:!0});const R=a.useMemo(()=>n?.date?Hs(n.date,"MM/DD/YYYY").format(vc):s,[n,s]);a.useEffect(()=>{o(R)},[o,R]),a.useEffect(()=>{!i&&!u&&T(A.PAGE_VIEWED,w.VIEW,{assisted_clock_out:!!r,missing_clock_out:!!m})},[i,T,r,m,u]);const S=a.useCallback(()=>{t({date:R,consolidatedIssues:_})},[t,R,_]);return a.useEffect(()=>{S()},[S]),a.useEffect(()=>{x()},[x]),a.useEffect(()=>{_&&(u||I&&(g||b(!0)))},[_,u,I,g,b]),h?e.jsxs(e.Fragment,{children:[_?e.jsx(Wn,{}):e.jsx(eo,{isCloverEmbedded:d}),e.jsx(Vn,{}),e.jsx(Gn,{}),v&&e.jsxs(l,{width:"100%",children:[e.jsx(Dt,{productArea:"timesheets"}),e.jsx(ht,{})]})]}):e.jsxs(l,{column:!0,spacebetween:!0,h:v?"calc(100vh - 206px)":null,minh:v?"600px":null,children:[e.jsxs(l,{bgcolor:v?"mono0":"mono100",ph:v?56:32,minh:"100%",ref:C,overflow:v?"scroll":"auto",children:[_?e.jsx(Wn,{}):e.jsx(eo,{isCloverEmbedded:d}),e.jsx(Vn,{}),e.jsx(Gn,{})]}),v&&e.jsxs(l,{width:"100%",children:[e.jsx(Dt,{productArea:"timesheets"}),e.jsx(ht,{})]})]})},Yu=W(t=>({date:xt(t),shouldSeeTimesheetsEmptyState:Qt(t),hasAssistedClockOut:vl(t),hasMissingClockOut:Tl(t),isLoading:Xt(t),isTimecardReviewAssistantEnabled:pe(t),isPageTemplateEnabled:Ke(t),isResolveIssuesSidebarDismissed:yl(t)}),{getDailyReviewDaysRowData:Lo,setInitialDate:re.setInitialDate,initializeResolveIssuesSidebar:re.initializeResolveIssuesSidebar,setResolveIssuesSidebarOpen:re.setResolveIssuesSidebarOpen})(Gu),zu=()=>{const t=z(),s=j(rt),n=j(qt),o=j(pe),{issuesCount:i,hasIssues:d}=ds(),r=d&&o,m=a.useCallback(()=>{t(re.setResolveIssuesSidebarOpen(!0))},[t]),u=s&&(n?e.jsx(us,{}):e.jsx(ms,{}));return!u&&!r?null:e.jsxs(l,{row:!0,alignItemsCenter:!0,gap:"sm",children:[u,r&&e.jsx(L,{variant:"primary",startIcon:"Warning",onClick:m,uxElement:"daily_review_resolve_issues_button",children:c("timesheets.daily_review.resolve_issues.header_button",{props:{count:i}})})]})},qu=({alt:t="Double Check",id:s,screenReadable:n=!1})=>e.jsxs("svg",{...n?{role:"img","aria-labelledby":s}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",fill:"none","aria-label":t,children:[e.jsx("path",{d:"M12.235 14.5063C11.7922 14.9606 11.0637 14.9606 10.6208 14.5063L4.90616 8.73738C4.45975 8.29029 4.45975 7.55475 4.90616 7.10766C5.35184 6.65336 6.07538 6.65336 6.52178 7.10766L11.4279 12.0617L22.0488 1.33802C22.4916 0.887326 23.2201 0.887326 23.663 1.33802C24.1129 1.788 24.1129 2.51849 23.663 2.96918L12.235 14.5063ZM12.235 30.6593C11.7922 31.1136 11.0637 31.1136 10.6208 30.6593L0.334696 20.2752C-0.111565 19.8281 -0.111565 19.0926 0.334696 18.6455C0.780671 18.1912 1.5042 18.1912 1.95061 18.6455L11.4279 28.2147L30.0483 9.41523C30.4912 8.96093 31.2197 8.96093 31.6625 9.41523C32.1125 9.86232 32.1125 10.5979 31.6625 11.0449L12.235 30.6593Z",fill:"#1E0B3A"}),e.jsx("path",{d:"M12.235 14.5063C11.7921 14.9606 11.0636 14.9606 10.6208 14.5063L4.90609 8.73738C4.45969 8.29029 4.45969 7.55475 4.90609 7.10766C5.35178 6.65336 6.07531 6.65336 6.52172 7.10766L11.4279 12.0617L22.0487 1.33802C22.4915 0.887326 23.2201 0.887326 23.6629 1.33802C24.1129 1.788 24.1129 2.51849 23.6629 2.96918L12.235 14.5063Z",fill:"#7E3DD4"})]}),Zu=({alt:t="Missing Clock Out",id:s,screenReadable:n=!1})=>e.jsxs("svg",{...n?{role:"img","aria-labelledby":s}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",fill:"none","aria-label":t,children:[e.jsx("rect",{width:"32",height:"32",rx:"4",fill:"#F1ECFF"}),e.jsx("path",{d:"M15.9997 7.625C17.1005 7.625 17.9133 8.27755 18.6198 9.14648C19.3201 10.0079 20.0689 11.275 21.0016 12.8477L22.6061 15.5527C23.5777 17.1908 24.3597 18.5044 24.7946 19.5674C25.232 20.6365 25.4206 21.6931 24.8639 22.6758C24.3066 23.6597 23.3034 24.0391 22.1628 24.209C21.0294 24.3778 19.5037 24.375 17.6042 24.375H14.3962C12.4967 24.375 10.971 24.3777 9.83758 24.209C8.6969 24.0391 7.69282 23.6597 7.13543 22.6758C6.57897 21.6931 6.7674 20.6364 7.20477 19.5674C7.63971 18.5044 8.42252 17.1909 9.39422 15.5527L10.9977 12.8477C11.9306 11.2749 12.6802 10.0079 13.3805 9.14648C14.087 8.27771 14.8991 7.62513 15.9997 7.625ZM15.9997 9.375C1
15.6948 9.37511 15.3306 9.52209 14.738 10.251C14.1391 10.9877 13.4655 12.1179 12.5026 13.7412L10.8991 16.4453C9.89725 18.1344 9.19901 19.3161 8.82488 20.2305C8.45341 21.1384 8.50379 21.5413 8.65789 21.8135C8.81149 22.0846 9.12898 22.3336 10.0954 22.4775C11.069 22.6225 12.4374 22.625 14.3962 22.625H17.6042C19.5631 22.625 20.9313 22.6225 21.905 22.4775C22.8714 22.3336 23.1879 22.0846 23.3415 21.8135C23.4957 21.5413 23.547 21.1386 23.1755 20.2305C22.8014 19.3161 22.103 18.1343 21.1013 16.4453L19.4968 13.7412C18.534 12.118 17.8613 10.9877 17.2624 10.251C16.6696 9.52184 16.3046 9.375 15.9997 9.375ZM15.9997 18.875C16.5979 18.875 17.0835 19.3598 17.0837 19.958C17.0837 20.5563 16.598 21.042 15.9997 21.042C15.4015 21.0418 14.9167 20.5562 14.9167 19.958C14.9169 19.3599 15.4016 18.8752 15.9997 18.875ZM15.1247 16.833V13.5C15.1247 13.0169 15.5166 12.6252 15.9997 12.625C16.4829 12.625 16.8747 13.0168 16.8747 13.5V16.833C16.8747 17.3163 16.4829 17.708 15.9997 17.708C15.5166 17.7078 15.1247 17.3161 15.1247 16.833Z",fill:"#8F55E5"})]}),{cx:Ju}=D("AnimatedArrow"),Xu=({expanded:t,color:s="tertiary",size:n="small"})=>e.jsx(l,{className:Ju({expanded:t}),children:e.jsx(fl,{iconName:"ArrowDown",size:n,color:s})}),{cx:Qu,cxEl:em}=D("AnimatedCollapse"),tm=({isExpanded:t,children:s})=>{const n=a.useRef(null),[o,i]=a.useState(t);a.useEffect(()=>{const r=n.current;if(!r)return;const m=u=>{u.target===r&&u.propertyName==="grid-template-rows"&&i(t)};return r.addEventListener("transitionend",m),()=>r.removeEventListener("transitionend",m)},[t]);const d=t&&o;return e.jsx(l,{className:Qu({expanded:t,unclipped:d}),ref:n,children:e.jsx(l,{className:em("inner"),children:s})})},{cx:sm}=D("IssueSectionAccordion"),_s=({title:t,count:s,isExpanded:n,onToggle:o,children:i,hideCount:d=!1})=>e.jsxs(l,{bw:"sm",bcolor:"default",bradiuss:!0,bgcolor:"default",shrink:0,children:[e.jsxs(l,{flex:!0,alignItemsCenter:!0,justifyContentSpaceBetween:!0,ph:"md",pv:"sm",pointer:!0,onClick:o,bgcolor:"default",bbw:n?"sm":void 0,bcolor:"default",className:sm({collapsed:!n}),children:[e.jsx(E,{variant:"bodySmBold",color:"primary",children:t}),e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"2xs",children:[s>0&&!d&&e.jsx(tn,{variant:"error",children:String(s)}),e.jsx(Xu,{expanded:n})]})]}),e.jsx(tm,{isExpanded:n,children:e.jsx(l,{flex:!0,column:!0,pb:"md",children:i})})]}),Q={MISSING_CLOCK_OUT:"missing_clock_out",UNSCHEDULED:"unscheduled",NO_SHOW:"no_show",MISSING_BREAK:"missing_break"},to={OPEN:"open",CLOSE:"close"},nm={COLLAPSE:"collapse"},ve={BULK_ACTION:"bulk_action",BULK_ACTION_CONFIRM:"bulk_action_confirm"},ks={ADD_CLOCK_OUT:"add_clock_out",EDIT_CLOCK_OUT:"edit_clock_out",SAVE_CLOCK_OUT:"save_clock_out"},It={CONFIRM_MISSED_BREAK:"confirm_missed_break",ADD_BREAK:"add_break",EDIT_BREAK:"edit_break"},om={MATCH_SHIFTS:"match_shifts"},et={ADD_NO_SHOW_REASON:"add_no_show_reason",ADD_NO_SHOW_TIME:"add_no_show_time",SAVE_NO_SHOW:"save_no_show",NO_SHOW_REASON:"no_show_reason"},ie={MISSING_CLOCK_OUT:"missingClockOut",UNSCHEDULED_SHIFT:"unscheduledShift",NO_SHOW:"noShow",MISSING_BREAKS:"missingBreaks"},im={[ie.MISSING_CLOCK_OUT]:Q.MISSING_CLOCK_OUT,[ie.UNSCHEDULED_SHIFT]:Q.UNSCHEDULED,[ie.NO_SHOW]:Q.NO_SHOW,[ie.MISSING_BREAKS]:Q.MISSING_BREAK},am=t=>{const s=[];return t.mealBreaks.length>0&&s.push(c("timesheets.daily_review.resolve_issues.missing_breaks.missed_meal_breaks",{props:{count:t.mealBreaks.length}})),t.restBreaks.length>0&&s.push(c("timesheets.daily_review.resolve_issues.missing_breaks.missed_rest_breaks",{props:{count:t.restBreaks.length}})),c("timesheets.daily_review.resolve_issues.missing_breaks.missed_summary",{props:{breaks:s.join(" + ")}})},Ki=({rows:t,breakPenaltyEnabled:s,isIndividualResolutionFlow:n=!1,onConfirm:o,onCancel:i})=>e.jsxs(l,{flex:!0,column:!0,gap:"sm",children:[s&&e.jsxs(l,{flex:!0,column:!0,gap:"2xs",children:[e.jsx(E,{variant:"bodyBold",color:"primary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_missed_breaks_heading")}),e.jsx(E,{variant:"body",color:"secondary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_missed_breaks_description")})]}),e.jsxs(l,{flex:!0,column:!0,gap:"xs",children:[e.jsx(E,{variant:"bodySmBoldTight",color:"secondary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.missed_breaks_heading")}),t.map(d=>n?e.jsxs(l,{flex:!0,column:!0,gap:"2xs",pv:"xs",children:[d.restBreaks.length>0&&e.jsx(E,{variant:"body",color:"primary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_rest_breaks",{props:{count:d.restBreaks.length}})}),d.mealBreaks.length>0&&e.jsx(E,{variant:"body",color:"primary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_meal_breaks",{props:{count:d.mealBreaks.length}})})]},d.shiftId):e.jsxs(l,{flex:!0,column:!0,gap:"2xs",pv:"xs",children:[e.jsx(E,{variant:"bodySmBold",color:"primary",children:d.employeeName}),e.jsx(E,{variant:"bodySmTight",color:"secondary",children:am(d)})]},d.shiftId))]}),e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:o,children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:i,uxElement:"resolve_issues_missing_breaks_confirm_all_cancel",children:c("timesheets.daily_review.resolve_issues.missing_breaks.cancel")})]})]}),lm="YYYY-MM-DD",Ui=`YYYY-MM-DD ${Ce}`,it=t=>te(t).format(lm),at=t=>te(t).format(Ui),jt=t=>te(t,Ui).format(Ce),so=(t,s)=>s?`${t} ${s}`:"",Ut=(t,s)=>{const n=t?it(t):"",o=s?it(s):n;return{clockInDate:n,clockOutDate:o,initialClockedIn:t?at(t):"",initialClockedOut:s?at(s):""}},$i=(t,s)=>{const n=t?it(t):"",o=s?it(s):n;return{clockInDate:n,clockOutDate:o,initialClockedIn:t?at(t):"",initialClockedOut:s?at(s):""}},no=Oc,{cx:rm,cxEl:cm}=D("ClockTimeEditFields"),gt=({clockedIn:t,clockedOut:s,clockInDate:n,clockOutDate:o,onClockedInChange:i,onClockedOutChange:d,showLabels:r=!0,startLabel:m=c("timecard_modal_v3.timecard_edit_section.clocked_in"),endLabel:u=c("timecard_modal_v3.timecard_edit_section.clocked_out")})=>{const _=a.useCallback(({target:{value:g}})=>{i(so(n,g))},[n,i]),h=a.useCallback(({target:{value:g}})=>{d(so(o,g))},[o,d]);return e.jsxs(l,{className:rm(),flex:!0,alignItemsStart:!0,gap:"2xs",children:[e.jsxs(l,{flex:!0,column:!0,gap:"2xs",grow:1,children:[r&&e.jsx(E,{variant:"captionBold",color:"secondary",children:m}
1),e.jsx(no,{name:"clocked_in",value:t?jt(t):"",onChange:_,iconSize:"xsmall",endIconName:"Close",startAfterTime:s?jt(s):void 0,isStartTime:!0})]}),e.jsx(l,{className:cm("separator",{compact:!r}),children:e.jsx(E,{variant:"body",color:"secondary",children:"-"})}),e.jsxs(l,{flex:!0,column:!0,gap:"2xs",grow:1,children:[r&&e.jsx(E,{variant:"captionBold",color:"secondary",children:u}),e.jsx(no,{name:"clocked_out",value:s?jt(s):"",onChange:h,iconSize:"xsmall",endIconName:"Close",startAfterTime:t?jt(t):void 0})]})]})},We=({employeeName:t,scheduleInfo:s,children:n,onNameClick:o,onEditOpen:i})=>e.jsxs(l,{bbw:"sm",bcolor:"default",bgcolor:"default",flex:!0,column:!0,gap:"xs",pv:"sm",children:[e.jsxs(l,{flex:!0,alignItemsCenter:!0,justifyContentSpaceBetween:!0,children:[e.jsxs(l,{flex:!0,column:!0,grow:1,minW:0,gap:"2xs",children:[e.jsx(l,{alignSelfStart:!0,children:e.jsx(L,{variant:"tertiaryPlain",size:"small",onClick:o,uxElement:"resolve_issues_card_name",children:t})}),e.jsx(E,{variant:"bodySmTight",color:"secondary",noWrap:!0,children:s})]}),i&&e.jsx(Ee,{icon:"Edit",label:c("timesheets.daily_review.resolve_issues.edit"),size:"medium",onClick:i})]}),n]}),hs=t=>{document.querySelector(`[data-shift-id="${t}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},ps=({alt:t="Check Circle Filled",id:s,screenReadable:n=!1})=>e.jsxs("svg",{...n?{role:"img","aria-labelledby":s}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 16 16",fill:"none","aria-label":t,children:[n&&e.jsx("title",{id:s,children:t}),e.jsx("path",{d:"M8 16C12.4187 16 16 12.4187 16 8C16 3.58125 12.4187 0 8 0C3.58125 0 0 3.58125 0 8C0 12.4187 3.58125 16 8 16ZM11.5312 6.53125L7.53125 10.5312C7.2375 10.825 6.7625 10.825 6.47188 10.5312L4.47188 8.53125C4.17813 8.2375 4.17813 7.7625 4.47188 7.47188C4.76562 7.18125 5.24062 7.17813 5.53125 7.47188L7 8.94063L10.4688 5.46875C10.7625 5.175 11.2375 5.175 11.5281 5.46875C11.8187 5.7625 11.8219 6.2375 11.5281 6.52812L11.5312 6.53125Z",fill:"#028810"})]}),dm={add:"timesheets.daily_review.resolve_issues.missing_breaks.adding_breaks",confirm:"timesheets.daily_review.resolve_issues.missing_breaks.confirming_as_missed"},um={add:"timesheets.daily_review.resolve_issues.missing_breaks.breaks_added",confirm:"timesheets.daily_review.resolve_issues.missing_breaks.missed_breaks_confirmed"},mm=({employeeName:t,scheduleInfo:s,action:n,isSuccess:o})=>e.jsxs(l,{bbw:"sm",bcolor:"default",bgcolor:"default",flex:!0,column:!0,gap:"xs",pv:"sm",children:[e.jsxs(l,{flex:!0,column:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"brand",underline:!0,children:t}),e.jsx(E,{variant:"bodySmTight",color:"secondary",noWrap:!0,children:s})]}),o?e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"sm",children:[e.jsx(ps,{}),e.jsx(E,{variant:"bodySm",color:"primary",children:c(um[n])})]}):e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"md",children:[e.jsx(dt,{variant:"dark",size:"small"}),e.jsx(E,{variant:"bodySm",color:"primary",children:c(dm[n])})]})]}),_m=t=>!!t&&typeof t=="object"&&"response"in t&&t.response!=null,xe=async(t,s)=>{if(!_m(t))return s;try{const n=await t.response.json();return n.timecard_errors?.[0]??n.general?.[0]??s}catch{return s}},Hi=(t,s)=>[...t,...s.map(n=>({mandated_break_id:n.mandatedBreakId,start_at:n.startAt,end_at:n.endAt}))],hm=(t,s)=>{const n=z(),[o,i]=a.useState(null),[d,r]=a.useState(null),[m,u]=a.useState(null),_=a.useCallback(()=>u(null),[]),h=a.useCallback(()=>n(Ne({shiftId:Number(t),consolidatedIssues:!0})),[n,t]),g=a.useCallback(async(b,C)=>{u(null),i("add");try{await le(`/timesheets/timecards/${s}`,{timecard:{shift_id:t,timebreaks:Hi(b,C)}}),r("add"),await h()}catch(T){u(await xe(T,c("timesheets.daily_review.resolve_issues.missing_breaks.server_error_subtitle")))}finally{i(null)}},[h,t,s]),x=a.useCallback(async b=>{u(null),i("confirm");try{await Promise.all(Array.from(new Set(b)).map(C=>le(`/timesheets/timecards/${t}/dismiss_missed_breaks`,{mandated_break_id:C}))),r("confirm"),await h()}catch(C){u(await xe(C,c("timesheets.daily_review.resolve_issues.missing_breaks.server_error_subtitle")))}finally{i(null)}},[h,t]);return{addBreaks:g,confirmAsMissed:x,pendingAction:o,succeededAction:d,serverError:m,clearServerError:_}},pm=t=>
1t.map(({mandatedBreakId:s,startAt:n,endAt:o,paid:i})=>({key:kl("MISSING-BREAK-DRAFT-"),paid:i,mandatedBreakId:s,clockInDate:n?it(n):"",clockOutDate:o?it(o):"",clockedIn:n?at(n):"",clockedOut:o?at(o):""})),oo=({draft:t,showLabels:s,onChange:n})=>{const o=a.useCallback(d=>n(t.key,"clockedIn",d),[n,t.key]),i=a.useCallback(d=>n(t.key,"clockedOut",d),[n,t.key]);return e.jsx(gt,{clockedIn:t.clockedIn,clockedOut:t.clockedOut,clockInDate:t.clockInDate,clockOutDate:t.clockOutDate,showLabels:s,startLabel:c("timesheets.daily_review.resolve_issues.missing_breaks.start_time"),endLabel:c("timesheets.daily_review.resolve_issues.missing_breaks.end_time"),onClockedInChange:o,onClockedOutChange:i})},gm=({row:t,breakPenaltyEnabled:s,bulkStatus:n=null})=>{const o=q(),{shiftId:i,jobId:d,employeeId:r,employeeName:m,workedInfo:u,restBreaks:_,mealBreaks:h,employeeNotTaken:g,notTakenReason:x,timebreaks:b}=t,{addBreaks:C,confirmAsMissed:T,pendingAction:y,succeededAction:v,serverError:I,clearServerError:R}=hm(i,d),S=a.useMemo(()=>[..._,...h],[_,h]),[k,f]=a.useState(null),[O,P]=a.useState(!1),M=k!==null,N=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:It.EDIT_BREAK,employee_id:r,issue_type:Q.MISSING_BREAK}),f(pm(S)),R()},[o,r,S,R]),K=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:It.ADD_BREAK,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.add_breaks"),employee_id:r,issue_type:Q.MISSING_BREAK}),C(b,S)},[o,r,C,b,S]),F=a.useCallback(()=>{k&&(o(A.BUTTON_CLICKED,w.CLICK,{element:It.ADD_BREAK,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.save"),employee_id:r,issue_type:Q.MISSING_BREAK}),C(b,k.map(({mandatedBreakId:V,clockedIn:X,clockedOut:ge})=>({mandatedBreakId:V,startAt:X,endAt:ge}))),f(null))},[o,r,C,b,k]),U=a.useCallback(()=>{P(!0)},[]),$=a.useCallback(()=>{f(null),R()},[R]),G=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:It.CONFIRM_MISSED_BREAK,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm"),employee_id:r,issue_type:Q.MISSING_BREAK,break_penalty_applies:s}),P(!1),T(S.map(({mandatedBreakId:V})=>V))},[o,r,s,T,S]),Y=a.useCallback(()=>{P(!1)},[]),H=a.useCallback(()=>hs(i),[i]),Z=a.useCallback((V,X,ge)=>{f(ut=>ut&&ut.map(gs=>gs.key===V?{...gs,[X]:ge}:gs))},[]),Ae=!k?.length||k.some(V=>!V.clockedIn||!V.clockedOut),ye=k?.filter(V=>V.paid)??[],Ue=k?.filter(V=>!V.paid)??[],Ye=!!n?.isSubmitting||!!n?.succeeded||!!y||!!v,ze=!Ye&&(I??n?.serverError)||null;return Ye?e.jsx(mm,{employeeName:m,scheduleInfo:u,action:n?.action??y??v,isSuccess:n?!!n.succeeded:!!v}):O?e.jsx(Ki,{rows:[t],breakPenaltyEnabled:s,isIndividualResolutionFlow:!0,onConfirm:G,onCancel:Y}):e.jsxs(We,{employeeName:m,scheduleInfo:u,onNameClick:H,onEditOpen:M?void 0:N,children:[M?e.jsxs(l,{flex:!0,column:!0,gap:"md",children:[ye.length>0&&e.jsxs(l,{flex:!0,column:!0,gap:"md",children:[e.jsx(E,{variant:"bodySmBoldTight",children:c("timesheets.daily_review.resolve_issues.missing_breaks.edit_rest_breaks")}),ye.map((V,X)=>e.jsx(oo,{draft:V,showLabels:X===0,onChange:Z},V.key))]}),Ue.length>0&&e.jsxs(l,{flex:!0,column:!0,gap:"md",children:[e.jsx(E,{variant:"bodySmBoldTight",children:c("timesheets.daily_review.resolve_issues.missing_breaks.edit_meal_breaks")}),Ue.map((V,X)=>e.jsx(oo,{draft:V,showLabels:X===0,onChange:Z},V.key))]})]}):e.jsxs(e.Fragment,{children:[_.length>0&&e.jsxs(l,{flex:!0,column:!0,gap:"2xs",pv:"xs",children:[e.jsx(E,{variant:"captionBold",color:"secondary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.rest_breaks")}),_.map((V,X)=>e.jsx(E,{variant:"body",color:"primary",children:V.timeRangeLabel},`${V.mandatedBreakId}-${X}`))]}),h.length>0&&e.jsxs(l,{flex:!0,column:!0,gap:"2xs",pv:"xs",children:[e.jsx(E,{variant:"captionBold",color:"secondary",children:c("timesheets.daily_review.resolve_issues.missing_breaks.meal_breaks")}),h.map((V,X)=>e.jsx(E,{variant:"body",color:"primary",children:V.timeRangeLabel},`${V.mandatedBreakId}-${X}`))]}),g&&x&&e.jsx(l,{blw:3,bcolor:"mono100",pl:"sm",children:e.jsx(E,{variant:"bodySmTight",color:"secondary",children:`"${x}"`})})]}),ze&&e.jsx(je,{variant:"error",uxElement:"resolve_issues_missing_breaks_error",title:c("timesheets.daily_review.resolve_issues.missing_breaks.server_error_title"),children:ze}),M?e.jsxs(l,{flex:!0,gap:"xs",mt:"md",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:F,disabled:Ae,children:c("timesheets.daily_review.resolve_issues.missing_breaks.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:$,uxElement:"resolve_issues_missing_breaks_cancel",children:c("timesheets.daily_review.resolve_issues.missing_breaks.cancel")})]}):e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:K,children:c("timesheets.daily_review.resolve_issues.missing_breaks.add_breaks")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:U,children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_as_missed")})]})]})},io={ADD:"add",CONFIRM:"confirm"},ao="timesheets.daily_review.resolve_issues.missing_breaks.server_error_subtitle",lo=t=>
1[...t.restBreaks,...t.mealBreaks],Cm=()=>{const t=z(),[s,n]=a.useState({}),o=a.useCallback((u,_)=>{n(h=>({...h,[u]:{...h[u],..._}}))},[]),i=a.useCallback(u=>t(Ne({shiftId:Number(u),consolidatedIssues:!0})),[t]),d=a.useCallback((u,_)=>{const h={};u.forEach(g=>{h[g.shiftId]={action:_,isSubmitting:!0,succeeded:!1,serverError:null}}),n(h)},[]),r=a.useCallback(async u=>{d(u,io.ADD),await Promise.all(u.map(async _=>{try{await le(`/timesheets/timecards/${_.jobId}`,{timecard:{shift_id:_.shiftId,timebreaks:Hi(_.timebreaks,lo(_).map(({mandatedBreakId:h,startAt:g,endAt:x})=>({mandatedBreakId:h,startAt:g,endAt:x})))}}),o(_.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await i(_.shiftId)}catch(h){const g=await xe(h,c(ao));o(_.shiftId,{isSubmitting:!1,succeeded:!1,serverError:g})}}))},[i,d,o]),m=a.useCallback(async u=>{d(u,io.CONFIRM),await Promise.all(u.map(async _=>{const h=Array.from(new Set(lo(_).map(({mandatedBreakId:g})=>g)));try{await Promise.all(h.map(g=>le(`/timesheets/timecards/${_.shiftId}/dismiss_missed_breaks`,{mandated_break_id:g}))),o(_.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await i(_.shiftId)}catch(g){const x=await xe(g,c(ao));o(_.shiftId,{isSubmitting:!1,succeeded:!1,serverError:x})}}))},[i,d,o]);return{statusMap:s,triggerAddAll:r,triggerConfirmAll:m}},xm=({rows:t,isExpanded:s,onToggle:n,breakPenaltyEnabled:o})=>{const i=q(),[d,r]=a.useState(!1),{statusMap:m,triggerAddAll:u,triggerConfirmAll:_}=Cm(),h=t.some(y=>{const v=m[y.shiftId];return v?.isSubmitting||v?.succeeded}),g=t.length>1,x=a.useCallback(()=>{i(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.add_all_breaks"),issue_type:Q.MISSING_BREAK,affected_count:t.length,break_penalty_applies:o}),u(t)},[i,u,t,o]),b=a.useCallback(()=>{i(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_all"),issue_type:Q.MISSING_BREAK,affected_count:t.length}),r(!0)},[i,t.length]),C=a.useCallback(()=>{r(!1)},[]),T=a.useCallback(()=>{i(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm"),issue_type:Q.MISSING_BREAK,affected_count:t.length,break_penalty_applies:o}),r(!1),_(t)},[i,_,t,o]);return a.useEffect(()=>{t.length===0&&r(!1)},[t.length]),t.length===0?null:e.jsx(_s,{title:c("timesheets.daily_review.resolve_issues.missing_breaks.title"),count:t.length,isExpanded:s,onToggle:n,hideCount:h,children:d?e.jsx(l,{p:"sm",children:e.jsx(Ki,{rows:t,breakPenaltyEnabled:o,onConfirm:T,onCancel:C})}):e.jsxs(e.Fragment,{children:[g&&!h&&e.jsxs(l,{flex:!0,gap:"xs",ph:"md",pv:"sm",children:[e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:x,children:c("timesheets.daily_review.resolve_issues.missing_breaks.add_all_breaks")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:b,children:c("timesheets.daily_review.resolve_issues.missing_breaks.confirm_all")})]}),e.jsx(l,{flex:!0,column:!0,ph:"md",gap:"xs",children:t.map(y=>e.jsx(gm,{row:y,breakPenaltyEnabled:o,bulkStatus:m[y.shiftId]??null},y.shiftId))})]})})},Em=({isSaveDisabled:t,isSubmitting:s,onSave:n,onCancel:o})=>e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:n,disabled:t,isLoading:s,children:c("timesheets.daily_review.resolve_issues.missing_clock_out.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:o,uxElement:"resolve_issues_missing_clock_out_cancel",children:c("timesheets.daily_review.resolve_issues.missing_clock_out.cancel")})]}),bm=({employeeName:t,scheduleInfo:s,isSuccess:n})=>e.jsxs(l,{bbw:"sm",bcolor:"default",bgcolor:"default",flex:!0,column:!0,gap:"xs",pv:"sm",children:[e.jsxs(l,{flex:!0,column:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"brand",underline:!0,children:t}),e.jsx(E,{variant:"bodySmTight",color:"secondary",noWrap:!0,children:s})]}),n?e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"sm",children:[e.jsx(ps,{}),e.jsx(E,{variant:"bodySm",color:"primary",children:c("timesheets.daily_review.resolve_issues.missing_clock_out.employee_clocked_out")})]}):e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"md",children:[e.jsx(dt,{variant:"dark",size:"small"}),e.jsx(E,{variant:"bodySm",color:"primary",children:c("timesheets.daily_review.resolve_issues.missing_clock_out.clocking_out")})]})]}),ym=(t,s,n,o,i)=>
1{const d=z(),r=Ut(n,o),[m,u]=a.useState(!1),[_,h]=a.useState(!1),[g,x]=a.useState(null),b=a.useCallback(()=>x(null),[]),C=a.useCallback(()=>d(Ne({shiftId:Number(t),consolidatedIssues:!0})),[d,t]);return{submitTimes:a.useCallback(async(y,v)=>{x(null),u(!0);try{await le(`/timesheets/timecards/${s}`,{timecard:{shift_id:t,actual_start_at:y,actual_end_at:v,timebreaks:i}}),h(!0),await C()}catch(I){x(await xe(I,c("timesheets.daily_review.resolve_issues.missing_clock_out.server_error_subtitle")))}finally{u(!1)}},[C,t,s,i]),isSubmitting:m,succeeded:_,serverError:g,clearServerError:b,...r}},Tm=({row:t,bulkStatus:s=null,bulkEditDraft:n=null,bulkEditStatus:o=null,onBulkDraftChange:i})=>{const d=q(),{shiftId:r,jobId:m,employeeId:u,employeeName:_,scheduleInfo:h,scheduledEnd:g,scheduledEndAt:x,actualStartAt:b,employeeNote:C,timebreaks:T}=t,{submitTimes:y,isSubmitting:v,succeeded:I,serverError:R,clearServerError:S,initialClockedIn:k,initialClockedOut:f,clockInDate:O,clockOutDate:P}=ym(r,m,b,x,T),[M,N]=a.useState(null),K=M!==null,F=v||I||!!s?.isSubmitting||!!s?.succeeded||!!o?.isSubmitting||!!o?.succeeded,U=I||!!s?.succeeded||!!o?.succeeded,$=F?null:R||o?.serverError||(n?null:s?.serverError)||null;a.useEffect(()=>{$&&d(A.ERROR_MESSAGE_SHOWN,w.VIEW,{error_msg:$,employee_id:u,issue_type:Q.MISSING_CLOCK_OUT})},[$,d,u]);const G=a.useCallback(()=>{d(A.BUTTON_CLICKED,w.CLICK,{element:ks.EDIT_CLOCK_OUT,employee_id:u,issue_type:Q.MISSING_CLOCK_OUT}),N({clockedIn:k,clockedOut:f}),S()},[d,u,k,f,S]),Y=a.useCallback(()=>{N(null),S()},[S]),H=a.useCallback(X=>{N(ge=>ge&&{...ge,clockedIn:X})},[]),Z=a.useCallback(X=>{N(ge=>ge&&{...ge,clockedOut:X})},[]),Ae=a.useCallback(()=>{d(A.BUTTON_CLICKED,w.CLICK,{element:ks.ADD_CLOCK_OUT,button_text:c("timesheets.daily_review.resolve_issues.missing_clock_out.clock_out"),employee_id:u,issue_type:Q.MISSING_CLOCK_OUT}),y(k,f)},[d,u,y,k,f]),ye=a.useCallback(()=>{M&&(d(A.BUTTON_CLICKED,w.CLICK,{element:ks.SAVE_CLOCK_OUT,button_text:c("timesheets.daily_review.resolve_issues.missing_clock_out.save"),employee_id:u,issue_type:Q.MISSING_CLOCK_OUT}),y(M.clockedIn,M.clockedOut))},[d,u,y,M]),Ue=a.useCallback(()=>hs(r),[r]),kt=a.useCallback(X=>i?.(r,{clockedIn:X}),[i,r]),Ye=a.useCallback(X=>i?.(r,{clockedOut:X}),[i,r]);if(F)return e.jsx(bm,{employeeName:_,scheduleInfo:h,isSuccess:U});if(n)return e.jsxs(We,{employeeName:_,scheduleInfo:h,onNameClick:Ue,children:[e.jsx(gt,{clockedIn:n.clockedIn,clockedOut:n.clockedOut,clockInDate:O,clockOutDate:P,onClockedInChange:kt,onClockedOutChange:Ye}),$&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.missing_clock_out.server_error_title"),children:$})]});const ze=!M?.clockedIn||!M?.clockedOut,V=!f;return e.jsxs(We,{employeeName:_,scheduleInfo:h,onNameClick:Ue,onEditOpen:K?void 0:G,children:[K?e.jsx(gt,{clockedIn:M.clockedIn,clockedOut:M.clockedOut,clockInDate:O,clockOutDate:P,onClockedInChange:H,onClockedOutChange:Z}):e.jsxs(e.Fragment,{children:[g&&e.jsxs(l,{flex:!0,column:!0,gap:"2xs",pv:"xs",children:[e.jsx(E,{variant:"captionBold",color:"secondary",children:c("timesheets.daily_review.resolve_issues.missing_clock_out.scheduled_end")}),e.jsx(E,{variant:"body",color:"primary",children:g})]}),C&&e.jsx(l,{blw:3,bcolor:"mono100",pl:"sm",children:e.jsx(E,{variant:"bodySmTight",color:"secondary",children:`"${C}"`})})]}),$&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.missing_clock_out.server_error_title"),children:$}),K?e.jsx(Em,{isSaveDisabled:ze,isSubmitting:v,onSave:ye,onCancel:Y}):e.jsx(L,{variant:"primary",size:"medium",onClick:Ae,fullWidth:!0,isLoading:v,disabled:V,children:c("timesheets.daily_review.resolve_issues.missing_clock_out.clock_out")})]})},vm=()=>{const t=z(),[s,n]=a.useState({}),o=a.useCallback((d,r)=>{n(m=>({...m,[d]:{...m[d],...r}}))},[]);return{triggerBulkClockOut:a.useCallback(async d=>{const r=d.filter(u=>{const{initialClockedOut:_}=Ut(u.actualStartAt,u.scheduledEndAt);return!!_});if(r.length===0)return;const m={};r.forEach(u=>{m[u.shiftId]={isSubmitting:!0,succeeded:!1,serverError:null}}),n(m),await Promise.all(r.map(async u=>{const{initialClockedIn:_,initialClockedOut:h}=Ut(u.actualStartAt,u.scheduledEndAt);try{await le(`/timesheets/timecards/${u.jobId}`,{timecard:{shift_id:u.shiftId,actual_start_at:_,actual_end_at:h,timebreaks:u.timebreaks}}),o(u.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await t(Ne({shiftId:Number(u.shiftId),consolidatedIssues:!0}))}catch(g){const x=await xe(g,c("timesheets.daily_review.resolve_issues.missing_clock_out.server_error_subtitle"));o(u.shiftId,{isSubmitting:!1,succeeded:!1,serverError:x})}}))},[t,o]),statusMap:s}},fm=()=>{const t=z(),[s,n]=a.useState({}),[o,i]=a.useState({}),d=a.useCallback(h=>{const g={};h.forEach(x=>{const{initialClockedIn:b,initialClockedOut:C}=Ut(x.actualStartAt,x.scheduledEndAt);g[x.shiftId]={clockedIn:b,clockedOut:C}}),n(g),i({})},[]),r=a.useCallback(()=>{n({}),i({})},[]),m=a.useCallback((h,g)=>{n(x=>({...x,[h]:{...x[h],...g}}))},[]),u=a.useCallback((h,g)=>{i(x=>({...x,[h]:{...x[h],...g}}))},[]),_=a.useCallback(async h=>{const g={};h.forEach(x=>{g[x.shiftId]={isSubmitting:!0,succeeded:!1,serverError:null}}),i(g),await Promise.all(h.map(async x=>{const b=s[x.shiftId];if(b)try{await le(`/timesheets/timecards/${x.jobId}`,{timecard:{shift_id:x.shiftId,actual_start_at:b.clockedIn,actual_end_at:b.clockedOut,timebreaks:x.timebreaks}}),u(x.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await t(Ne({shiftId:Number(x.shiftId),consolidatedIssues:!0}))}catch(C){const T=await xe(C,c("timesheets.daily_review.resolve_issues.missing_clock_out.server_error_subtitle"));u(x.shiftId,{isSubmitting:!1,succeeded:!1,serverError:T})}}))},[t,s,u]);return{draftMap:s,statusMap:o,openBulkEdit:d,cancelBulkEdit:r,setDraftTimes:m,triggerBulkSave:_}},km=({rows:t,isExpanded:s,onToggle:n})=>{const o=q(),{triggerBulkClockOut:i,statusMap:d}=vm(),{draftMap:r,statusMap:m,openBulkEdit:u,cancelBulkEdit:_,setDraftTimes:h,triggerBulkSave:g}=fm(),x=t.some(f=>r[f.shiftId]!==void 0),b=t.some(f=>{const O=d[f.shiftId];return O?.isSubmitting||O?.succeeded}),C=t.some(f=>{const O=m[f.shiftId];return O?.isSubmitting||O?.succeeded}),T=b||C,y=t.length>1,v=a.useCallback(()=>{const f=t.filter(O=>!!O.scheduledEndAt);o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.missing_clock_out.clock_out_all"),issue_type:Q.MISSING_CLOCK_OUT,affected_count:f.length}),i(t)},[o,i,t]),I=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION,button_text:c("timesheets.daily_review.resolve_issues.missing_clock_out.edit_times"),issue_type:Q.MISSING_CLOCK_OUT,affected_count:t.length}),u(t)},[o,u,t]),R=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.missing_clock_out.save"),issue_type:Q.MISSING_CLOCK_OUT,affected_count:t.length}),g(t)},[o,g,t]),S=t.some(f=>{const O=r[f.shiftId];return!O?.clockedIn||!O?.clockedOut}),k=t.some(f=>m[f.shiftId]?.isSubmitting);return t.length===0?null:e.jsxs(_s,{title:c("timesheets.daily_review.resolve_issues.missing_clock_out.title"),count:t.length,isExpanded:s,onToggle:n,hideCount:T,children:[y&&!T&&!x&&e.jsxs(e.Fragment,{children:[e.jsxs(l,{flex:!0,gap:"xs",ph:"md",pv:"sm",children:[e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:v,children:c("timesheets.daily_review.resolve_issues.missing_clock_out.clock_out_all")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:I,children:c("timesheets.daily_review.resolve_issues.missing_clock_out.edit_times")})]}),e.jsx(l,{ph:"md",children:e.jsx(Pe,{spacing:0})})]}),e.jsx(l,{flex:!0,column:!0,ph:"md",pt:"sm",gap:T?"xs":"sm",children:t.map(f=>e.jsx(Tm,{row:f,bulkStatus:d[f.shiftId]??null,bulkEditDraft:r[f.shiftId]??null,bulkEditStatus:m[f.shiftId]??null,onBulkDraftChange:h},f.shiftId))}),x&&!C&&e.jsxs(l,{flex:!0,gap:"xs",ph:"md",pt:"sm",pb:"sm",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:R,disabled:S,isLoading:k,children:c("timesheets.daily_review.resolve_issues.missing_clock_out.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:_,uxElement:"resolve_issues_missing_clock_out_cancel_all",children:c("timesheets.daily_review.resolve_issues.missing_clock_out.cancel")})]})]})},Sm=c("timesheets.daily_review.resolve_issues.no_show.reasons"),Fi=Sm.map(t=>({label:t,value:t})),$t=t=>t.trim().toLowerCase().replace(/\s+/g,"_"),Im=({selectedReason:t,affectedCount:s,onReasonChange:n,onSave:o,onCancel:i})=>
1{const d=q(),r=a.useCallback(({target:{value:m}})=>{const u=String(m);d(A.DROPDOWN_CLICKED,w.CLICK,{element:et.NO_SHOW_REASON,dropdown_selection:$t(u),affected_count:s,issue_type:Q.NO_SHOW}),n(u)},[d,s,n]);return e.jsxs(l,{flex:!0,column:!0,gap:"sm",ph:"md",pv:"sm",children:[e.jsx(Be,{name:"bulk_no_show_reason",options:Fi,value:t,onChange:r,placeholder:c("timesheets.daily_review.resolve_issues.no_show.choose_reason")}),e.jsx(E,{variant:"bodySmTight",color:"secondary",children:c("timesheets.daily_review.resolve_issues.no_show.reason_applies_to_all")}),e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:o,disabled:!t,children:c("timesheets.daily_review.resolve_issues.no_show.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:i,uxElement:"resolve_issues_no_show_add_reason_all_cancel",children:c("timesheets.daily_review.resolve_issues.no_show.cancel")})]}),e.jsx(Pe,{spacing:0})]})},jm={reason:"timesheets.daily_review.resolve_issues.no_show.adding_reason",time:"timesheets.daily_review.resolve_issues.no_show.adding_time"},wm={reason:"timesheets.daily_review.resolve_issues.no_show.reason_added",time:"timesheets.daily_review.resolve_issues.no_show.time_added"},Om=({employeeName:t,scheduleInfo:s,action:n,isSuccess:o})=>e.jsxs(l,{bbw:"sm",bcolor:"default",bgcolor:"default",flex:!0,column:!0,gap:"xs",pv:"sm",children:[e.jsxs(l,{flex:!0,column:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"brand",underline:!0,children:t}),e.jsx(E,{variant:"bodySmTight",color:"secondary",noWrap:!0,children:s})]}),o?e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"sm",children:[e.jsx(ps,{}),e.jsx(E,{variant:"bodySm",color:"primary",children:c(wm[n])})]}):e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"md",children:[e.jsx(dt,{variant:"dark",size:"small"}),e.jsx(E,{variant:"bodySm",color:"primary",children:c(jm[n])})]})]}),Rm=(t,s)=>{const n=z(),[o,i]=a.useState(null),[d,r]=a.useState(!1),[m,u]=a.useState(!1),[_,h]=a.useState(null),g=a.useCallback(()=>h(null),[]),x=a.useCallback(()=>n(Ne({shiftId:Number(t),consolidatedIssues:!0})),[n,t]),b=a.useCallback(async T=>{h(null),i("reason"),r(!0);try{await le(`/timesheets/timecards/${t}/update_shift`,{shift:{no_show_reason:T}}),u(!0),await x()}catch(y){h(await xe(y,c("timesheets.daily_review.resolve_issues.no_show.server_error_subtitle")))}finally{r(!1)}},[x,t]),C=a.useCallback(async(T,y)=>{h(null),i("time"),r(!0);try{await le(`/timesheets/timecards/${s}`,{timecard:{shift_id:t,actual_start_at:T,actual_end_at:y}}),u(!0),await x()}catch(v){h(await xe(v,c("timesheets.daily_review.resolve_issues.no_show.server_error_subtitle")))}finally{r(!1)}},[x,t,s]);return{submitReason:b,submitTime:C,action:o,isSubmitting:d,succeeded:m,serverError:_,clearServerError:g}},Nm=({row:t,bulkReasonMode:s=!1,bulkReasonStatus:n=null,bulkTimeDraft:o=null,bulkTimeStatus:i=null,onBulkDraftChange:d})=>{const r=q(),{shiftId:m,jobId:u,employeeId:_,employeeName:h,scheduleInfo:g,scheduledStartAt:x,scheduledEndAt:b}=t,{submitReason:C,submitTime:T,action:y,isSubmitting:v,succeeded:I,serverError:R,clearServerError:S}=Rm(m,u),[k,f]=a.useState(),[O,P]=a.useState(null),M=O!==null,N=v||I||!!n?.isSubmitting||!!n?.succeeded||!!i?.isSubmitting||!!i?.succeeded,K=N?null:R||i?.serverError||n?.serverError||null;a.useEffect(()=>{K&&r(A.ERROR_MESSAGE_SHOWN,w.VIEW,{error_msg:K,employee_id:_,issue_type:Q.NO_SHOW})},[K,r,_]);const F=a.useCallback(()=>hs(m),[m]),U=a.useCallback(V=>d?.(m,{clockedIn:V}),[d,m]),$=a.useCallback(V=>d?.(m,{clockedOut:V}),[d,m]),G=a.useCallback(({target:{value:V}})=>{const X=String(V);f(X),r(A.DROPDOWN_CLICKED,w.CLICK,{element:et.NO_SHOW_REASON,dropdown_selection:$t(X),employee_id:_,issue_type:Q.NO_SHOW})},[r,_]),Y=a.useCallback(()=>{k&&(r(A.BUTTON_CLICKED,w.CLICK,{element:et.ADD_NO_SHOW_REASON,button_text:c("timesheets.daily_review.resolve_issues.no_show.add_reason"),employee_id:_,issue_type:Q.NO_SHOW}),r(A.BUTTON_CLICKED,w.CLICK,{element:et.SAVE_NO_SHOW,button_text:c("timesheets.daily_review.resolve_issues.no_show.add_reason"),no_show_reason:$t(k),employee_id:_,issue_type:Q.NO_SHOW}),C(k))},[r,_,C,k]),H=a.useCallback(()=>{r(A.BUTTON_CLICKED,w.CLICK,{element:et.ADD_NO_SHOW_TIME,button_text:c("timesheets.daily_review.resolve_issues.no_show.add_time"),employee_id:_,issue_type:Q.NO_SHOW});const{clockInDate:V,clockOutDate:X,initialClockedIn:ge,initialClockedOut:ut}=$i(x,b);P({clockedIn:ge,clockedOut:ut,clockInDate:V,clockOutDate:X}),S()},[r,_,x,b,S]),Z=a.useCallback(()=>{P(null),S()},[S]),Ae=a.useCallback(()=>
1{O&&(r(A.BUTTON_CLICKED,w.CLICK,{element:et.SAVE_NO_SHOW,button_text:c("timesheets.daily_review.resolve_issues.no_show.save"),employee_id:_,issue_type:Q.NO_SHOW}),T(O.clockedIn,O.clockedOut))},[r,_,T,O]),ye=a.useCallback(V=>{P(X=>X&&{...X,clockedIn:V})},[]),Ue=a.useCallback(V=>{P(X=>X&&{...X,clockedOut:V})},[]),kt=!O?.clockedIn||!O?.clockedOut,Ye=I||!!n?.succeeded||!!i?.succeeded,ze=n?"reason":i?"time":void 0;return N?e.jsx(Om,{employeeName:h,scheduleInfo:g,action:ze??y??"reason",isSuccess:Ye}):o?e.jsxs(We,{employeeName:h,scheduleInfo:g,onNameClick:F,children:[e.jsx(gt,{clockedIn:o.clockedIn,clockedOut:o.clockedOut,clockInDate:o.clockInDate,clockOutDate:o.clockOutDate,onClockedInChange:U,onClockedOutChange:$}),K&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.no_show.server_error_title"),children:K})]}):s?e.jsx(We,{employeeName:h,scheduleInfo:g,onNameClick:F,children:K&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.no_show.server_error_title"),children:K})}):e.jsxs(We,{employeeName:h,scheduleInfo:g,onNameClick:F,children:[M?e.jsx(gt,{clockedIn:O.clockedIn,clockedOut:O.clockedOut,clockInDate:O.clockInDate,clockOutDate:O.clockOutDate,onClockedInChange:ye,onClockedOutChange:Ue}):e.jsx(Be,{name:"no_show_reason",options:Fi,value:k,onChange:G,placeholder:c("timesheets.daily_review.resolve_issues.no_show.choose_reason")}),K&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.no_show.server_error_title"),children:K}),M?e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:Ae,disabled:kt,isLoading:v,uxElement:"resolve_issues_no_show_save",children:c("timesheets.daily_review.resolve_issues.no_show.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:Z,uxElement:"resolve_issues_no_show_cancel",children:c("timesheets.daily_review.resolve_issues.no_show.cancel")})]}):e.jsxs(l,{flex:!0,gap:"xs",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:Y,disabled:!k,uxElement:"resolve_issues_no_show_add_reason",children:c("timesheets.daily_review.resolve_issues.no_show.add_reason")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:H,uxElement:"resolve_issues_no_show_add_time",children:c("timesheets.daily_review.resolve_issues.no_show.add_time")})]})]})},Am=()=>{const t=z(),[s,n]=a.useState(),[o,i]=a.useState({}),d=a.useCallback((u,_)=>{i(h=>({...h,[u]:{...h[u],..._}}))},[]),r=a.useCallback(()=>{n(void 0),i({})},[]),m=a.useCallback(async(u,_)=>{const h={};u.forEach(g=>{h[g.shiftId]={isSubmitting:!0,succeeded:!1,serverError:null}}),i(h),await Promise.all(u.map(async g=>{try{await le(`/timesheets/timecards/${g.shiftId}/update_shift`,{shift:{no_show_reason:_}}),d(g.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await t(Ne({shiftId:Number(g.shiftId),consolidatedIssues:!0}))}catch(x){const b=await xe(x,c("timesheets.daily_review.resolve_issues.no_show.server_error_subtitle"));d(g.shiftId,{isSubmitting:!1,succeeded:!1,serverError:b})}}))},[t,d]);return{selectedReason:s,setSelectedReason:n,statusMap:o,resetBulkAddReason:r,triggerBulkAddReason:m}},Dm=()=>{const t=z(),[s,n]=a.useState({}),[o,i]=a.useState({}),d=a.useCallback(h=>{const g={};h.forEach(x=>{const{clockInDate:b,clockOutDate:C,initialClockedIn:T,initialClockedOut:y}=$i(x.scheduledStartAt,x.scheduledEndAt);g[x.shiftId]={clockedIn:T,clockedOut:y,clockInDate:b,clockOutDate:C}}),n(g),i({})},[]),r=a.useCallback(()=>{n({}),i({})},[]),m=a.useCallback((h,g)=>{n(x=>({...x,[h]:{...x[h],...g}}))},[]),u=a.useCallback((h,g)=>{i(x=>({...x,[h]:{...x[h],...g}}))},[]),_=a.useCallback(async h=>{const g={};h.forEach(x=>{g[x.shiftId]={isSubmitting:!0,succeeded:!1,serverError:null}}),i(g),await Promise.all(h.map(async x=>{const b=s[x.shiftId];if(b)try{await le(`/timesheets/timecards/${x.jobId}`,{timecard:{shift_id:x.shiftId,actual_start_at:b.clockedIn,actual_end_at:b.clockedOut}}),u(x.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await t(Ne({shiftId:Number(x.shiftId),consolidatedIssues:!0}))}catch(C){const T=await xe(C,c("timesheets.daily_review.resolve_issues.no_show.server_error_subtitle"));u(x.shiftId,{isSubmitting:!1,succeeded:!1,serverError:T})}}))},[t,s,u]);return{draftMap:s,statusMap:o,openBulkAddTime:d,cancelBulkAddTime:r,setDraftTimes:m,triggerBulkAddTime:_}},Lm=({rows:t,isExpanded:s,onToggle:n})=>
1{const o=q(),[i,d]=a.useState("idle"),{selectedReason:r,setSelectedReason:m,statusMap:u,resetBulkAddReason:_,triggerBulkAddReason:h}=Am(),{draftMap:g,statusMap:x,openBulkAddTime:b,cancelBulkAddTime:C,setDraftTimes:T,triggerBulkAddTime:y}=Dm(),v=t.some(Y=>{const H=u[Y.shiftId];return H?.isSubmitting||H?.succeeded}),I=t.some(Y=>{const H=x[Y.shiftId];return H?.isSubmitting||H?.succeeded}),R=v||I,S=t.length>1,k=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION,button_text:c("timesheets.daily_review.resolve_issues.no_show.add_reason_all"),issue_type:Q.NO_SHOW,affected_count:t.length}),_(),d("addReasonAll")},[o,_,t.length]),f=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION,button_text:c("timesheets.daily_review.resolve_issues.no_show.add_times_all"),issue_type:Q.NO_SHOW,affected_count:t.length}),b(t),d("addTimeAll")},[o,b,t]),O=a.useCallback(()=>{_(),d("idle")},[_]),P=a.useCallback(()=>{C(),d("idle")},[C]),M=a.useCallback(()=>{r&&(o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.no_show.save"),issue_type:Q.NO_SHOW,affected_count:t.length,no_show_reason:$t(r)}),h(t,r))},[o,h,t,r]),N=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.no_show.save"),issue_type:Q.NO_SHOW,affected_count:t.length}),y(t)},[o,y,t]),K=a.useMemo(()=>t.some(Y=>{const H=g[Y.shiftId];return!H?.clockedIn||!H?.clockedOut}),[t,g]),F=t.some(Y=>x[Y.shiftId]?.isSubmitting);if(a.useEffect(()=>{t.length>0||(d("idle"),_(),C())},[t.length,_,C]),t.length===0)return null;const U=i==="addReasonAll",$=U&&!R,G=i==="addTimeAll"&&!R;return e.jsxs(_s,{title:c("timesheets.daily_review.resolve_issues.no_show.title"),count:t.length,isExpanded:s,onToggle:n,hideCount:R,children:[S&&i==="idle"&&!R&&e.jsxs(e.Fragment,{children:[e.jsxs(l,{flex:!0,gap:"xs",ph:"md",pv:"sm",children:[e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:k,children:c("timesheets.daily_review.resolve_issues.no_show.add_reason_all")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:f,children:c("timesheets.daily_review.resolve_issues.no_show.add_times_all")})]}),e.jsx(l,{ph:"md",children:e.jsx(Pe,{spacing:0})})]}),$&&e.jsx(Im,{selectedReason:r,affectedCount:t.length,onReasonChange:m,onSave:M,onCancel:O}),e.jsx(l,{flex:!0,column:!0,ph:"md",pt:"sm",gap:R?"xs":"sm",children:t.map(Y=>e.jsx(Nm,{row:Y,bulkReasonMode:U,bulkReasonStatus:u[Y.shiftId]??null,bulkTimeDraft:g[Y.shiftId]??null,bulkTimeStatus:x[Y.shiftId]??null,onBulkDraftChange:T},Y.shiftId))}),G&&e.jsxs(l,{flex:!0,gap:"xs",ph:"md",pt:"sm",pb:"sm",children:[e.jsx(L,{variant:"primary",size:"medium",grow:!0,onClick:N,disabled:K,isLoading:F,children:c("timesheets.daily_review.resolve_issues.no_show.save")}),e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:P,uxElement:"resolve_issues_no_show_add_times_all_cancel",children:c("timesheets.daily_review.resolve_issues.no_show.cancel")})]})]})},Mm=({employeeName:t,isSuccess:s})=>e.jsxs(l,{bbw:"sm",bcolor:"default",bgcolor:"default",flex:!0,column:!0,gap:"xs",pv:"sm",children:[e.jsx(E,{variant:"bodySmBoldTight",color:"brand",underline:!0,children:t}),s?e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"sm",children:[e.jsx(ps,{}),e.jsx(E,{variant:"bodySm",color:"primary",children:c("timesheets.daily_review.resolve_issues.unmatched_shifts.combined")})]}):e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"md",children:[e.jsx(dt,{variant:"dark",size:"small"}),e.jsx(E,{variant:"bodySm",color:"primary",children:c("timesheets.daily_review.resolve_issues.unmatched_shifts.combining")})]})]}),Bm=(t,s)=>{const n=an(),[o,i]=a.useState(!1),[d,r]=a.useState(!1),[m,u]=a.useState(null),_=a.useCallback(()=>u(null),[]);return{matchShift:a.useCallback(async()=>{if(s){u(null),i(!0);try{await n(nn({scheduledShiftId:Number(s),unscheduledShiftId:Number(t)})).unwrap(),r(!0),await n(sn(Number(s),Number(t),window.location.pathname))}catch(g){u(await xe(g,c("timesheets.daily_review.resolve_issues.unmatched_shifts.server_error_subtitle")))}finally{i(!1)}}},[n,t,s]),isSubmitting:o,succeeded:d,serverError:m,clearServerError:_}},{cxEl:Pm}=D("UnscheduledShiftCard"),ro=({label:t,timeRange:s,date:n})=>e.jsxs(l,{flex:!0,column:!0,grow:1,minW:0,p:"xs",bgcolor:"purple100",bradiuss:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:t}),e.jsx(E,{variant:"bodySmTight",color:"mono700",children:s}),e.jsx(E,{variant:"bodySmTight",color:"mono700",children:n})]}),Km=({row:t,bulkStatus:s=null})=>{const n=q(),{shiftId:o,employeeId:i,employeeName:d,workedTimeRange:r,workedDate:m,noShowTimeRange:u,noShowDate:_,scheduledShiftId:h}=t,{matchShift:g,isSubmitting:x,succeeded:b,serverError:C}=Bm(o,h),T=x||b||!!s?.isSubmitting||!!s?.succeeded,y=b||!!s?.succeeded,v=T?null:C||s?.serverError||null;a.useEffect(()=>{v&&n(A.ERROR_MESSAGE_SHOWN,w.VIEW,{error_msg:v,employee_id:i,issue_type:Q.UNSCHEDULED})},[v,n,i]);const I=a.useCallback(()=>hs(o),[o]),R=a.useCallback(()=>{n(A.BUTTON_CLICKED,w.CLICK,{element:om.MATCH_SHIFTS,button_text:c("timesheets.daily_review.resolve_issues.unmatched_shifts.match"),employee_id:i,issue_type:Q.UNSCHEDULED}),g()},[n,i,g]);return T?e.jsx(Mm,{employeeName:d,isSuccess:y}
1):e.jsxs(We,{employeeName:d,scheduleInfo:"",onNameClick:I,children:[e.jsxs(l,{flex:!0,alignItemsCenter:!0,gap:"xs",pv:"xs",children:[e.jsx(ro,{label:c("timesheets.daily_review.resolve_issues.unmatched_shifts.worked_label"),timeRange:r,date:m}),e.jsx(ee,{iconName:"SortArrows",size:"small",color:"primary",className:Pm("sortArrows")}),e.jsx(ro,{label:c("timesheets.daily_review.resolve_issues.unmatched_shifts.no_show_label"),timeRange:u,date:_})]}),v&&e.jsx(je,{variant:"error",title:c("timesheets.daily_review.resolve_issues.unmatched_shifts.server_error_title"),children:v}),e.jsx(L,{variant:"primary",size:"medium",onClick:R,fullWidth:!0,disabled:!h,isLoading:x,uxElement:"resolve_issues_unmatched_shifts_match",children:c("timesheets.daily_review.resolve_issues.unmatched_shifts.match")})]})},Um=()=>{const t=an(),[s,n]=a.useState({}),o=a.useCallback((d,r)=>{n(m=>({...m,[d]:{...m[d],...r}}))},[]);return{triggerBulkMatch:a.useCallback(async d=>{const r={};d.forEach(m=>{r[m.shiftId]={isSubmitting:!0,succeeded:!1,serverError:null}}),n(r),await Promise.all(d.map(async m=>{if(m.scheduledShiftId)try{await t(nn({scheduledShiftId:Number(m.scheduledShiftId),unscheduledShiftId:Number(m.shiftId)})).unwrap(),o(m.shiftId,{isSubmitting:!1,succeeded:!0,serverError:null}),await t(sn(Number(m.scheduledShiftId),Number(m.shiftId),window.location.pathname))}catch(u){const _=await xe(u,c("timesheets.daily_review.resolve_issues.unmatched_shifts.server_error_subtitle"));o(m.shiftId,{isSubmitting:!1,succeeded:!1,serverError:_})}}))},[t,o]),statusMap:s}},$m=({rows:t,isExpanded:s,onToggle:n})=>{const o=q(),{triggerBulkMatch:i,statusMap:d}=Um(),r=t.some(h=>{const g=d[h.shiftId];return g?.isSubmitting||g?.succeeded}),m=t.length>1,u=a.useMemo(()=>t.filter(h=>h.scheduledShiftId),[t]),_=a.useCallback(()=>{o(A.BUTTON_CLICKED,w.CLICK,{element:ve.BULK_ACTION_CONFIRM,button_text:c("timesheets.daily_review.resolve_issues.unmatched_shifts.match_all"),issue_type:Q.UNSCHEDULED,affected_count:u.length}),i(u)},[o,i,u]);return t.length===0?null:e.jsxs(_s,{title:c("timesheets.daily_review.resolve_issues.unmatched_shifts.title"),count:t.length,isExpanded:s,onToggle:n,hideCount:r,children:[m&&!r&&e.jsx(l,{flex:!0,gap:"xs",ph:"md",pv:"sm",children:e.jsx(L,{variant:"secondary",size:"medium",grow:!0,onClick:_,disabled:u.length===0,children:c("timesheets.daily_review.resolve_issues.unmatched_shifts.match_all")})}),e.jsx(l,{flex:!0,column:!0,ph:"md",gap:r?"xs":void 0,children:t.map(h=>e.jsx(Km,{row:h,bulkStatus:d[h.shiftId]??null},h.shiftId))})]})},{cx:Hm,cxEl:co}=D("ResolveIssuesSidebar"),Fm=({isOpen:t,onClose:s})=>{const n=z(),o=q(),[i,d]=a.useState(t),r=a.useRef(t),[m,u]=a.useState(ie.MISSING_CLOCK_OUT),_=j(Xt),h=j(Sl),{missingClockOutRows:g,unscheduledShiftRows:x,noShowRows:b,missingBreaksRows:C,issuesCount:T,hasIssues:y}=ds();a.useEffect(()=>{t&&o(A.PANEL_VIEWED,w.VIEW,{missing_clock_out_count:g.length,unscheduled_count:x.length,no_show_count:b.length,missing_break_count:C.length})},[t,o]),a.useEffect(()=>{const N={[ie.MISSING_CLOCK_OUT]:g,[ie.UNSCHEDULED_SHIFT]:x,[ie.NO_SHOW]:b,[ie.MISSING_BREAKS]:C},K=t&&m?N[m].map(F=>F.shiftId):[];n(re.setHighlightedShiftIds(K))},[t,m,g,x,b,C,n]);const v=a.useCallback(N=>{const K={[ie.MISSING_CLOCK_OUT]:g,[ie.UNSCHEDULED_SHIFT]:x,[ie.NO_SHOW]:b,[ie.MISSING_BREAKS]:C},F=m===N;o(A.DOWN_CARET_CLICKED,w.CLICK,{caret_direction:F?to.CLOSE:to.OPEN,issue_type:im[N],affected_count:K[N].length}),u(F?null:N)},[m,o,g,x,b,C]),I=a.useCallback(()=>v(ie.MISSING_CLOCK_OUT),[v]),R=a.useCallback(()=>v(ie.UNSCHEDULED_SHIFT),[v]),S=a.useCallback(()=>v(ie.NO_SHOW),[v]),k=a.useCallback(()=>v(ie.MISSING_BREAKS),[v]),f=a.useCallback(()=>{o(A.DISMISS_CLICKED,w.CLICK,{element:nm.COLLAPSE}),s()},[s,o]);a.useEffect(()=>{r.current=t},[t]);const[{width:O,x:P},M]=Go(()=>({width:t?380:0,x:t?0:380,config:{tension:250,friction:30}}));return a.useEffect(()=>{if(t){d(!0),M.start({width:380,x:0});return}M.start({width:0,x:380,onRest:()=>{r.current||d(!1)}})},[t,M]),i?e.jsx(Ks.div,{className:Hm(),style:{height:"100%",width:O,overflow:"hidden",flexShrink:0,display:"flex",minWidth:0},children:e.jsx(Ks.div,{style:{height:"100%",flex:1,minWidth:0,overflow:"hidden",transform:P.to(N=>`translateX(${N}px)`)},children:e.jsxs(l,{h:"100%",w:380,maxw:"100%",bgcolor:"default",blw:"sm",bcolor:"default",flex:!0,column:!0,minW:0,overflow:"hidden",children:[e.jsxs(l,{minh:57,bbw:"sm",flex:!0,alignItemsCenter:!0,ph:"xs",justifyContentSpaceBetween:!0,bcolor:"default",shrink:0,children:[e.jsxs(l,{p:"xs",flex:!0,alignItemsCenter:!0,gap:"xs",minW:0,children:[e.jsx(Zu,{}),e.jsx(E,{noWrap:!0,variant:"heading4",children:c("timesheets.daily_review.resolve_issues.sidebar_title",{props:{count:T}})})]}),e.jsx("button",{type:"button",className:co("collapse-button"),"aria-label":c("timesheets.daily_review.resolve_issues.collapse_sidebar"),onClick:f,children:e.jsx(wc,{iconName:"Collapse",size:"large",color:"accent"})})]}),e.jsx(l,{overflowX:"hidden",flex:!0,column:!0,grow:1,minh:0,minW:0,children:e.jsx(l,{className:co("content"),p:"md",flex:!0,column:!0,gap:"sm",overflowY:"auto",overflowX:"hidden",grow:1,h:"100%",minh:0,minW:0,children:_?e.jsx(l,{flex:!0,grow:1,alignItemsCenter:!0,justifyContentCenter:!0,children:e.jsx(dt,{size:"small",variant:"dark"})}):y?e.jsxs(e.Fragment,{children:[e.jsx(km,{rows:g,isExpanded:m===ie.MISSING_CLOCK_OUT,onToggle:I}),e.jsx($m,{rows:x,isExpanded:m===ie.UNSCHEDULED_SHIFT,onToggle:R}),e.jsx(Lm,{rows:b,isExpanded:m===ie.NO_SHOW,onToggle:S}),e.jsx(xm,{rows:C,isExpanded:m===ie.MISSING_BREAKS,onToggle:k,breakPenaltyEnabled:h})]}):e.jsxs(l,{flex:!0,column:!0,grow:1,alignItemsCenter:!0,justifyContentCenter:!0,gap:"lg",children:[e.jsx(qu,{}),e.jsxs(l,{column:!0,alignItemsCenter:!0,gap:8,textAlign:"center",children:[e.jsx(E,{variant:"heading4",children:c("timesheets.daily_review.resolve_issues.empty_state.t
1itle")}),e.jsx(E,{variant:"body",color:"mono700",children:c("timesheets.daily_review.resolve_issues.empty_state.subtitle")})]})]})})})]})})}):null},Wm=ae({productArea:me.TIME_TRACKING,eventCategory:be.DAILY_REVIEW_RESOLVE_PANEL})(Fm),{cx:Vm}=D("AddTimeCardButton"),Tn=({startDate:t,showTimecardModal:s})=>{const n=a.useCallback(()=>{At({category:ne.TIMESHEETS,action:B.ADD_TIMECARD_BUTTON_CLICKED});const o=Tt(t)?Ws().format("MM/DD/YYYY"):t;s(null,null,{date:o})},[s,t]);return e.jsx(L,{variant:"secondary",onClick:n,className:Vm(),dataTestId:"add-time-card-button",children:c("timesheets.react_page.add_timecard")})};Tn.propTypes={startDate:p.string,showTimecardModal:p.func};const{cx:Gm}=D("EmbeddedManageTipsCTA"),Ym=({subscribedToTipPooling:t,activeTipPolicyId:s,dailyTipOut:n,showTimecardModal:o,startDate:i})=>{const d=z(),r=a.useCallback(()=>{d(ln({heading:c("timesheets.clover_redirect.tip_pooling.heading"),body:c("timesheets.clover_redirect.tip_pooling.body"),goToText:c("timesheets.clover_redirect.tip_pooling.go_to_text"),href:"/settings/tip_manager",headingImage:"tip_pooling"}))},[d]);if(!t)return e.jsx(L,{variant:"secondary",onClick:r,className:Gm(),children:c("timesheets.react_page.calculate_tip_outs")});if(t){if(s&&!n)return e.jsx(us,{});if(!s)return e.jsx(ms,{})}return e.jsx(Tn,{showTimecardModal:o,startDate:i})},{cx:zm}=D("IntroductoryTipOutsButton"),{BUTTON_CLICKED:qm}=A,{CLICK:Zm}=w,Wi=({createOTE:t})=>{const s=q(),n=a.useCallback(()=>{s(qm,Zm),t("show_manage_tips_button_dismissed")},[s,t]);return e.jsx(L,{variant:"secondary",onClick:n,className:zm(),component:Gt,to:"/settings/tip_manager",children:c("timesheets.react_page.calculate_tip_outs")})};Wi.propTypes={startDate:p.string,showTimecardModal:p.func};const Jm=W(null,{createOTE:ot})(ae({productArea:_e.TIMESHEETS,eventCategory:ne.TIP_MANAGER_UNSUBSCRIBED})(Wi)),vn=({showIntroductoryManageTipsButton:t,subscribedToTipPooling:s,activeTipPolicyId:n,dailyTipOut:o,showTimecardModal:i,mobile:d,startDate:r,isPageTemplate:m})=>{if(he())return e.jsx(Ym,{subscribedToTipPooling:s,activeTipPolicyId:n,dailyTipOut:o,showTimecardModal:i,startDate:r});if(t&&!m)return e.jsx(Jm,{});if(s){if(n&&!o)return e.jsx(us,{});if(!n)return e.jsx(ms,{})}return e.jsx(Tn,{showTimecardModal:i,mobile:d,startDate:r})};vn.propTypes={showIntroductoryManageTipsButton:p.bool,subscribedToTipPooling:p.bool,activeTipPolicyId:p.string,dailyTipOut:p.bool,showTimecardModal:p.func.isRequired,mobile:p.bool,startDate:p.string,isPageTemplate:p.bool};const Xm=()=>{const t=z(),{startDate:s}=cs(),n=j(rt),o=j(Yo),i=j(qt),d=j(zo),r=j(Ke),m=a.useCallback((...u)=>t(ue(...u)),[t]);return e.jsx(vn,{showIntroductoryManageTipsButton:o,subscribedToTipPooling:n,activeTipPolicyId:i!=null?String(i):void 0,dailyTipOut:d,showTimecardModal:m,startDate:s,isPageTemplate:r})},Ss={DEFAULT:"default",URL_OVERRIDE:"dateRangeOverride",LAST_7_DAYS_PAYROLL:rn},Qm=(t,s,n)=>{switch(t){case Ss.LAST_7_DAYS_PAYROLL:return{payrollPeriod:rn,endDate:Ws().format("MM/DD/YYYY"),startDate:Ws().clone().subtract(7,"days").format("MM/DD/YYYY")};case Ss.URL_OVERRIDE:return{payrollPeriod:Il,endDate:n,startDate:s};case Ss.DEFAULT:default:return{payrollPeriod:localStorage.getItem("ReactTimesheetsPayrollPeriod"),endDate:localStorage.getItem("ReactTimesheetsEndDate"),startDate:localStorage.getItem("ReactTimesheetsStartDate")}}},Vi=(t,s,n)=>{if(!t||!s)return!1;const o=wn(t),i=wn(s);return o.isValid()&&i.isValid()&&o.isSameOrBefore(i)?!(jl(o,i)||!n&&wl(o)):!1},e_=(t,s,n)=>Vi(t,s,n)&&(s!==localStorage.getItem("ReactTimesheetsEndDate")||t!==localStorage.getItem("ReactTimesheetsStartDate")),t_=t=>{const s=localStorage.getItem("ReactTimesheetsPayrollPeriod"),n=localStorage.getItem("ReactTimesheetsStartDate"),o=localStorage.getItem("ReactTimesheetsEndDate");return!s||!Vi(n,o,t)},{cx:s_}=D("BackgroundColorBlur"),n_={backgroundColor:qo.purplePinkMedium,height:"100px",width:"100px",top:"50px",left:"50px",opacity:"0.7",filter:"blur(65px)",position:"absolute",zIndex:-1},fn=({blurMap:t})=>{const s=t.map(n=>({...n_,...n}));return e.jsx(tt,{className:s_(),children:s.map((n,o)=>e.jsx("div",{style:n},o))})};fn.propTypes={blurMap:p.arrayOf(p.shape({backgroundColor:p.string,height:p.string,width:p.str
1ing,top:p.string,left:p.string,opacity:p.string,filter:p.string,zIndex:p.string}))};fn.defaultProps={blurMap:[{}]};const{cx:uo,cxEl:Is}=D("TimesheetsZeroState"),{TIME_CLOCK_DRAWER:o_}=Ft,{TIMESHEETS_ZERO_STATE:i_}=bc,{TIMESHEETS_ZERO_STATE:a_}=xi,{BUTTON_CLICKED:mo,PAGE_VIEWED:l_}=A,{CLICK:_o,VIEW:r_}=w,c_=()=>{const t=z(),s=q();lt(l_,r_);const n=a.useCallback(()=>{s(mo,_o,{button_text:"Set up our first time clock"}),t(Ct.openBottomDrawer({drawerType:o_}))},[t,s]),o=a.useCallback(()=>{s(mo,_o,{button_text:"Maybe later"}),t(Ao())},[t,s]),i=c("timesheets_guided_setup.time_pay_journey.zero_state_content.title"),d=c("timesheets_guided_setup.time_pay_journey.zero_state_content.body"),r={text:c("timesheets_guided_setup.time_pay_journey.zero_state_content.cta-one"),onClick:n},m={text:c("timesheets_guided_setup.time_pay_journey.zero_state_content.cta-two"),onClick:o},u={file:new URL("https://cdn.joinhomebase.com/assets/square-clock-bundle-BxvalVEk.svg",import.meta.url).href};return e.jsx(tt,{className:uo(),w:"100%",h:"100%",top:0,left:0,row:!0,vcenter:!0,hcenter:!0,absolute:!0,children:e.jsxs(tt,{className:uo(),hcenter:!0,maxw:559,column:!0,pa24:!0,children:[e.jsxs(tt,{mb32:!0,relative:!0,children:[e.jsx("img",{src:`${u.file}`,alt:`${u.altText}`}),e.jsx(fn,{blurMap:[{left:"10px",top:"125px",backgroundColor:qo.purple400}]})]}),e.jsxs(tt,{column:!0,hcenter:!0,className:Is("content"),children:[e.jsx(E,{component:"h3",variant:"heading3",className:Is("title"),children:i}),e.jsx(E,{component:"p",variant:"body",className:Is("body"),children:d}),e.jsx(Rc,{primaryCTA:r,secondaryCTA:m})]})]})})},d_=ae({productArea:i_,eventCategory:a_})(c_),{cx:u_}=D("PayPeriodReviewTabEmptyState"),m_=()=>{Oe()({is_clover_embedded:!0}),lt(A.PAGE_VIEWED,w.VIEW);const s=a.useCallback(()=>{window.location.href="/clover/embedded/timesheets/step2?isFullScreenModal=true&calledfrom=payperiod"},[]);return e.jsxs(e.Fragment,{children:[e.jsx(l,{ph:32,gap:21,bgcolor:"mono0",className:u_(),children:e.jsx(Ti,{image:e.jsx(Nc,{w:120}),header:c("clover_embedded.timesheets.ftu_screen.pay_period_review.header"),body:c("clover_embedded.timesheets.ftu_screen.pay_period_review.body"),emptyState:!0,primaryCTA:{text:c("clover_embedded.timesheets.ftu_screen.pay_period_review.primary_cta"),uxElement:"connect_my_timeclock",handleClickPrimaryCTA:s}})}),e.jsx(Dt,{})]})},__=ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS_PAY_PERIOD_REVIEW_EMPTY_STATE})(m_),h_="https://cdn.joinhomebase.com/assets/shifts_calendar-bundle-BveCflDp.png";var p_=t=>e.jsx(l,{w:72,...t,minw:72,className:`FDBIllustration${t?.className?` ${t.className}`:""}`,children:e.jsx("img",{src:h_,style:{width:"100%"},alt:"Shifts Calendar Illustration"})});const{cx:g_}=D("PayPeriodReviewTabEmptyState"),C_=({openTimecardModal:t,companyOnboardingSegment:s,bgcolor:n="mono100"})=>{const o=a.useMemo(()=>new URLSearchParams(window.location.search),[]);Oe()({first_time_use:!0}),lt(A.PAGE_VIEWED,w.VIEW);const d=a.useCallback(()=>{t(null,null,{date:o.get("startDate")})},[t,o]),r=a.useCallback(()=>{s==="starter"?On.push("/payroll"):On.push("/settings/payroll?scrollTo=export-section")},[s]);return e.jsx(l,{ph:"xl",gap:21,bgcolor:n,className:g_(),children:e.jsx(yn,{image:e.jsx(p_,{w:284}),header:c("ftu_timesheets.pay_period_review_empty_state.header"),body:c("ftu_timesheets.pay_period_review_empty_state.body"),emptyState:!0,primaryCTA:{text:c("ftu_timesheets.pay_period_review_empty_state.primary_cta"),uxElement:"add_timecard",handleClickPrimaryCTA:d},secondaryCTA:{text:c("ftu_timesheets.pay_period_review_empty_state.secondary_cta"),uxElement:"set_up_payroll",handleClickSecondaryCTA:r},primaryStartIcon:!0})})},x_=W(t=>({companyOnboardingSegment:Ol(t)}),{openTimecardModal:ue})(ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS_PAY_PERIOD_REVIEW_EMPTY_STATE})(C_)),js=500,E_=({children:t,isNavVisible:s,showNav:n})=>{const[o,i]=a.useState(window.location.href),[d,r]=a.useState(s),[m,u]=Go(()=>({from:{maxHeight:s?js:0}}));return a.useEffect(()=>{const _=()=>{i(window.location.href)};return window.addEventListener("popstate",_),window.addEventListener("pushState",_),window.addEventListener("replaceState",_),n(),()=>{window.removeEventListener("popstate",_),window.removeEventListener("pushState",_),window.removeEventListener("replaceState",_)}},[n,o]),a.useEffect(()=>{d!==s&&(s?u.start({from:{maxHeight:0},to:{maxHeight:js}}):u.start({from:{maxHeight:js},to:{maxHeight:0}}),r(s))},[s,u,d]),e.jsx(Ks.div,{style:{...m},children:t})},Gi=W(t=>({isNavVisible:cn(t)}),{showNav:Zo})(E_),Yi=t=>{const[s,n]=a.useState(!0),[o,i]=a.useState(!0),[d,r]=a.useState(null),[m,u]=a.useState(!1),_=a.useCallback(()=>{n(t.current?.scrollLeft<1);const g=t.current?.scrollLeft===t.current?.scrollWidth-t.current?.clientWidth||t.current?.scrollWidth===0;
1i(g)},[t,n,i]);a.useEffect(()=>{t.current?.scrollWidth>t.current?.clientWidth&&i(!1),m&&r(t.current?.offsetTop+t.current?.offsetHeight/2)},[t,m]),a.useEffect(()=>{u(!0)},[u]);const h=a.useCallback(()=>{if(!t.current)return;const g=t.current.firstElementChild,x=g.offsetWidth+g.getBoundingClientRect().left;i(x<=window.innerWidth),r(t.current.offsetTop+t.current.offsetHeight/2)},[t]);return a.useEffect(()=>(window.addEventListener("resize",h,!0),()=>{window.removeEventListener("resize",h,!0)}),[h]),{onScroll:_,leftLimit:s,rightLimit:o,scrollPosition:d}},zi=({className:t,employee:s,onClick:n})=>{const o=a.useCallback(()=>{n(s.id,s.full_name)},[s.id,s.full_name,n]);return e.jsxs(Jo,{w:270,p:20,pr:16,ml:16,onClick:o,className:t,relative:!0,shrink:0,children:[e.jsxs(l,{row:!0,vcenter:!0,children:[e.jsx(l,{mr:8,children:e.jsx(bt,{image:s.avatar_url,initials:s.initials})}),e.jsx(l,{style:{whiteSpace:"nowrap",overflow:"hidden"},children:e.jsx(E,{color:"mono900",variant:"bodyBold",children:e.jsxs(l,{ellipsis:!0,children:[" ",s.full_name]})})})]}),e.jsxs(l,{row:!0,gap:8,ml:4,mt:41,children:[e.jsx(ee,{iconName:"Critical",size:"small",color:"red300"}),e.jsx(E,{color:"red300",variant:"captionBold",children:c(s.has_check_address_error?"payroll.dashboard.needs_review.address_invalid":"payroll.dashboard.needs_review.missing_details")})]})]})};zi.propTypes={className:p.string,employee:p.object.isRequired,onClick:p.func.isRequired};const b_={height:"100%"},qi=({timecardsWithIssuesCount:t,createOTE:s,showMakeBreaksOptionalTooltip:n,hideMakeBreaksOptionalTooltip:o})=>{const i=q(),d=a.useCallback(()=>{i(A.TOOLTIP_VIEWED,w.HOVER)},[i]),r=a.useCallback(()=>{s("make_breaks_optional"),o(),i(A.BUTTON_CLICKED,w.CLICK)},[s,o,i]),m=a.useCallback(()=>{s("make_breaks_optional"),o(),i(A.DISMISS_CLICKED,w.CLICK)},[s,o,i]);return e.jsx(oe,{open:n,variant:"primary",content:e.jsxs(l,{column:!0,children:[e.jsxs(l,{mb:16,row:!0,spacebetween:!0,vcenter:!0,children:[e.jsx(E,{variant:"heading4",children:c("timesheets.react_page.needs_review.missed_break_options.title")}),e.jsx(ee,{iconcolor:"purple100",iconName:"Close",onClick:m,size:"small"})]}),e.jsx(l,{hcenter:!0,vcenter:!0,mh:-12,children:e.jsx("img",{src:new URL("https://cdn.joinhomebase.com/assets/needs_review-bundle-DkZ9IZD4.gif",import.meta.url).href,style:b_})}),e.jsx(l,{mt:16,mb:11.3,children:e.jsx(E,{variant:"bodySm",children:c("timesheets.react_page.needs_review.missed_break_options.description")})}),e.jsx(L,{fullWidth:!0,variant:"secondary",size:"small",onClick:r,component:Gt,to:"/settings/time_tracking/breaks",children:e.jsx(E,{variant:"bodySmBold",children:c("timesheets.react_page.needs_review.missed_break_options.cta")})})]}),placement:"right-start",children:e.jsx(l,{onMouseEnter:d,dataTestId:"tooltip-badge",children:e.jsx(dn,{variant:"loud",text:t})})})};qi.propTypes={timecardsWithIssuesCount:p.number.isRequired,createOTE:p.func.isRequired,showMakeBreaksOptionalTooltip:p.bool.isRequired,hideMakeBreaksOptionalTooltip:p.func.isRequired};const y_=W(()=>({}),{createOTE:ot})(ae({productArea:me.TIMESHEETS,eventCategory:be.OPTIONAL_BREAKS})(qi)),Zi=({timecardsWithIssuesCount:t,showMakeBreaksOptionalTooltip:s,hideMakeBreaksOptionalTooltip:n,handleToggleSlider:o})=>s?e.jsx(y_,{timecardsWithIssuesCount:t,showMakeBreaksOptionalTooltip:s,hideMakeBreaksOptionalTooltip:n}):e.jsx(l,{onClick:o,dataTestId:"needs-review-badge",children:e.jsx(dn,{variant:"loud",text:t})});Zi.propTypes={timecardsWithIssuesCount:p.number.isRequired,handleToggleSlider:p.func.isRequired,showMakeBreaksOptionalTooltip:p.bool.isRequired,hideMakeBreaksOptionalTooltip:p.func.isRequired};const T_=W(t=>({showMakeBreaksOptionalTooltip:Rl(t)}),{hideMakeBreaksOptionalTooltip:Nl})(Zi),{cxEl:v_}=D("IssueMenu"),Ji=({mandatedBreaks:t,trackUx:s,row:n,removeThisIssue:o,turnOffThisMandatedBreak:i,dismissThisMandatedBreak:d})=>{const[r,m]=a.useState(null),u=a.useCallback(()=>{m(null)},[]),_=a.useCallback(k=>{s(A.DISMISS_CLICKED,w.CLICK),m(k.currentTarget)},[m,s]),h=()=>n.get("issues_collection");if(!(()=>{const k=h(),f=k.groupBy(O=>O.get("type"));return f.size===1&&f.keys().next().value==="missing_break"&&k.groupBy(O=>O.get("meta")).size===1})())return null;const b=n.getIn(["issues_collection",0,"meta"]),C=t?.get(b);if(!C)return Ka({message:"orphan_mandated_break",context:{mandated_break_id:b,shift_id:n.get("id"),job_id:n.get("job_id")}}),null;const T=()=>n.get("id"),y=Cs(C),v=()=>{s(A.LINK_CLICKED,w.CLICK,{link_text:c("timesheets.react_page.needs_review.dismiss_menu.turn_off",{props:{type:y}})}
1),u(),i(b)},I=()=>{s(A.LINK_CLICKED,w.CLICK,{link_text:c("timesheets.react_page.needs_review.dismiss_menu.dismiss_all",{props:{type:y}})}),u(),d(b)},R=()=>{s(A.LINK_CLICKED,w.CLICK,{link_text:c("timesheets.react_page.needs_review.dismiss_menu.dismiss_one")}),u(),Bl(T(),b).then(()=>{o(n)})},S={menuItemSections:[[{label:c("timesheets.react_page.needs_review.dismiss_menu.dismiss_one"),iconName:"Close",onClick:R,visible:!0},{label:c("timesheets.react_page.needs_review.dismiss_menu.dismiss_all",{props:{type:Cs(C)}}),iconName:"Close",onClick:I,visible:C&&h().size>1},{label:c("timesheets.react_page.needs_review.dismiss_menu.turn_off",{props:{type:Cs(C)}}),iconName:"Ban",onClick:v,visible:C&&C.get("active")}].filter(k=>k.visible)],size:"small"};return e.jsxs(l,{style:{position:"absolute",top:10,right:10},children:[e.jsx(Ee,{icon:"MoreVertical",className:v_("dismiss"),onClick:_}),e.jsx(Re,{...S,open:r!==null,onClose:u,anchorEl:r,anchorOriginHorizontal:"right",transformOriginHorizontal:"right"})]})};Ji.propTypes={mandatedBreaks:se.map,row:se.map,trackUx:p.func.isRequired,removeThisIssue:p.func.isRequired,turnOffThisMandatedBreak:p.func.isRequired,dismissThisMandatedBreak:p.func.isRequired};const f_=W((t,s)=>({mandatedBreaks:Al(t,s)}),{removeThisIssue:Ml,turnOffThisMandatedBreak:Ll,dismissThisMandatedBreak:Dl})(Ji),{cx:k_}=D("Issue"),Xi=({row:t,openTimecardModal:s})=>{const n=q(),o=a.useCallback(()=>{n(A.TIMECARD_CLICKED,w.CLICK),s(t)},[n,s,t]);return e.jsxs(Jo,{w:270,ml:16,className:k_(),relative:!0,shrink:0,children:[e.jsx(f_,{row:t,trackUx:n}),e.jsxs(l,{p:16,pointer:!0,onClick:o,column:!0,gap:8,children:[e.jsxs(l,{row:!0,vcenter:!0,children:[e.jsx(l,{mr:8,children:e.jsx(bt,{image:t.get("employee").get("avatar_url"),initials:t.get("employee").get("initials")})}),e.jsx(l,{style:{whiteSpace:"nowrap",overflow:"hidden"},children:e.jsx(E,{color:"mono900",variant:"bodyBold",children:e.jsx(l,{ellipsis:!0,children:t.get("employee").get("full_name")})})})]}),e.jsx(l,{className:"mb4",children:e.jsx(E,{variant:"bodySm",color:"mono700",children:t.get("dayDuration")})}),e.jsxs(l,{row:!0,gap:8,children:[e.jsx(ee,{iconName:"Critical",size:"small",color:"red300"}),e.jsx(E,{color:"red300",variant:"captionBold",children:t.get("issues")})]})]})]})};Xi.propTypes={row:se.map.isRequired,openTimecardModal:p.func.isRequired};const S_=ae({productArea:me.TIMESHEETS,eventCategory:be.NEEDS_REVIEW})(Xi),{cx:I_,cxEl:Xe}=D("Issues"),Qi=({employees:t,employeeSortBy:s,isPayrollEnrolled:n,onShowModal:o,payrollIneligibleEmployees:i,rows:d,mobile:r,showTimecardModal:m})=>{const[u,_]=a.useState(!1),h=a.useRef(),g=a.useMemo(()=>$l(d,f=>(t[f.get("job_id")]?.get(s)||"").toLowerCase()),[s,t,d]),x=a.useMemo(()=>d.length+(n?i.length:0),[n,i,d]),b=a.useMemo(()=>x>0,[x]),C=u?"ChevronUp":"ChevronDown",T=a.useCallback(()=>{_(!u),Hl()},[u,_]),y=a.useCallback((f,O)=>{o(Vo,{auto:!0,employeeId:f,employeeName:O})},[o]),v=a.useCallback(f=>{m(f.get("key"),null,f,{groupRows:g,startingPath:Ua.TIMESHEETS})},[m,g]),I=a.useCallback(()=>g.map(f=>e.jsx(S_,{row:f,openTimecardModal:v},f.get("id"))),[v,g]),{onScroll:R,leftLimit:S}=Yi(h),k=a.useCallback(f=>{if(!h.current)return;const O=2*300;let P=f?h.current.scrollLeft-O:h.current.scrollLeft+O;P<0&&(P=0),P>h.current.scrollWidth-h.current.clientWidth&&(P=h.current.scrollWidth-h.current.clientWidth),h.current.scrollTo({left:P,behavior:"smooth"})},[]);return e.jsx(l,{borderbox:!0,pb:b?8:0,className:I_(),children:b&&e.jsxs(l,{children:[e.jsx(l,{className:Xe("toggleTitle"),pointer:!0,children:e.jsxs(l,{vcenter:!0,gap:12,children:[e.jsx(l,{vcenter:!0,children:e.jsx(ee,{onClick:T,color:"mono900",iconName:C,size:"xsmall"})}),e.jsxs(l,{className:Xe("toggleSlider",C),row:!0,vcenter:!0,gap:8,children:[e.jsx(l,{onClick:T,children:e.jsx(E,{variant:"heading4",color:"mono900",children:c("timesheets.react_page.needs_review.title")})}),e.jsx(T_,{timecardsWithIssuesCount:x,handleToggleSlider:T})]})]})}),u&&e.jsxs(l,{vcenter:!0,ml:-16,children:[e.jsx(l,{relative:!0,children:e.jsx(l,{className:Xe("arrow","left",{hidden:S||r}),pointer:!0,onClick:de(k,!0),bgcolor:"mono900",borderRadius:"50%",opacity:.7,vcenter:!0,hcenter:!0,h:30,w:30,absolute:!0,left:0,children:e.jsx(ee,{color:"mono0",iconName:"C
1aretLeft",size:"xsmall"})})}),e.jsxs(l,{row:!0,overflowX:"scroll",scrollX:!0,ref:h,onScroll:R,className:Xe("slider"),relative:!0,children:[i.map((f,O)=>e.jsx(l,{inlineBlock:!0,children:e.jsx(zi,{className:Xe(`payroll-item-${f.id}`),employee:f,onClick:y})},`payroll-ineligible-user-${O}`)),I()]}),e.jsx(l,{relative:!0,children:e.jsx(l,{className:Xe("arrow","right",{hidden:r}),pointer:!0,onClick:de(k,!1),bgcolor:"mono900",borderRadius:"50%",opacity:.7,vcenter:!0,hcenter:!0,h:30,w:30,absolute:!0,right:0,children:e.jsx(ee,{color:"mono0",iconName:"CaretRight",size:"xsmall"})})})]})]})})};Qi.propTypes={employees:p.object.isRequired,employeeSortBy:p.string,isPayrollEnrolled:p.bool,onShowModal:p.func.isRequired,payrollIneligibleEmployees:p.array,rows:p.array.isRequired,mobile:p.bool,showTimecardModal:p.func.isRequired};const j_=W((t,s)=>({employees:Xo(t,s),employeeSortBy:ts(t),isPayrollEnrolled:Ul(t),payrollIneligibleEmployees:Kl(t),rows:Pl(t,s)}),{onShowModal:es,showTimecardModal:ue})(Qi),{cx:w_}=D("EmployeeDownloadButton"),O_=()=>{const t=z(),s=a.useCallback(()=>{t(Fl())},[t]);return e.jsx(L,{className:w_("employee-print"),size:"medium",variant:"primary",onClick:s,children:c("timesheets.react_page.payroll.download_button")})},Ht=({title:t,name:s,filter:n,groupBy:o,onClick:i=null,eventAction:d,eventCategory:r=ne.TIMESHEETS_MORE_ACTIONS_DROPDOWN,eventProperties:m})=>{const u=z(),_=a.useCallback(()=>{u(Wl({name:s,filter:n,groupBy:o,onClick:i,eventAction:d,eventCategory:r,eventProperties:m}))},[u,d,r,m,n,o,s,i]);return e.jsx(J,{label:t,onClick:_})},{cxEl:fe}=D("MoreActions"),ea=({canManageLocation:t,canExportTimecards:s,canImportTimecards:n,handleClickExport:o,endDate:i,startDate:d,importTimecards:r,payrollActive:m,filter:u,groupBy:_,showModal:h,period:g})=>{const x=z(),b=Ve(),C=he(),T=q(),[y,v]=a.useState(null),[I,R]=a.useState(!1),S=j(rt),k=a.useCallback($=>{T(B.MORE_ACTIONS_CLICKED,w.CLICK),v($.currentTarget)},[T]),f=a.useCallback(()=>{v(null)},[]),O=a.useCallback(()=>{T(B.IMPORT_TIMESHEETS_CLICKED,w.CLICK),f(),r(d,i)},[i,f,r,d,T]),P=a.useCallback(()=>{window.open("https://support.joinhomebase.com/s/article/Step-5-Get-to-Know-Timesheets","_blank"),f()},[f]),M=a.useCallback(()=>{T(B.SETTINGS_CLICKED,w.CLICK),f(),window.cloverDashKit&&C?window.cloverDashKit.sendMessage("navigation",{location:"settings.time_clock",path:"time_clock_options"}):window.location.href="/settings/time_tracking/time_clock"},[f,T,C]),N=a.useCallback(()=>{g&&(T(B.VIEW_SUMMARY_CLICKED,w.CLICK),f(),b.push(`/timesheets/payroll_summary_detail?period=${g}&from=${un}`))},[T,f,b,g]),K=a.useCallback(()=>{T(B.DOWNLOAD_CLICKED,w.CLICK),f(),R(!0),x(Qo({groupBy:_,filter:u})).finally(()=>R(!1))},[T,f,x,_,u]),F=a.useCallback(()=>{T(B.EXPORT_TIMESHEETS_CLICKED,w.CLICK),s?o():(T(B.VIEW,w.VIEW,{productArea:_e.PAYWALL,eventCategory:ne.TIMECARD_EDIT_HISTORY}),C?x(ei()):h(ti,{noPadding:!0,onClose:$=>{T(B.CLOSE_CLICKED,w.CLICK,{productArea:_e.PAYWALL,eventCategory:ne.TIMECARD_EDIT_HISTORY}),$()}})),f()},[s,o,f,h,T,C,x]),U=a.useCallback(()=>{T(B.TIP_MANAGER,w.CLICK),f();const $="/settings/tip_manager";C?x(ln({heading:c("timesheets.clover_redirect.tip_pooling.heading"),body:c("timesheets.clover_redirect.tip_pooling.body"),goToText:c("timesheets.clover_redirect.tip_pooling.go_to_text"),href:$,headingImage:"tip_pooling"})):window.location.href=$},[x,f,C,T]);return e.jsxs(l,{children:[e.jsx(L,{variant:"tertiary",size:"medium",onClick:k,className:fe("menu-button"),endIcon:"CaretDown",children:c("timesheets.react_page.more_actions_menu.title")}),e.jsxs(Re,{className:fe("context-menu"),open:!!y,anchorEl:y,onClose:f,children:[e.jsxs(on,{className:fe("print"),parentMenuOpen:y!==null,label:c("timesheets.react_page.more_actions_menu.print_timesheets.title"),iconName:"Print",children:[e.jsx(Ht,{title:c("timesheets.react_page.more_actions_menu.print_timesheets.default"),name:"all_timecards",groupBy:_,filter:u,onClick:f}),e.jsx(Ht,{title:c(`timesheets.react_page.more_actions_menu.print_timesheets.${_}`),name:"grouped_timecards",groupBy:_,filter:u,onClick:f})]}),m&&e.jsx(J,{className:fe("view_summary"),label:c("timesheets.react_page.more_actions_menu.view_summary"),iconName:"Documents",disabled:!g,onClick:N}),e.jsx(J,{className:fe("download_time_cards"),label:c("timesheets.react_page.more_actions_menu.download_time_cards"),iconName:"Download",disabled:!d||!i||I,onClick:K}),e.jsx(J,{className:fe("export"),label:c("timesheets.react_page.more_actions_menu.export"),iconName:"Email",onClick:F}),n&&!C&&e.jsx(J,{className:fe("import"),label:c("timesheets.react_page.more_actions_menu.import"),iconName:"Import",disabled:!t,onClick:O}),!S&&e.jsx(J,{className:fe("tip_manager"),label:c("timesheets.react_page.more_actions_menu.enable_tip_manager"),iconName:"Money",onClick:U}),e.jsx(J,{className:fe("get_to_know_timesheets"),label:c("timesheets.react_page.more_actions_menu.get_to_know_timesheets"),iconName:"Question",onClick:P}),e.jsx(J,{className:fe("settings"),label:c("timesheets.react_page.more_actions_menu.settings"),iconName:"Settings",onClick:M})]})]})};ea.propTypes={canManageLocation:p.bool,canExportTimecards:p.bool,canImportTimecards:p.bool,handleClickExport:p.func,endDate:p.string,
1startDate:p.string,importTimecards:p.func,payrollActive:p.bool,filter:p.string,groupBy:p.string,showModal:p.func,period:p.string};const R_=ae({productArea:_e.TIMESHEETS,eventCategory:ne.TIMESHEETS_MORE_ACTIONS_DROPDOWN})(ea),{cxEl:N_}=D("TimesheetsNavigation"),ta=()=>{const t=he();return e.jsx(L,{className:N_("run-payroll"),startIcon:"Money",...t?{href:"/payroll",target:Do.BLANK}:{component:Gt,to:"/payroll"},children:c("payroll.dashboard.run_payroll")})},{cxEl:Te}=D("ToolsMenu"),A_=({canManageLocation:t,canExportTimecards:s,canImportTimecards:n,handleClickExport:o,endDate:i,startDate:d,importTimecards:r,payrollActive:m,filter:u,groupBy:_,showModal:h,period:g,iconOnly:x})=>{const b=z(),C=Ve(),T=he(),y=q(),[v,I]=a.useState(null),[R,S]=a.useState(!1),k=j(rt),f=a.useCallback(Z=>{y(B.DOWN_CARET_CLICKED,w.CLICK,{caret_direction:_t.CARET_DIRECTION.OPEN}),I(Z.currentTarget)},[y]),O=a.useCallback(()=>{I(null)},[]),P=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.IMPORT_TIME_CARDS_FROM_POS}),O(),r(d??"",i??"")},[i,O,r,d,y]),M=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.GET_TO_KNOW_TIMESHEETS}),window.open("https://support.joinhomebase.com/s/article/Step-5-Get-to-Know-Timesheets","_blank"),O()},[O,y]),N=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.SETTINGS}),O(),window.cloverDashKit&&T?window.cloverDashKit.sendMessage("navigation",{location:"settings.time_clock",path:"time_clock_options"}):C.push("/settings/time_tracking/time_clock")},[O,C,T,y]),K=a.useCallback(()=>{g&&(y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.VIEW_SUMMARY}),O(),C.push(`/timesheets/payroll_summary_detail?period=${g}&from=${un}`))},[O,C,g,y]),F=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.DOWNLOAD_TIME_CARDS}),O(),S(!0),b(Qo({groupBy:_,filter:u})).finally(()=>S(!1))},[O,b,_,u,y]),U=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.EMAIL_TIME_CARD_EDIT_HISTORY}),s?o():T?b(ei()):h(ti,{noPadding:!0,onClose:Z=>{Z()}}),O()},[s,o,O,h,T,b,y]),$=a.useCallback(()=>{y(B.DROPDOWN_CLICKED,w.CLICK,{element:ce.ELEMENT.TIMESHEETS_TOOLS_MENU,dropdown_selection:ce.DROPDOWN_SELECTION.ENABLE_TIP_MANAGER}),O();const Z="/settings/tip_manager";T?b(ln({heading:c("timesheets.clover_redirect.tip_pooling.heading"),body:c("timesheets.clover_redirect.tip_pooling.body"),goToText:c("timesheets.clover_redirect.tip_pooling.go_to_text"),href:Z,headingImage:"tip_pooling"})):C.push(Z)},[b,O,C,T,y]),G=c("timesheets.react_page.more_actions_menu.print_timesheets.default"),Y=c(`timesheets.react_page.more_actions_menu.print_timesheets.${_}`),H={employee:ce.DROPDOWN_SELECTION.PRINT_BY_EMPLOYEE_VIEW,role:ce.DROPDOWN_SELECTION.PRINT_BY_ROLE_VIEW,day:ce.DROPDOWN_SELECTION.PRINT_BY_DATE_VIEW};return e.jsxs(l,{children:[x?e.jsx(Ee,{icon:"MoreHorizontal",size:"medium",onClick:f,className:Te("menu-button"),label:c("timesheets.react_page.more_actions_menu.title")}):e.jsx(L,{variant:"tertiary",size:"medium",onClick:f,className:Te("menu-button"),endIcon:"CaretDown",children:c("timesheets.react_page.more_actions_menu.title")}),e.jsxs(Re,{className:Te("context-menu"),open:!!v,anchorEl:v,onClose:O,children:[e.jsxs(on,{className:Te("print"),parentMenuOpen:v!==null,label:c("timesheets.react_page.more_actions_menu.print_timesheets.title"),children:[e.jsx(Ht,{title:G,name:"all_timecards",groupBy:_,filter:u,onClick:O,eventAction:B.DROPDOWN_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS_MENU_DROPDOWN,eventProperties:{element:_t.ELEMENT.PRINT,dropdown_selection:ce.DROPDOWN_SELECTION.PRINT_BY_DEFAULT_VIEW,button_text:G}}),e.jsx(Ht,{title:Y,name:"grouped_timecards",groupBy:_,filter:u,onClick:O,eventAction:B.DROPDOWN_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS_MENU_DROPDOWN,eventProperties:{element:_t.ELEMENT.PRINT,dropdown_selection:H[_],button_text:Y}})]}),m&&e.jsx(J,{className:Te("view_summary"),label:c("timesheets.react_page.more_actions_menu.view_summary"),disabled:!g,onClick:K}),e.jsx(J,{className:Te("download_time_cards"),label:c("timesheets.react_page.more_actions_menu.download_time_cards"),disabled:!d||!i||R,onClick:F}),e.jsx(J,{className:Te("export"),label:c("timesheets.react_page.more_actions_menu.export"),onClick:U}),n&&!T&&e.jsx(J,{className:Te("import"),label:c("timesheets.react_page.more_actions_menu.import"),disabled:!t,onClick:P}),!k&&e.jsxs(e.Fragment,{children:[e.jsx(Pe,{spacing:0}),e.jsx(J,{className:Te("tip_manager"),label:c("timesheets.react_page.more_actions_menu.enable_tip_manager"),onClick:$})]}),e.jsx(Pe,{spacing:0}),e.jsx(J,{className:Te("get_to_know_timesheets"),label:c("timesheets.react_page.more_actions_menu.get_to_know_timesheets"),onClick:M}),e.jsx(J,{className:Te("settings"),label:c("timesheets.react_page.more_actions_menu.settings"),onClick:N})]})]})},sa=ae({productArea:_e.TIMESHEETS,eventCategory:ne.TIMESHEETS_TOOLS_MENU_DROPDOWN})(A_),{cxEl:D_}=D("TimesheetsNavigation"),na=({dataIsLoading:t,period:s,payrollProvider:n})=>{const o=Ve(),i=a.useCallback(()=>{s&&(At({category:ne.TIMESHEETS,action:B.VIEW_SUMMARY_CLICKED}),o.push(`/timesheets/payroll_summary_detail?period=${s}&from=${un}`))},[o,s]),d=n?.get("provider_key")==="clover"?c("timesheets.react_page.payroll.download_button_clover"):c("timesheets.react_page.payroll.view_summary");return e.jsx(L,{dataTestId:"view-summary-button",className:D_("viewSummary"),isLoading:t
1(),size:"medium",variant:"primary",onClick:i,children:d})},ws=4,ho=16,oa=({canManageTimecards:t,mobile:s,canManageLocation:n,canExportTimecards:o,canImportTimecards:i,importTimecards:d,endDate:r,startDate:m,handleClickExport:u,filter:_,groupBy:h,payrollActive:g,showModal:x,period:b,dataIsLoading:C,showIntroductoryManageTipsButton:T,subscribedToTipPooling:y,activeTipPolicyId:v,dailyTipOut:I,showTimecardModal:R,payrollProvider:S})=>{const{cxEl:k}=D("TimesheetsNavigation"),f=j(vt);return t?e.jsxs(l,{className:k("bottom-row"),row:!0,wrap:!0,pt:"sm",pb:"md",children:[e.jsx(l,{className:k("wrapper-bottom"),shrink:0,mb:s?ws:0,children:e.jsx(l,{mr:ho,className:k("more-actions"),zIndex:1,children:f?e.jsx(sa,{canManageLocation:n,canExportTimecards:o,canImportTimecards:i,importTimecards:d,endDate:r,startDate:m,handleClickExport:u,filter:_,groupBy:h,payrollActive:g,showModal:x,period:b}):e.jsx(R_,{canManageLocation:n,canExportTimecards:o,canImportTimecards:i,importTimecards:d,endDate:r,startDate:m,handleClickExport:u,filter:_,groupBy:h,payrollActive:g,showModal:x,period:b,isLoading:C})})}),e.jsx(l,{mr:ho,mb:s?ws:0,className:k("wrapper__add-timecard"),shrink:0,children:e.jsx(vn,{showIntroductoryManageTipsButton:T,subscribedToTipPooling:y,activeTipPolicyId:v,dailyTipOut:I,showTimecardModal:R,mobile:s,startDate:m})}),e.jsx(l,{className:k("wrapper__primary-button"),shrink:0,mb:s?ws:0,children:g?e.jsx(ta,{}):e.jsx(na,{dataIsLoading:C,period:b,payrollProvider:S})})]}):e.jsx(l,{className:k("bottom-row"),pv:16,children:e.jsx(l,{className:k("secondary-wrapper-bottom"),inlineBlock:!0,children:e.jsx(O_,{})})})};oa.propTypes={canManageTimecards:p.bool.isRequired,mobile:p.bool,canManageLocation:p.bool,canExportTimecards:p.bool,canImportTimecards:p.bool,importTimecards:p.func.isRequired,endDate:p.string,startDate:p.string,handleClickExport:p.func.isRequired,filter:p.string,groupBy:p.string,payrollActive:p.bool,showModal:p.func.isRequired,period:p.string,dataIsLoading:p.func.isRequired,showIntroductoryManageTipsButton:p.bool,subscribedToTipPooling:p.bool,activeTipPolicyId:p.string,dailyTipOut:p.bool,showTimecardModal:p.func.isRequired,payrollProvider:se.map};const{cx:L_}=D("FiltersMenu"),M_=()=>{const t=z(),s=q(),[n,o]=a.useState(null),i=!!n,d=j(ss),r=j(Vt),m=a.useCallback(h=>{s(B.DOWN_CARET_CLICKED,w.CLICK,{element:Rn.ELEMENT.FILTERS_MENU,caret_direction:_t.CARET_DIRECTION.OPEN}),o(h.currentTarget)},[s]),u=a.useCallback(()=>{o(null)},[]),_=a.useCallback(({roles:h})=>{s(B.DROPDOWN_CLICKED,w.CLICK,{element:Rn.ELEMENT.ROLES,dropdown_selection:h.join(",")}),t(Vl(h))},[t,s]);return e.jsxs(l,{className:L_(),children:[e.jsx(L,{variant:"tertiary",size:"medium",onClick:m,endIcon:"CaretDown",dataTestId:"filters-menu-button",children:c("timesheets.filters_menu.title")}),e.jsx(Re,{open:i,anchorEl:n,onClose:u,children:e.jsx(l,{column:!0,gap:"md",p:"md",minw:320,maxw:360,children:e.jsx(rs,{currentRoleFilterValue:d,roleFilterOptions:r,setFilters:_,labelI18n:"timesheets.react_page.filter_table.roles",width:288,clearIcon:!0,labelLeft:!0})})})]})},ia=ae({productArea:_e.TIMESHEETS,eventCategory:ne.TIMESHEETS_FILTERS_MENU_DROPDOWN})(M_),B_=({stateStartDate:t,stateEndDate:s,onFetchTimesheetData:n,payrollPeriods:o,featureAccess:i,hasPayrollPeriod:d})=>{const[r,m]=a.useState(t),[u,_]=a.useState(s);a.useEffect(()=>{m(C=>C||t),_(C=>C||s)},[t,s]);const h=a.useCallback(C=>{const T=C.startDate.format(Fs("parsable_date")),y=C.endDate.format(Fs("parsable_date"));!Ln(T)||!Ln(y)||(m(T),_(y),n({startDate:T,endDate:y,payrollPeriod:C.stateKey}))},[n]),g=d?o.map(C=>({label:C.get("label_translation"),startDate:Je(0,C.get("start_date")),endDate:Je(0,C.get("end_date"))})):o.filter(C=>C.get("label_translation")!=="Current Payroll Period"&&C.get("label_translation")!=="Previous Payroll Period").map(C=>({label:C.get("label_translation"),startDate:Je(0,C.get("start_date")),endDate:Je(0,C.get("end_date"))})),x=a.useCallback(()=>{if(!i)return $s(fc(),ql*-1)},[i]),b=a.useCallback(()=>c(`${Dc}.${i?"month_max":"past_three_months"}`),[i]);return e.jsx(e.Fragment,{children:e.jsx(Ac,{name:"Timesheets Range",uxElement:"Pay Period Menu",startDate:Je(0,r),endDate:Je(0,u),onApplyRange:h,startOfWorkWee
1k:0,presets:g,customPresetText:b(),maxRange:Lc,blockDatesBefore:x()})})},P_=t=>({featureAccess:ni(t,{name:"historical_timesheets"}),payrollPeriods:zl(t),hasPayrollPeriod:ft(t),stateStartDate:Yl(t),stateEndDate:Gl(t)}),K_={onFetchTimesheetData:si},aa=W(P_,K_)(B_),{cx:U_}=D("ViewButton"),la=({toggleAllCards:t,groupKeys:s,cardsAreExpanded:n})=>{const o=a.useCallback(()=>{n()?(At({category:ne.TIMESHEETS,action:B.COLLAPSE_ALL_CLICKED}),t(s.concat(["all"]))):(At({category:ne.TIMESHEETS,action:B.EXPAND_ALL_CLICKED}),t([]))},[n,t,s]);return e.jsx(L,{className:U_(),variant:"tertiary",onClick:o,startIcon:n()?"Collapse":"Expand",children:c(`timesheets.react_page.${n()?"collapse_all":"expand_all"}`)})};la.propTypes={toggleAllCards:p.func,groupKeys:p.array,cardsAreExpanded:p.func};const{cx:Os}=D("ColumnOptions"),ra=({columns:t,direction:s="column",handleReorderColumns:n,handleUpdateColumns:o})=>{const i=j(vt);return e.jsx(l,{className:Os({wrapper:!0,"wrapper--row":s==="row"}),children:e.jsxs(l,{grow:!0,className:Os({"inner-wrapper":!0,"inner-wrapper--row":s==="row"}),row:s==="row",vcenter:s==="row",gap:s==="row"?8:void 0,justifyContentSpaceBetween:s==="row",children:[e.jsx(l,{mb:s==="column"?8:0,tleft:!0,children:e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:s==="row"?c("timesheets.react_page.filter_table.visible_columns"):c("timesheets.react_page.filter_table.columns")})}),e.jsx(l,{className:Os({"select-wrapper":s==="row"}),children:e.jsx(Mc,{columnOptions:t.toJS(),updateColumns:o,reorderColumns:n,submitChanges:!1,minIndex:3,eventCategory:ne.TIMESHEETS_TOOLS,eventAction:B.EDIT_COLUMNS_DROPDOWN_CLICKED,region:ke.TIMESHEETS_TABLE,isHeaderRedesignEnabled:i})})]})})},po=192,ca=[{value:"first_name",label:c("timesheets.react_page.sort_by.first_name")},{value:"last_name",label:c("timesheets.react_page.sort_by.last_name")}],da=[{value:"day",label:c("timesheets.react_page.group_by.date")},{value:"employee",label:c("timesheets.react_page.group_by.employee")},{value:"role",label:c("timesheets.react_page.group_by.role")}],Ys="all",{cx:$_,cxEl:Rs}=D("ViewMenu"),H_=(t,s)=>pn(t,{groupBy:s}),F_=({initialFilterBy:t,initialGroupBy:s,cardsAreExpanded:n,groupKeys:o,toggleAllCards:i})=>{const d=z(),r=q(),[m,u]=a.useState(null),_=!!m,h=s||"employee",g=j(mn),x=j(U=>H_(U,h)),b=j(ts),C=j(_n),T=j(ss),[y,v]=a.useState({employeeFilter:t||"all",groupBy:h,sortBy:b,roles:T||[],hideWithoutHours:C,columns:Me.fromJS(x)});a.useEffect(()=>{v(U=>({...U,employeeFilter:t||"all",sortBy:b,groupBy:h,columns:Me.fromJS(x),hideWithoutHours:C}))},[x,t,h,b,C]);const I=a.useCallback((U,$)=>{v(G=>{const Y={...G,[U]:$};return d(hn(Y)),Y})},[d]),R=a.useCallback(U=>{r(B.DOWN_CARET_CLICKED,w.CLICK,{element:Ze.ELEMENT.VIEW_MENU,caret_direction:_t.CARET_DIRECTION.OPEN}),u(U.currentTarget)},[r]),S=a.useCallback(()=>{u(null)},[]),k=a.useCallback((U,$)=>{let G="all",Y="all";$&&typeof $=="object"&&!Array.isArray($)&&(G=String($.value??"all"),Y=String($.label??"all")),G!=="all"&&r(B.DROPDOWN_CLICKED,w.CLICK,{element:Ze.ELEMENT.SEARCH_TEAM_MEMBERS,dropdown_selection:Y}),I("employeeFilter",G)},[I,r]),f=a.useCallback(U=>{r(B.DROPDOWN_CLICKED,w.CLICK,{element:Ze.ELEMENT.SORT_BY,dropdown_selection:U.target.value}),I("sortBy",U.target.value),d(ns({columnKey:"main",direction:"asc"}))},[d,I,r]),O=a.useCallback(U=>{r(B.DROPDOWN_CLICKED,w.CLICK,{element:Ze.ELEMENT.GROUP_BY,dropdown_selection:U.target.value}),I("groupBy",U.target.value)},[I,r]),P=a.useCallback((U,$)=>{const G=y.columns.get(U),Y=y.columns.delete(U).insert($,G);I("columns",Y)},[y.columns,I]),M=a.useCallback((U,$)=>{const G=y.columns.findIndex(H=>H.get("key")===U),Y=y.columns.setIn([G,"value"],$);I("columns",Y)},[y.columns,I]),N=a.useCallback(()=>{const U=!n(),$=U?"timesheets.view_menu.expand_all_rows":"timesheets.view_menu.collapse_all_rows";r(B.TOGGLE_CLICKED,w.CLICK,{element:Ze.ELEMENT.EXPAND_COLLAPSE_ROWS,toggle_text:c($),selection:String(U)}),n()?i(o.concat(["all"])):i([])},[n,i,o,r]),K=a.useCallback(()=>{const U=!y.hideWithoutHours;r(B.TOGGLE_CLICKED,w.CLICK,{element:Ze.ELEMENT.SHOW_TEAM_MEMBERS_WITHOUT_HOURS,toggle_text:c("timesheets.view_menu.show_team_members_without_hours"),selection:String(U)}
1),I("hideWithoutHours",U)},[I,y.hideWithoutHours,r]),F=a.useMemo(()=>{const{employeeFilter:U}=y;if(!(!U||U===Ys))return g.find($=>$.value===U)?.label},[g,y]);return e.jsxs(l,{className:$_(),children:[e.jsx(L,{variant:"tertiary",size:"medium",onClick:R,endIcon:"CaretDown",dataTestId:"view-menu-button",children:c("timesheets.view_menu.title")}),e.jsx(Re,{open:_,anchorEl:m,onClose:S,children:e.jsxs(l,{column:!0,gap:16,p:16,minw:320,maxw:360,children:[e.jsx(zt,{name:"employeeFilter",options:g,onChange:k,value:F,placeholder:c("timesheets.view_menu.search_placeholder"),startIcon:"Search",dataTestId:"view-menu-search"}),e.jsxs(l,{row:!0,vcenter:!0,gap:8,justifyContentSpaceBetween:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.view_menu.sort_by")}),e.jsx(l,{minw:188,children:e.jsx(Be,{name:"sortBy",options:ca,onChange:f,value:y.sortBy,dataTestId:"view-menu-sort-by"})})]}),e.jsxs(l,{row:!0,vcenter:!0,gap:8,justifyContentSpaceBetween:!0,children:[e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.view_menu.group_by")}),e.jsx(l,{minw:188,children:e.jsx(Be,{name:"groupBy",options:da,onChange:O,value:y.groupBy,dataTestId:"view-menu-group-by"})})]}),e.jsx(ra,{columns:y.columns,direction:"row",handleReorderColumns:P,handleUpdateColumns:M}),e.jsxs(l,{children:[e.jsx(Pe,{type:"light",spacing:16}),e.jsxs(l,{row:!0,vcenter:!0,justifyContentSpaceBetween:!0,gap:8,pointer:!0,onClick:K,dataTestId:"view-menu-hide-without-hours",children:[e.jsx(E,{color:"mono900",children:c("timesheets.view_menu.show_team_members_without_hours")}),e.jsxs(l,{className:Rs("icon-toggle"),children:[e.jsx(l,{className:Rs("icon",y.hideWithoutHours?"hidden":"visible"),children:e.jsx(ee,{iconName:"Show",size:"medium",color:"purple500"})}),e.jsx(l,{className:Rs("icon",y.hideWithoutHours?"visible":"hidden"),children:e.jsx(ee,{iconName:"Hide",size:"medium",color:"purple500"})})]})]}),e.jsxs(l,{row:!0,vcenter:!0,justifyContentSpaceBetween:!0,gap:8,mt:16,pointer:!0,onClick:N,dataTestId:"view-menu-expand-all-rows",children:[e.jsx(E,{color:"mono900",children:c(`timesheets.view_menu.${n()?"collapse_all_rows":"expand_all_rows"}`)}),e.jsx(ee,{iconName:n()?"Collapse":"Expand",size:"medium",color:"purple500"})]})]})]})})]})},ua=ae({productArea:_e.TIMESHEETS,eventCategory:ne.TIMESHEETS_VIEW_MENU_DROPDOWN})(F_),W_=4,Ns=4,ma=({mobile:t,shouldSeeTimesheetsEmptyState:s,dataIsLoading:n,cardsAreExpanded:o,groupKeys:i,toggleAllCards:d,filter:r,groupBy:m})=>{const{cxEl:u}=D("TimesheetsNavigation"),_=j(vt);return e.jsxs(l,{className:u("top-row"),row:!0,wrap:!0,pt:"sm",pb:"md",children:[e.jsx(l,{className:u("wrapper-top"),inlineBlock:!0,vcenter:!0,children:e.jsx(l,{className:u("payroll-picker-wrapper"),mb:t&&W_,mr:Ns,inlineBlock:!0,disabled:n(),children:e.jsx(aa,{})})}),_&&!s&&e.jsx(l,{vcenter:!0,shrink:0,mr:Ns,children:e.jsx(ia,{})}),_&&!s&&e.jsx(l,{vcenter:!0,shrink:0,mr:Ns,children:e.jsx(ua,{initialFilterBy:r,initialGroupBy:m,cardsAreExpanded:o,groupKeys:i,toggleAllCards:d})}),!_&&!s&&e.jsx(l,{className:u("view-collapse-button"),shrink:0,children:e.jsx(la,{cardsAreExpanded:o,groupKeys:i,toggleAllCards:d})})]})};ma.propTypes={mobile:p.bool,shouldSeeTimesheetsEmptyState:p.bool,dataIsLoading:p.func.isRequired,cardsAreExpanded:p.func.isRequired,groupKeys:p.array.isRequired,toggleAllCards:p.func.isRequired,filter:p.string,groupBy:p.string};const _a=({showTimecardModal:t,loadingRows:s,loadingTotals:n,canImportTimecards:o,canManageLocation:i,canExportTimecards:d,canManageTimecards:r,collapsedCards:m,groupKeys:u,showModal:_,importTimecards:h,toggleAllCards:g,payrollActive:x,mobile:b,shouldSeeTimesheetsEmptyState:C,subscribedToTipPooling:T,showIntroductoryManageTipsButton:y,activeTipPolicyId:v,dailyTipOut:I,payrollProvider:R})=>{const S=No(),{cx:k}=D("TimesheetsNavigation"),{startDate:f,endDate:O,groupBy:P,filter:M}=cs(),N=a.useMemo(()=>{if(!f||!O)return null;const $=Lt(f,"MM/DD/YYYY").format("MM/DD/YYYY"),G=Lt(O,"MM/DD/YYYY").format("MM/DD/YYYY");return`${$}-${G}`},[f,O]),K=a.useCallback(()=>Xs(mi({start_date:f,end_date:O})).then(()=>ct.success(c("timesheets.history.export_is_processing"),{autoHideTimeout:5e3})),[f,O]),F=a.useCallback(()=>s||n,[s,n]),U=a.useCallback(()=>m.size===0,[m]);return e.jsx(l,{className:k({isEmbedded:S}),wrap:!0,children:e.jsxs(l,{row:!b,wrap:!0,spacebetween:!b,grow:!0,children:[e.jsx(ma,{mobile:b,shouldSeeTimesheetsEmptyState:C,dataIsLoading:F,cardsAreExpanded:U,groupKeys:u,toggleAllCards:g,filter:M,groupBy:P}),e.jsx(oa,{canManageTimecards:r,mobile:b,canManageLocation:i,canExportTimecards:d,canImportTimecards:o,importTimecards:h,endDate:O,startDate:f,handleClickExport:K,filter:M,groupBy:P,payrollActive:x,showModal:_,period:N,dataIsLoading:F,showIntroductoryManageTipsButton:y,subscribedToTipPooling:T,activeTipPolicyId:v,dailyTipOut:I,showTimecardModal:t,payrollProvider:R})]})})};_a.propTypes={showTimecardModal:p.func.isRequired,loadingRows:p.bool.isRequired,loadingTotals:p.bool.isRequired,canImportTimecards:p.bool,canManageLocation:p.bool,canExportTimecards:p.bool,canManageTimecards:p.bool.isRequired,collapsedCards:se.set.isRequired,groupKeys:p.array.isRequired,showModal:p.func.isRequired,importTimecards:p.func.isRequired,toggleAllCards:p.func.isRequired,payrollActive:p.bool,mobile:p.bool,shouldSeeTimesheetsEmptyState:p.bool,subscribedToTipPooling:p.bool,showIntroductoryManageTipsButton:p.bool,activeTipPolicyId:p.string,dailyTipOut:p.bool,payrollProvider:se.map};const V_=ae({productArea:"Timesheets",eventCategory:"Timesheets - Tools"})(W((t,s)=>{const n=new URLSearchParams(window.location.search),o=n.get("groupBy")||"employee",i=n.get("filter")||"all";return{loadingRows:Cn(t),loadingTotals:gn(t),hasPayrollSettings:ft(t,s),canImportCreditTips:Ql(t),canImportTimecards:ci(t),canManageLocation:is(t),canExportTimecards:ri(t),importCreditTips:Xl(t),payrollActive:li(t,"payroll_active"),companyHasTimecards:Jl(t),collapsedCards:ai(t),groupKeys:ii(t,{...s,groupBy:o,filter:i}),hasUserCompletedTimesheetsGuidedSetup:os(t),currentLocation:Zl(t),subscribedToTipPooling:rt(t),showIntroductoryManageTipsButton:Yo(t),activeTipPolicyId:qt(t),dailyTipOut:zo(t),payrollProvider:oi(t)}},{showModal:es,changeLocationSettings:er,importTimecards:ui,showTimecardModal:ue,toggleAllCards:di})(_a)),{cx:As}=D("SortEmployee"),G_={last_name:B.SORT_EMPLOYEE_LAST_NAME_SELECTED,first_name:B.SORT_EMPLOYEE_FIRST_NAME_SELECTED},ha=({onSetSortColumn:t,sortBy:s,setSortBy:n})=>{const o=a.useCallback(i=>{const d=i.target.value;we({productArea:_e.TIMESHEETS,eventAction:G_[d],eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}}),n(d),t({columnKey:"main",direction:"asc"})},[n,t]);return e.jsx(l,{className:As("wrapper"),onClick:de(tr,{action:B.SORT_EMPLOYEES_BY_CLICKED,properties:{region:ke.TIMESHEETS_TABLE}}),children:e.jsxs(l,{grow:1,className:As("inner-wrapper"),children:[e.jsx(l,{mb:"xs",tleft:!0,children:e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.react_page.filter_table.sort")})}),e.jsx(Be,{clearable:!1,options:ca,searchable:!1,onChange:o,value:s,className:As("select-input","FilterTable__sort-by")})]})})};
1ha.propTypes={sortBy:p.string,setSortBy:p.func,setSortColumn:p.func};const Y_=W(()=>({}),{onSetSortColumn:ns})(ha),{cx:Ds}=D("FilterEmployee"),pa=({employeeFilterOptions:t,employeeFilter:s,setEmployeeFilter:n})=>{const o=a.useCallback(()=>{we({productArea:_e.TIMESHEETS,eventAction:B.FILTER_TABLE_MENU_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}})},[]),i=a.useCallback(r=>!r||r==="all"?{value:"all"}:t.find(m=>m.value===r),[t]),d=a.useCallback((r,m)=>{const u=m?.value||"all",_=u==="all"?B.FILTER_BY_ALL_EMPLOYEES_SELECTED:B.FILTER_BY_EMPLOYEE_SELECTED;n(u),we({productArea:_e.TIMESHEETS,eventAction:_,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}})},[n]);return e.jsx(l,{className:Ds("wrapper"),onClick:o,children:e.jsxs(l,{grow:1,className:Ds("inner-wrapper"),children:[e.jsx(l,{mb:"xs",tleft:!0,children:e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.react_page.filter_table.filter")})}),e.jsx(zt,{className:Ds("select-input","FilterTable__filter-by"),options:t,onChange:d,value:i(s).label,placeholder:c("timesheets.react_page.employee_dropdown.placeholder"),startIcon:"Search"})]})})};pa.propTypes={employeeFilterOptions:p.array,employeeFilter:p.string,setEmployeeFilter:p.func};const{cx:Ls}=D("GroupEmployee"),z_={employee:B.GROUP_BY_EMPLOYEE_SELECTED,day:B.GROUP_BY_DATE_SELECTED,role:B.GROUP_BY_ROLE_SELECTED},ga=({groupBy:t,setGroupBy:s})=>{const n=a.useCallback(()=>{we({productArea:_e.TIMESHEETS,eventAction:B.GROUP_BY_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}})},[]),o=a.useCallback(i=>{const d=i.target.value;s(d),we({productArea:_e.TIMESHEETS,eventAction:z_[d],eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}})},[s]);return e.jsx(l,{className:Ls("wrapper"),onClick:n,children:e.jsxs(l,{grow:!0,className:Ls("inner-wrapper"),children:[e.jsx(l,{mb:8,tleft:!0,children:e.jsx(E,{variant:"bodySmBoldTight",color:"mono700",children:c("timesheets.react_page.filter_table.group")})}),e.jsx(Be,{clearable:!1,options:da,searchable:!1,onChange:o,value:t,className:Ls("select-input","FilterTable__group-by")})]})})};ga.propTypes={groupBy:p.string,setGroupBy:p.func};const{cx:go}=D("HideEmployee"),Ca=({hideWithoutHours:t,setHideWithoutHours:s})=>{const n=a.useCallback(()=>{we({productArea:_e.TIMESHEETS,eventAction:B.HIDE_EMPLOYEES_CHECKBOX_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE,is_checked:!t}}),s(!t)},[t,s]);return e.jsx(l,{className:go("wrapper"),children:e.jsxs(l,{tleft:!0,row:!0,vcenter:!0,pt:24,children:[e.jsx(l,{mr:16,children:e.jsx(sr,{checked:t,name:"hideWithoutHours",onChange:n,className:"FilterTable__hide-without-hours-checkbox"})}),e.jsx(E,{className:go("label"),variant:"body",children:c("timesheets.react_page.filter_table.without_hours")})]})})};Ca.propTypes={hideWithoutHours:p.bool,setHideWithoutHours:p.func};const{cx:wt}=D("ActionWidget"),xa=({employeeFilterOptions:t,initialColumns:s,initialFilterBy:n,initialGroupBy:o,initialHideWithoutHours:i,initialSortBy:d,initialRolesFilter:r,onUpdateFilters:m,roleFilterOptions:u})=>{const[_,h]=a.useState(!1),[g,x]=a.useState({employeeFilter:n,groupBy:o,sortBy:d,roles:r||[],hideWithoutHours:i,columns:Me.fromJS(s)}),b=a.useCallback(()=>{we({productArea:_e.TIMESHEETS,eventAction:B.FILTER_TIMESHEETS_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE,is_open:!_}}),h(!_)},[_]);a.useEffect(()=>{x(v=>({...v,employeeFilter:n,sortBy:d,groupBy:o,columns:Me.fromJS(s),hideWithoutHours:i}))},[s,n,o,d,i]);const C=a.useCallback((v,I,R=!1)=>{R&&we({productArea:_e.TIMESHEETS,eventAction:B.EDIT_COLUMNS_APPLY_CLICKED,eventCategory:ne.TIMESHEETS_TOOLS,actionType:w.CLICK,properties:{region:ke.TIMESHEETS_TABLE}}),x(v==="roles"?S=>{const k={...S,[v]:I.roles};return m(k),k}:S=>{const k={...S,[v]:I};return m(k),k})},[m]),T=a.useCallback((v,I)=>{const R=g.columns.get(v),S=g.columns.delete(v).insert(I,R);C("columns",S,!0)},[g.columns,C]),y=a.useCallback((v,I)=>{const R=g.columns.findIndex(k=>k.get("key")===v),S=g.columns.setIn([R,"value"],I);C("columns",S,!0)},[g.columns,C]);return e.jsxs(l,{className:wt("wrapper","FilterTable"),column:!0,pb:16,gap:8,children:[e.jsx(l,{className:wt("filter-toggle"),children:e.jsxs(l,{vcenter:!0,gap:12,children:[e.jsx(l,{vcenter:!0,children:e.jsx(ee,{onClick:b,color:"mono900",iconName:_?"ChevronUp":"ChevronDown",size:"xsmall",dataTestId:"ActionWidget__toggle-caret"})}),e.jsx(l,{onClick:b,className:wt("toggle-name"),children:e.jsx(E,{variant:"heading4",children:c("timesheets.react_page.filter_timesheets.title")})})]})}),_&&e.jsxs(l,{className:wt("filter-tools-wrapper"),"data-testid":"filter-tools-wrapper",wrap:!0,bradiu
1sm:!0,bgcolor:"mono0",p:16,pt:12,pb:12,pr:12,bcolor:"mono300",bw:1,row:!0,children:[e.jsx(pa,{employeeFilterOptions:t,employeeFilter:g.employeeFilter,setEmployeeFilter:de(C,"employeeFilter")}),e.jsx(Y_,{sortBy:g.sortBy,setSortBy:de(C,"sortBy")}),e.jsx(rs,{currentRoleFilterValue:g.roles,roleFilterOptions:u,setFilters:de(C,"roles"),labelI18n:"timesheets.react_page.filter_table.roles",width:250}),e.jsx(ga,{groupBy:g.groupBy,setGroupBy:de(C,"groupBy")}),e.jsx(ra,{columns:g.columns,handleReorderColumns:T,handleUpdateColumns:y}),e.jsx(Ca,{hideWithoutHours:g.hideWithoutHours,setHideWithoutHours:de(C,"hideWithoutHours")})]})]})};xa.propTypes={employeeFilterOptions:p.array,initialColumns:p.array,initialFilterBy:p.string,initialGroupBy:p.string,initialHideWithoutHours:p.bool,initialSortBy:p.string,onUpdateFilters:p.func};const q_=W((t,s)=>({employeeFilterOptions:mn(t,s),initialColumns:pn(t,s),initialHideWithoutHours:_n(t,s),initialSortBy:ts(t,s),initialRolesFilter:ss(t,s),roleFilterOptions:Vt(t,s)}),{onUpdateFilters:hn})(xa),Z_=(t,s)=>pn(t,{groupBy:s}),J_=()=>{const t=z(),{filter:s,groupBy:n}=cs(),o=n||"employee",i=j(mn),d=j(ts),r=j(_n),m=j(ss),u=j(g=>Z_(g,o)),_=i.find(g=>g.value===s)?.label,h=a.useCallback((g,x)=>{let b=Ys;x&&typeof x=="object"&&!Array.isArray(x)&&(b=String(x.value??Ys)),t(hn({employeeFilter:b,groupBy:o,sortBy:d,roles:m||[],columns:Me.fromJS(u),hideWithoutHours:r}))},[t,o,d,m,u,r]);return e.jsx(l,{minw:280,children:e.jsx(zt,{name:"employeeSearch",options:i,onChange:h,value:_,placeholder:c("timesheets.view_menu.search_placeholder"),startIcon:"Search",dataTestId:"pay-period-employee-search"})})},X_=()=>{const t=z(),{groupBy:s,filter:n,startDate:o,endDate:i}=cs(),d=j(ai),r=j(k=>ii(k,{groupBy:s,filter:n})),m=j(is),u=j(ri),_=j(ci),h=j(k=>li(k,"payroll_active")),g=j(Cn),x=j(gn),b=j(oi),C=o&&i?`${Lt(o,"MM/DD/YYYY").format("MM/DD/YYYY")}-${Lt(i,"MM/DD/YYYY").format("MM/DD/YYYY")}`:null,T=a.useCallback(()=>d.size===0,[d]),y=a.useCallback(()=>g||x,[g,x]),v=a.useCallback(k=>t(di(k)),[t]),I=a.useCallback(()=>Xs(mi({start_date:o,end_date:i})).then(()=>ct.success(c("timesheets.history.export_is_processing"),{autoHideTimeout:5e3})),[o,i]),R=a.useCallback((k,f)=>t(ui(k,f)),[t]),S=a.useCallback((k,f)=>t(es(k,f)),[t]);return e.jsx(Le.Toolbar,{filters:e.jsxs(e.Fragment,{children:[e.jsx(J_,{}),e.jsx(ia,{})]}),context:e.jsx(aa,{}),viewOptions:e.jsxs(e.Fragment,{children:[e.jsx(sa,{iconOnly:!0,canManageLocation:m,canExportTimecards:u,canImportTimecards:_,importTimecards:R,endDate:i,startDate:o,handleClickExport:I,filter:n,groupBy:s,payrollActive:h,showModal:S,period:C??void 0}),e.jsx(ua,{initialFilterBy:n,initialGroupBy:s,cardsAreExpanded:T,groupKeys:r,toggleAllCards:v}),h?e.jsx(ta,{}):e.jsx(na,{dataIsLoading:y,period:C??void 0,payrollProvider:b})]})})},Q_=({holiday_day:t,holiday_date:s,holiday_name:n})=>{const[o,i]=a.useState(!1),d=a.useCallback(u=>{Xs("/payroll/banners/dismiss_banner?name=approval_deadline_changed&banner_location=timesheets"),u&&u()},[]),r=a.useCallback(()=>{d(()=>window.location.href="/payroll")},[d]),m=a.useCallback(()=>{d(()=>i(!0))},[d,i]);return o?null:e.jsx(l,{mt:"lg",mh:"md",mb:"md",dataTestId:"approval_deadline_changed_banner",children:e.jsx(je,{title:c("timesheets.react_page.payroll.approval_deadline_changed_banner.title"),type:"warning",variant:"warning",onClose:m,action:e.jsx(L,{variant:"secondary",size:"medium",onClick:r,children:c("timesheets.react_page.payroll.approval_deadline_changed_banner.button")}),children:c("timesheets.react_page.payroll.approval_deadline_changed_banner.subtitle",{props:{holiday_day:t,holiday_date:s,holiday_name:n}})})})},{cx:Qe}=D("TableHeaderCell"),Ea=({canManageTimecards:t,column:s,setSortColumn:n,sortColumn:o,currentGroupBy:i,updateColumn:d,cxEl:r,setExplainerSideDrawerOpen:m,setSearchColumnKey:u})=>{const[_,h]=a.useState(!1),[g,x]=a.useState(),b=a.useRef(),C=a.useMemo(()=>s.get("key"),[s]),T=a.useCallback(()=>{h(!1)},[]);a.useEffect(()=>{const N=K=>{b.current&&!b.current.contains(K.target)&&T()};return document.addEventListener("click",N,!0),()=>{document.removeEventListener("click",N,!0)}},[T]);const y=a.useCallback(N=>{b.current=N,h(!_),_||nr({columnName:s.get("name")}
1)},[_,s]),v=a.useCallback(N=>{N.onClick(),or({columnName:s.get("name"),action:`${N.label} Clicked`}),h(!1)},[s]),I=a.useCallback(N=>{n({columnKey:C,direction:N},()=>{localStorage.setItem("ReactTimesheetsSortColumnKey",C),localStorage.setItem("ReactTimesheetsSortDirection",N)})},[C,n]),R=a.useCallback(()=>{let N;C==="main"?N=i==="employee"?"day":"employee":C==="date"?N="day":N=C,Us({groupBy:N}),localStorage.setItem("ReactTimesheetsGroupBy",N)},[C,i]),S=a.useCallback(()=>{d(C,!1)},[d,C]),k=a.useCallback(N=>{const K="ffcra";m(!0),N.startsWith(K)?u(K):u(N)},[m,u]),f=a.useMemo(()=>{const N=[{label:c("timesheets.react_page.header_menu.sort_asc"),onClick:de(I,"asc"),icon:"SortUp",direction:"asc"},{label:c("timesheets.react_page.header_menu.sort_desc"),onClick:de(I,"desc"),icon:"SortDown",direction:"desc"}];return t&&["main","date","employee","role"].includes(C)&&N.push({label:c("timesheets.react_page.header_menu.group_by"),onClick:R,icon:"Group"}),t&&!["main","date","employee"].includes(C)&&(N.push({label:c("timesheets.react_page.header_menu.hide"),onClick:S,icon:"Hide"}),N.push({label:c("timesheets.react_page.header_menu.what_is_this"),onClick:de(k,C),icon:"Question"})),N},[I,C,t,R,S,k]);function O(){return C===o.get("columnKey")}function P(N){return O()?o.get("direction")===N:!1}function M(){return O()?o.get("direction")==="desc"?"CaretDown":"CaretUp":"CaretDown"}return e.jsx(l,{vcenter:!0,className:`${Qe("column",s.get("value-type")+"-column")} ${r(C)}`,ref:x,pointer:!0,onClick:de(y,g),dataTestId:`table-header-cell-${C}`,children:e.jsxs(l,{className:Qe("column-item"),row:!0,children:[e.jsx(l,{children:e.jsx(E,{color:"mono700",variant:"captionBold",children:s.get("name")})}),e.jsx(l,{p:4,pr:0,pt:3,className:Qe("caret",s.get("value-type")),children:e.jsx(ee,{color:O()?"mono700":"mono500",iconName:M(),size:"small",className:Qe("caret-icon")})}),_&&e.jsx(l,{ref:b,className:Qe("view-menu",s.get("value-type")+"-column"),shadow:"z3",pr:8,pl:8,pt:24,pb:24,mt:12,w:240,children:f.map((N,K)=>e.jsxs(l,{w:212,children:[e.jsxs(l,{bradiuss:!0,flex:!0,"flex-row":!0,vcenter:!0,h:32,pr:16,pl:12,pointer:!0,onClick:de(v,N),className:Qe("menu-option",{"menu-option-selected":P(N.direction)}),children:[e.jsx(ee,{size:"small",iconName:N.icon,color:P(N.direction)?"mono100":"mono900"}),e.jsx(E,{variant:"body",color:P(N.direction)?"mono100":"mono900",children:N.label}),P(N.direction)&&e.jsx(ee,{className:"selected-icon",size:"small",left:"0",iconName:"Success",color:"mono100"})]}),K===1&&e.jsx(l,{w:236,children:e.jsx(Pe,{spacing:8,type:"light",color:"mono400"})})]},K))})]})},C)};Ea.propTypes={canManageTimecards:p.bool,column:se.map.isRequired,setSortColumn:p.func.isRequired,sortColumn:se.map.isRequired,currentGroupBy:p.string.isRequired,updateColumn:p.func.isRequired,cxEl:p.func.isRequired};const eh=(t,s)=>!s||!t?t:t.replace(/<a\s+([^>]*?)href=(['"])(.*?)\2([^>]*?)>/gi,'<a $1href=$2$3$2 target="_blank" rel="noopener noreferrer" $4>'),{cx:th}=D("ColumnAccordion"),sh=({title:t,explanation:s,isInitiallyExpanded:n})=>{const[o,i]=a.useState(n),d=he(),r=a.useCallback(()=>{i(!o)},[o]);return e.jsx(l,{children:e.jsxs(l,{row:!0,flex:!0,alignItems:"center",justifyContent:"space-between",pv:16,gap:8,bbw:1,bcolor:"mono300",children:[e.jsx(l,{children:e.jsx(Ee,{size:"small",icon:o?"ChevronUp":"ChevronDown",onClick:r})}),e.jsxs(l,{column:!0,flex:!0,gap:12,children:[e.jsx(l,{children:e.jsx(E,{variant:"heading3",color:"mono900",children:t})}),e.jsx(Bc,{in:o,children:e.jsx(E,{className:th("explanation"),variant:"body",asHTML:!0,color:"mono700",children:eh(s,d)})})]})]})})},nh=({onClearFilters:t})=>e.jsxs(l,{flex:!0,column:!0,alignItems:"center",justifyContentCenter:!0,gap:3,pv:32,children:[e.jsx(l,{flex:!0,justifyContentCenter:!0,pt:32,pb:40,children:e.jsx(Qs,{w:120})}),e.jsx(E,{variant:"heading3",color:"mono900",textAlign:"center",children:c("timesheets_column_explanations.no_results.title")}),e.jsx(E,{variant:"body",color:"mono700",textAlign:"center",children:c("timesheets_column_explanations.no_results.description")}),e.jsx(l,{pt:24,flex:!0,justifyContentCenter:!0,children:e.jsx(L,{variant:"primary",onClick:t,children:c("timesheets_column_explanations.no_results.cta")})})]}),oh=["actual","variance","blue_laws_hours","cash_tips","credit_tips","overtime","double_overtimes","qualified_overtime","costs","ffcra","holiday_pay","issues","break_penalty","time_off_hours","regular","role","scheduled_hours","split_shift_hours","spread_of_hours","timecard","paid","unpaid_breaks_hours","wage_rate"],ih=({initialSearchColumnKey:t})=>{const[s,n]=a.useState(""),o=j(pe),i=a.useMemo(()=>oh.map(u=>{const _=u==="unpaid_breaks_hours"&&o?"meal_breaks_hours":u;return{title:c(`timesheets_column_explanations.columns.${_}
1.name`),explanation:c(`timesheets_column_explanations.columns.${_}.explanation`),key:u}}),[o]);a.useEffect(()=>{const u=i.find(_=>_.key===t);n(u?u.title:"")},[i,t]);const d=a.useCallback(()=>{n("")},[n]),r=a.useCallback(u=>{n(u.target.value)},[n]),m=i.filter(u=>u.title.toLowerCase().includes(s.toLowerCase())||u.explanation.toLowerCase().includes(s.toLowerCase()));return e.jsxs(l,{children:[e.jsx(E,{variant:"heading2",children:c("timesheets_column_explanations.title")}),e.jsxs(l,{pv:12,children:[e.jsx(E,{inline:!0,variant:"body",color:"mono700",children:c("timesheets_column_explanations.description")})," ",e.jsx(xn,{endIcon:"ExternalLink",href:"https://support.joinhomebase.com/s/article/Step-5-Get-to-Know-Timesheets",target:"_blank",children:c("timesheets.react_page.more_actions_menu.get_to_know_timesheets")})]}),e.jsxs(l,{pb:32,children:[e.jsx(l,{pv:8,children:e.jsx(E,{variant:"bodySmBold",color:"mono700",children:c("timesheets_column_explanations.search.label")})}),e.jsx(ir,{name:"search",startIcon:"Search",endIcon:s&&e.jsx(ee,{iconName:"Clear",size:"medium",color:"purple500",onClick:d}),placeholder:c("timesheets_column_explanations.search.placeholder"),value:s,onChange:r})]}),e.jsx(l,{children:m.length>0?m.map(u=>e.jsx(sh,{isInitiallyExpanded:u.key===t,title:u.title,explanation:u.explanation},u.key)):e.jsx(nh,{onClearFilters:d})})]})},Co=({isEmbedded:t,searchColumnKey:s,handleClose:n})=>{const o=j(ar);return e.jsxs(l,{width:"100%",pb:16,children:[o&&e.jsx(l,{h:48}),e.jsxs(l,{pb:t?0:16,mh:"auto",maxw:"640px",children:[t?e.jsx(Ic,{pv:20,onClick:n}):e.jsx(l,{pt:18,pr:16,row:!0,flex:!0,alignItems:"center",justifyContentEnd:!0,children:e.jsx(Ee,{size:"small",icon:"Close",label:c("timesheets.explainer.close"),onClick:n})}),e.jsx(l,{ph:t?0:32,children:e.jsx(ih,{initialSearchColumnKey:s})})]})]})},{cx:ah}=D("ExplainerSideDrawer"),lh=({open:t,setOpen:s,searchColumnKey:n})=>{const o=he(),i=a.useCallback(()=>{s(!1)},[s]);return o?e.jsx($o,{open:t,onClose:i,hideCloseIcon:!0,fullScreen:!0,children:()=>e.jsx(Co,{isEmbedded:o,searchColumnKey:n,handleClose:i})}):e.jsx(lr,{open:t,width:"480px",className:ah(),zIndex:13e3,children:e.jsx(Co,{isEmbedded:o,searchColumnKey:n,handleClose:i})})},{cx:rh,cxEl:ch}=D("TableHeader"),ba=({canManageTimecards:t,columns:s,groupBy:n,onSetSortColumn:o,onUpdateColumn:i,sortColumn:d})=>{const[r,m]=a.useState(!1),[u,_]=a.useState("");return e.jsxs(l,{className:rh(),row:!0,vcenter:!0,sticky:!0,bg:"white",h:48,top:0,z:2,children:[e.jsx(lh,{open:r,setOpen:m,searchColumnKey:u}),s.map(h=>e.jsx(Ea,{canManageTimecards:t,column:h,currentGroupBy:n,updateColumn:i,cxEl:ch,setExplainerSideDrawerOpen:m,setSearchColumnKey:_,setSortColumn:o,sortColumn:d},h)),e.jsx(l,{w:hi})]})};ba.propTypes={canManageTimecards:p.bool,columns:se.list,groupBy:p.string,onSetSortColumn:p.func.isRequired,onUpdateColumn:p.func.isRequired,sortColumn:se.map};const dh=W((t,s)=>({columns:_i(t,s),sortColumn:rr(t,s)}),{onSetSortColumn:ns,onUpdateColumn:cr})(ba),{cx:uh,cxEl:xo}=D("TableFooter"),ya=({columns:t,loadingSummaries:s,totals:n})=>e.jsxs(l,{className:uh(),b:!0,vcenter:!0,row:!0,sticky:!0,borderbox:!0,style:{borderRight:0,borderLeft:0},children:[e.jsx(l,{className:xo("main",{},"text-column"),vcenter:!0,hcenter:!0,children:e.jsx(E,{variant:"bodyBold",children:c("timesheets.react_page.footer_row.title")})}),t.map(o=>{const i=o.get("key"),d=()=>_r.includes(i)?null:s?e.jsx(pi,{type:"grayBar"}):e.jsx(E,{variant:"bodyBold",children:n.get(i)});return e.jsx(l,{className:xo(i,{},o.get("value-type")+"-column"),children:d()},i)}),e.jsx(l,{minw:42})]});ya.propTypes={columns:se.list.isRequired,totals:se.map.isRequired};const mh=W((t,s)=>({columns:mr(t,s),totals:ur(t,s),loadingSummaries:dr(t)}),{})(ya),{cx:_h}=D("TimesheetsEmptyState"),{LINK_CLICKED:hh}=A,{CLICK:ph}=w,{TIMESHEETS:gh}=me,{TIMESHEETS:Ch}=ne,kn=({description:t,link:s,completedStepLink:n,hasUserCompletedTimesheetsGuidedSetup:o})=>{const i=q(),{href:d,copy:r}=o?n:s,m=a.useCallback(()=>i(hh,ph,{link_text:o?"Set more advanced time tracking options in Settings":"Learn more about time tracking",link_url:d}),[o,d,i]);return e.jsxs(tt,{className:_h(),children:[e.jsx(E,{variant:"bodyBold",component:"p",children:t}),e.jsx(xn,{endIcon:"ExternalLink",onClick:m,href:d,target:"_blank",size:"small",children:r})]})};kn.propsTypes={description:p.string,link:p.object,completedStepLink:p.object,hasUserCompletedTimesheetsGuidedSetup:p.bool};kn.defaultProps={description:c("timesheets_guided_setup.timesheets_empty_state.description"),link:{copy:c("timesheets_guided_setup.timesheets_empty_state.link"),href:`${hr}/Time-Clocks`},completedStepLink:{copy:c("timesheets_guided_setup.timesheets_completed_empty_state.link"),href:"/settings/time_tracking/time_clock"},hasUserCompletedTimesheetsGuidedSetup:!1};const xh=W(t=>({hasUserCompletedTimesheetsGuidedSetup:os(t)}),{})(ae({productArea:gh,eventCategory:Ch})(kn)),{CLICK:Eh}=w,{cx:bh}
1=D("AddEmployeeRow"),Ta=({showAddEmployeeModal:t,shouldSeeTimesheetsZeroState:s,shouldShowEnforcementDialog:n,canCloseEnforcementDialog:o,showEnforcementDialog:i})=>{const d=he(),r=q(),m=a.useCallback(()=>{r(A.ADD_EMPLOYEES_CLICKED,Eh,{}),n?i({productArea:me.TIMESHEETS,canCloseDialog:o}):t({calledFrom:me.TIMESHEETS})},[r,n,i,o,t]);return d?e.jsx(l,{bgcolor:"mono0",p:12,minh:20,h:20}):e.jsx(l,{pointer:!0,vcenter:!0,className:bh(),bgcolor:"mono0",p:12,h:20,onClick:m,children:!s&&e.jsxs(l,{vcenter:!0,grow:!0,"data-testid":"add-employee-row",children:[e.jsx(xn,{startIcon:"Add",size:"small",children:c("timesheets.react_page.add_employee_link")}),n&&e.jsx(Pc,{content:c("enforcement.employee_cap.tooltip")})]})})};Ta.propTypes={showAddEmployeeModal:p.func.isRequired,shouldSeeTimesheetsZeroState:p.bool,shouldShowEnforcementDialog:p.bool.isRequired,canCloseEnforcementDialog:p.bool.isRequired,showEnforcementDialog:p.func.isRequired};const yh=t=>({shouldShowEnforcementDialog:xr(t),canCloseEnforcementDialog:Cr(t)}),Th={showAddEmployeeModal:gr,showEnforcementDialog:pr},vh=ae({productArea:me.TIMESHEETS,eventCategory:"Timesheets"})(W(yh,Th)(Ta));function fh({onClick:t}){return e.jsx(l,{p:12,pt:16,pb:16,children:e.jsx(L,{onClick:t,startIcon:"Add",size:"small",variant:"tertiary",dataTestId:"add-timecard-row-add-button",children:c("timesheets.react_page.summary_row.menu.add_timecard")})})}const va=({cardIsCollapsed:t,groupBy:s,group:n,columns:o})=>{const i=(_,h)=>{const g=Jt(_,null,Er);return e.jsx(oe,{content:g?_:null,children:e.jsx(l,{className:"vcenter",maxw:h,children:e.jsx(E,{variant:"bodyBold",color:"mono900",children:_})})})},d=()=>{const _=n.job?.get("full_name")??"",g=o.some(x=>x.get("key")==="role"||x.get("key")==="wage_rate")?br:yr;return e.jsxs(e.Fragment,{children:[e.jsx(l,{className:"vcenter",style:{margin:"-6px 8px",minWidth:24},children:e.jsx(bt,{image:n.job?.get("avatar_url"),initials:n.job?.get("initials")})}),i(_,g)]})},r=()=>i(n.day.format("dddd, MMMM DD")),m=()=>i(n.role.get("name"),Tr),u=t?"ChevronDown":"ChevronUp";return e.jsxs(l,{row:!0,children:[e.jsx(l,{className:"vcenter",pr:8,"data-testid":u,children:e.jsx(ee,{color:"mono900",size:"xsmall",iconName:u})}),s==="employee"&&d(),s==="day"&&r(),s==="role"&&m()]})};va.propTypes={cardIsCollapsed:p.bool.isRequired,groupBy:p.string.isRequired,group:p.object.isRequired,columns:se.list.isRequired};const kh=({currentUser:t,lockTimesheetsPermission:s,employees:n,timecardPhotosEnabled:o,minTierNameForPhotos:i,createChannel:d,toggleMessengerShown:r,showPhotosModal:m,currentLocationId:u,group:_,groupBy:h,approvalStatus:g,handleTimecardApprovals:x})=>{const[b,C]=a.useState(!1),[T,y]=a.useState(null),v=a.useRef(null);a.useEffect(()=>{const H=No();C(H)},[]);const I=a.useCallback(()=>_.rows.filter(H=>H.get("has_timecard_photos")),[_.rows]),R=a.useCallback(()=>{Fe({action:B.TIMECARD_ATTACHMENTS_CLICKED}),m(_,I(),o,i)},[_,m,o,i,I]),S=a.useMemo(()=>{const H=t.get("id");if(h==="employee"){const Z=_.job?.get("user_id");return Z&&Z!==H?[Z]:[]}return _.rows.reduce((Z,Ae)=>{if(!Ae.get("paid_time_off")){const ye=n[Ae.get("job_id")]?.get("user_id");ye&&ye!==H&&!Z.includes(ye)&&Z.push(ye)}return Z},[])},[h,_,n,t]),k=a.useCallback(()=>S.length>0,[S]),f=a.useCallback(()=>{Fe({action:B.MESSAGE_CLICKED}),k()&&(d({location_id:u,channel:{participants_attributes:S.map(H=>({user_id:H}))},prefilledMessage:" "}),r(!0))},[d,r,u,S,k]),O=a.useCallback(()=>k()?h==="employee"?c("timesheets.react_page.summary_row.menu.message_employee",{props:{name:_.job?.get("full_name")??""}}):c("timesheets.react_page.summary_row.menu.message_group"):null,[k,h,_.job]),P=a.useCallback(()=>I().length>0,[I]),M=a.useCallback(()=>P()?c("timesheets.react_page.summary_row.menu.timecard_attachment"):null,[P]),N=a.useCallback(()=>g&&s?c(`timesheets.react_page.summary_row.menu.${g==="locked"?"unapprove_all":"approve_all"}`):null,[g,s]),K=a.useCallback(()=>[{value:O(),iconName:"Email"},{value:M(),iconName:"Image"},{value:N(),iconName:g==="locked"?"Unlock":"Lock"}].filter(H=>H.value!==null),[O,M,N,g]),F=a.useCallback(()=>{y(null)},[]),U=a.useCallback(H=>{F(),H===O()?f():H===M()?R():H===N()&&x()},[F,O,f,M,R,N,x]),$=[K().map(H=>({label:H.value,iconName:H.iconName,onClick:()=>U(H.value)}))],G=a.useCallback(()=>{Fe({action:B.ROW_HEADER_MENU_CLICKED})},[]),Y=a.useCallback(H=>{y(H.currentTarget),G()},[G]);return b?e.jsx(l,{"data-testid":"table-row-header-menu",w:40}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{"aria-label":"menu-button",onClick:Y,icon:"MoreVertical",color:"mono900",dataTestId:"table-row-header-menu",ref:v}),e.jsx(Re,{open:!!T,anchorEl:T,onClose:F,menuItemSections:$})]})},Sh=(t,s)=>({currentUser:wr(t),lockTimesheetsPermission:!!Et(t,s),employees:Xo(t,s),timecardPhotosEnabled:jr(t),minTierNameForPhotos:Ir(t,s),currentLocationId:Sr(t),approvalStatus:En(t,s)}),Ih={createChannel:kr,toggleMessengerShown:fr,showPhotosModal:vr},jh=W(Sh,Ih)(kh),{cxEl:Eo}=D("TableRowsGroup"),fa=({settingEnabled:t,approvalStatus:s,roleHasAccessToLock:n,handleTimecardApprovals:o})=>{const i=s==="locked",d=i?"Lock":"Unlock",r=i?"unapprove_all":"approve_all";return!n||!s||!t?null:e.jsx(l,{className:Eo("group-lock-button"),children:e.jsx(oe,{content:c(`timesheets.react_page.tooltips.${r}`),children:e.jsx(Ee,{onClick:o,size:"small",icon:d,className:Eo(`${s}-icon`)})})})};fa.propTypes={approvalStatus:p.string,roleHasAccessToLock:p.bool,settingEnabled:p.bool,handleTimecardApprovals:p.func};const wh=W((t,s)=>({settingEnabled:Rr(t,s),approvalStatus:En(t,s),roleHasAccessToLock:Or(t)}))(fa),Oh=["overtime","double_overtimes","qualified_overtime"],ka=({columns:t,columnExclusions:s,summaryRow:n,handleCollapse:o,handleTimecardApprovals:i,group:d})=>{const{cxEl:r}=D("TableRowsGroup");return e.jsx(e.Fragment,{children:t.filter(m=>!s[m.get("key")]).map(m=>e.jsx(l,{onClick:o,children:e.jsxs(l,{vcenter:!0,className:r(`summary-${m.get("key")}`,{},"header-column-item",m.get("value-type")+"-column",Oh.includes(m.get("key"))&&n.get(m.get("key"))>0&&"red-column"),children:[m.get("key")==="timecard"&&e.jsx(wh,{handleTimecardApprovals:i,group:d}),e.jsx(E,{variant:"bodyBold",color:"mono900",children:!["issues","role","wage_rate"].includes(m.get("key"))&&n.get(m.get("key"))})]})},m.get("key")))})};ka.propTypes={columns:se.list.isRequired,columnExclusions:p.object.isRequired,summaryRow:se.map.isRequired,handleCollapse:p.func.isRequired,handleTimecardApprovals:p.func.isRequired,group:p.object.isRequired};const Sa=({cardIsCollapsed:t,handleCollapse:s,handleTimecardApprovals:n,group:o,groupBy:i,columns:d,columnExclusions:r,summaryRow:m,approvalStatus:u,canManageTimecards:_,getHasTimecards:h})=>{const{cxEl:g}=D("TableRowsGroup");return e.jsxs(l,{row:!0,className:g(t?"un-collapse-button":"collapse-button","header-row","group-header-row vcenter hleft"),w:"100%",children:[e.jsx(l,{vcenter:!0,className:"main-column",onClick:s,children:e.jsx(va,{cardIsCollapsed:t,groupBy:i,group:o,columns:d})}),e.jsx(ka,{columns:d,columnExclusions:r,summaryRow:m,handleCollapse:s,handleTimecardApprovals:n,group:o}),_?e.jsx(l,{"data-testid":"container-manage-timecards",className:g("actions",{},"vcenter hcenter"),children:h()?e.jsx(jh,{handleTimecardApprovals:n,group:o,groupBy:i,approvalStatus:u}):e.jsx(l,{w:40})}):e.jsx(l,{w:48})]})};Sa.propTypes={cardIsCollapsed:p.bool.isRequired,handleCollapse:p.func.isRequired,handleTimecardApprovals:p.func.isRequired,group:p.object.isRequired,groupBy:p.string.isRequired,columns:se.list.isRequired,columnExclusions:p.object.isRequired,summaryRow:se.map.isRequired,approvalStatus:p.string,canManageTimecards:p.bool.isRequired,getHasTimecards:p.func.isRequired};const{cxEl:Rh}=D("TableRow"),Nh=["overtime","double_overtimes","qualified_overtime"],Ia=({column:t,loadingTotals:s,timecard:n})=>{if(n.get(t.get("key"))!==null){let o=n.get(t.get("key"));t.get("key")!=="timecard"&&!o&&!s&&(o="--");const i=Jt(o,t.get("key"));return e.jsx(E,{variant:"body",className:Rh("value",{},Nh.includes(t.get("key"))&&o>0?"red-column":null),children:o?e.jsx(oe,{content:i?o:null,children:o}):s&&e.jsx(pi,{type:"grayBar"})})}return""};Ia.propTypes={column:se.map,loadingTotals:p.bool,timecard:se.map};const Ah=W(t=>({loadingTotals:gn(t)}),{})(Ia),{cxEl:bo}=D("LockIcon"),Dh=(t,s,n)=>s==="disabled_locked"?e.jsxs(l,{children:[e.jsx(l,{children:n.get("locked_message")}),e.jsx(l,{children:c("timesheets.react_page.tooltips.no_permission_to_unlock")})]}):t==="locked"?c("timesheets.react_page.tooltips.unlock_timecard"):c("timesheets.react_page.tooltips.lock_timecard"),ja=({onUpdateTimecardApprovals:t,timecard:s,timecardLockVisibility:n,timecardApprovalStatus:o})=>{const i=o==="locked"?"Lock":"Unlock",d=Dh(o,n,s),r=a.useCallback(m=>{m.stopPropagation(),en({action:B.INDIVIDUAL_LOCK_CLICKED}),t([s.get("id")],!s.get("approved"))},[t,s]);return n==="hidden"?null:e.jsx(l,{className:bo("action"),children:e.jsx(oe,{content:d,placement:"left",children:e.jsx(Ee,{onClick:r,size:"small",icon:i,className:bo(`${o}-icon`),disabled:n==="disabled_locked"})})})};ja.propTypes={lockTimesheetsPermission:p.bool.isRequired,onUpdateTimecardApprovals:p.func,timecard:se.map};const Lh=W((t,s)=>({lockTimesheetsPermission:!!Et(t,s),timecardLockVisibility:Po(t,s),timecardApprovalStatus:Bo(t,s)}),{onUpdateTimecardApprovals:Zt})(ja),{cxEl:Mh}=D("NoShow"),wa=({timecard:t})=>{const s=j(pe),n=!s&&t.get("issues")==="no_show";return e.jsx("span",{className:Mh("value",n?"red":"navy"),children:s?"--":c("timecard_modal.timecard_row.no_show")})};wa.propTypes={timecard:se.map};const zs=[Nn.PENDING,Nn.APPROVED],Nt=" - ",Oa=t=>{const s=t.get("issues_collection");return s?Me.List.isList(s)?s:Me.fromJS(s):Me.List()},nt=(t,s)=>t.find(n=>n.get("type")===s),yo=t=>{if(!t)return;const s=te(t);return s.isSame(te(),"day")?s.format("h:mm a"):s.format("h:mm a, ddd, MMM D")},Ra=t=>{const n=(t.get("timecard")||"").indexOf(Nt)!==-1,o=Oa(t),i=nt(o,st.ASSISTED_CLOCK_IN),d=nt(o,st.ASSISTED_CLOCK_OUT),r=!!nt(o,st.AUTO_CLOCK_OUT),m=zs.includes(i?.getIn(["meta","status"])),u=n&&(zs.includes(d?.getIn(["meta","status"]))||r);return{showAssistedClockIn:m,showAssistedClockOut:u}},Bh=({timecard:t})=>{const s=t.get("timecard")||"",n=s.indexOf(Nt),o=n!==-1,i=o?s.slice(0,n):s,d=o?s.slice(n+Nt.length):null,{showAssistedClockIn:r,showAssistedClockOut:m}=Ra(t),u=Oa(t),_=nt(u,st.ASSISTED_CLOCK_IN),h=nt(u,st.ASSISTED_CLOCK_OUT),g=!!nt(u,st.AUTO_CLOCK_OUT),x=_?.getIn(["meta","submitted_at"]),b=h?.getIn(["meta","submitted_at"]),C=zs.includes(h?.getIn(["meta","status"])),T=t.get("actual_start_at"),y=t.get("actual_end_at");return e.jsxs(l,{row:!0,alignItems:"center",gap:2,children:[e.jsxs(l,{row:!0,alignItems:"center",gap:2,children:[r&&e.jsx(l,{vcenter:!0,"data-testid":"assisted-clock-indicator",children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),r?e.jsx(Ei,{submittedAt:x,formattedStartAt:T?te(T).format(Ce):void 0,formattedTime:yo(x),children:e.jsx(E,{variant:"body",color:"info",children:i})}):e.jsx(E,{variant:"body",children:i})]}),d!==null&&e.jsx(E,{variant:"body",children:Nt.trim()}),d!==null&&e.jsxs(l,{row:!0,alignItems:"center",gap:2,children:[m&&e.jsx(l,{vcenter:!0,"data-testid":"assisted-clock-indicator",children:e.jsx(ee,{iconName:"Overtime",size:"xsmall",color:"info"})}),C?e.jsx(bi,{submittedAt:b,formattedTime:yo(b),formattedEndAt:y?te(y).format(Ce):void 0,children:e.jsx(E,{variant:"body",color:"info",children:d})}):g?e.jsx(yi,{children:e.jsx(E,{variant:"body",color:"info",children:d})}):e.jsx(E,{variant:"body",children:d})]})]})};var Ms={},To;function Ph(){return To||(To=1,(function(t){Object.defineProperty(t,"__esMo
1dule",{value:!0});var s="fal",n="copy",o=448,i=512,d=[],r="f0c5",m="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM352 32.491a15.88 15.88 0 0 1 7.431 4.195l51.882 51.883A15.885 15.885 0 0 1 415.508 96H352V32.491zM288 464c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V144c0-8.822 7.178-16 16-16h80v240c0 26.51 21.49 48 48 48h112v48zm128-96c0 8.822-7.178 16-16 16H176c-8.822 0-16-7.178-16-16V48c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v240z";t.definition={prefix:s,iconName:n,icon:[o,i,d,r,m]},t.faCopy=t.definition,t.prefix=s,t.iconName=n,t.width=o,t.height=i,t.ligatures=d,t.unicode=r,t.svgPathData=m})(Ms)),Ms}var Kh=Ph(),Bs={},vo;function Uh(){return vo||(vo=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var s="fal",n="edit",o=576,i=512,d=[],r="f044",m="M417.8 315.5l20-20c3.8-3.8 10.2-1.1 10.2 4.2V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h292.3c5.3 0 8 6.5 4.2 10.2l-20 20c-1.1 1.1-2.7 1.8-4.2 1.8H48c-8.8 0-16 7.2-16 16v352c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V319.7c0-1.6.6-3.1 1.8-4.2zm145.9-191.2L251.2 436.8l-99.9 11.1c-13.4 1.5-24.7-9.8-23.2-23.2l11.1-99.9L451.7 12.3c16.4-16.4 43-16.4 59.4 0l52.6 52.6c16.4 16.4 16.4 43 0 59.4zm-93.6 48.4L403.4 106 169.8 339.5l-8.3 75.1 75.1-8.3 233.5-233.6zm71-85.2l-52.6-52.6c-3.8-3.8-10.2-4-14.1 0L426 83.3l66.7 66.7 48.4-48.4c3.9-3.8 3.9-10.2 0-14.1z";t.definition={prefix:s,iconName:n,icon:[o,i,d,r,m]},t.faEdit=t.definition,t.prefix=s,t.iconName=n,t.width=o,t.height=i,t.ligatures=d,t.unicode=r,t.svgPathData=m})(Bs)),Bs}var $h=Uh();const Hh={no_show:$e.faExclamationCircle,missing_clock_out:$e.faExclamationCircle,missing_break:$e.faExclamationCircle,missing_breaks:$e.faExclamationCircle,unscheduled_shift:$e.faExclamationCircle,waived_break:$e.faExclamationCircle,employee_added_clock_out:$h.faEdit,shift_duplicate:Kh.faCopy,approved:Kc.faCheck,late_clock_out:$e.faExclamationCircle},Na=({iconType:t})=>t==="auto_clock_out"?e.jsx(Nr,{type:"clockIn",color:An.red300}):e.jsx(Ar,{icon:Hh[t],color:An.red300});Na.propTypes={iconType:Rt.string.isRequired};const Aa=({timecard:t})=>{const s=j(pe),n=t.get("issues");return s?e.jsx(tn,{variant:"error",children:c(`timesheets.daily_review.issues_cell.${n}`)}):e.jsx(Na,{iconType:n})};Aa.propTypes={timecard:se.map};const{cx:Fh,cxEl:fo}=D("TableRow"),Wh=({canManageTimecards:t,columns:s,groupRows:n,index:o,timecard:i})=>{const d=an(),r=j(pe),m=a.useCallback(()=>{const C=i.get("key"),T={groupRows:i.get("id")?n.filter(y=>!!y.get("id")):[i]};en({action:B.TIMECARD_CLICKED}),d(ue(C,null,null,T))},[i,d,n]),u=a.useCallback(()=>Tt(i.get("date"))?ct.error(c("timesheets.other_errors.future")):m(),[i,m]),_=j(pe),h=(i.get("no_show_reason")||i.get("has_note"))&&t,{showAssistedClockIn:g,showAssistedClockOut:x}=Ra(i),b=r&&(g||x);return e.jsx(l,{className:Fh(),"data-testid":`TableRow-${o}`,vcenter:!0,onClick:u,children:e.jsxs(l,{row:!0,className:fo("columns"),children:[s.toArray().map(C=>e.jsxs(l,{row:!0,vcenter:!0,className:fo(C.get("key"),{},C.get("value-type")+"-column"),children:[C.get("key")==="timecard"&&e.jsx(l,{pr:4,vcenter:!0,className:"lock-icon",children:e.jsx(Lh,{timecard:i})}),C.get("key")==="timecard"&&i.get("timecard")==null&&(i.get("issues")==="no_show"||i.get("no_show_reason"))&&e.jsx(wa,{timecard:i}),C.get("key")==="issues"&&i.get("issues")?e.jsx(Aa,{timecard:i}):C.get("key")==="timecard"&&b?e.jsx(Bh,{timecard:i}):e.jsx(Ah,{column:C,timecard:i}),C.get("key")==="timecard"&&t&&_&&e.jsx(l,{className:"notes-icon",pl:8,vcenter:!0,children:e.jsx(Ni,{data:i.get("timecardNotes"),employeeFirstName:i.get("employeeFirstName")||"",employeeLastName:i.get("employeeLastName")||null,clockOutAt:i.get("actual_end_at")||null})}),C.get("key")==="timecard"&&!_&&h&&e.jsx(l,{className:"notes-icon",pl:8,vcenter:!0,children:e.jsx(ee,{color:"purple500",size:"small",iconName:"Documents"})})]},C.get("key"))),e.jsx(l,{w:hi-Dr})]})})},Da=({group:t,columns:s,canManageTimecards:n,children:o})=>{const{cxEl:i}=D("TableRowsGroup");return e.jsxs("div",{className:i("job-container",t.rows.length===0?"no-timecards":"has-time
1cards"),children:[t.rows.map((d,r)=>e.jsx(Wh,{columns:s,groupRows:t.rows,index:r,timecard:d,canManageTimecards:n},`${d.get("id")}-${r}`)),o]})};Da.propTypes={group:p.object.isRequired,columns:se.list.isRequired,canManageTimecards:p.bool.isRequired,children:p.node};const La=({canManageTimecards:t,groupBy:s,date:n,columnExclusions:o,columns:i,cardIsCollapsed:d,group:r,summaryRow:m,approvalStatus:u,collapseCard:_,showTimecardModal:h,updateTimecardApprovals:g})=>{const{cx:x}=D("TableRowsGroup"),b=a.useCallback(v=>{v?.stopPropagation();const I=Kr(r.rows);Fe({action:B.LOCK_CLICKED}),g(I,u!=="locked")},[u,r.rows,g]),C=a.useCallback(()=>{d?Fe({action:B.EXPAND_CLICKED}):Fe({action:B.COLLAPSE_CLICKED}),_(r.key)},[d,_,r.key]),T=a.useCallback(()=>{if(Tt(n))return ct.error(c("timesheets.other_errors.future"));const v=s==="employee"&&{job_id:r.job.get("id"),date:n,role_id:r.job.get("role_id")}||s==="day"&&{date:r.day.format("MM/DD/YYYY")}||s==="role"&&{role_id:r.role.get("id"),date:n};Fe({action:B.ADD_TIMECARD_CLICKED}),h(null,null,v)},[n,s,r,h]),y=a.useCallback(()=>m.get("timecardCount")>0,[m]);return e.jsxs("div",{className:x(),style:{display:"flex",flexDirection:"column"},children:[e.jsx(Sa,{cardIsCollapsed:d,handleCollapse:C,handleTimecardApprovals:b,group:r,groupBy:s,columns:i,columnExclusions:o,summaryRow:m,approvalStatus:u,canManageTimecards:t,getHasTimecards:y}),!d&&e.jsx(Da,{group:r,columns:i,canManageTimecards:t,children:t&&e.jsx(fh,{onClick:T})})]})};La.propTypes={canManageTimecards:p.bool,groupBy:p.string.isRequired,date:p.string,columnExclusions:p.object.isRequired,columns:se.list.isRequired,cardIsCollapsed:p.bool,group:p.object.isRequired,summaryRow:se.map,approvalStatus:p.string,collapseCard:p.func.isRequired,showTimecardModal:p.func.isRequired,updateTimecardApprovals:p.func.isRequired};const Vh=(t,s)=>({columns:_i(t,s),columnExclusions:Pr(),summaryRow:Br(t,s),cardIsCollapsed:Mr(t,s),approvalStatus:En(t,s)}),Gh={showTimecardModal:ue,updateTimecardApprovals:Zt,collapseCard:Lr},Yh=W(Vh,Gh)(ae({productArea:me.TIMESHEETS,eventCategory:be.TABLE_ROWS_GROUP})(La)),{cx:zh,cxEl:ko}=D("TableRows"),Ma=({canManageJobs:t,canManageTimecards:s,filter:n,groupBy:o,handleScrollTable:i,leftLimit:d,mobile:r,rightLimit:m,scrollPosition:u,startDate:_,tableData:h,shouldSeeTimesheetsZeroState:g,shouldSeeTimesheetsEmptyState:x})=>e.jsxs(Ro.Fragment,{children:[e.jsxs("div",{className:zh(),style:{backgroundColor:"white",flexGrow:1,paddingBottom:8},children:[!g&&!d&&!r&&e.jsx(l,{className:ko("arrow","left"),top:u,pointer:!0,onClick:de(i,!0),bgcolor:"mono900",bradius:"50%",opacity:.7,vcenter:!0,hcenter:!0,h:30,w:30,children:e.jsx(ee,{color:"mono0",iconName:"CaretLeft",size:"xsmall"})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",flexGrow:1},children:h.map((b,C)=>e.jsx(Yh,{canManageTimecards:s,date:_,filter:n,group:b,groupBy:o,mobile:r},C))}),!g&&!m&&!r&&e.jsx(l,{className:ko("arrow","right"),top:u,pointer:!0,onClick:de(i,!1),bgcolor:"mono900",bradius:"50%",opacity:.7,vcenter:!0,hcenter:!0,h:30,w:30,children:e.jsx(ee,{color:"mono0",iconName:"CaretRight",size:"xsmall"})})]}),t&&e.jsx(vh,{shouldSeeTimesheetsZeroState:g}),!g&&x&&e.jsx(xh,{})]});Ma.propTypes={canManageJobs:p.bool.isRequired,canManageTimecards:p.bool,filter:p.string,groupBy:p.string,handleScrollTable:p.func,leftLimit:p.bool,mobile:p.bool,rightLimit:p.bool,scrollPosition:p.number,startDate:p.string,tableData:p.array.isRequired,shouldSeeTimesheetsZeroState:p.bool,shouldSeeTimesheetsEmptyState:p.bool};const qh=W((t,s)=>{window.performance.mark("TableRows_start");const n={canManageJobs:Ur(t),tableData:gi(t,s)};return window.performance.mark("TableRows_end"),window.performance.measure("TableRows_measure","TableRows_start","TableRows_end"),n},{})(Ma),{cx:So}=D("TimesheetsTable"),Ba=({canManageTimecards:t,groupBy:s,mobile:n,shouldSeeTimesheetsZeroState:o=!1,shouldSeeTimesheetsEmptyState:i,showNav:d,hideNav:r,isNavVisible:m})=>{const u=he(),_=j(pe),h=a.useRef(null),{onScroll:g,leftLimit:x,rightLimit:b,scrollPosition:C}=Yi(h),[T,y]=a.useState(new URLSearchParams(window.location.search)),v=Ve();a.useEffect(()=>{v.listen(S=>{y(new URLSearchParams(S.search))})},[v]);const I=a.useCallback(S=>{const k=h.current;if(!k)return;const f=S?B.SCROLL_BUTTON_LEFT_CLICKED:B.SCROLL_BUTTON_RIGHT_CLICKED;return we({productArea:_e.TIMESHEETS,eventAction:f,eventCategory:ne.TIMESHEETS,actionType:w.CLICK}),S?k.scrollLeft-=po:k.scrollLeft+=po},[]),R=a.useCallback(S=>{const k=h.current;k&&(S.deltaY>0&&k.scrollTop>50&&m&&r(),S.deltaY<0&&!m&&k.scrollTop<50&&d())},[r,d,m]);return a.useEffect(()=>{const S=h.current;if(S)return S.addEventListener("wheel",R),()=>{S.removeEventListener("wheel",R)}},[r,d,m,R]),e.jsx("div",{className:So("wrapper",{isEmbedded:u,"wide-issues":_}),ref:h,onScroll:g,children:e.jsx(l,{style:{height:"100%",display:"flex",flexGrow:1,zIndex:2},children:e.jsxs(l,{className:So("gap"),children:[e.jsxs(l,{children:[e.jsx(dh,{groupBy:s,canManageTimecards:t}),e.jsx(qh,{canManageTimecards:t,filter:T.get("filter"),groupBy:T.get("groupBy"),handleScrollTable:I,leftLimit:x,mobile:n,rightLimit:b,scrollPosition:C,startDate:T.get("startDate"),shouldSeeTimesheetsZeroState:o,shouldSeeTimesheetsEmptyState:i})]}),e.jsx(mh,{groupBy:T.get("groupBy")})]})})})};Ba.propTypes={canManageTimecards:p.bool,groupBy:p.string,mobile:p.bool,shouldSeeTimesheetsZeroState:p.bool,shouldSeeTimesheetsEmptyState:p.bool};
1const Zh=W(t=>({isNavVisible:cn(t)}),{showNav:Zo,hideNav:$r})(Ba),Jh=({tipEngineAlert:t})=>{if(!t||!t.show)return null;const{title:s,body:n}=t.error;return e.jsx(l,{ph:32,pt:24,pb:16,bgcolor:"mono100",children:e.jsx(Uc,{title:s,body:n})})},Io=W(t=>({tipEngineAlert:Hr(t)}))(Jh),{cx:jo}=D("Timesheets"),Pa=({submissionDeadlineAdjustedBanner:t,canManageTimecards:s,filter:n,groupBy:o,loadingInitData:i,loadingRows:d,mobile:r,shouldSeeTimesheetsZeroState:m=!1,shouldSeeEmbeddedCTA:u=!1,shouldSeeTimesheetsEmptyState:_=!1})=>{const h=a.useRef(),[g,x]=a.useState(null),b=Oe(),C=he(),T=j(cn),y=j(yt),v=j(vt),I=j(Ke);b({first_time_use:!0});const R=a.useCallback(()=>{h.current&&x(window.innerHeight-h.current.getBoundingClientRect().y)},[]),S=a.useCallback(()=>{R()},[R]);a.useEffect(()=>{R();const N=setInterval(()=>{R()},10);return setTimeout(()=>{clearInterval(N)},500),()=>{clearInterval(N)}},[R,T]),a.useEffect(()=>(R(),window.addEventListener("resize",S,!0),window.addEventListener("wheel",S,!0),()=>{window.removeEventListener("resize",S,!0),window.removeEventListener("wheel",S,!0)}),[S,R]);const k=window.sessionStorage.getItem("timeCardAdded")||!1,f=e.jsxs(l,{className:jo("PayPeriodNav"),children:[!m&&!I&&e.jsx(V_,{mobile:r,canManageTimecards:s,shouldSeeEmbeddedCTA:u}),t&&e.jsx(Q_,{holiday_day:t.get("holiday_day"),holiday_date:t.get("holiday_date"),holiday_name:t.get("holiday_name")}),m&&e.jsx(d_,{}),s&&!i&&!_&&e.jsxs(l,{ph:C?56:32,pv:I?"md":"none",children:[!v&&!I&&e.jsx(q_,{initialFilterBy:n,initialGroupBy:o}),e.jsx(j_,{filter:n,mobile:r})]})]}),O=P=>_&&!k?y?e.jsx(__,{}):e.jsx(x_,{bgcolor:P}):e.jsx(Zh,{groupBy:o,mobile:r,canManageTimecards:s,shouldSeeTimesheetsZeroState:m,shouldSeeTimesheetsEmptyState:_});return I&&s?e.jsxs(e.Fragment,{children:[e.jsxs(Le.FullWidth,{toolbar:e.jsx(X_,{}),children:[e.jsx(Io,{}),e.jsxs(Dn,{centered:!0,isLoading:d,children:[f,O("mono0")]})]}),e.jsx(ht,{})]}):e.jsxs("div",{ref:h,children:[e.jsxs(Dn,{centered:!0,isLoading:d,children:[e.jsx(Io,{}),e.jsxs(l,{className:jo(),column:!0,h:g,overflow:"hidden",bgcolor:C?"mono0":"mono100",children:[e.jsx(Gi,{children:f}),O("mono100")]})]}),e.jsx(ht,{})]})};Pa.propTypes={canManageTimecards:p.bool.isRequired,filter:p.string,getStoredFilterValue:p.string,groupBy:p.string,loadingInitData:p.bool,loadingRows:p.bool,mobile:p.bool,shouldSeeTimesheetsZeroState:p.bool,shouldSeeEmbeddedCTA:p.bool,shouldSeeTimesheetsEmptyState:p.bool};const Ot={DEFAULT:"default",URL_OVERRIDE:"dateRangeOverride",LAST_7_DAYS_PAYROLL:rn},{cx:Xh}=D("PayPeriodReviewView"),Qh=({groupBy:t,sortBy:s,filter:n,startDate:o,endDate:i})=>{const d=q(),r=z(),m=j(as),u=j(Ke),_=j(Ci),h=j(ls),g=j(Qt),x=j(Cn),b=j(Fr),C=j(ft),T=j(Wr),y=j(Vr),v=j(Gr),I=j(F=>ni(F,{name:"historical_timesheets"})),R=a.useMemo(()=>{const F=window.localStorage.getItem("ReactTimesheetsGroupBy");return Yr.includes(t)&&t||F!=="undefined"&&F||"employee"},[t]),S=j(F=>gi(F,{filter:n,sortBy:s,groupBy:R})),k=()=>{if(C){if(e_(o,i,I))return Ot.URL_OVERRIDE;if(t_(I))return Ot.LAST_7_DAYS_PAYROLL}else return Ot.LAST_7_DAYS_PAYROLL;return Ot.DEFAULT},[f]=a.useState(k),[O]=a.useState(Qm(f,o,i)),P=a.useMemo(()=>{const F=window.localStorage.getItem("ReactTimesheetsFilter");return["all",...y.toArray().map(G=>G.get("id")?.toString()??"")].includes(F)},[y]),M=a.useMemo(()=>P?window.localStorage.getItem("ReactTimesheetsFilter"):"all",[P]),N=a.useCallback(F=>{r(si(F))},[r]);a.useEffect(()=>{r(zr()),window.localStorage.getItem("ReactTimesheetsSortColumnKey")&&r(ns({columnKey:window.localStorage.getItem("ReactTimesheetsSortColumnKey"),direction:window.localStorage.getItem("ReactTimesheetsSortDirection")})),d({actionType:w.CLICK,eventAction:A.TIMESHEETS_TAB_SHOWN,properties:{first_time_use:!0}}),r(qr(s||window.localStorage.getItem("ReactTimesheetsSortBy")||"first_name")),N({...O}),m&&r(Zr()),Jr(tc),Us({filter:M,groupBy:R,startDate:O.startDate,endDate:O.endDate}),document.title="Homebase - Timesheets"},[]),a.useEffect(()=>{_&&window.localStorage.setItem("openFilterWidget",(!_).toString()),b||(localStorage.getItem("scrollPosition")!==null&&window.scrollTo(0,Number(localStorage.getItem("scrollPosition"))),localStorage.removeItem("scrollPosition")),v&&(r(Xr(v)),r(Fo.setChangedShiftId(null))),Us({filter:n||M,groupBy:R,startDate:o||O.startDate,endD
1ate:i||O.endDate})},[b,_,v,n,o,i,R,M,O,r]);const K=Qr(S);return e.jsx(ec,{maxWidth:600,children:F=>{const U=e.jsx(Pa,{submissionDeadlineAdjustedBanner:T,canManageTimecards:m,filter:n||M,groupBy:R,loadingRows:x,loadingInitData:b,mobile:F,shouldSeeEmbeddedCTA:h,shouldSeeTimesheetsZeroState:_,shouldSeeTimesheetsEmptyState:!K&&g});return u&&m?U:e.jsx(l,{className:Xh(),children:U})}})},wo=ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS})(Qh),qs=({uxElement:t,copy:s})=>{const n=Ve(),o=a.useCallback(()=>{n.push("/clover/embedded/timesheets/step1?isFullScreenModal=true")},[n]);return e.jsx(L,{variant:"secondary",size:"medium",onClick:o,uxElement:t,dataTestId:"timesheets_timeclock_settings_cta",children:s})},Sn=({variant:t,showStartIcon:s,onModalOpening:n,showPayrollModal:o,cx:i,cxEl:d})=>{const r=a.useCallback(()=>{n&&n(),o(!0)},[n,o]);return e.jsx(l,{hleft:!0,className:i(),children:e.jsx(L,{onClick:r,className:d("set-payroll-settings"),variant:t,startIcon:s&&"Money",children:c("timesheets.react_page.payroll_periods.set_payroll_period")})})};Sn.propTypes={onModalOpening:Rt.func,showStartIcon:Rt.bool,variant:Rt.string};Sn.defaultProps={showStartIcon:!0,variant:"tertiary"};const Zs=W(null,{showPayrollModal:sc})(nc("SetPayrollSettingsButton",Sn)),{TIME_CLOCK_DRAWER:ep}=Ft,Js=({uxElement:t,copy:s,cxEl:n,variant:o="tertiary",showStartIcon:i=!0})=>{const d=z(),r=a.useCallback(()=>{d(Ct.openBottomDrawer({drawerType:ep}))},[d]);return e.jsx(L,{variant:o,size:"medium",onClick:r,className:n("embedded_cta"),uxElement:t,startIcon:i?"LightBulb":"",dataTestId:"embedded_cta",children:s})},{cxEl:tp}=D("TimeTrackingEmbeddedHeaderCTA"),sp=()=>{const t=j(ls),s=j(os);return t?e.jsx(Js,{uxElement:"timesheets_embedded_cta",copy:c(s?"timesheets_guided_setup.timesheets_completed_embedded_cta_daily_review":"timesheets_guided_setup.timesheets_embedded_cta_daily_review"),cxEl:tp,variant:"secondary",showStartIcon:!1}):null},np=()=>{const t=j(yt),s=j(is),n=j(as),o=j(ft),i=j(ls),d=t&&s,r=!o&&n;if(!d&&!i&&!r)return null;const m=d?e.jsx(qs,{uxElement:"timesheets_timeclock_settings_cta",copy:c("clover_embedded.timesheets.ftu_screen.timeclock_settings_cta")}):i&&e.jsx(sp,{});return e.jsx(je,{variant:"info",title:c("timesheets.start_tracking_hours_alert.title"),action:r&&e.jsx(Zs,{variant:"secondary",showStartIcon:!1}),secondaryAction:m,uxElement:"timesheets_start_tracking_hours_alert",children:c("timesheets.start_tracking_hours_alert.body")})},op=({ariaName:t,cx:s,cxEl:n,dataTestId:o="FDBTab",disabled:i,onChange:d,options:r,scrollable:m,tabValue:u,uxElement:_,noPadding:h,count:g,step:x})=>{const[b,C]=Ro.useState(u||r[0].value),T=q({element:_});a.useEffect(()=>{u!==void 0&&C(u)},[u]),a.useEffect(()=>{x&&x>=1&&T(A.TOOLTIP_VIEWED,w.VIEW,{step:x})},[x]);const y=a.useCallback((v,I)=>{const R=r.find(S=>S.value===I);if(i||R?.disabled){v.preventDefault();return}_&&T(A.TAB_CLICKED,w.CLICK,{value:I,tabText:R?.label,icon:R?.iconName}),C(I),d?.(v,I)},[i,d,r,T,_]);return e.jsx(l,{pv:h?0:20,children:e.jsx(oc,{className:s(),value:b,onChange:y,"aria-label":`${t}-tabs`,"data-testid":o,variant:m?"scrollable":"fullWidth",scrollButtons:!1,children:r.map(({label:v,value:I,disabled:R,iconName:S,badgeText:k,badgeVariant:f="loud",tooltipArgs:O})=>{const P=b===I;return e.jsx(ic,{value:I,"data-testid":`${o}-${I}`,"aria-disabled":i||R,className:n("tab",{iconName:S,scrollable:m}),label:e.jsx(l,{row:!0,vcenter:!0,children:e.jsx(oe,{overrideZIndex:900,count:g,...O,children:e.jsxs(l,{row:!0,vcenter:!0,minh:40,children:[e.jsx(l,{mr:S||k?8:0,children:e.jsx(E,{component:"div",variant:"body",children:v})}),S&&!k&&e.jsx(l,{vcenter:!0,ml:P?-4:"",children:e.jsx(ee,{iconName:S,size:"small",color:S==="Critical"?"error300":"warning300"})}),k&&e.jsx(l,{vcenter:!0,ml:P?-4:"",children:e.jsx(dn,{text:k,variant:f,disabled:i||R})})]})})})},`${v}-${I}`)})})})},ip=$c("FDBTabs")(op),{cx:Oo,cxEl:Ie}=D("TimesheetsTabNav"),ap=({activeTabValue:t,setActiveTabValue:s,tooltipIndex:n,setTooltipIndex:o,isCloverEmbedded:i})=>{const d=z(),r=q(),m=Ve(),u=Oe(),_=he(),h=j(ac),g=j(ls),x=j(os),b=j(ft),C=j(as),T=j(is),y=j(vt);u({first_time_use:!0});const v=a.useCallback(H=>{let Z="/timesheets/";Z=H==="daily_review"?"/timesheets/daily_review":"/timesheets/pay_period_review",m.replace(Z)},[m]),I=a.useCallback((H,Z)=>{r(A.BUTTON_CLICKED,w.CLICK,{button_text:Z}),Z&&(s(Z),v(Z))},[s,r,v]),R=a.useCallback(H=>{r(A.BUTTON_CLICKED,w.CLICK,{button_text:c("ftu_timesheets.empty_state.tooltips.next_button_title"),element:"next",step:n}
1),H.stopPropagation(),n===1&&(d(ot("daily_review_guided_timesheets_tooltip_completed")),I(H,"pay_period_review")),o(Z=>Z+1)},[n,r,o,d,I]),S=a.useCallback(()=>{n===1&&d(ot("daily_review_guided_timesheets_tooltip_completed")),o(0)},[n,o,d]),k=a.useCallback(()=>{r(A.BUTTON_CLICKED,w.CLICK,{button_text:c("ftu_timesheets.empty_state.tooltips.got_it_button_title"),element:"got_it",step:n}),S()},[S,n,r]),f=a.useCallback(()=>{r(A.TOOLTIP_DISMISSED,w.CLICK,{step:n}),S()},[S,n,r]);a.useEffect(()=>{v(t)},[t,v]);const O=[{value:"daily_review",label:y?c("timesheets.tab_menu.day"):c("timesheets.tab_menu.daily_review"),...!y&&{badgeText:h,tooltipArgs:{buttonTitle:c("ftu_timesheets.empty_state.tooltips.next_button_title"),content:c("ftu_timesheets.empty_state.tooltips.1.content"),placement:"right-start",variant:"primary",open:n===1,title:c("ftu_timesheets.empty_state.tooltips.1.title"),onButtonClick:R,onDismissClick:f}}},{value:"pay_period_review",label:y?c("timesheets.tab_menu.pay_period"):c("timesheets.tab_menu.pay_period_review"),...!y&&{tooltipArgs:{buttonTitle:c("ftu_timesheets.empty_state.tooltips.next_button_title"),content:c("ftu_timesheets.empty_state.tooltips.2.content"),placement:"right-start",variant:"primary",open:n===2,title:c("ftu_timesheets.empty_state.tooltips.2.title"),onButtonClick:R,onDismissClick:f}}}],P={options:O,dataTestId:"timesheets-tab-nav"},M=!b&&C,K=c("ftu_timesheets.empty_state.tooltips.count",{props:{currentCount:n,totalCount:M?4:3}}),F={buttonTitle:c(`ftu_timesheets.empty_state.tooltips.${M?"next_button_title":"got_it_button_title"}`),content:c("ftu_timesheets.empty_state.tooltips.3.content"),placement:"bottom-end",variant:"primary",open:n===3,title:c("ftu_timesheets.empty_state.tooltips.3.title"),onButtonClick:M?R:k,onDismissClick:f,count:K},U={buttonTitle:c(`ftu_timesheets.empty_state.tooltips.${M?"next_button_title":"got_it_button_title"}`),content:c("clover_embedded.timesheets.ftu_screen.tooltips.3.content"),placement:"bottom-end",variant:"primary",open:n===3,title:c("clover_embedded.timesheets.ftu_screen.tooltips.3.title"),onButtonClick:M?R:k,onDismissClick:f,count:K},$={buttonTitle:c("ftu_timesheets.empty_state.tooltips.got_it_button_title"),content:c("ftu_timesheets.empty_state.tooltips.4.content"),placement:"bottom-end",variant:"primary",open:n===4,title:c("ftu_timesheets.empty_state.tooltips.4.title"),onButtonClick:k,onDismissClick:f,count:K},G=a.useCallback((H,Z)=>{I(H,Z)},[I]),Y={buttonTitle:c("ftu_timesheets.empty_state.tooltips.next_button_title"),content:c(`ftu_timesheets.empty_state.tooltips.${n===1?"1":"2"}.content`),placement:"bottom",variant:"primary",open:n===1||n===2,title:c(`ftu_timesheets.empty_state.tooltips.${n===1?"1":"2"}.title`),onButtonClick:R,onDismissClick:f,count:K};return y?e.jsx(l,{ph:_?56:32,bgcolor:_?"mono0":"mono100",className:Oo("redesigned"),children:e.jsxs(l,{row:!0,vcenter:!0,pt:16,pb:8,className:Ie("header_wrapper_redesigned"),children:[e.jsx(E,{variant:"heading1",children:c("timesheets.tab_menu.title")}),e.jsx(l,{className:Ie("picker_wrapper"),children:e.jsx(oe,{...Y,children:e.jsx(Mo,{options:O,tabValue:t,onChange:G,ariaName:"timesheets-view",dataTestId:"timesheets-segmented-picker"})})}),e.jsxs(l,{row:!0,vcenter:!0,gap:8,ml:"auto",className:Ie("button_wrapper_redesigned"),children:[g&&e.jsx(oe,{...F,children:e.jsx(Js,{uxElement:"timesheets_embedded_cta",copy:c(x?"timesheets_guided_setup.timesheets_completed_embedded_cta_daily_review":"timesheets_guided_setup.timesheets_embedded_cta_daily_review"),cxEl:Ie,variant:"secondary",showStartIcon:!1})}),i&&T&&e.jsx(oe,{...U,children:e.jsx(qs,{uxElement:"timesheets_timeclock_settings_cta",copy:c("clover_embedded.timesheets.ftu_screen.timeclock_settings_cta")})}),M&&e.jsx(oe,{...$,children:e.jsx(Zs,{variant:"secondary",className:Ie("payroll-button"),showStartIcon:!1})})]})]})}):e.jsxs(l,{ph:_?56:32,gap:21,bgcolor:_?"mono0":"mono100",className:Oo(),children:[e.jsxs(l,{pb:8,pt:16,justifyContentSpaceBetween:!0,className:Ie("header_wrapper"),children:[e.jsx(E,{variant:"heading1",children:c("timesheets.tab_menu.title")}),e.jsxs(l,{className:Ie("button_wrapper"),children:[g&&e.jsx(oe,{...F,children:e.jsx(Js,{uxElement:"timesheets_embedded_cta",copy:c(x?"timesheets_guided_setup.timesheets_completed_embedded_cta_daily_review":"timesheets_guided_setup.timesheets_embedded_cta_daily_review"),cxEl:Ie,variant:"secondary",showStartIcon:!1})}),i&&T&&e.jsx(oe,{...U,children:e.jsx(qs,{uxElement:"timesheets_timeclock_settings_cta",copy:c("clover_embedded.timesheets.ftu_screen.timeclock_settings_cta")})}),M&&e.jsx(oe,{...$,children:e.jsx(Zs,{variant:"secondary",className:Ie("payroll-button"),showStartIcon:!1})})]})]}),e.jsx(l,{children:e.jsx(ip,{noPadding:!0,scrollable:!0,onChange:I,tabValue:t,count:K,step:n,...P})})]})},lp=({urlQuery:t,canManageTimecards:s,shouldSeeTimesheetsZeroState:n,hasUserSeenTooltip:o,getDailyReviewLocationData:i,isCloverEmbedded:d,dismissChangesAlert:r,showTipChangesAlert:m,showChangesSavedToast:u,closeChangesSavedToast:_,isTimecardReviewAssistantEnabled:h,resolveIssuesSidebarOpen:g,closeResolveIssuesSidebar:x,dismissResolveIssuesSidebar:b,isPageTemplateEnabled:C})=>
1{const T=Ve(),y=q(),[v,I]=a.useState(Cc(window.location.href)),R=a.useCallback($=>{$===Se.PAY_PERIOD_REVIEW&&x(),I($)},[x]),S=a.useCallback($=>{const G=$===Se.PAY_PERIOD_REVIEW?"/timesheets/pay_period_review":"/timesheets/daily_review";T.replace(G)},[T]),k=a.useCallback(($,G)=>{y(A.BUTTON_CLICKED,w.CLICK,{button_text:G}),G&&(R(G),S(G))},[R,S,y]);a.useEffect(()=>{C&&S(v)},[C,v,S]);const f=a.useMemo(()=>[{value:Se.DAILY_REVIEW,label:c("timesheets.tab_menu.day")},{value:Se.PAY_PERIOD_REVIEW,label:c("timesheets.tab_menu.pay_period")}],[]),O=v===Se.PAY_PERIOD_REVIEW?2:1,[P,M]=a.useState(o?0:O),N=$a().env.stack==="staging";if(a.useEffect(()=>{i()},[i]),n)return d&&N?e.jsx(xc,{}):e.jsx(qc,{});if(!s)return e.jsx(wo,{...t});const K=e.jsxs(e.Fragment,{children:[v===Se.DAILY_REVIEW&&e.jsx(Yu,{urlQuery:t,isCloverEmbedded:d}),v===Se.PAY_PERIOD_REVIEW&&e.jsx(wo,{...t,isCloverEmbedded:d}),e.jsx(Ps,{variant:"success",open:m,hideCloseIcon:!0,onClose:r,children:e.jsx(E,{children:c("tip_pooling_settings.table_data.tip_changes_alert")})}),e.jsx(Ps,{variant:"success",open:u,hideCloseIcon:!0,onClose:_,children:e.jsx(E,{children:c("timesheets.react_page.changes_saved_toast")})})]}),F=h&&e.jsx(Wm,{isOpen:g,onClose:b}),U=v===Se.DAILY_REVIEW?e.jsx(zu,{}):v===Se.PAY_PERIOD_REVIEW?e.jsx(Xm,{}):null;return C?e.jsxs(l,{flex:!0,row:!0,h:"100%",children:[e.jsx(l,{flex:!0,column:!0,grow:1,minh:0,overflowX:"hidden",children:e.jsx(Le,{title:c("timesheets.tab_menu.title"),actions:U,alert:d?null:e.jsx(np,{}),tabs:{options:f,tabValue:v,onChange:k,ariaName:"timesheets-view",dataTestId:"timesheets-page-tabs"},children:K})}),F]}):e.jsxs(l,{bgcolor:"mono100",className:d&&"CloverEmbedded CloverEmbeddedTimesheets",flex:!0,row:!0,h:"100%",children:[e.jsxs(l,{flex:!0,column:!0,grow:1,minh:0,overflowX:"hidden",children:[e.jsx(Gi,{children:e.jsx(ap,{activeTabValue:v,setActiveTabValue:R,tooltipIndex:P,setTooltipIndex:M,isCloverEmbedded:d})}),K]}),F]})},Lp=W((t,s)=>({urlQuery:mc(t,s),canManageTimecards:as(t),isActiveUser:!uc(t),shouldSeeTimesheetsZeroState:Ci(t),hasUserSeenTooltip:dc(t),isCloverEmbedded:yt(t),showTipChangesAlert:cc(t),showChangesSavedToast:rc(t),isTimecardReviewAssistantEnabled:pe(t),resolveIssuesSidebarOpen:lc(t),isPageTemplateEnabled:Ke(t)}),{updatedReduxExperiments:gc,getDailyReviewLocationData:pc,dismissChangesAlert:hc,closeChangesSavedToast:_c,closeResolveIssuesSidebar:()=>re.setResolveIssuesSidebarOpen(!1),dismissResolveIssuesSidebar:re.dismissResolveIssuesSidebar})(ae({productArea:me.TIMESHEETS,eventCategory:be.TIMESHEETS})(lp));export{Lp as default};
2//# sourceMappingURL=TimesheetsPage-chunk-yH7qeytp.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.