1import{cl as S,j as e,cs as ye,bL as x,cm as q,r as i,bQ as Se,cf as Ce,cn as se,de as Te,cc as Ee,dj as Be}from"./vendor-ct_YKIP6_bundle.js";import{a8 as z,a6 as $,G as R,d as ne,l as f,A as G,a4 as j,h as ve,ag as D,H as B,F as g,T as _,ak as he,dj as De,tI as Fe,ab as Je,c as X,gO as Ae,d5 as Le,df as ke,bx as M,u as Ie,z as Re,dg as Pe,qc as pe,qd as He,pU as We,dO as Oe,dB as me,dC as ge,g as Ue,jt as Z,dy as Ve,cl as de,jv as Me,aU as Ne}from"./registration-BfOA5mCx_bundle.js";import{O as ze}from"./OpenSideFilterButton-DjD096f1_bundle.js";import"./moment-DyvZl3Ud_bundle.js";import{lg as K,lh as I,b$ as $e,hL as Y,W as Ge,e as qe,li as Ke,lj as be,aI as E,A as Ye,B as Qe,T as Xe,P as Ze,lk as te,ll as je,bq as et,lm as tt}from"./index-BiagCLbs_bundle.js";import{B as st,S as nt,A as at,U as it,J as ot}from"./ui-SKKIsiVZ_bundle.js";import{S as rt,a as lt}from"./manage-team-DdoqA3xP_bundle.js";import{B as ae,a as ie,b as oe,c as re,d as le,e as ce}from"./index-D45wVLyt_bundle.js";import{S as xe}from"./info-circle-large-BOkOwgLn_bundle.js";import{S as ct}from"./index-CFLQqsAR_bundle.js";import{S as dt}from"./bulk-import-intro-card-qkzSe-D3_bundle.js";import{C as ut}from"./slackIntegration-mZcBTumD_bundle.js";import"./sentry-DLDmuXKN_bundle.js";import"./datadog-DxmyjtSX_bundle.js";import"./stripe-BA7RN6Z4_bundle.js";import"./speedboat-vendor-DBIVks5t_bundle.js";import"./legacy-banner-close-DeSaGTzB_bundle.js";const ht=x(z).withConfig({displayName:"UpgradePlanButton__SecondaryButton"})(["padding:unset;text-align:center;min-width:126px;background-color:",";"],({theme:t})=>t.bg.white),fe=({onClick:t})=>{const{t:s}=S();return e.jsx(ye,{to:"/change-plan",onClick:t,children:e.jsx(ht,{styleType:"commonCTA",children:s("common.upgrade")})})},pt=({onDismiss:t})=>{const{t:s}=S(),a=()=>{R.clickJobUpgradeFromWarning()};return e.jsxs(ae,{variant:"neutral","data-testid":"jobs-approaching-limit-banner",children:[e.jsxs(ie,{icon:e.jsx(xe,{}),children:[e.jsx(oe,{children:s("jobs.approaching_limit_banner.title")}),e.jsx(re,{children:$(s("jobs.approaching_limit_banner.subtitle"))})]}),e.jsxs(le,{children:[e.jsx(fe,{onClick:a}),e.jsx(ce,{onClick:t})]})]})},mt=({onDismiss:t})=>{const{t:s}=S(),{jobLimit:a}=K(),r=()=>{R.clickJobUpgradeFromLimitReached()};return e.jsxs(ae,{variant:"neutral","data-testid":"jobs-limit-reached-banner",children:[e.jsxs(ie,{icon:e.jsx(xe,{}),children:[e.jsx(oe,{children:s("jobs.limits_reached_banner.title")}),e.jsx(re,{children:$(s("jobs.limits_reached_banner.subtitle",{activeJobsLeft:a}))})]}),e.jsxs(le,{children:[e.jsx(fe,{onClick:r}),e.jsx(ce,{onClick:t})]})]})},gt=x.button.withConfig({displayName:"DriftBanner__ReviewButton"})(["cursor:pointer;color:",";font-size:12px;font-weight:700;letter-spacing:1.3px;"],({theme:t})=>t.text.neutral700),bt=()=>{const{t}=S(),s=ne(),{setValue:a}=q(),r=f(c=>c.pages?.jobListPage?.unresolvedDriftCount??null),o=f(c=>c.pages?.jobListPage?.isDriftBannerDismissed??!1),l=i.useCallback(()=>{a("filters.status",[...I.filters.status]),a("filters.miscellaneous.showConflictJobs",!0)},[a]),u=i.useCallback(()=>s({type:G.DISMISS_JOBS_LIST_DRIFT_BANNER}),[s]),p=r??0;return p<=0||o?null:e.jsxs(ae,{variant:"warning","data-testid":"jobs-drift-banner",children:[e.jsxs(ie,{icon:e.jsx($e,{}),children:[e.jsx(oe,{children:t("appfolio.jobs_list_drift_banner.title",{count:p})}),e.jsx(re,{children:t("appfolio.jobs_list_drift_banner.subtitle")})]}),e.jsxs(le,{children:[e.jsx(gt,{"data-testid":"jobs-drift-banner-review",type:"button",onClick:l,children:t("appfolio.jobs_list_drift_banner.review")}),e.jsx(ce,{onClick:u})]})]})},ee="jobs_limit_reached_dismissed",jt=()=>{const{isAtWarning:t,isAtLimit:s,activeJobs:a}=K(),[r,o]=i.useState(null),[l,u]=i.useState(()=>sessionStorage.getItem(ee)==="true"),p=i.useRef(s);return i.useEffect(()=>{p.current&&!s&&(sessionStorage.removeItem(ee),u(!1)),p.current=s},[s]),{showApproachingBanner:t&&(r===null||a>r),showLimitReachedBanner:s&&!l,dismissApproachingBanner:()=>o(a),dismissLimitReachedBanner:()=>{sessionStorage.setItem(ee,"true"),u(!0)}}},xt=()=>{const{showApproachingBanner:t,showLimitReachedBanner:s,dismissApproachingBanner:a,dismissLimitReachedBanner:r}=jt(),o=Y();return e.jsxs(e.Fragment,{children:[e.jsx(bt,{}),e.jsxs(j,{when:o,children:[e.jsx(j,{when:t,children:e.jsx(pt,{onDismiss:a})}),e.jsx(j,{when:s,children:e.jsx(mt,{onDismiss:r})})]})]})}
1,ft=()=>{const{t}=S();return e.jsx(B,{outside:!0,all:16,children:e.jsx(_,{fontMedium:!0,mediumSize:!0,neutral700:!0,lineHeight:"20px",children:t("jobs.search_hint")})})},_t=()=>{const{t}=S(),s=()=>{R.clickJobUpgradeFromHeader()};return e.jsx(it,{to:"/change-plan",onClick:s,children:t("jobs.subheading_upgrade",{upgradeLink:t("jobs.subheading_upgrade")})})},wt=({isEmptyState:t})=>{const{t:s}=S(),{activeJobs:a,jobLimit:r,isUnlimited:o,isUnlimitedEnterprise:l}=K(),u=Y();return e.jsxs(B,{top:12,bottom:12,children:[e.jsx(j,{when:o||!u,children:e.jsxs(_,{block:!0,neutral500:!0,smallSize:!0,letterSpacing:"0.4px",children:[s("jobs.subheading"),e.jsxs(j,{when:o||l,children:[e.jsx("br",{}),s(l?"jobs.subheading_unlimited_enterprise":"jobs.subheading_unlimited")]})]})}),e.jsxs(j,{when:!o&&u,children:[e.jsx(_,{block:!0,neutral500:!0,smallSize:!0,letterSpacing:"0.4px",children:s("jobs.subheading")}),e.jsx(j,{when:!t,children:e.jsx(g,{alignItems:"center",children:e.jsxs(_,{block:!0,neutral500:!0,smallSize:!0,letterSpacing:"0.4px",children:[e.jsxs(at,{children:[s("jobs.subheading_active_jobs",{activeJobs:a,jobLimit:r})," "]})," ",e.jsx(_t,{})," ",s("jobs.subheading_to_add_more")]})})})]})]})},yt=()=>{const{t}=S(),{showModal:s,hideModal:a}=he(),r=Y(),o=()=>{s("CreateJobModal",{styleType:"light",disableOutsideClick:!0,size:"extended",overflow:"visible",isDefaultHeadingHidden:!0,data:{handleCloseClick:a}})},l=()=>{R.clickNewJob(),o()};return r?e.jsx(z,{iconWithSpinner:!0,"data-testid":"new-job",styleType:"brandCTA",type:"button",onClick:l,children:t("jobs.new_job")}):e.jsx(z,{styleType:"brandCTA",type:"button",onClick:l,children:t("jobs.new_job")})},St=()=>{const{t}=S(),s=i.useContext(Se),{register:a,watch:r,setValue:o,getFieldState:l}=q(),{permissions:u}=ve(),p=Y(),c=f(d=>d.pages?.jobListPage?.jobs),b=f(d=>d.pages?.jobListPage?.isSearchOrFilterApplied??!1),m=D(c)&&!b;return e.jsx(B,{top:28,children:e.jsxs(g,{column:!0,gap:20,children:[e.jsxs(B,{bottom:26,right:12,style:{borderBottom:`solid 1px ${s.bg.neutral200}`},children:[e.jsxs(g,{alignItems:"center",height:"42px",justifyContent:"space-between",children:[e.jsxs(g,{alignItems:"center",gap:12,children:[e.jsx(_,{as:"h1",children:t("jobs.heading")}),e.jsx(j,{when:!p,children:e.jsx(st,{children:t("common.beta")})})]}),e.jsxs(g,{alignItems:"center",justifyContent:"center",gap:10,children:[e.jsx(j,{when:u?.manageJobSettings,children:e.jsx(nt,{to:"/job-settings",children:e.jsx(rt,{color:s.text.neutral700})})}),e.jsx(yt,{})]})]}),e.jsx(wt,{isEmptyState:m})]}),e.jsx(xt,{}),e.jsx(j,{when:!m,children:e.jsxs(g,{gap:12,justifyContent:"space-between",width:"fit-content",children:[e.jsx(Ge,{getFieldState:l,isScannerApplicable:!1,maxWidth:"380px",name:"keyword",placeHolder:t("jobs.search_placeholder"),register:a,searchHint:e.jsx(ft,{}),setValue:o,watch:r}),e.jsx(ze,{showCount:!0})]})})]})})},N={typeSpeed:70,eraseSpeed:35,pauseAfterTyping:1800,pauseBeforeNextWord:450},Ct=(t,s={})=>{const{typeSpeed:a=N.typeSpeed,eraseSpeed:r=N.eraseSpeed,pauseAfterTyping:o=N.pauseAfterTyping,pauseBeforeNextWord:l=N.pauseBeforeNextWord}=s,[u,p]=i.useState(0),[c,b]=i.useState(0),[m,d]=i.useState(!1),C=t[u]??"",F=!m&&c===C.length,J=m&&c===0;return i.useEffect(()=>{if(t.length===0)return;if(F){const w=setTimeout(()=>d(!0),o);return()=>clearTimeout(w)}if(J){const w=setTimeout(()=>{d(!1),p(L=>(L+1)%t.length)},l);return()=>clearTimeout(w)}const A=setTimeout(()=>b(w=>w+(m?-1:1)),m?r:a);return()=>clearTimeout(A)},[c,m,J,F,t.length,a,r,o,l]),C.slice(0,c)},Tt=Ce(["0%,49%{opacity:1;}50%,100%{opacity:0;}"]),Et=x.span.withConfig({displayName:"ui__TypedTextRoot"})(["display:inline-grid;"]),Bt=x.span.withConfig({displayName:"ui__LongestWord"})(["grid-area:1 / 1;visibility:hidden;"]),vt=x.span.withConfig({displayName:"ui__TypedValue"})(["grid-area:1 / 1;white-space:nowrap;text-align:left;"]),Dt=x.span.withConfig({displayName:"ui__Cursor"})(["display:inline-block;width:0.09em;height:1em;margin-left:2px;vertical-align:text-bottom;background-color:currentColor;animation:"," 1s step-end infinite;@media (prefers-reduced-motion:reduce){animation:none;}"],Tt),Ft=({words:t,...s})=>{const a=i.useMemo(()=>t.reduce((o,l)=>l.length>
1o.length?l:o,""),[t]),r=Ct(t,s);return e.jsxs(Et,{"aria-live":"off",children:[e.jsx(Bt,{"aria-hidden":"true",children:a}),e.jsxs(vt,{children:[r,e.jsx(Dt,{"aria-hidden":"true"})]})]})},Jt=x(g).withConfig({displayName:"ui__EmptyStateContent"})(["max-width:1100px;padding-top:10px;"]),At=x(_).withConfig({displayName:"ui__EmptyStateHeading"})(["display:block;color:",";font-size:22px;font-weight:600;line-height:32px;text-align:center;"],({theme:t})=>t.text.neutral700),Lt=x(_).withConfig({displayName:"ui__EmptyStateSubheading"})(["display:block;color:",";font-size:14px;line-height:20px;text-align:center;"],({theme:t})=>t.text.neutral500),kt=x(g).withConfig({displayName:"ui__JobFeatureCard"})(["flex:1;min-height:150px;width:300px;padding:16px 30px;border:1px solid ",";border-radius:6px;text-align:left;"],({theme:t})=>t.delimiter.neutral200),It=x(g).withConfig({displayName:"ui__JobFeatureIcon"})(["align-self:flex-start;padding:10px;border-radius:50%;background-color:",";color:",";"],({theme:t})=>t.bg.neutral200,({theme:t})=>t.icon.neutral700),Rt=x(_).withConfig({displayName:"ui__JobFeatureTitle"})(["color:",";font-style:normal;font-size:18px;font-weight:600;line-height:24px;"],({theme:t})=>t.text.neutral900),Pt=x(_).withConfig({displayName:"ui__JobFeatureDescription"})(["color:",";font-size:14px;font-weight:400;line-height:20px;"],({theme:t})=>t.text.neutral600),Ht=[{id:"jobs",Icon:De},{id:"manage_team",Icon:lt},{id:"lock",Icon:qe}],Wt=["jobs","work_orders","projects","service_calls","tickets"],Ot=({onCreateJob:t})=>{const{t:s}=S(),a=i.useMemo(()=>Wt.map(o=>s(`jobs.empty_state.terms.${o}`)),[s]),r=$(s("jobs.empty_state.heading"),{term:()=>e.jsx(_,{brand:!0,inheritSize:!0,inheritWeight:!0,children:e.jsx(Ft,{words:a})})});return e.jsx(g,{center:!0,children:e.jsxs(Jt,{column:!0,fullWidth:!0,alignItems:"center",gap:55,children:[e.jsxs(g,{column:!0,alignItems:"center",gap:24,children:[e.jsx(dt,{"aria-label":s("jobs.empty_state.empty_job_img_alt"),role:"img"}),e.jsxs(g,{column:!0,alignItems:"center",gap:16,children:[e.jsx(At,{children:r}),e.jsx(Lt,{children:$(s("jobs.empty_state.subheading"))})]})]}),e.jsxs(g,{column:!0,fullWidth:!0,alignItems:"center",gap:24,children:[e.jsx(g,{fullWidth:!0,gap:32,children:Ht.map(({id:o,Icon:l})=>e.jsxs(kt,{column:!0,"data-testid":`jobs-empty-state-feature-${o}`,gap:12,children:[e.jsx(It,{center:!0,children:e.jsx(l,{})}),e.jsxs(g,{column:!0,gap:12,children:[e.jsx(Rt,{children:s(`jobs.empty_state.job_features.${o}.title`)}),e.jsx(Pt,{children:s(`jobs.empty_state.job_features.${o}.description`)})]})]},o))}),e.jsx(z,{styleType:"brandCTA",type:"button",onClick:t,children:s("jobs.create_first_job")})]})]})})},ue=t=>i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16",...t},i.createElement("rect",{width:16,height:16,fill:"#007AC6",rx:3.2}),i.createElement("path",{fill:"#FEFEFE",d:"M8.361 3.198c.817-.025 1.634.146 2.334.584.633.394 1.041 1.056 1.198 1.776.128.588.08 1.133.09 1.731.016.59.014 1.175-.003 1.764-.025.833-.122 1.463-.587 2.177-.595.912-1.496 1.49-2.557 1.72a5.4 5.4 0 0 1-1.515.08c-1.308-.119-2.975-.895-3.276-2.304-.134-.629.046-1.352.39-1.874.62-.899 1.701-1.273 2.735-1.452.387-.067.774-.097 1.162-.146q.492-.061.98-.153c.642-.118 1.213-.26 1.157-1.008a1.14 1.14 0 0 0-.396-.821c-.493-.44-1.241-.457-1.866-.45-.947.027-1.742.329-2.017 1.321-.072.257-.086.488-.275.688a.78.78 0 0 1-.552.243c-.253.006-.484-.055-.669-.234-.289-.28-.279-.575-.204-.94a3.2 3.2 0 0 1 .808-1.582c.795-.832 1.95-1.097 3.063-1.12m2.008 4.92c-.355.13-.575.158-.946.225q-.533.097-1.068.183c-.516.082-1.042.162-1.54.315-.382.118-.843.317-1.014.703-.235.531-.033 1.058.42 1.388.56.403 1.3.543 1.975.433.684-.113 1.377-.439 1.789-1.014.486-.68.405-1.435.404-2.223l-.007-.01z"})),Ut=t=>i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16",...t},i.createElement("g",{clipPath:"url(#appfolio-integration-inactive_svg__clip0_2195_62389)"},i.createElement("rect",{width:16,height:16,fill:"#E4E4E5",rx:3.2}
1),i.createElement("path",{fill:"#54565D",d:"M8.361 3.198c.817-.025 1.634.146 2.335.584.632.394 1.04 1.056 1.196 1.776.128.588.08 1.133.091 1.732.017.59.014 1.174-.004 1.763-.024.833-.121 1.463-.587 2.177-.594.912-1.495 1.49-2.556 1.72a5.4 5.4 0 0 1-1.515.08c-1.308-.119-2.975-.895-3.276-2.304-.135-.629.045-1.352.39-1.874.62-.899 1.7-1.273 2.735-1.452.387-.067.774-.097 1.162-.146q.492-.061.98-.153c.642-.118 1.213-.26 1.157-1.008a1.14 1.14 0 0 0-.395-.821c-.493-.44-1.242-.457-1.866-.45-.947.027-1.744.328-2.019 1.321-.07.257-.085.488-.273.688a.78.78 0 0 1-.552.243c-.254.006-.486-.055-.67-.234-.289-.28-.279-.575-.204-.94a3.2 3.2 0 0 1 .808-1.582c.795-.832 1.95-1.097 3.063-1.12m2.008 4.92c-.355.13-.576.158-.946.225q-.533.098-1.068.183c-.515.082-1.042.162-1.54.315-.383.118-.843.318-1.014.703-.235.531-.033 1.058.42 1.388.56.403 1.3.544 1.976.433.684-.113 1.375-.439 1.787-1.014.487-.68.405-1.435.404-2.223l-.006-.01z"}),i.createElement("rect",{width:2.406,height:20.006,x:.012,y:1.727,fill:"#76777D",stroke:"#fff",strokeWidth:1.25,rx:1.203,transform:"rotate(-45 .012 1.727)"})),i.createElement("defs",null,i.createElement("clipPath",{id:"appfolio-integration-inactive_svg__clip0_2195_62389"},i.createElement("rect",{width:16,height:16,fill:"#fff",rx:3.2})))),Vt=({source:t})=>Fe(t)?t?.active?t?.hasUnresolvedDrift?e.jsxs(B,{relative:!0,children:[e.jsx(ue,{width:16,height:16,"data-testid":"job-appfolio-source-icon"}),e.jsx(ot,{children:e.jsx(Ke,{width:12,height:12,viewBox:"0 0 16 16","data-testid":"job-appfolio-source-icon-error"})})]}):e.jsx(ue,{width:16,height:16,"data-testid":"job-appfolio-source-icon"}):e.jsx(Ut,{width:16,height:16,"data-testid":"job-appfolio-inactive-icon"}):null,Mt=t=>{const{t:s}=S(),a=ne(),{setValue:r}=q(),{activeCustomFields:o}=be(),l=f(n=>n?.pages?.jobListPage?.meta?.currentPage),u=f(n=>n?.pages?.jobListPage?.isSearchOrFilterApplied),p=Je(),[c,b,m,d,C]=se({name:["sortBy","sortDirection","filters","perPage","keyword"]}),{showModal:F,hideModal:J}=he(),A=()=>{R.clickCreateYourFirstJob(),F("CreateJobModal",{styleType:"light",disableOutsideClick:!0,size:"extended",overflow:"visible",isDefaultHeadingHidden:!0,data:{handleCloseClick:()=>J()}})},w=i.useMemo(()=>[{Header:s("jobs.columns.job_name"),accessor:"name",minWidth:320,maxWidth:320,sticky:"left",align:"left",Cell:({row:{original:n,index:h}})=>e.jsxs(g,{center:!0,gap:16,children:[e.jsx(E,{testId:`job-${h}-name`,value:n.name,trim:!0,maxWidth:"260px"}),e.jsx(Vt,{source:n.source})]}),disableSortBy:!1,padding:"0 8px 0 16px"},{Header:s("jobs.columns.status"),accessor:"status",minWidth:160,sticky:"left",Cell:({row:{original:n,index:h}})=>e.jsx("span",{"data-testid":`job-${h}-status`,children:e.jsx(ct,{label:n.status?.label,status:n.status?.key})}),disableSortBy:!1,padding:"0 8px",align:"left"},...o.map(n=>({Header:n.label.toString(),accessor:n.id.toString(),minWidth:180,Cell:({row:{original:h,index:y}})=>{const H=h.customFieldValues?.find(Q=>Q.customFieldId===n.id)?.value;return D(H)?e.jsx(E,{testId:`job-${y}-${n.id}`}):e.jsx(E,{testId:`job-${y}-${n.id}`,value:H})},disableSortBy:!0,padding:"0 8px",align:"left"})),{Header:s("jobs.columns.start_date"),accessor:"startDate",minWidth:180,Cell:({row:{original:n,index:h}})=>{const{formattedDateTime:y}=X({date:n.startDate,isUserTimezone:!1,isOnlyDate:!0});return D(n.startDate)?e.jsx(E,{testId:`job-${h}-start-date`}):e.jsx(E,{testId:`job-${h}-start-date`,value:y})},disableSortBy:!1,padding:"0 8px",align:"left"},{Header:s("jobs.columns.end_date"),accessor:"endDate",minWidth:180,Cell:({row:{original:n,index:h}})=>{const{formattedDateTime:y}=X({date:n.endDate,isUserTimezone:!1,isOnlyDate:!0});return D(n.endDate)?e.jsx(E,{testId:`job-${h}-end-date`}):e.jsx(E,{testId:`job-${h}-end-date`,value:y})},disableSortBy:!1,padding:"0 8px",align:"left"},{Header:s("jobs.columns.created_by"),accessor:"createdBy",minWidth:180,Cell:({row:{original:n,index:h}})=>e.jsx(E,{testId:`job-${h}-created-by`,value:n?.createdBy?.name}),disableSortBy:!1,padding:"0 8px",align:"left"},{Header:s("jobs.columns.last_updated"),accessor:"updatedAt",minWidth:200,Cell:({row:{original:n,index:h}})=>{const{formattedDateTime:y,timezone:H,dateFormat:Q,is12HourTimeFormat:_e}=X({date:n.updatedAt,isUserTimezone:!1,includeTime:!0});if(Ae(n.updatedAt)){const we=Le({date:n.updatedAt,timezone:H,dateFormat:Q,is12HourTimeFormat:_e,includeDateForToday:!0});return e.jsx(ke,{content:we,portalAnchor:"#page-content-wrapper",children:e.jsx(_,{cursorPointer:!0,neutral700:!0,trimLongString:!0,"data-testid":`job-${h}-last-updated`,offsets:{pt:4},children:y})})}return e.jsx(E,{testId:`job-${h}-last-updated`,value:y})},disableSortBy:!1,padding:"0 8px",align:"left"}],[o]),L=w.reduce((n,h)=>n+h.minWidth,0),W={sortBy:[{id:c,desc:b===M.Descending}]},O=i.useCallback(n=>{const h=n?.[0]?.id,y=b===M.Descending?M.Ascending:M.Descending;return c!==h?r("sortBy",h):r("sortDirection",y)},[b,c,r]),U=i.useCallback(n=>{if(d!==n.perPage)return r("perPage",n.perPage);a({type:G.FETCH_JOBS_REQUEST,payload:{sortBy:c,sortDirection:b,filters:m,keyword:C,...n}})},[a,c,b,m,d,C,r]),{locationPush:T}=Ie(),V=i.useCallback(n=>{T(`/job/${n.original.id}`)},[T]),{tableWrapperRef:v,height:k,width:P}=Ye({minTableWidth:L,minTableHeight:Qe,contentWrapperRef:t.contentWrapperRef});return e.jsxs(B,{fullHeight:!0,relative:!0,bottom:50,minHeight:k,children:[e.jsxs(j,{when:Re(t.jobs),children:[e.jsx("div",{ref:v,children:e.jsx(Xe,{columns:w,data:t.jobs,height:k,initialState:W,source:"job",width:P,onRowClick:V,onSort:O})}),e.jsx(Ze,{tableMode:!0,currentCount:t.jobs?.length,hasNext:t.paginationMeta?.hasNext,hasPrev:t.paginationMeta?.hasPrev,offset:t.paginationMeta?.offset,totalCount:t.totalCount,values:{currentPage:l,perPage:d},onChange:U})]}),e.jsx(j,{when:!p.fetchJobs&&D(t.jobs)&&!!u,children:e.jsx(B,{outside:!0,top:-24,children:e.jsx(_,{largerLineHeight:!0,largeSize:!0,neutral700:!0,children:s("jobs.no_results")})})}),e.jsx(j,{when:!p.fetchJobs&&D(t.jobs)&&!u,children:e.jsx(Ot,{onCreateJob:A})}),e.jsx(j,{when:p.fetchJobs,children:e.jsx(Pe,{largeRed:!0,height:"100%",size:"74px",width:"100%"})})]})},Nt={status:pe(je),miscellaneous:{[te]:!1}},zt=t=>{const s=t?.persistedFormValues?.initialized||!1,a=f(d=>d.pages?.jobListPage?.jobs||[]),r=f(d=>d.pages?.jobListPage?.meta||{}),o=f(d=>d.pages?.jobListPage?.totalCount??null),{setValue:l}
1=q(),u=i.useRef(null),[p,c]=se({name:["filters.status","filters.miscellaneous.showConflictJobs"]}),b=i.useMemo(()=>({status:pe(je,p),miscellaneous:{[te]:!!c}}),[p,c]),m=i.useCallback(({status:d,miscellaneous:C})=>{l("filters.status",He(d)),l("filters.miscellaneous.showConflictJobs",!!C?.[te])},[l]);return e.jsx(We,{data:b,defaultState:Nt,filterType:Oe.JOB,submitFilterValues:m,children:e.jsx(B,{horizontal:40,children:e.jsxs(g,{ref:u,column:!0,fullWidth:!0,gap:40,children:[e.jsx(St,{}),e.jsx(j,{when:s,children:e.jsx(Mt,{contentWrapperRef:u,jobs:a,paginationMeta:r,totalCount:o})})]})})})},$t=async t=>{try{return await(await(await me()).transaction(ge.JOB_LIST,"readwrite")).store.put(t,"jobListFormValues")}catch{return null}},Gt=async()=>{try{return await(await(await me()).transaction(ge.JOB_LIST,"readonly")).store.get("jobListFormValues")??I}catch{return I}},us=()=>{be();const t=ne(),s=Te({defaultValues:I}),{userStorage:a,updateUserStorage:r}=Ue(),o=f(n=>n.pages?.jobListPage?.jobs),l=f(n=>n.pages?.jobListPage?.isSearchOrFilterApplied??!1),u=f(n=>n.spinner?.fetchJobs??!1),p=Z(u),c=i.useRef(!1),{activeJobs:b,jobLimit:m,limitState:d,isPlanLoaded:C}=K();i.useEffect(()=>{c.current||!C||p&&!u&&(c.current=!0,R.viewJobListingPage({isEmptyState:D(o)&&!l,jobsLimitState:d,jobsLimit:m,jobsActive:b}))},[p,u,o,l,d,m,b,C]),i.useEffect(()=>{a?.hasViewedJobsRoute||r({hasViewedJobsRoute:!0})},[a?.hasViewedJobsRoute,r]);const{reset:F,control:J}=s,[A,w,L,W,O,U]=se({name:["sortBy","sortDirection","perPage","filters.status","filters.miscellaneous.showConflictJobs","keyword"],control:J}),T=i.useMemo(()=>({sortBy:A,sortDirection:w,perPage:L,filters:{status:W,miscellaneous:{showConflictJobs:O}}}),[A,w,L,W,O]),V=Z(T),{debouncedValue:v}=Ve(U,500),k=Z(v);i.useEffect(()=>{if(!de(V,T))t({type:G.FETCH_JOBS_REQUEST,payload:{...T,keyword:v,currentPage:1}});else if(!de(k,v)){if(Me(v,k))return;t({type:G.FETCH_JOBS_REQUEST,payload:{...T,keyword:v,currentPage:1}})}},[V,T,U,k,v,t]);const{persistedFormValues:P}=et({formValues:T,defaultValues:I,persistedFields:tt,getFromDb:Gt,saveToDb:$t});return Ee(()=>F(Ne(I,P)),[P.initialized]),e.jsx(ut,{$greyBg:!0,children:e.jsx(Be,{...s,children:e.jsx(B,{fullHeight:!0,fullWidth:!0,children:e.jsx(zt,{persistedFormValues:P})})})})};export{us as default}; 2//# sourceMappingURL=index-BXFab4N3_bundle.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.