1"use strict";(self.webpackChunkproteams_cms=self.webpackChunkproteams_cms||[]).push([[7962],{10783:(e,t,n)=>{n.d(t,{A:()=>s});var i=n(23235),l=n(44414);const s=(0,i.A)((0,l.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline")},11023:(e,t,n)=>{n.r(t),n.d(t,{default:()=>A});var i=n(89379),l=n(32988),s=n(9950),a=n(98179),o=n(12482),r=n(17662),d=n(59051),c=n.n(d),u=n(72823),m=n(23235),p=n(44414);const h=(0,m.A)((0,p.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H5.17L4 17.17V4h16zm-9-4h2v2h-2zm0-6h2v4h-2z"}),"SmsFailedOutlined");var v=n(66220),x=n(75518);const g=function(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().trim().toLowerCase().replace(/[\s-]+/g,"_");return["sms","text","text_message","message"].includes(e)?"sms":["push","push_notification","notification","fcm","firebase_push"].includes(e)?"push":e},f=e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(null===e||void 0===e?void 0:e.timestamp)||(null===e||void 0===e?void 0:e.createdAt)||(null===e||void 0===e?void 0:e.createdOn)||(null===e||void 0===e?void 0:e.sentAt)||(null===e||void 0===e?void 0:e.dateTime)||(null===e||void 0===e?void 0:e.date);if(!t)return null;if(null!==t&&void 0!==t&&t.toDate)return t.toDate();const n=new Date(t);return Number.isNaN(n.getTime())?null:n}(e);return!!t&&c()(t).format(c().HTML5_FMT.DATE)===c()().format(c().HTML5_FMT.DATE)};function y(){var e,t,n;const d=(0,s.useContext)(u.A),[c,m]=(0,s.useState)("All"),[y,A]=(0,s.useState)([]),b="companyUser"===(null===d||void 0===d||null===(e=d.userProfile)||void 0===e?void 0:e.role)?null===d||void 0===d||null===(t=d.userProfile)||void 0===t?void 0:t.id:null===d||void 0===d||null===(n=d.userProfile)||void 0===n?void 0:n.companyId;(0,s.useEffect)((()=>{(async()=>{if(b)try{const e=[(0,v._M)("companyId","==",b),(0,v._M)("status","==","failed")],t=(await(0,v.GG)((0,v.P)((0,v.rJ)(x.IN,"clientCommunications"),...e))).docs.map((e=>(0,i.A)({id:e.id},e.data())));A(t)}catch(e){console.error("Failed to fetch failed client communications:",e),A([])}else A([])})()}),[b]);const j=(0,s.useMemo)((()=>"Today"===c?y.filter((e=>f(e))):y),[y,c]),k=(0,s.useMemo)((()=>j.filter((e=>"sms"===g(null===e||void 0===e?void 0:e.channel))).length),[j]),w=(0,s.useMemo)((()=>j.filter((e=>"push"===g(null===e||void 0===e?void 0:e.channel))).length),[j]),C=j.length,N=(0,s.useMemo)((()=>k+w),[k,w]),S=(0,s.useMemo)((()=>C?N/C*100:0),[N,C]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(l.A,{item:!0,xs:12,sm:7,lg:12,className:"mb-20",children:[(0,p.jsxs)("div",{className:"d-flex flex-center mb-10",children:[(0,p.jsx)(h,{style:{color:"rgba(239, 68, 68, 1)"}}),(0,p.jsx)("p",{className:"p-0 m-0 ml-10 fonthe dark:text-white",children:"Failed Delivery Overview"})]}),(0,p.jsx)("div",{style:{marginBottom:"10px",width:"100%",border:"1px solid #E2E8F0"}}),(0,p.jsx)(a.A,{value:c,className:"field newonr",name:"failedDeliveryFilter",onChange:e=>{m(e.target.value)},options:[{label:"All",value:"All"},{label:"Today",value:"Today"}]})]}),(0,p.jsxs)("ul",{children:[(0,p.jsx)("li",{className:r.A.listItem2,children:(0,p.jsxs)(l.A,{container:!0,spacing:1,children:[(0,p.jsx)(l.A,{item:!0,xs:7,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Failed SMS"}),(0,p.jsx)(l.A,{item:!0,xs:5,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,p.jsx)("strong",{children:Number.isFinite(k)?k:0})})]})}),(0,p.jsx)("li",{className:r.A.listItem2,children:(0,p.jsxs)(l.A,{container:!0,spacing:1,children:[(0,p.jsx)(l.A,{item:!0,xs:7,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Failed Push"}),(0,p.jsx)(l.A,{item:!0,xs:5,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,p.jsx)("strong",{children:Number.isFinite(w)?w:0})})]})}),(0,p.jsx)("li",{className:r.A.listItem2,children:(0,p.jsxs)(l.A,{container:!0,spacing:1,children:[(0,p.jsx)(l.A,{item:!0,xs:7,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Total Failures"}),(0,p.jsx)(l.A,{item:!0,xs:5,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,p.jsx)("strong",{children:Number.isFinite(N)?N:0})})]})})]}),(0,p.jsx)(l.A,{item:!0,xs:12,sm:5,lg:12,className:"mt-10",children:(0,p.jsx)(o.A,{signt:"yes",value:Number.isFinite(S)?S:0,wrapclass:"#ef4444",title:"Failure Ratio"})})]})}const A=s.memo(y)},12482:(e,t,n)=>{n.d(t,{A:()=>r});n(9950);
1var i=n(69994),l=n(60197),s=n(39886),a=n(44414);const o=(0,i.A)((()=>({wrapper:{width:"100%"},labelRow:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},barContainer:{width:"100%",height:8,borderRadius:9999,backgroundColor:"#157F3C33",overflow:"hidden"},progressBar:{height:"100%",borderRadius:9999,transition:"width 0.4s ease-in-out"}}))),r=e=>{let{value:t=0,signt:n="",wrapclass:i="",title:r}=e;const d=o();return(0,a.jsxs)(l.A,{className:"".concat(d.wrapper," ").concat(i),children:[(0,a.jsxs)("div",{className:d.labelRow,children:[(0,a.jsx)(s.A,{variant:"body2",className:"text-gray-500 dark:text-gray-100 text-[16px] font-medium",children:r}),(0,a.jsxs)(s.A,{variant:"body2",className:"dark:text-[#94A3B8] text-[16px] font-medium",children:[Math.round(t),"yes"===n?"%":""]})]}),(0,a.jsx)("div",{className:d.barContainer,children:(0,a.jsx)("div",{className:"".concat(d.progressBar),style:{width:"".concat(t,"%"),backgroundColor:i}})})]})}},14897:(e,t,n)=>{n.r(t),n.d(t,{default:()=>g});var i=n(9950),l=n(28429),s=n(73483),a=(n(98179),n(9987),n(26833)),o=n(17662),r=(n(55362),n(59051),n(27783)),d=(n(31375),n(62496)),c=(n(19977),n(35626)),u=(n(51233),n(33722)),m=n(72823),p=n(44414);n(50420);var h=n(10783),v=n(40887);const x=i.memo((e=>{var t,n,x;let{isFreemium:g=!1}=e;const f=(0,l.Zp)(),y=(0,i.useContext)(m.A),[A,b]=((0,i.useContext)(c.A),(0,i.useState)([])),[j,k]=(0,i.useState)(""),[w,C]=(0,i.useState)(""),[N,S]=(0,i.useState)(),[D,T]=(0,i.useState)(!1),[I,P]=(0,i.useState)(null),[M,F]=(0,i.useState)(!1),[E,O]=(0,i.useState)(),[B,L]=(0,i.useState)(),[R,z]=(0,i.useState)({}),[W,Y]=((0,u.A)("(max-width:767px)"),(0,u.A)("(min-width: 771px) and (max-width: 940px)"),(0,i.use
1State)(null)),[H,_]=(0,i.useState)(!1),[U,V]=(0,i.useState)(!1),[q,K]=(0,i.useState)(null),[G,Z]=(0,i.useState)(!1),[J,X]=(0,i.useState)(null),[Q,$]=(0,i.useState)(),[ee,te]=(0,i.useState)(),ne=((0,l.Zp)(),"companyUser"===(null===y||void 0===y||null===(t=y.userProfile)||void 0===t?void 0:t.role)?null===y||void 0===y||null===(n=y.userProfile)||void 0===n?void 0:n.id:null===y||void 0===y||null===(x=y.userProfile)||void 0===x?void 0:x.companyId),ie=()=>{f("/account/upgrade")},le=e=>{switch(e){case"1":return"High";case"2":return"Medium";case"3":return"Low";default:return"Unknown"}},se=(0,i.useCallback)((async()=>{try{var e,t,n;const[i,l]=await Promise.all([new Promise((e=>(0,a.Xy)(ne,e,(()=>e({status:!0,data:[]})),{limit:500}))),new Promise(((e,t)=>(0,d.mu)({companyId:ne},e,t)))]),s=null===l||void 0===l?void 0:l.filter((e=>!0!==(null===e||void 0===e?void 0:e.archive))),o=null===s||void 0===s?void 0:s.filter((e=>"Pending"===(null===e||void 0===e?void 0:e.status))),c=[...new Set(s.map((e=>e.createdBy)))],u=null===i||void 0===i||null===(e=i.data)||void 0===e||null===(t=e.filter((e=>null===c||void 0===c?void 0:c.includes(null===e||void 0===e?void 0:e.userId))))||void 0===t?void 0:t.map((e=>({value:null===e||void 0===e?void 0:e.userId,label:"".concat(null===e||void 0===e?void 0:e.firstName," ").concat(null===e||void 0===e?void 0:e.lastName)})));L(u);const m=null===s||void 0===s?void 0:s.map((e=>{var t;const n=null===u||void 0===u?void 0:u.find((t=>(null===t||void 0===t?void 0:t.value)===(null===e||void 0===e?void 0:e.createdBy))),i=(null===n||void 0===n?void 0:n.label)||"Unknown employee",l=null===e||void 0===e||null===(t=e.supplyItems)||void 0===t?void 0:t.some((e=>void 0!==(null===e||void 0===e?void 0:e.maxNumberAllowed)));return{dateOfRequest:null===e||void 0===e?void 0:e.dateOfRequest,preview:"".concat(le((null===e||void 0===e?void 0:e.priority)||"")," - (").concat(l?"Clothing":"Supplies",")"),time:(0,r.K6)(null===e||void 0===e?void 0:e.dateOfRequest)||"",user:i,id:null===e||void 0===e?void 0:e.id,orderNumber:null===e||void 0===e?void 0:e.orderNumber}})),p=null===m||void 0===m||null===(n=m.sort(((e,t)=>new Date(t.dateOfRequest)-new Date(e.dateOfRequest))))||void 0===n?void 0:n.slice(0,5);b(p),te(null===o||void 0===o?void 0:o.length)}catch(i){console.error("Error fetching employee summary data:",i)}}),[ne]);return(0,i.useEffect)((()=>{g||se()}),[se,g]),g?(0,p.jsx)(v.A,{icon:(0,p.jsx)(h.A,{className:o.A.iconYellow}),updates:[],title:"Supply Requests",count:0,to:"/supplies/cleaning/manage",viewAll:"/supplies/cleaning/manage",emptyMessage:(0,s.IV)("Supply Requests"),showUpgradeButton:!0,upgradeButtonText:"Upgrade plan",onUpgradeClick:ie}):(0,p.jsx)(v.A,{icon:(0,p.jsx)(h.A,{className:o.A.iconYellow}),updates:A,title:"Supply Requests",count:ee,to:"/supplies/cleaning/manage",viewAll:"/supplies/cleaning/manage"})})),g=x},17317:(e,t,n)=>{n.d(t,{A:()=>p});var i=n(9950),l=n(18464),s=n(87233),a=n(25979),o=n(90474),r=n(11088),d=n(25333),c=n(4477),u=n(68476),m=n(44414);const p=e=>{let{itemsPerPage:t=5,onItemsPerPageChange:n,disabled:p=!1,totalItems:h,page:v=1,onPageChange:x}=e;const[g,f]=(0,i.useState)(t);(0,i.useEffect)((()=>{f(t)}),[t]);const y=Number.isFinite(h)&&"function"===typeof x,A=y?Math.max(1,Math.ceil(h/g)):1,b=Math.min(Math.max(v,1),A),j=h>0?(b-1)*g+1:0,k=Math.min(b*g,h||0);return(0,m.jsxs)(l.A,{display:"flex",justifyContent:"end",alignItems:"center",p:2,className:"bg-white dark:bg-[#1A1F2C]",flexWrap:"wrap",gap:2,children:[(0,m.jsxs)(l.A,{className:"d-flex flex-center flex-justify-end",gap:1,children:[(0,m.jsx)(s.A,{variant:"body2",className:"text-[#020817] dark:text-[#94A3B8]",children:"Records Per Page:"}),(0,m.jsx)(a.A,{size:"small",variant:"outlined",children:(0,m.jsxs)(o.A,{value:g,onChange:e=>{const t=e.target.value;f(t),n&&n(t,1)},disabled:p,className:"min-w-[70px] dark:text-white",sx:{"& .MuiOutlinedInput-root":{backgroundColor:"transparent","& fieldset":{borderColor:"#E2E8F0"},"&:hover fieldset":{borderColor:"#CBD5E1"},"&.Mui-focused fieldset":{borderColor:"#3B82F6"}},"& .MuiSelect-select":{color:"inherit",padding:"8px 12px"}},children:[(0,m.jsx)(r.A,{value:5,children:"5"}),(0,m.jsx)(r.A,{value:10,children:"10"}),(0,m.jsx)(r.A,{value:15,children:"15"}),(0,m.jsx)(r.A,{value:20,children:"20"})]})}),(0,m.jsx)(s.A,{variant:"body2",className:"text-[#020817] dark:text-[#94A3B8]"})]}),y&&(0,m.jsxs)(l.A,{display:"flex",alignItems:"center",gap:1,"data-testid":"pagination-controls",children:[(0,m.jsxs)(s.A,{variant:"body2",className:"text-[#020817] dark:text-[#94A3B8]",children:[j,"\u2013",k," of ",h]}),(0,m.jsx)(d.A,{size:"small","aria-label":"Previous page",disabled:b<=1,onClick:()=>x(b-1),className:"text-[#020817] dark:text-white",sx:{"&.Mui-disabled":{color:"inherit",opacity:.3}},children:(0,m.jsx)(c.A,{fontSize:"small"})}),(0,m.jsx)(d.A,{size:"small","aria-label":"Next page",disabled:b>=A,onClick:()=>x(b+1),className:"text-[#020817] dark:text-white",sx:{"&.Mui-disabled":{color:"inherit",opacity:.3}},children:(0,m.jsx)(u.A,{fontSize:"small"})})]})]})}},21859:(e,t,n)=>{n.d(t,{A:()=>l});var i=n(9950);function l(e,t,n){const[l,s]=(0,i.useState)((()=>{try{const i=window.localStorage.getItem(e);if(null==i)return t;const l=JSON.parse(i);return"function"!==typeof n||n(l)?l:t}catch(i){return t}}));return[l,(0,i.useCallback)((t=>{s((n=>{const i="function"===typeof t?t(n):t;try{window.localStorage.setItem(e,JSON.stringify(i))}catch(l){}return i}))}),[e])]}},28144:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var i=n(89379),l=n(9950),s=n(69994),a=n(10783),o=n(17662),r=n(72823),d=n(40887),c=n(27783),u=n(48185),m=n(23693),p=n(44414);const h=(0,s.A)((e=>({root:{width:"100%",maxWidth:"36ch",backgroundColor:e.palette.background.paper}
1,inline:{display:"inline"}}))),v=l.memo((()=>{var e,t,n,s,v;h();const x=(0,l.useContext)(r.A),[g,f]=(0,l.useState)([]),[y,A]=(0,l.useState)("High"),[b,j]=(0,l.useState)([]),k="Client"===(null===x||void 0===x||null===(e=x.userProfile)||void 0===e?void 0:e.role),w="undefined"!==typeof window?localStorage.getItem("companyId"):null,C=k?w||(null===x||void 0===x||null===(t=x.userProfile)||void 0===t?void 0:t.companyId):"companyUser"===(null===x||void 0===x||null===(n=x.userProfile)||void 0===n?void 0:n.role)?null===x||void 0===x||null===(s=x.userProfile)||void 0===s?void 0:s.id:null===x||void 0===x||null===(v=x.userProfile)||void 0===v?void 0:v.companyId,N=k?(0,m.ZS)(x):null,S=(0,l.useCallback)((async()=>{try{if(k&&await(0,m.Db)(x).catch((()=>{})),k&&!N)return f([]),void j([]);const[e]=await Promise.all([new Promise(((e,t)=>(0,u.b2)(C,e,t,{clientId:k?N:null})))]),t=(null===e||void 0===e?void 0:e.filter((e=>{var t,n;return(null===e||void 0===e?void 0:e.companyId)===C&&(!k||String(null!==(t=null===e||void 0===e||null===(n=e.client)||void 0===n?void 0:n.id)&&void 0!==t?t:"")===String(N))})))||[],n=null===t||void 0===t?void 0:t.filter((e=>{var t,n;return!(null!==e&&void 0!==e&&null!==(t=e.readUser)&&void 0!==t&&t.includes(null===x||void 0===x||null===(n=x.userProfile)||void 0===n?void 0:n.id))}));j(n);const l=null===t||void 0===t?void 0:t.map((e=>{var t;return(0,i.A)((0,i.A)({},e),{},{preview:null===e||void 0===e?void 0:e.description,user:(null===e||void 0===e||null===(t=e.employee)||void 0===t?void 0:t.name)||"",time:(0,c.K6)(null===e||void 0===e?void 0:e.updatedAt)})}));f(l)}catch(e){console.error("Error loading data:",e)}}),[C,N,k,x]);(0,l.useEffect)((()=>{S()}),[S]);const D=(0,l.useMemo)((()=>{var e,t;return null===g||void 0===g||null===(e=g.filter((e=>(null===e||void 0===e?void 0:e.priority)===y&&"Closed"!==(null===e||void 0===e?void 0:e.status))))||void 0===e||null===(t=e.sort(((e,t)=>{var n,i,l,s;const a=new Date(t.createdOn)-new Date(e.createdOn);if(0!==a)return a;const o=parseInt((null===(n=e.issueNumber)||void 0===n||null===(i=n.match(/\d+/))||void 0===i?void 0:i[0])||"0",10);return parseInt((null===(l=t.issueNumber)||void 0===l||null===(s=l.match(/\d+/))||void 0===s?void 0:s[0])||"0",10)-o})))||void 0===t?void 0:t.slice(0,5)}),[g,y]);return(0,p.jsx)(d.A,{icon:(0,p.jsx)(a.A,{className:o.A.iconRed}),updates:D,title:"Team Issues",count:null===b||void 0===b?void 0:b.length,to:"/operations/issues/manage",viewAll:"/operations/issues/manage"})}))},31279:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var i=n(9950),l=n(72823),s=n(27783),a=n(40887),o=n(17662),r=n(75491),d=n(305),c=n(44414);const u=i.memo((()=>{var e,t,n,u,m,p;const h=(0,i.useContext)(l.A),[v,x]=(0,i.useState)([]),[g,f]=(0,i.useState)(0),[y,A]=(0,i.useState)([]),[b]=(0,i.useState)((()=>localStorage.getItem("clientId"))),[j]=(0,i.useState)((()=>localStorage.getItem("companyId"))),k="Client"===(null===h||void 0===h||null===(e=h.userProfile)||void 0===e?void 0:e.role)?j||(null===h||void 0===h||null===(t=h.userProfile)||void 0===t?void 0:t.companyId):"companyUser"===(null===h||void 0===h||null===(n=h.userProfile)||void 0===n?void 0:n.role)?null===h||void 0===h||null===(u=h.userProfile)||void 0===u?void 0:u.id:null===h||void 0===h||null===(m=h.userProfile)||void 0===m?void 0:m.companyId,w=b||(null===h||void 0===h||null===(p=h.userProfile)||void 0===p?void 0:p.client),C=(0,i.useCallback)((async()=>{try{(0,d.G5)(k,(async e=>{var t;const n=null===e||void 0===e?void 0:e.filter((e=>!1!==e.status)),i="Client"===(null===h||void 0===h||null===(t=h.userProfile)||void 0===t?void 0:t.role)?null===n||void 0===n?void 0:n.filter((e=>!0===(null===e||void 0===e?void 0:e.clientChannel)&&(null===e||void 0===e?void 0:e.client)===w)):n;A(i);const l=[...new Set(null===i||void 0===i?void 0:i.map((e=>e.id)))];if(!l.length)return;const a=await(0,d.oS)(l);if(null===a||void 0===a||!a.length)return;let o=0;const r=new Map;null===a||void 0===a||a.forEach((e=>{var t;const n="".concat(null===e||void 0===e?void 0:e.channelId,"_").concat(null===e||void 0===e||null===(t=e.sender)||void 0===t?void 0:t.userId),i=r.get(n);(!i||(null===i||void 0===i?void 0:i.createdOn)<(null===e||void 0===e?void 0:e.createdOn))&&r.set(n,e)}));const u=Array.from(r.values()).map((e=>{var t,n,l,a,r,d,u;const m=null===i||void 0===i?void 0:i.find((t=>t.id===e.channelId));return!Array.isArray(null===e||void 0===e?void 0:e.readBy)||null!==e&&void 0!==e&&e.readBy.includes(null===h||void 0===h||null===(t=h.userProfile)||void 0===t?void 0:t.id)||(o+=1),{user:(0,c.jsxs)(c.Fragment,{children:[null!==(n=null===e||void 0===e||null===(l=e.sender)||void 0===l?void 0:l.firstName)&&void 0!==n?n:""," ",null!==(a=null===e||void 0===e||null===(r=e.sender)||void 0===r?void 0:r.lastName)&&void 0!==a?a:"",(0,c.jsxs)("span",{className:null!==m&&void 0!==m&&m.clientChannel?"text-[#6B7280] ml-5":"ml-5",children:["(",null!==(d=null===m||void 0===m?void 0:m.groupName)&&void 0!==d?d:"",")"]})]}),time:(0,s.K6)(null===e||void 0===e?void 0:e.createdOn),preview:null!==(u=null===e||void 0===e?void 0:e.message)&&void 0!==u?u:"",id:null===m||void 0===m?void 0:m.id}}));f(o),x(null===u||void 0===u?void 0:u.slice(0,5))}))}catch(e){console.error("Error loading team messages:",e)}}),[null===h||void 0===h?void 0:h.userProfile,k,w]);return(0,i.useEffect)((()=>{C()}),[C]),(0,c.jsx)(a.A,{icon:(0,c.jsx)(r.A,{className:o.A.iconBlue}),updates:v,title:"Team Messages",count:g,to:"/communications/message-board/live-chat",viewAll:"/communications/message-board/live-chat",channels:y})}))},40887:(e,t,n)=>{n.d(t,{A:()=>v});var i=n(9950),l=n(17662),s=n(28429),a=n(42074),o=n(75491),r=n(23235),d=n(44414);const c=(0,r.A)((0,d.jsx)("path",{d:"M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25m-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12m0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5m0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2"}),"PeopleOutline"),u=(0,r.A)((0,d.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var m=n(72823),p=n(41111);const h=(0,i.memo)((e=>{let{icon:t,updates:n,title:r,count:h,to:v,viewAll:x,client:g,channels:f,showViewAll:y=!0,showArrow:A=!0,onUpdateClick:b,scrollC
1ontent:j=!1,contentMaxHeight:k="none",emptyMessage:w="Communication messages will be posted soon",isItemClickable:C=!0,loading:N=!1,showUpgradeButton:S=!1,upgradeButtonText:D="Upgrade Plan",onUpgradeClick:T}=e;const I=(0,s.Zp)(),P=(0,i.useContext)(m.A),M=(e,t)=>{if(C)if("function"!==typeof b)if("My Tickets"===r||"Team Issues"===r)I("".concat(v,"/").concat(e));else if("Team Messages"===r||"Client Messages"===r){const t=null===f||void 0===f?void 0:f.find((t=>(null===t||void 0===t?void 0:t.id)===e));null===P||void 0===P||P.setCurrentChannel(t),I(v)}else"Supply Requests"===r?(null===P||void 0===P||P.setSupplyId(e),I(v)):I(v);else b(t)};return(0,d.jsx)(d.Fragment,{children:!0===g?(0,d.jsxs)("div",{className:"".concat(l.A.card," bg-white dark:bg-[#1A1F2C] text-[#020817] dark:text-white dark:border-0 shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]"),children:[(0,d.jsx)("div",{className:"p-16",children:(0,d.jsxs)("div",{className:"d-flex flex-center flex-space-between",children:[(0,d.jsxs)("div",{className:l.A.headerLeft,children:[t,(0,d.jsx)("div",{className:"".concat(l.A.headerTitle," dark:text-white"),children:r})]}),(0,d.jsxs)("div",{className:l.A.notificationBadge,children:[h," new"]})]})}),(0,d.jsx)("div",{className:l.A.cardContent,children:(0,d.jsxs)("div",{className:"d-flex flex-direction-column flex-center mt-20 p-6 bg-[#FAF5FF] dark:bg-purple-950 rounded",style:{borderRadius:"4px"},children:[(0,d.jsx)("div",{className:"mt-35",children:(0,d.jsx)(c,{className:"text-purple-500 dark:text-purple-300",style:{fontSize:"3.1875rem"}})}),(0,d.jsx)("div",{className:"mt-10 text-[#6B21A8] dark:text-purple-200 font-semibold text-base leading-5",children:"Invite your clients to communicate"}),(0,d.jsx)("div",{className:"mt-10 mh-10 text-[#7E22CE] dark:text-purple-300 text-sm leading-5 text-center",children:"Speed up response time, centralize client feedback and improve overall client satisfaction."}),(0,d.jsx)("div",{className:"mv-15",children:(0,d.jsx)(p.$,{variant:"",onClick:()=>{I("/peoples/createClient")},className:"bg-[#9333EA] dark:bg-purple-600 hover:bg-purple-700 text-white text-[15px] rounded",children:"Invite Clients"})})]})})]}):N?(0,d.jsxs)("div",{className:"".concat(l.A.card," bg-white dark:bg-[#1A1F2C] text-[#020817] dark:text-white dark:border-0 shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]"),children:[(0,d.jsx)("div",{className:"p-16",children:(0,d.jsxs)("div",{className:"d-flex flex-center flex-space-between",children:[(0,d.jsxs)("div",{className:l.A.headerLeft,children:[t,(0,d.jsx)("div",{className:"".concat(l.A.headerTitle," dark:text-white"),children:r})]}),(0,d.jsxs)("div",{className:l.A.notificationBadge,children:[h," new"]})]})}),(0,d.jsx)("div",{className:l.A.cardContent,children:(0,d.jsx)("div",{className:"d-flex flex-direction-column flex-center py-24",children:(0,d.jsx)("div",{className:"text-[#64748B] dark:text-slate-300 text-sm",children:"Loading\u2026"})})})]}):(null===n||void 0===n?void 0:n.length)>0?(0,d.jsxs)("div",{className:"".concat(l.A.card," bg-white dark:bg-[#1A1F2C] text-[#020817] dark:text-white dark:border-0 shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]"),children:[(0,d.jsx)("div",{className:"p-16",children:(0,d.jsxs)("div",{className:"d-flex flex-center flex-space-between",children:[(0,d.jsxs)("div",{className:l.A.headerLeft,children:[t,(0,d.jsx)("div",{className:"".concat(l.A.headerTitle," dark:text-white"),children:r})]}),(0,d.jsxs)("div",{className:l.A.notificationBadge,children:[h," new"]})]})}),(0,d.jsxs)("div",{className:l.A.cardContent,style:j?{maxHeight:k,overflowY:"auto"}:void 0,children:[null===n||void 0===n?void 0:n.map(((e,t)=>(0,d.jsxs)("div",{className:l.A.updateItem,style:{cursor:C?"pointer":"default"},onClick:C?()=>M(null===e||void 0===e?void 0:e.id,e):void 0,children:[(0,d.jsxs)("div",{className:l.A.updateTop,children:[(0,d.jsxs)("span",{className:"".concat(l.A.user," dark:text-white"),children:["Team Issues"===r&&(0,d.jsxs)("span",{className:"mr-6",children:["Issue #",null===e||void 0===e?void 0:e.issueNumberInt]}),"Supply Requests"===r&&(0,d.jsxs)("span",{className:"mr-6",children:["Supply #",null===e||void 0===e?void 0:e.orderNumber]}),e.user,null!==e&&void 0!==e&&e.subText?(0,d.jsx)("span",{className:l.A.alertSubText,children:e.subText}):null]}),(0,d.jsx)("span",{className:"".concat(l.A.time," dark:text-white"),children:e.time})]}),(0,d.jsxs)("p",{className:"".concat(l.A.preview," dark:text-[#94A3B8] d-flex flex-space-between flex-center"),children:[null!==e&&void 0!==e&&e.preview?e.preview.length>50?e.preview.substring(0,50)+"...":e.preview:"",A?(0,d.jsx)("span",{style:{cursor:"pointer"},onClick:t=>{t.stopPropagation(),M(null===e||void 0===e?void 0:e.id,e)},children:(0,d.jsx)(u,{fontSize:"small"})}):null]})]},t))),y&&x?(0,d.jsx)("div",{children:(0,d.jsx)(a.N_,{to:x,className:"link text-blue-600 dar
1k:text-blue-400 underline",children:"View all"})}):null]})]}):(0,d.jsxs)("div",{className:"".concat(l.A.card," bg-white dark:bg-[#1A1F2C] text-[#020817] dark:text-white dark:border-0 shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]"),children:[(0,d.jsx)("div",{className:"p-16",children:(0,d.jsxs)("div",{className:"d-flex flex-center flex-space-between",children:[(0,d.jsxs)("div",{className:l.A.headerLeft,children:[t,(0,d.jsx)("div",{className:"".concat(l.A.headerTitle," dark:text-white"),children:r})]}),(0,d.jsxs)("div",{className:l.A.notificationBadge,children:[h," new"]})]})}),(0,d.jsx)("div",{className:l.A.cardContent,children:(0,d.jsxs)("div",{className:"d-flex flex-direction-column flex-center",style:{minHeight:"250px"},children:[(0,d.jsx)("div",{className:"mt-35",children:(0,d.jsx)(o.A,{className:"text-slate-300 dark:text-slate-400",fontSize:"large"})}),(0,d.jsx)("div",{className:"mt-10 text-[#64748B] dark:text-slate-300 text-base font-medium leading-5",children:w}),S&&(0,d.jsx)("div",{className:"mv-15",children:(0,d.jsx)(p.$,{onClick:T,className:"text-[15px] rounded bg-primary text-primary-foreground hover:bg-primary/90",children:D})})]})})]})})}));h.displayName="CommunicationsCard";const v=h},54661:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r});var i=n(9950),l=n(42074),s=n(72823),a=n(21859),o=n(44414);const r=e=>{var t;let{ShiftWorkPanel:n,OpenWorkPanel:r}=e;const d=(0,i.useContext)(s.A),[c,u]=(0,a.A)("dailySummary.activeTab.".concat((null===d||void 0===d||null===(t=d.userProfile)||void 0===t?void 0:t.id)||"user"),"shiftWork",(e=>"shiftWork"===e||"openWork"===e)),[m,p]=(0,i.useState)(null),[h,v]=(0,i.useState)(null),[x]=(0,l.ok)(),g=x.get("openWorkProject");(0,i.useEffect)((()=>{g&&u("openWork")}),[g]);const f=(e,t)=>null==t?e:"".concat(e," (").concat(t,")"),y=(0,o.jsxs)("div",{className:"tabs-list dark:bg-[#2c3440] dark:text-white",style:{marginBottom:16},children:[(0,o.jsx)("button",{type:"button",className:"tab-trigger ".concat("shiftWork"===c?"active dark:bg-[#2c3440] dark:text-white":"dark:text-white"),onClick:()=>u("shiftWork"),"data-testid":"daily-summary-tab-shift-work",children:f("Shift Work",m)}),(0,o.jsx)("button",{type:"button",className:"tab-trigger ".concat("openWork"===c?"active dark:bg-[#2c3440] dark:text-white":"dark:text-white"),onClick:()=>u("openWork"),"data-testid":"daily-summary-tab-open-work",children:f("Open Work",h)})]});return(0,o.jsxs)("div",{"data-testid":"daily-summary-tabs",children:[(0,o.jsx)("div",{style:{display:"shiftWork"===c?"block":"none"},children:(0,o.jsx)(i.Suspense,{fallback:null,children:(0,o.jsx)(n,{onCountChange:p,tabStrip:y})})}),(0,o.jsx)("div",{style:{display:"openWork"===c?"block":"none"},children:(0,o.jsx)(i.Suspense,{fallback:null,children:(0,o.jsx)(r,{onCountChange:v,tabStrip:y})})})]})}},59352:(e,t,n)=>{n.r(t),n.d(t,{default:()=>xe});var i=n(89379),l=n(1156),s=(n(66220),n(39886)),a=n(52816),o=n(32988),r=n(97226),d=n(4750),c=n(55510),u=n(18464),m=n(33722),p=n(1320),h=n(70693),v=n(15769),x=n(69780),g=n(9213),f=n(21671),y=n(34075),A=n(42074),b=n(9950),j=n(4477),k=n(68476),w=n(23235),C=n(44414);const N=(0,w.A)((0,C.jsx)("path",{d:"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V9h14zm0-12H5V5h14zM7 11h5v5H7z"}),"TodayOutlined");var S=n(14726),D=n(59051),T=n.n(D),I=n(81831),P=n(19673),M=n(95345),F=n(98179),E=n(3412),O=n(17662),B=n(38532),L=n(46639),R=n(72823),z=n(95050),W=n(35834),Y=n(17317),H=n(87810),_=n(17255),U=n(99792),V=n(51233),q=n(41277),K=n(67714),G=n(25728),Z=n(27783),J=n(73483),X=n(6397),Q=n(13217),$=n(6486);const ee=e=>{var t,n,l,o,r,d;const c=!0===e.readOnly,[u,m]=(0,b.useState)(""),[p,h]=(0,b.useState)(!1),[v,x]=(0,b.useState)(!1),g=null===(t=((e,t)=>{const n=[];for(let i in e)for(let t in e[i]){const l=e[i][t].title;"Opentasks"!==l&&n.push({value:l,label:l,data:e[i],shiftId:i})}return 0!==(null===n||void 0===n?void 0:n.length)&&"No Shift"!==t||null===n||void 0===n||n.push({value:"No Shift",label:"No Shift"}),n})(null===(n=e.appointment)||void 0===n||null===(l=n.clientDetails)||void 0===l?void 0:l.shiftData,null===e||void 0===e||null===(o=e.appointment)||void 0===o?void 0:o.shift))||void 0===t?void 0:t.filter(((e,t,n)=>t===(null===n||void 0===n?void 0:n.findIndex((t=>(null===t||void 0===t?void 0:t.value)===(null===e||void 0===e?void 0:e.value))))));if((0,b.useEffect)((()=>{m((()=>{var t,n;if(!(null!==(t=e.appointment)&&void 0!==t&&t.tasks&&Object.keys(null===(n=e.appointment)||void 0===n?void 0:n.tasks).length>0))return(0,C.jsxs)("div",{children:["----"," ",(0,C.jsx)("span",{style:{color:"red"},children:"(0 Tasks)"})]});for(let s in null===(i=e.appointment)||void 0===i?void 0:i.tasks){var i,l;return null===(l=e.appointment)||void 0===l?void 0:l.tasks[s].title}}))}),[e.appointment]),c){var f,y;let t="\u2014";if(null!==(f=e.appointment)&&void 0!==f&&f.tasks&&Object.keys(e.appointment.tasks).length>0)for(const n in e.appointment.tasks){t=e.appointment.tasks[n].title;break}else"No Shift"===(null===e||void 0===e||null===(y=e.appointment)||void 0===y?void 0:y.shift)&&(t="No Shift");return(0,C.jsx)(s.A,{variant:"body2",className:"text-[#020817] dark:text-white font-medium",children:t})}return(0,C.jsxs)(C.Fragment,{children:[p?(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(L.A,{size:20})}):(0,C.jsx)("div",{className:"clientsingleSelect mt-8",children:(0,C.jsx)(F.A,{label:"Select Shift",value:1===(null===g||void 0===g?void 0:g.length)&&"No Shift"===(null===(r=g[0])||void 0===r?void 0:r.value)?"No Shift":u,className:"field",name:"selectedShift",onChange:t=>{var n,l;null!==e&&void 0!==e&&null!==(n=e.appointment)&&void 0!==n&&n.checkInDateTime?x(!0):1===(null===g||void 0===g?void 0:g.length)&&"No Shift"===(null===(l=g[0])||void 0===l?void 0:l.value)||(async t=>{const{target:{value:n}}=t,l=null===g||void 0===g?void 0:g.find((e=>e.value===n)),s=(0,i.A)((0,i.A)({}
1,e.appointment),{},{shiftId:l.shiftId,tasks:l.data});delete s.clientDetails,delete s.id,h(!0),(0,B.y$)(e.appointment.id,s,(t=>{null===e||void 0===e||e.setShow(!1),h(!1),e.refreshData()}),(t=>{null===e||void 0===e||e.setShow(!1),h(!1),e.refreshData()})),m(n)})(t)},options:g,disabled:1===(null===g||void 0===g?void 0:g.length)&&"No Shift"===(null===(d=g[0])||void 0===d?void 0:d.value),trimShift:!0})}),v&&(0,C.jsx)(_.lG,{open:v,onClose:()=>x(!1),children:(0,C.jsxs)(_.Cf,{closeButton:!1,children:[(0,C.jsx)(_.L3,{className:"mt-5 dark:text-white border-b pb-10",children:"Shift Change Not Allowed"}),(0,C.jsx)("p",{className:"font-medium text-[16px] dark:text-white mb-10 mt-5",children:"This shift cannot be changed because work has started."}),(0,C.jsx)("div",{className:"d-flex flex-justify-center",children:(0,C.jsx)(a.A,{style:{backgroundColor:"hsl(var(--primary))",color:"white",maxWidth:"250px"},variant:"default",onClick:()=>x(!1),autoFocus:!0,children:"Close"})})]})})]})},te=e=>{let{onClick:t}=e;return(0,C.jsx)("button",{className:"reassign-icon-btn",onClick:t,title:"Reassign Employee",style:{border:"1px solid rgba(59,130,246,0.3)",cursor:"pointer",background:"rgba(59,130,246,0.08)",width:22,height:22,borderRadius:5,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.18s",color:"#3b82f6",flexShrink:0,padding:0,verticalAlign:"middle",marginLeft:5},children:(0,C.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,C.jsx)("path",{d:"M7 16V4m0 0L3 8m4-4l4 4"}),(0,C.jsx)("path",{d:"M17 8v12m0 0l4-4m-4 4l-4-4"})]})})},ne=e=>{var t,n;let{clientsList:l,show:m,toggleShow:p,saveData:h,handelDeleteTime:v,onRequestAppointmentCancel:x,getTimeZoneData:g,getStatusTag:f,getTaskListByComma:y,getTaskCount:j,getClientsSummaryData:k,setShow:w,checkInDateTime:N,checkOutDateTime:S,setCheckInDateTime:D,setCheckOutDateTime:I,durationString:P,setDurationString:M,itemsPerPage:F,page:B=1,auth:L,breakDurationString:R,setBreakDurationString:Y,openReassignPanel:H,getRescheduleMeta:U,handleReschedule:V,readOnly:q=!1,getClockInOutProps:K}=e;const[Z,J]=(0,b.useState)(!1),[ne,ie]=(0,b.useState)(null),le=null===L||void 0===L?void 0:L.setIsModalOpen,se=null===L||void 0===L?void 0:L.setSelectedAppointment,ae=(0,$.M_)(null===L||void 0===L||null===(t=L.userProfile)||void 0===t?void 0:t.calendarIconPreferences),oe=()=>{J(!1),ie(null)},[re,de]=(0,b.useState)(!1),[ce,ue]=(0,b.useState)(null),me=()=>{de(!1),ue(null)},pe=(Math.max(B,1)-1)*F;return null===l||void 0===l||null===(n=l.slice(pe,pe+F))||void 0===n?void 0:n.map((e=>{var t;const{isReschedule:n,isCancel:b}=U(e),F=(null===e||void 0===e?void 0:e.calendarTimezone)||"America/New_York",B=g(F),L=(0,E.vj)(e),$=L?L.startDate:T()(e.appointmentDateTime).parseZone(F).format("MMM DD YYYY"),pe=L?L.startTime:T()(e.appointmentDateTime).parseZone(F).format("h:mm a"),he=L?L.endDate:T()(e.appointmentDateTime).add(e.duration,"minutes").parseZone(F).format("MMM DD YYYY"),ve=L?L.endTime:T()(e.appointmentDateTime).add(e.duration,"minutes").parseZone(F).format("h:mm a");return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(u.A,{sx:{borderRadius:2,border:"1px solid",borderColor:"divider",boxShadow:1,mb:2,p:2},className:"bg-white dark:bg-[#1A1F2C] shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)] text-[#020817] dark:text-white",children:[(0,C.jsxs)(u.A,{display:"flex",justifyContent:"space-between",alignItems:"flex-start",mb:2,children:[q?(0,C.jsxs)("span",{className:"text-[#020817] dark:text-white font-semibold text-lg",style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.name,ae.linked?(0,C.jsx)(X.A,{appointment:e,appointments:l,size:16,className:"dark:text-[#E5E7EB] text-[#334155]"}):null,ae.openWork?(0,C.jsx)(Q.A,{appointment:e,size:16}):null]}):(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,C.jsx)(A.N_,{to:"/peoples/createClient/".concat(null===e||void 0===e?void 0:e.clientId),className:"text-blue-600 dark:text-blue-400 font-semibold text-lg",children:e.name}),ae.linked?(0,C.jsx)(X.A,{appointment:e,appointments:l,size:16,className:"dark:text-[#E5E7EB] text-[#334155]"}):null,ae.openWork?(0,C.jsx)(Q.A,{appointment:e,size:16}):null]}),f(e)]}),(0,C.jsxs)(o.A,{container:!0,spacing:2,className:"mb-8",children:[(0,C.jsxs)(o.A,{item:!0,xs:6,className:"flex flex-col",children:[(0,C.jsx)(s.A,{variant:"body",className:O.A.customHeader,children:"Start"}),(0,C.jsx)(s.A,{variant:"body",className:"text-base font-medium text-[#020817] dark:text-white mt-1",children:"-"===pe?"
1-":"".concat(pe," ").concat((null===B||void 0===B?void 0:B.abbr)||"").trim()}),(0,C.jsx)(s.A,{variant:"body",className:O.A.customHeader,children:$})]}),(0,C.jsxs)(o.A,{item:!0,xs:6,className:"flex flex-col",children:[(0,C.jsx)(s.A,{variant:"body",className:O.A.customHeader,children:"End"}),(0,C.jsx)(s.A,{variant:"body",className:"text-base font-medium text-[#020817] dark:text-white mt-1",children:"-"===ve?"-":"".concat(ve," ").concat((null===B||void 0===B?void 0:B.abbr)||"").trim()}),(0,C.jsx)(s.A,{variant:"body",className:O.A.customHeader,children:he})]})]}),(0,C.jsxs)(u.A,{mb:2,children:[(0,C.jsx)(s.A,{variant:"body",className:O.A.customHeader,children:"Shift"}),(0,C.jsx)(ee,{appointment:e,refreshData:k,isEdit:m[e.id],setShow:w,readOnly:q})]}),(0,C.jsxs)(u.A,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,C.jsxs)(s.A,{variant:"body",className:O.A.customHeader2,style:{display:"flex",alignItems:"center",gap:0},children:["Employee:"," ",q?(0,C.jsx)("span",{className:"text-[#020817] dark:text-white ml-4",children:e.calendar}):(0,C.jsx)(A.N_,{to:"/peoples/createEmp/".concat(null===e||void 0===e?void 0:e.userId),className:"text-blue-600 dark:text-blue-400 ml-4",children:e.calendar}),!q&&(0,C.jsx)(te,{onClick:t=>H(t,e)})]}),(0,C.jsx)(r.A,{size:"small",onClick:()=>p(e.id),children:m[e.id]?(0,C.jsx)(z.A,{className:"text-black dark:text-white"}):(0,C.jsx)(W.A,{className:"text-black dark:text-white"})})]}),(0,C.jsx)(d.A,{in:m[e.id],timeout:"auto",unmountOnExit:!0,children:(0,C.jsxs)(u.A,{mt:2,pt:2,className:"border-t border-gray-200 dark:border-gray-700",children:[(0,C.jsxs)(o.A,{container:!0,spacing:2,children:[(0,C.jsxs)(o.A,{item:!0,xs:12,children:[(0,C.jsx)(s.A,{variant:"body",className:"".concat(O.A.apptDetailSectionTitle," text-[#334155] dark:text-[#E2E8F0]"),children:"Clock Times"}),m[null===e||void 0===e?void 0:e.id]?(0,C.jsx)(G.Q,(0,i.A)((0,i.A)({},"function"===typeof K?K(e):{cellData:e}),{},{show:m[null===e||void 0===e?void 0:e.id],checkInDateTime:N,setCheckInDateTime:D,checkOutDateTime:S,setCheckOutDateTime:I,setDurationString:M,durationString:P,breakDurationString:R,setBreakDurationString:Y,readOnly:q}),"".concat(e.id,"-").concat(("function"===typeof K?null===(t=K(e))||void 0===t?void 0:t.selectedEmployeeId:"")||"")):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("div",{children:"In: ----"}),(0,C.jsx)("div",{children:"Out: ----"})]})]}),(0,C.jsx)(s.A,{variant:"body",className:"pl-2 pt-3 ".concat(O.A.apptDetailSectionTitle," text-[#020817] dark:text-white"),children:"Tasks"}),(0,C.jsxs)(o.A,{xs:12,className:"flex mt-1 pl-2",children:[(0,C.jsxs)(o.A,{item:!0,xs:6,className:"flex flex-col",children:[(0,C.jsx)(s.A,{variant:"body",className:"".concat(O.A.apptDetailTaskLabel," dark:text-[#CBD5E1]"),children:"Assigned:"}),(0,C.jsx)(s.A,{onClick:()=>(e=>{ie(e),J(!0)})(e),className:"mt-2 ml-2 text-base font-bold text-[#020817] dark:text-white cursor-pointer",children:j(e,!0)})]}),(0,C.jsxs)(o.A,{item:!0,xs:6,className:"flex flex-col",children:[(0,C.jsx)(s.A,{variant:"body",className:"".concat(O.A.apptDetailTaskLabel," dark:text-[#CBD5E1]"),children:"Completed:"}),(0,C.jsx)(s.A,{onClick:()=>(e=>{ue(e),de(!0)})(e),className:"mt-2 ml-2 text-base font-bold text-[#020817] dark:text-white cursor-pointer",children:j(e,!1)})]})]})]}),(0,C.jsxs)(u.A,{mt:2,className:O.A.apptDetailsSection,children:[(0,C.jsx)(s.A,{variant:"body",component:"h3",className:"".concat(O.A.apptDetailsHeading," dark:text-[#F1F5F9]"),children:"Appointment Details"}),(0,C.jsxs)(u.A,{className:O.A.apptDetailsActionsRow,children:[(0,C.jsx)("button",{type:"button",onClick:()=>{se(e),le(!0)},className:"".concat(O.A.apptDetailsAction," ").concat(O.A.apptDetailsActionViewMore),children:"View More"}),!q&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("button",{type:"button",onClick:()=>V(e),disabled:!n,className:"".concat(O.A.apptDetailsAction," ").concat(O.A.apptDetailsActionReschedule," ").concat(n?"":O.A.apptDetailsActionDisabled),children:"Reschedule"}),"function"===typeof x&&(0,C.jsx)("button",{type:"button",disabled:!b,className:"".concat(O.A.apptDetailsAction," ").concat(O.A.apptDetailsActionCancel," ").concat(b?"":O.A.apptDetailsActionDisabled),onClick:t=>{var n;t.preventDefault(),t.stopPropagation(),b&&(null===x||void 0===x||x(e,(null===(n=U(e))||void 0===n?void 0:n.matchingAppointments)||[]))},children:"Cancel"})]})]})]}),!q&&(0,C.jsx)(u.A,{display:"flex",alignItems:"flex-start",justifyContent:"flex-end",mt:2,gap:1,className:"w-100",children:(0,C.jsxs)("div",{className:"d-flex w-100 gap-8 justify-content-end",children:[(0,C.jsx)(a.A,{size:"small",variant:"contained",className:"saveButton text-white dark:bg-[#078037] dark:text-white ".concat(O.A.apptDetailActionBtn),style:{flex:1,minWidth:"62px",maxWidth:"120px"},type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),h(e)},children:"Save"}),(0,C.jsx)(a.A,{className:"dark:text-white ".concat(O.A.apptDetailActionBtn),size:"small",variant:"outlined",style:{flex:1,minWidth:"68px",maxWidth:"120px"},type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),v(e)},children:"Reset"})]})})]})})]},e.id),Z&&(0,C.jsx)(_.lG,{open:Z,onClose:oe,fullWidth:!0,maxWidth:"sm",children:(0,C.jsxs)(_.Cf,{className:"mt-3 bg-white dark:bg-[#2c3440] dark:text-white",children:[(0,C.jsx)(s.A,{variant:"body",className:"mt-5 text-xl font-bold text-[#020817] dark:text-white",children:"Tasks Assigned"}),(0,C.jsx)(c.A,{}),ne&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s.A,{variant:"body",className:"text-base font-semibold mb-8 dark:text-white",children:"Regular Task"}),(0,C.jsx)(s.A,{variant:"body",className:"text-sm text-gray-600 dark:text-white",children:y(ne)}),(0,C.jsx)(s.A,{variant:"body",className:"mt-4 text-base font-semibold mb-8 dark:text-white",children:"Open Task"}),(0,C.jsx)(s.A,{variant:"body",className:"text-sm text-gray-600 dark:text-white",children:y(ne,1)})]}),(0,C.jsx)("div",{className:"justify-center mb-5",children:(0,C.jsx)(a.A,{variant:"contained",onClick:oe,className:"bg-green-700 text-white rounded-lg px-6 py-2",children:"Close"})})]})}),re&&(0,C.jsx)(_.lG,{open:re,onClose:me,fullWidth:!0,maxWidth:"sm",children:(0,C.jsxs)(_.Cf,{className:"mt-12 bg-white dark:bg-[#2c3440] text-[#020817] dark:text-white",children:[(0,C.jsx)(s.A,{variant:"body",className:"mt-5 text-xl font-bold text-[#020817] dark:text-white",children:"Tasks Assigned"}),(0,C.jsx)(c.A,{}),ce&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s.A,{variant:"body",className:"text-base font-semibold mb-8 dark:text-white",children:"Completed Task"}),(0,C.jsx)(s.A,{variant:"body",className:"text-sm text-gray-600 dark:text-white",children:y(ne,2)})]}),(0,C.jsx)("div",{className:"justify-center mb-5",children:(0,C.jsx)(a.A,{variant:"contained",onClick:me,className:"bg-green-700 text-white rounded-lg px-6 py-2",children:"Close"})})]})})]})}))},ie=e=>{let{badge:t,title:n,description:i,helperText:a,variant:o="schedule"}=e;return(0,C.jsx)(u.A,{sx:{minHeight:{xs:230,md:290},display:"flex",alignItems:"center",justifyContent:"center",px:{xs:1.5,sm:2.5,md:3},py:{xs:2.5,md:4}},children:(0,C.jsx)(u.A,{className:"bg-[#F8FAFC] dark:bg-[#0F172A] dark:border-[#1E293B]",sx:{width:"100%",maxWidth:840,borderRadius:{xs:"14px",md:"18px"},px:{xs:2.5,sm:4,md:5},py:{xs:3.5,sm:4.25,md:4.75}},children:(0,C.jsxs)(u.A,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",gap:1.5},children:[(0,C.jsx)(u.A,{sx:{width:{xs:50,md:58},height:{xs:50,md:58},borderRadius:"999px",backgroundColor:"rgba(251, 146, 60, 0.14)",color:"#EA580C",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,C.jsx)(l.A,{fontSize:"small"})}
1),(0,C.jsx)(u.A,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",px:1.5,py:.5,borderRadius:"999px",fontSize:{xs:"0.66rem",md:"0.7rem"},fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:"#C2410C",backgroundColor:"rgba(255, 237, 213, 0.95)"},className:"dark:text-orange-100 dark:bg-[#431407]",children:t}),(0,C.jsx)(s.A,{variant:"h6",className:"text-[#020817] dark:text-white",sx:{fontWeight:600,fontSize:{xs:"1.06rem",sm:"1.22rem",md:"1.34rem"},lineHeight:1.35,letterSpacing:"-0.01em",mt:.35},children:n}),(0,C.jsx)(s.A,{variant:"body2",className:"text-[#475569] dark:text-[#CBD5E1]",sx:{fontSize:{xs:"0.92rem",md:"0.97rem"},lineHeight:1.62,fontWeight:450,maxWidth:520},children:i}),a?(0,C.jsx)(s.A,{variant:"body2",sx:{fontSize:{xs:"0.9rem",md:"0.94rem"},lineHeight:1.55,fontWeight:500,maxWidth:560,mt:.65},children:(0,C.jsx)(u.A,{component:"span",sx:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",justifyContent:"center",gap:.75,px:{xs:1.1,md:1.4},py:{xs:.7,md:.8},borderRadius:"999px",border:"1px solid rgba(251, 146, 60, 0.24)",backgroundColor:"rgba(251, 146, 60, 0.08)",color:"#C2410C"},className:"dark:bg-[rgba(154,52,18,0.15)] dark:border-[rgba(194,65,12,0.35)] dark:text-orange-200",children:a})}):null]})})})},le=function(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},se={"#cc1716":50,"#ff7e00":40,"#f9bc0a":30,"#078037":10},ae=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#078037",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=Math.max(1,Number(t)||1),i=n>99?"99+":String(n),l=i.length>2?10:i.length>1?12:14,s=1===n?'<circle cx="22" cy="21" r="7" fill="white"/>\n <path d="M12 36C13.8 30.6 17.2 28 22 28C26.8 28 30.2 30.6 32 36" fill="white"/>':'<circle cx="22" cy="23" r="12" fill="white"/>\n <text x="22" y="24" text-anchor="middle" dominant-baseline="central" font-family="Arial, Helvetica, sans-serif" font-size="'.concat(l,'" font-weight="700" fill="').concat(e,'">').concat(i,"</text>"),a='\n <svg width="44" height="56" viewBox="0 0 44 56" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M22 55C18 48 6 38 6 24C6 13.5 13.5 5 22 5C30.5 5 38 13.5 38 24C38 38 26 48 22 55Z" fill="'.concat(e,'" stroke="white" stroke-width="2"/>\n ').concat(s,"\n </svg>\n ");return"data:image/svg+xml;charset=UTF-8,".concat(encodeURIComponent(a))},oe=[{elementType:"geometry",stylers:[{color:"#0f172a"}]},{elementType:"labels.text.stroke",stylers:[{color:"#0f172a"}]},{elementType:"labels.text.fill",stylers:[{color:"#94a3b8"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#1e293b"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#cbd5e1"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#1d4ed8"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#111827"}]},{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#94a3b8"}]}],re=new window.Map,de=e=>"".concat(e||"").trim().toLowerCase().replace(/\s+/g," "),ce=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(t.length<=1){const e=t[0]||{};return'\n <div class="map-pin-iw-content" style="padding: 0; margin: 0; max-width: 184px; font-family: Arial, sans-serif; line-height: 1.18;">\n <div style="font-size: 10px; font-weight: 700; color: #0f172a; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">\n '.concat(le(e.employeeName),'\n </div>\n <div style="font-size: 9px; color: #334155; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">\n ').concat(le(e.clientName),'\n </div>\n <div style="font-size: 9px; color: ').concat(le(e.statusColor),'; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">\n ').concat(le(e.statusLabel),'\n </div>\n <div style="font-size: 8px; color: #475569;">\n ').concat(le(e.startLabel),": ").concat(le(e.startText),"\n </div>\n ").concat(e.endText?'<div style="font-size: 8px; color: #475569;">'.concat(le(e.endLabel),": ").concat(le(e.endText),"</div>"):"",'\n <div style="font-size: 8px; color: #64748b;
1 margin-top: 1px; margin-bottom: 4px;">\n Scheduled: ').concat(le(e.scheduledStartText)," - ").concat(le(e.scheduledEndText),"\n </div>\n </div>\n ")}const n=(null===(e=t[0])||void 0===e?void 0:e.clientName)||"Site",i=t.map((e=>'\n <div style="display:flex; align-items:flex-start; justify-content:space-between; gap:8px; padding:7px 0; border-bottom:1px solid #E2E8F0;">\n <div style="min-width:0;">\n <div style="font-size:11px; font-weight:600; color:#0f172a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">\n '.concat(le(e.employeeName),'\n </div>\n <div style="font-size:9px; color:#64748b; margin-top:1px;">\n ').concat(le(e.startLabel),": ").concat(le(e.startText),'\n </div>\n </div>\n <div style="font-size:10px; font-weight:700; color:').concat(le(e.statusColor),'; white-space:nowrap;">\n ').concat(le(e.statusLabel),"\n </div>\n </div>\n "))).join("");return'\n <div class="map-pin-iw-content" style="padding: 0; margin: 0; width: 240px; font-family: Arial, sans-serif; line-height: 1.2;">\n <div style="font-size: 12px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">\n '.concat(le(n),'\n </div>\n <div style="font-size: 10px; color: #64748b; margin: 2px 0 6px;">\n ').concat(t.length,' team members at this site\n </div>\n <div style="max-height: 220px; overflow-y: auto;">\n ').concat(i,"\n </div>\n </div>\n ")},ue="map-pin-infowindow-style",me=e=>{let{pins:t,isDarkMode:n}=e;const l=(0,S.ko)();return(0,b.useEffect)((()=>{var e,s;if(!l||null===(e=window)||void 0===e||null===(s=e.google)||void 0===s||!s.maps)return;if(l.setOptions({styles:n?oe:null}),!document.getElementById(ue)){const e=document.createElement("style");e.id=ue,e.innerHTML="\n .gm-style .gm-style-iw-c {\n padding: 8px 10px 8px 8px !important;\n border-radius: 10px !important;\n }\n .gm-style .gm-style-iw-d {\n overflow: auto !important;\n }\n .gm-style .gm-ui-hover-effect {\n top: 2px !important;\n right: 2px !important;\n width: 20px !important;\n height: 20px !important;\n opacity: 0.75 !important;\n border-radius: 999px !important;\n background: rgba(15, 23, 42, 0.06) !important;\n }\n .gm-style .gm-ui-hover-effect:hover {\n opacity: 1 !important;\n background: rgba(22, 163, 74, 0.14) !important;\n }\n .gm-style .gm-ui-hover-effect > span {\n width: 12px !important;\n height: 12px !important;\n margin: 4px !important;\n filter: invert(32%) sepia(67%) saturate(1298%) hue-rotate(96deg) brightness(91%) contrast(86%);\n }\n",document.head.appendChild(e)}let a=!1;const o=[],r=new window.google.maps.LatLngBounds,d=new window.google.maps.Geocoder,c=new window.Map,u=e=>{const t=de(e);if(!t)return Promise.resolve(null);if(c.has(t))return c.get(t);const n=((e,t)=>{const n=de(t);return n?re.has(n)?Promise.resolve(re.get(n)):new Promise((i=>{const l=s=>{e.geocode({address:t},((e,t)=>{var a,o;if("OK"===t&&null!==e&&void 0!==e&&null!==(a=e[0])&&void 0!==a&&null!==(o=a.geometry)&&void 0!==o&&o.location){const t=e[0].geometry.location,l={lat:t.lat(),lng:t.lng()};return re.set(n,l),void i(l)}("OVER_QUERY_LIMIT"===t||"UNKNOWN_ERROR"===t)&&s>0?window.setTimeout((()=>l(s-1)),400):("ZERO_RESULTS"!==t&&"INVALID_REQUEST"!==t||re.set(n,null),i(null))}))};l(3)})):Promise.resolve(null)})(d,e);return c.set(t,n),n};return Promise.all((t||[]).map((async e=>{const t=Number(null===e||void 0===e?void 0:e.lat),n=Number(null===e||void 0===e?void 0:e.lng);if(Number.isFinite(t)&&Number.isFinite(n))return{pin:e,position:{lat:t,lng:n}};if(null===e||void 0===e||!e.addressText)return{pin:e,position:null};return{pin:e,position:await u(e.addressText)}}))).then((e=>{if(a)return;const t=(e=>{const t=new window.Map;return(e||[]).forEach((e=>{var n;if(null===e||void 0===e||!e.position)return;const l=Number(e.position.lat),s=Number(e.position.lng);if(!Number.isFinite(l)||!Number.isFinite(s))return;const a=de(null===e||void 0===e||null===(n=e.pin)||void 0===n?void 0:n.addressText)||"".concat(l.toFixed(4),":").concat(s.toFixed(4));t.has(a)||t.set(a,[]),t.get(a).push((0,i.A)((0,i.A)({},e),{},{position:{lat:l,lng:s}}
1))})),Array.from(t.values()).map((e=>({position:e[0].position,pins:e.map((e=>e.pin))})))})(e);if(t.forEach(((e,t)=>{var n;let{pins:i,position:s}=e;const a=i.length,d=function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=(null===(e=t[0])||void 0===e?void 0:e.statusColor)||"#078037",i=-1;return t.forEach((e=>{const t=se[String((null===e||void 0===e?void 0:e.statusColor)||"").toLowerCase()]||0;t>i&&(i=t,n=(null===e||void 0===e?void 0:e.statusColor)||n)})),n}(i),c=1===a?"".concat(i[0].employeeName," - ").concat(i[0].clientName):"".concat(a," team members at ").concat((null===(n=i[0])||void 0===n?void 0:n.clientName)||"this site"),u=new window.google.maps.Marker({map:l,position:s,title:c,zIndex:t+1,icon:{url:ae(d,a),scaledSize:new window.google.maps.Size(44,56),anchor:new window.google.maps.Point(22,56)}}),m=new window.google.maps.InfoWindow({content:ce(i)}),p=[];1===a&&(p.push(u.addListener("mouseover",(()=>m.open({anchor:u,map:l,shouldFocus:!1})))),p.push(u.addListener("mouseout",(()=>m.close())))),p.push(u.addListener("click",(()=>m.open({anchor:u,map:l,shouldFocus:!1})))),p.push(m.addListener("domready",(()=>{const e=document.querySelector(".map-pin-iw-content"),t=null===e||void 0===e?void 0:e.closest(".gm-style-iw-c");t&&(t.style.paddingLeft="4px")}))),o.push({marker:u,infoWindow:m,listeners:p}),r.extend(s)})),1===t.length){var n;const e=null===(n=t[0])||void 0===n?void 0:n.position;l.setCenter(e),l.setZoom(14)}else t.length>1&&l.fitBounds(r,{top:60,right:60,bottom:60,left:60})})),()=>{a=!0,o.forEach((e=>{let{marker:t,infoWindow:n,listeners:i}=e;i.forEach((e=>{var t;return null===e||void 0===e||null===(t=e.remove)||void 0===t?void 0:t.call(e)})),n.close(),t.setMap(null)}))}}),[l,t,n]),null},pe=e=>{let{pins:t,isMobile:n,openReassignPanel:i,filterDate:l,allowReassign:a=!0}=e;const o=(null===t||void 0===t?void 0:t.length)>0,r=(0,b.useMemo)((()=>{const e=(t||[]).find((e=>{const t=Number(null===e||void 0===e?void 0:e.lat),n=Number(null===e||void 0===e?void 0:e.lng);return Number.isFinite(t)&&Number.isFinite(n)}));return{lat:(null===e||void 0===e?void 0:e.lat)||39.5,lng:(null===e||void 0===e?void 0:e.lng)||-98.35}}),[t]),[d,c]=(0,b.useState)((()=>{var e,t,n;return"undefined"!==typeof window&&(null===(e=document)||void 0===e||null===(t=e.documentElement)||void 0===t||null===(n=t.classList)||void 0===n?void 0:n.contains("dark"))}));return(0,b.useEffect)((()=>{if("undefined"===typeof window)return;const e=document.documentElement,t=()=>{const t=e.classList.contains("dark");c(t)};t();const n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>{n.disconnect()}}),[]),o?(0,C.jsxs)(u.A,{sx:{display:"grid",gridTemplateColumns:n?"1fr":"minmax(0, 2fr) minmax(260px, 1fr)",gap:2,p:n?1:2,width:"100%",overflowX:"hidden"},children:[(0,C.jsx)(u.A,{sx:{height:n?360:540,borderRadius:"12px",overflow:"hidden",border:"1px solid #E2E8F0"},className:"dark:border-[#334155]",children:(0,C.jsx)(S.c4,{apiKey:"AIzaSyCQu0ku4myhKsSAsQ5BX6vseHJ9bPCyAvc",children:(0,C.jsx)(S.T5,{mapId:d?void 0:"bf51a910020fa25a",defaultCenter:r,defaultZoom:4,streetViewControl:!1,mapTypeControl:!1,fullscreenControl:!n,style:{width:"100%",height:"100%"},gestureHandling:"greedy",children:(0,C.jsx)(me,{pins:t,isDarkMode:d})})})}),(0,C.jsxs)(u.A,{sx:{maxHeight:n?"none":540,overflowY:"auto",border:"1px solid #E2E8F0",borderRadius:"12px",p:1.5,backgroundColor:"#FFFFFF"},className:"dark:bg-[#111827] dark:border-[#334155]",children:[(0,C.jsxs)(s.A,{variant:"body2",className:"text-[#0F172A] dark:text-white",style:{fontWeight:600,marginBottom:"10px"},children:["Team Status (",t.length,")"]}),t.map((e=>(0,C.jsxs)(u.A,{sx:{p:1,mb:.75,borderRadius:"10px",border:"1px solid #E2E8F0",backgroundColor:"#F8FAFC"},className:"dark:bg-[#1F2937] dark:border-[#374151]",children:[(0,C.jsxs)(u.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[(0,C.jsx)(s.A,{variant:"body2",className:"text-[#020817] dark:text-white",style:{fontWeight:600,lineHeight:1.2},children:e.employeeName}),a&&(0,C.jsx)(te,{onClick:t=>i(t,e.appointment)})]}),(0,C.jsx)(s.A,{variant:"caption",className:"text-[#475569] dark:text-[#CBD5E1]",style:{lineHeight:1.2},children:e.clientName}),(0,C.jsx)(s.A,{variant:"body2",style:{color:e.statusColor,fontWeight:600,marginTop:"2px",lineHeight:1.2},children:e.statusLabel}),(0,C.jsxs)(s.A,{variant:"caption",className:"text-[#64748B] dark:text-[#94A3B8]",style:{display:"block",marginTop:"4px",lineHeight:1.2},children:[e.startLabel,": ",e.startText]}),e.endText?(0,C.jsxs)(s.A,{variant:"caption",className:"text-[#64748B] dark:text-[#94A3B8]",style:{display:"block",lineHeight:1.2},children:[e.endLabel,": ",e.endText]}):null,(0,C.jsxs)(s.A,{variant:"caption",className:"text-[#64748B] dark:text-[#94A3B8]",style:{display:"block",lineHeight:1.2},children:["Scheduled: ",e.scheduledStartText," - ",e.scheduledEndText]})]},e.id)))]})]}):(0,C.jsx)(ie,{variant:"gapDay",badge:"No Map Pins",title:"No mappable locations for ".concat(l),description:"Appointments exist, but no GPS/location data is available to place employees on the map.",helperText:"Switch to List View to review full appointment details."})},he=b.memo((function(e){var t,n,i,d,c,w,S,D,F,B,L,z,W;let{onCountChange:_,tabStrip:U=null}=e;const G=(0,b.useContext)(R.A),[X,Q]=(0,b.useState)(!1),[$,ee]=(0,b.useState)({open:!1,appointment:null,matchingAppointments:[]}),te=(0,b.useCallback)((function(e){ee({open:!0,appointment:e,matchingAppointments:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})}),[]),le=(0,b.useCallback)((()=>{ee({open:!1,appointment:null,matchingAppointments:[]})}),[]),se=(0,b.useCallback)((()=>{const{appointment:e,matchingAppointments:t}=$;e&&(null===G||void 0===G||G.setEditAppointmentData({selectedAppointment:e}),null===G||void 0===G||G.setUpdateAppointmentData({matchingAppointments:t||[]}),Q(!0),le())}
1),[$,G,le]),{sort:ae,filterDate:oe,hasAnyAppointmentsInRange:re,clientsList:de,isLoading:ce,isSummaryLoading:ue,setIsLoading:me,handleDateChange:he,handleFilterDatePickerChange:xe,renderRow:ge,setShow:fe,show:ye,getClientsSummaryData:Ae,getTimeZoneData:be,getStatusTag:je,getTaskListByComma:ke,getTaskCount:we,toggleShow:Ce,getClockInOutProps:Ne,changeDate:Se,jumpToToday:De,itemsPerPage:Te,setItemsPerPage:Ie,page:Pe,setPage:Me,employee:Fe,clients:Ee,appointments:Oe,deleteDialog:Be,setDeleteDialog:Le,handelConfirmDeleteTime:Re,setUpdateDialog:ze,updateDialog:We,handleConfirmUpdateTime:Ye,checkInDateTime:He,setCheckInDateTime:_e,checkOutDateTime:Ue,setCheckOutDateTime:Ve,breakDurationString:qe,setBreakDurationString:Ke,reassignState:Ge,setReassignState:Ze,reassignEmployees:Je,openReassignPanel:Xe,confirmReassign:Qe,ReassignFloatingPanel:$e,getRescheduleMeta:et,handleReschedule:tt,showRecurringDialog:nt,showSomeDialog:it,showLinkedRescheduleDialog:lt,recurringOption:st,setRecurringOption:at,selectedRescheduleAppointment:ot,handleConfirmRescheduleStep1:rt,handleConfirmRescheduleStep2:dt,handleLinkedRescheduleConfirm:ct,handleBackFromLinkedReschedule:ut,resetRescheduleDialogState:mt,RescheduleDialogStep1:pt,RescheduleDialogStep2:ht,RescheduleLinkedDialog:vt,createAppointmentSchedulePath:xt,appointmentWindowHydrated:gt,mapViewPins:ft,showReassignUpgradeDialog:yt,closeReassignUpgradeDialog:At,goToReassignUpgrade:bt}=(0,E.Ay)(!0,{onRequestAppointmentCancel:te});(0,b.useEffect)((()=>{"function"===typeof _&&_((null===de||void 0===de?void 0:de.length)||0)}),[de,_]);const[jt,kt]=(0,b.useState)(!1),wt=(0,m.A)("(max-width:767px)"),Ct=(0,m.A)("(min-width: 771px) and (max-width: 940px)"),[Nt,St]=("companyUser"===(null===G||void 0===G||null===(t=G.userProfile)||void 0===t?void 0:t.role)?null===G||void 0===G||null===(n=G.userProfile)||void 0===n||n.id:null===G||void 0===G||null===(i=G.userProfile)||void 0===i||i.companyId,(0,b.useState)(null)),[Dt,Tt]=(0,b.useState)("list"),[It,Pt]=(0,b.useState)("\u2014"),[Mt,Ft]=(0,b.useState)(!1),Et=G.isModalOpen,Ot=G.setIsModalOpen,Bt=G.selectedAppointment,Lt=(G.setSelectedAppointment,null===G||void 0===G||null===(d=G.editAppointmentData)||void 0===d?void 0:d.selectedAppointment),Rt=null===(c=G.updateAppointmentData)||void 0===c?void 0:c.matchingAppointments,{toast:zt}=(0,K.d)(),Wt=Array.isArray(null===G||void 0===G||null===(w=G.userProfile)||void 0===w?void 0:w.role)?G.userProfile.role.includes("Client"):"Client"===(null===G||void 0===G||null===(S=G.userProfile)||void 0===S?void 0:S.role),Yt=0===(null===de||void 0===de?void 0:de.length),Ht=(null===G||void 0===G||null===(D=G.userProfile)||void 0===D?void 0:D.planAccess)||(null===G||void 0===G||null===(F=G.userProfile)||void 0===F?void 0:F.plansAccess)||(null===G||void 0===G||null===(B=G.userProfile)||void 0===B?void 0:B.planaccess),_t=String((null===Ht||void 0===Ht||null===(L=Ht.features)||void 0===L||null===(z=L.dashboard)||void 0===z?void 0:z.daily_summary)||"").toLowerCase(),Ut=(0,Z.jI)(Ht,"dashboard.daily_summary")&&"list"!==_t&&"none"!==_t,Vt=gt&&Yt&&!re,qt="map"===Dt&&!Ut,Kt=T()(oe).format("MMMM D, YYYY"),Gt=T()().add(-365,"days").format("YYYY-MM-DD"),Zt=T()().add(15,"days").format("YYYY-MM-DD"),Jt=(0,b.useMemo)((()=>{const e=T()(oe,"YYYY-MM-DD",!0);return e.isValid()?e.clone():T()().startOf("day")}),[oe]),Xt=(0,b.useMemo)((()=>({min:T()(Gt,"YYYY-MM-DD"),max:T()(Zt,"YYYY-MM-DD")})),[Gt,Zt]),Qt=T()(oe).isSame(T()(),"day"),$t=T()().format("D"),en=oe>Gt,tn=oe<Zt,nn=(0,C.jsx)(ie,{variant:"map"===Dt?"gapDay":"schedule",badge:"map"===Dt?"No Map Pins":"No Appt",title:Vt?"map"===Dt?"No appointments to map":"No appointments scheduled yet":"map"===Dt?"No map data for ".concat(Kt):"No appointments on ".concat(Kt),description:"map"===Dt?"This date does not have any scheduled appointments to display on the map.":"This date does not have any scheduled appointments.",helperText:"map"===Dt?(0,C.jsxs)(C.Fragment,{children:["Switch to"," ",(0,C.jsx)("span",{className:"text-[#C2410C] dark:text-orange-400 font-semibold cursor-pointer underline hover:text-orange-700 dark:hover:text-orange-300 decoration-orange-300 dark:decoration-orange-600",onClick:()=>Tt("list"),children:"List View"})," ","for full details."]}):Wt?"Contact your service provider to schedule visits.":(0,C.jsxs)(C.Fragment,{children:["Let's schedule your next appointment"," ",(0,C.jsx)(A.N_,{to:xt,className:"inline-flex items-center rounded-full px-2 py-1 text-[0.82rem] font-semibold leading-none no-underline text-white hover:!text-white bg-[#C2410C] hover:bg-[#9A3412]",children:"Schedule now"})]})}),ln=(0,C.jsx)(u.A,{sx:{minHeight:{xs:230,md:290}},"aria-busy":"true","data-testid":"daily-summary-loading"}),sn=(0,C.jsx)(ie,{variant:"gapDay",badge:"Upgrade Required",title:(0,J.IV)("map view"),description:"Upgrade your plan to unlock map-based daily summary and location insights.",helperText:Wt?"Please contact your service provider to enable map access.":(0,C.jsx)(A.N_,{to:"/account/upgrade",className:"inline-flex items-center rounded-full px-3 py-1 text-[0.82rem] font-semibold leading-none no-underline text-white hover:!text-white bg-[#C2410C] hover:bg-[#9A3412]",children:"Upgrade plan"})}),an=async e=>{var t;Ie(e);const n=null===G||void 0===G||null===(t=G.userProfile)||void 0===t?void 0:t.id;(0,H.sC)(n,e),await Ae(!1,e)};(0,b.useEffect)((()=>{var e;null!==G&&void 0!==G&&null!==(e=G.userProfile)&&void 0!==e&&e.preference&&Ie(G.userProfile.preference)}),[]);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(o.A,{container:!0,alignItems:"center",spacing:2,className:"mb-10",children:[(0,C.jsx)(o.A,{item:!0,xs:12,sm:12,lg:6,className:"d-flex flex-center flex-space-between",children:(0,C.jsxs)(s.A,{variant:"h6",className:"text-gray-900 dark:text-white",style:{fontSize:"20px",lineHeight:"28px",fontWeight:"600"},children:[(0,C.jsx)(l.A,{className:"color-lightGreen mr-10 svg-icon"}),"Daily Summary"]})}),(0,C.jsx)(o.A,{item:!0,xs:12,sm:12,lg:6,"data-tour":"date-navigation",children:(0,C.jsxs)(u.A,{className:wt||Ct?"groupsearch":"groupsearch float-right",sx:{dis
1play:"flex",alignItems:"center",justifyContent:wt||Ct?"stretch":"flex-end",flexDirection:wt?"column":"row",gap:wt?1:0,width:"100%"},children:[(0,C.jsxs)(u.A,{className:"mr-10 dark:bg-[#0F172A] dark:border-[#334155]",sx:{p:"4px",borderRadius:"999px",display:"inline-flex",alignItems:"center",gap:"4px",border:"1px solid",borderColor:"rgba(148,163,184,0.35)",backgroundColor:"#F1F5F9",width:wt?"100%":"auto",maxWidth:wt?"250px":"none",mr:wt?0:"10px"},children:[(0,C.jsx)(a.A,{className:"list"===Dt?"":"text-[#475569] dark:text-[#94A3B8]",size:"small",variant:"text",onClick:()=>Tt("list"),style:{textTransform:"none",minWidth:wt?"96px":"118px",borderRadius:"999px",padding:"6px 14px",fontWeight:600,border:"1px solid transparent",transition:"all 180ms ease",backgroundColor:"list"===Dt?"hsl(var(--primary))":"transparent",color:"list"===Dt?"#FFFFFF":void 0,boxShadow:"none"},children:"List View"}),(0,C.jsx)(a.A,{className:"map"===Dt?"":"text-[#475569] dark:text-[#94A3B8]",size:"small",variant:"text",onClick:()=>{Tt("map")},style:{textTransform:"none",minWidth:wt?"96px":"118px",borderRadius:"999px",padding:"6px 14px",fontWeight:600,border:"1px solid transparent",transition:"all 180ms ease",backgroundColor:"map"===Dt?"hsl(var(--primary))":"transparent",color:"map"===Dt?"#FFFFFF":void 0,boxShadow:"none"},children:"Map View"})]}),(0,C.jsxs)(u.A,{sx:{display:"flex",alignItems:wt?"stretch":"center",flexDirection:wt?"column":"row",gap:wt?.75:.5,width:wt?"100%":"auto",justifyContent:"center",maxWidth:wt?"100%":"none"},children:[(0,C.jsxs)(u.A,{sx:{display:"flex",alignItems:"center",gap:.5,width:wt?"100%":"auto"},children:[(0,C.jsx)(r.A,{onClick:()=>Se(-1),className:"p-4",disabled:!en,"aria-label":"Previous day",sx:{width:wt?40:"auto",height:wt?40:"auto",flexShrink:0},children:(0,C.jsx)(j.A,{fontSize:"large",className:"text-black dark:text-white"})}),(0,C.jsx)(I.$,{dateAdapter:M.Y,children:(0,C.jsx)(P.l,{format:"MMMM D, YYYY",value:Jt,onChange:xe,minDate:Xt.min,maxDate:Xt.max,views:["year","month","day"],closeOnSelect:!0,reduceAnimations:!0,slotProps:{desktopTransition:{timeout:0},mobileTransition:{timeout:0},textField:{name:"date",size:"small",variant:"outlined",fullWidth:wt,className:"field bg-white dark:bg-[#1A1F2C] text-black dark:text-white",sx:{flex:wt?1:"unset",minWidth:wt?0:180,maxWidth:wt?"none":220,width:wt?"100%":"auto","& .MuiOutlinedInput-root":{backgroundColor:"inherit"},"& .MuiOutlinedInput-input":{padding:"10px 14px"}}}}})}),(0,C.jsx)(r.A,{onClick:()=>Se(1),className:"p-4",disabled:!tn,"aria-label":"Next day",sx:{width:wt?40:"auto",height:wt?40:"auto",flexShrink:0},children:(0,C.jsx)(k.A,{fontSize:"large",className:"text-black dark:text-white"})})]}),(0,C.jsxs)(a.A,{size:"small",variant:"outlined",onClick:De,disabled:Qt,title:"Jump to today",style:{textTransform:"none",fontWeight:600,minWidth:wt?"140px":"112px",borderRadius:"999px",padding:"7px 12px",borderColor:"rgba(22, 163, 74, 0.45)",color:"hsl(var(--color-status-success))",marginLeft:wt?0:4},className:"dark:text-green-400 dark:border-green-600",startIcon:(0,C.jsx)(N,{fontSize:"small"}),sx:{width:wt?"fit-content":"auto",alignSelf:wt?"center":"auto"},children:["Today [",$t,"]"]})]})]})})]}),U,(0,C.jsxs)("div",{className:"dark:bg-[#1A1F2C] shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)] sectionBox nospacing position-relative clientWrap ".concat(O.A.summaryTableWrap),style:{padding:wt?"10px 8px":"0px",borderRadius:"8px",overflowX:"hidden"},children:[!wt&&!Ct&&(0,C.jsx)(u.A,{children:qt?sn:0===(null===de||void 0===de?void 0:de.length)?ue?ln:nn:(0,C.jsx)(C.Fragment,{children:"list"===Dt?(0,C.jsxs)(p.A,{component:h.A,children:[(0,C.jsxs)(v.A,{children:[(0,C.jsx)(x.A,{children:(0,C.jsxs)(g.A,{className:"bg-[#f8fafc] dark:bg-[#1A1F2C]",children:[(0,C.jsx)(f.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Client"}),(0,C.jsx)(f.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Status"}),(0,C.jsx)(f.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Shift"}),(0,C.jsx)(f.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Start"}),(0,C.jsx)(f.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"End"}),(0,C.jsx)(f.A,{align:"right",className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Actions"})]})}),(0,C.jsx)(y.A,{children:ge()})]}),(0,C.jsx)(Y.A,{itemsPerPage:Te,onItemsPerPageChange:an,disabled:Wt,totalItems:(null===de||void 0===de?void 0:de.length)||0,page:Pe,onPageChange:Me})]}):(0,C.jsx)(pe,{pins:ft,isMobile:!1,openReassignPanel:Xe,filterDate:Kt,allowReassign:!Wt})})}),(wt||Ct)&&(0,C.jsx)("div",{children:qt?sn:0===(null===de||void 0===de?void 0:de.length)?ue?ln:nn:(0,C.jsx)(C.Fragment,{children:"list"===Dt?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(ne,{clientsList:de,show:ye,toggleShow:Ce,getClockInOutProps:Ne,s
1aveData:async e=>{ze({open:!0,cellData:e})},handelDeleteTime:async e=>{Le({open:!0,cellData:e})},getTimeZoneData:be,getStatusTag:je,getTaskListByComma:ke,getTaskCount:we,getClientsSummaryData:Ae,setShow:fe,checkInDateTime:He,checkOutDateTime:Ue,setCheckInDateTime:_e,setCheckOutDateTime:Ve,durationString:It,setDurationString:Pt,itemsPerPage:Te,page:Pe,auth:G,breakDurationString:qe,setBreakDurationString:Ke,openReassignPanel:Xe,getRescheduleMeta:et,handleReschedule:tt,onRequestAppointmentCancel:te,readOnly:Wt}),(0,C.jsx)(Y.A,{itemsPerPage:Te,onItemsPerPageChange:an,disabled:Wt,totalItems:(null===de||void 0===de?void 0:de.length)||0,page:Pe,onPageChange:Me})]}):(0,C.jsx)(pe,{pins:ft,isMobile:!0,openReassignPanel:Xe,filterDate:Kt,allowReassign:!Wt})})}),!Wt&&(0,C.jsx)($e,{reassignState:Ge,setReassignState:Ze,employees:Je,onConfirm:Qe})]}),Bt&&(0,C.jsx)(ve,{isModalOpen:Et,selectedAppointment:Bt,isMobile:wt,isLandscape:Ct,clientDetails:Ee,employeeDetails:Fe,appoinments:Oe,auth:G,setIsModalOpen:Ot,setCancelAppt:Q,settingsData:Nt,alerts:"todayAlerts"}),X&&(0,C.jsx)(V.db,{open:X,client:Ee,onConfirm:async(e,t)=>{var n,i,l;const s={name:"".concat(null===G||void 0===G||null===(n=G.userProfile)||void 0===n?void 0:n.firstName," ").concat(null===G||void 0===G||null===(i=G.userProfile)||void 0===i?void 0:i.lastName),id:null===G||void 0===G||null===(l=G.userProfile)||void 0===l?void 0:l.id};Q(!1);const a=await(0,q.Jx)(e,s,t);a.success?Ft(!0):console.error("Failed to delete appointment:",a.error)},auth:Lt,onClose:()=>{Q(!1)},appointments:Rt}),(null===$||void 0===$?void 0:$.open)&&(0,C.jsx)(V.h,{open:null===$||void 0===$?void 0:$.open,onConfirm:se,onClose:le,title:"Cancel Appointment",message:"Are you sure you want to cancel this appointment?",buttonTitle:"Confirm"}),Mt&&(0,C.jsx)(V.b,{open:Mt,onClose:async()=>{var e;me(!0),fe(!1),G.setEditAppointmentData({}),G.setUpdateAppointmentData({}),Ft(!1),Ot(!1),Q(!1),await(e=3500,new Promise((t=>setTimeout(t,e)))),await Ae(),null===zt||void 0===zt||zt({title:"Success",description:"Appointment Deleted Successfully",variant:"default"}),me(!1)},title:"Appointment Deleted Successfully",message:"Your appointment has been successfully deleted. Thank you for using our scheduling system."}),(null===Be||void 0===Be?void 0:Be.open)&&(0,C.jsx)(V.h,{open:null===Be||void 0===Be?void 0:Be.open,onConfirm:Re,onClose:()=>Le({open:!1,cellData:null}),title:"Confirm Reset",message:"This will clear and reset the existing check-in and check-out data. Are you sure you want to proceed?"}),(null===We||void 0===We?void 0:We.open)&&(0,C.jsx)(V.h,{open:null===We||void 0===We?void 0:We.open,onConfirm:Ye,onClose:()=>ze({open:!1,cellData:null}),title:"Confirm Update",message:"Are you sure you want to update? This action will update the check-in and check-out data."}),nt&&ot&&(0,C.jsx)(pt,{open:nt,onConfirm:rt,onClose:mt,recurringOption:st,setRecurringOption:at,selectedAppointment:ot,isOneTime:"Recurring Appointment"!==(null===ot||void 0===ot||null===(W=ot.apoointmentDetails)||void 0===W?void 0:W.type)}),it&&(0,C.jsx)(ht,{open:it,onConfirm:dt,onClose:mt}),lt&&ot&&(0,C.jsx)(vt,{open:lt,selectedAppointment:ot,settingsData:Nt,onConfirm:ct,onClose:ut}),yt&&(0,C.jsx)(V.h,{open:yt,onConfirm:bt,onClose:At,title:"Upgrade Required",message:(0,J.IV)("one-touch shift reassignment"),buttonTitle:"Upgrade"})]})})),ve=e=>{const{isModalOpen:t}=e,[n,l]=(0,b.useState)(!1);(0,b.useEffect)((()=>{t?l(t):setTimeout((()=>{l(t)}),250)}),[t]);return n?(0,C.jsx)("div",{className:"modal-overlay active",onClick:t=>{var n,i,l,s;null!==(n=t.target)&&void 0!==n&&null!==(i=n.classList)&&void 0!==i&&i.contains("modal-overlay")&&(null===e||void 0===e||e.setIsModalOpen(!1),null===e||void 0===e||null===(l=e.auth)||void 0===l||l.setEditAppointmentData({}),null===e||void 0===e||null===(s=e.auth)||void 0===s||s.setUpdateAppointmentData({}))},children:(0,C.jsx)("div",{className:"modal-content dark:bg-[#1A1F2C] ".concat(t?"slideUpModal":"slideDownModal"),children:(0,C.jsx)(U.T,(0,i.A)({},e))})}):null},xe=he},60197:(e,t,n)=>{n.d(t,{A:()=>E});var i=n(45458),l=n(58168),s=n(84277);function a(e,t){var n={};return Object.keys(e).forEach((function(i){-1===t.indexOf(i)&&(n[i]=e[i])})),n}function o(e){var t=function(t){var n=e(t);return t.css?(0,l.A)({},(0,s.A)(n,e((0,l.A)({theme:t.theme}
1,t.css))),a(t.css,[e.filterProps])):t.sx?(0,l.A)({},(0,s.A)(n,e((0,l.A)({theme:t.theme},t.sx))),a(t.sx,[e.filterProps])):n};return t.propTypes={},t.filterProps=["css","sx"].concat((0,i.A)(e.filterProps)),t}const r=o;const d=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=function(e){return t.reduce((function(t,n){var i=n(e);return i?(0,s.A)(t,i):t}),{})};return i.propTypes={},i.filterProps=t.reduce((function(e,t){return e.concat(t.filterProps)}),[]),i};var c=n(64467),u=n(413);function m(e,t){return t&&"string"===typeof t?t.split(".").reduce((function(e,t){return e&&e[t]?e[t]:null}),e):null}const p=function(e){var t=e.prop,n=e.cssProperty,i=void 0===n?e.prop:n,l=e.themeKey,s=e.transform,a=function(e){if(null==e[t])return null;var n=e[t],a=m(e.theme,l)||{};return(0,u.N)(e,n,(function(e){var t;return"function"===typeof a?t=a(e):Array.isArray(a)?t=a[e]||e:(t=m(a,e)||e,s&&(t=s(t))),!1===i?t:(0,c.A)({},i,t)}))};return a.propTypes={},a.filterProps=[t],a};function h(e){return"number"!==typeof e?e:"".concat(e,"px solid")}const v=d(p({prop:"border",themeKey:"borders",transform:h}),p({prop:"borderTop",themeKey:"borders",transform:h}),p({prop:"borderRight",themeKey:"borders",transform:h}),p({prop:"borderBottom",themeKey:"borders",transform:h}),p({prop:"borderLeft",themeKey:"borders",transform:h}),p({prop:"borderColor",themeKey:"palette"}),p({prop:"borderRadius",themeKey:"shape"}));const x=d(p({prop:"displayPrint",cssProperty:!1,transform:function(e){return{"@media print":{display:e}}}}),p({prop:"display"}),p({prop:"overflow"}),p({prop:"textOverflow"}),p({prop:"visibility"}),p({prop:"whiteSpace"}));const g=d(p({prop:"flexBasis"}),p({prop:"flexDirection"}),p({prop:"flexWrap"}),p({prop:"justifyContent"}),p({prop:"alignItems"}),p({prop:"alignContent"}),p({prop:"order"}),p({prop:"flex"}),p({prop:"flexGrow"}),p({prop:"flexShrink"}),p({prop:"alignSelf"}),p({prop:"justifyItems"}),p({prop:"justifySelf"}));const f=d(p({prop:"gridGap"}),p({prop:"gridColumnGap"}),p({prop:"gridRowGap"}),p({prop:"gridColumn"}),p({prop:"gridRow"}),p({prop:"gridAutoFlow"}),p({prop:"gridAutoColumns"}),p({prop:"gridAutoRows"}),p({prop:"gridTemplateColumns"}),p({prop:"gridTemplateRows"}),p({prop:"gridTemplateAreas"}),p({prop:"gridArea"}));const y=d(p({prop:"position"}),p({prop:"zIndex",themeKey:"zIndex"}),p({prop:"top"}),p({prop:"right"}),p({prop:"bottom"}),p({prop:"left"}));const A=d(p({prop:"color",themeKey:"palette"}),p({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette"}));const b=p({prop:"boxShadow",themeKey:"shadows"});function j(e){return e<=1?"".concat(100*e,"%"):e}var k=p({prop:"width",transform:j}),w=p({prop:"maxWidth",transform:j}),C=p({prop:"minWidth",transform:j}),N=p({prop:"height",transform:j}),S=p({prop:"maxHeight",transform:j}),D=p({prop:"minHeight",transform:j});p({prop:"size",cssProperty:"width",transform:j}),p({prop:"size",cssProperty:"height",transform:j});const T=d(k,w,C,N,S,D,p({prop:"boxSizing"}));var I=n(84654);const P=d(p({prop:"fontFamily",themeKey:"typography"}),p({prop:"fontSize",themeKey:"typography"}),p({prop:"fontStyle",themeKey:"typography"}),p({prop:"fontWeight",themeKey:"typography"}),p({prop:"letterSpacing"}),p({prop:"lineHeight"}),p({prop:"textAlign"}));var M=n(84160),F=r(d(v,x,g,f,y,A,b,T,I.A,P));const E=(0,M.A)("div")(F,{name:"MuiBox"})},61804:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var i=n(9950),l=n(28429),s=n(72823),a=n(27783),o=n(73483),r=n(40887),d=n(17662),c=n(10783),u=n(44194),m=n(44414);const p=function(e){var t,n,p;let{isFreemium:h=!1}=e;const v=(0,l.Zp)(),x=(0,i.useContext)(s.A),[g,f]=(0,i.useState)([]),[y,A]=(0,i.useState)(0),b="companyUser"===(null===x||void 0===x||null===(t=x.userProfile)||void 0===t?void 0:t.role)?null===x||void 0===x||null===(n=x.userProfile)||void 0===n?void 0:n.id:null===x||void 0===x||null===(p=x.userProfile)||void 0===p?void 0:p.companyId,j=()=>{v("/account/upgrade")},k=(0,i.useCallback)((async()=>{try{var e,t;const[n]=await Promise.all([(0,u.dp)(b)]);if(null===n||void 0===n||null===(e=n.data)||void 0===e||!e.length)return;let i=0;const l=null===n||void 0===n||null===(t=n.data)||void 0===t?void 0:t.map((e=>{var t;if(Array.isArray(null===e||void 0===e?void 0:e.readUser)){var n,l;(null===e||void 0===e||null===(n=e.readUser)||void 0===n?void 0:n.includes(null===x||void 0===x||null===(l=x.userProfile)||void 0===l?void 0:l.id))||(i+=1)}return{user:"Ticket #".concat(null===e||void 0===e?void 0:e.ticketNumber),time:(0,a.K6)(null===e||void 0===e?void 0:e.createdAt),preview:null!==(t=null===e||void 0===e?void 0:e.subject)&&void 0!==t?t:"",id:null===e||void 0===e?void 0:e.id}}));A(i);const s=(e=>e.sort(((e,t)=>e.updatedAt<t.updatedAt?-1:e.updatedAt>t.updatedAt?1:0)))(l.slice(0,5));f(s)}
1catch(n){console.error("Error loading team messages:",n)}}),[null===x||void 0===x?void 0:x.userProfile,b]);return(0,i.useEffect)((()=>{h||k()}),[k,h]),h?(0,m.jsx)(r.A,{icon:(0,m.jsx)(c.A,{className:d.A.iconBlue}),updates:[],title:"My Tickets",count:0,to:"/manageSupportDetails",viewAll:"/help/manageSupport",emptyMessage:(0,o.IV)("My Tickets"),showUpgradeButton:!0,upgradeButtonText:"Upgrade plan",onUpgradeClick:j}):(0,m.jsx)(r.A,{icon:(0,m.jsx)(c.A,{className:d.A.iconBlue}),updates:g,title:"My Tickets",count:y,to:"/manageSupportDetails",viewAll:"/help/manageSupport"})}},69065:(e,t,n)=>{n.r(t),n.d(t,{default:()=>$e});var i=n(89379),l=n(9950),s=n(42074),a=n(52816),o=n(72e3),r=n(18464),d=n(87233),c=n(9213),u=n(21671),m=n(25333),p=n(33738),h=n(1320),v=n(70693),x=n(15769),g=n(69780),f=n(34075),y=n(80045),A=n(57528),b=n(72004),j=n(3484);function k(e){return String(e).match(/[\d.\-+]*\s*(.*)/)[1]||""}function w(e){return parseFloat(e)}var C=n(34419),N=n(88283),S=n(59254),D=n(26012),T=n(4236),I=n(45558),P=n(1614);function M(e){return(0,P.Ay)("MuiSkeleton",e)}(0,I.A)("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);var F=n(44414);const E=["animation","className","component","height","style","variant","width"];var O,B,L,R;const z=(0,N.i7)(O||(O=(0,A.A)(["\n 0% {\n opacity: 1;\n }\n\n 50% {\n opacity: 0.4;\n }\n\n 100% {\n opacity: 1;\n }\n"]))),W=(0,N.i7)(B||(B=(0,A.A)(["\n 0% {\n transform: translateX(-100%);\n }\n\n 50% {\n /* +0.5s of delay between each loop */\n transform: translateX(100%);\n }\n\n 100% {\n transform: translateX(100%);\n }\n"]))),Y="string"!==typeof z?(0,N.AH)(L||(L=(0,A.A)(["\n animation: "," 2s ease-in-out 0.5s infinite;\n "])),z):null,H="string"!==typeof W?(0,N.AH)(R||(R=(0,A.A)(["\n &::after {\n animation: "," 2s linear 0.5s infinite;\n }\n "])),W):null,_=(0,S.Ay)("span",{name:"MuiSkeleton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!1!==n.animation&&t[n.animation],n.hasChildren&&t.withChildren,n.hasChildren&&!n.width&&t.fitContent,n.hasChildren&&!n.height&&t.heightAuto]}})((0,D.A)((e=>{let{theme:t}=e;const n=k(t.shape.borderRadius)||"px",i=w(t.shape.borderRadius);return{display:"block",backgroundColor:t.vars?t.vars.palette.Skeleton.bg:(0,C.X4)(t.palette.text.primary,"light"===t.palette.mode?.11:.13),height:"1.2em",variants:[{props:{variant:"text"},style:{marginTop:0,marginBottom:0,height:"auto",transformOrigin:"0 55%",transform:"scale(1, 0.60)",borderRadius:"".concat(i).concat(n,"/").concat(Math.round(i/.6*10)/10).concat(n),"&:empty:before":{content:'"\\00a0"'}}},{props:{variant:"circular"},style:{borderRadius:"50%"}},{props:{variant:"rounded"},style:{borderRadius:(t.vars||t).shape.borderRadius}},{props:e=>{let{ownerState:t}=e;return t.hasChildren},style:{"& > *":{visibility:"hidden"}}},{props:e=>{let{ownerState:t}=e;return t.hasChildren&&!t.width},style:{maxWidth:"fit-content"}},{props:e=>{let{ownerState:t}=e;return t.hasChildren&&!t.height},style:{height:"auto"}},{props:{animation:"pulse"},style:Y||{animation:"".concat(z," 2s ease-in-out 0.5s infinite")}},{props:{animation:"wave"},style:{position:"relative",overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)","&::after":{background:"linear-gradient(\n 90deg,\n transparent,\n ".concat((t.vars||t).palette.action.hover,",\n transparent\n )"),content:'""',position:"absolute",transform:"translateX(-100%)",bottom:0,left:0,right:0,top:0}}},{props:{animation:"wave"},style:H||{"&::after":{animation:"".concat(W," 2s linear 0.5s infinite")}}}]}}))),U=l.forwardRef((function(e,t){const n=(0,T.b)({props:e,name:"MuiSkeleton"}),{animation:l="pulse",className:s,component:a="span",height:o,style:r,variant:d="text",width:c}=n,u=(0,y.A)(n,E),m=(0,i.A)((0,i.A)({},n),{},{animation:l,component:a,variant:d,hasChildren:Boolean(u.children)}),p=(e=>{const{classes:t,variant:n,animation:i,hasChildren:l,width:s,height:a}=e,o={root:["root",n,i,l&&"withChildren",l&&!s&&"fitContent",l&&!a&&"heightAuto"]};return(0,j.A)(o,M,t)})(m);return(0,F.jsx)(_,(0,i.A)((0,i.A)({as:a,ref:t,className:(0,b.A)(p.root,s),ownerState:m},u),{},{style:(0,i.A)({width:c,height:o},r)}))}));var V=n(95050),q=n(35834),K=n(64320),G=n(1156),Z=n(52828),J=n(66220),X=n(25045),Q=n.n(X),$=n(81831),ee=n(19673),te=n(95345),ne=n(72823),ie=n(21859),le=n(59051),se=n.n(le),ae=n(41277),oe=n(3412),re=n(27681),de=n(55362),ce=n(27783);const ue=e=>null==e||""===e?null:String(e).trim()||null,me=e=>{if(!e)return null;if("function"===typeof e.toMillis)return e.toMillis();if(null!=e.seconds)return 1e3*e.seconds;if(null!=e._seconds)return 1e3*e._seconds;const t=new Date(e).getTime();return Number.isNaN(t)?null:t},pe=(e,t)=>(0,i.A)((0,i.A)({},e),{},{projectLeadNeedsReplacement:e.teamsLoaded&&Boolean(e.projectLeadId)&&(!e.leadOnTeam||!1===t.get(e.projectLeadId))}),he=e=>{var t,n;const l=ue((null===e||void 0===e?void 0:e.projectLeadId)||(null===e||void 0===e||null===(t=e.apoointmentDetails)||void 0===t?void 0:t.projectLeadId));return(0,i.A)((0,i.A)({},e),{},{openTeams:[],teamsLoaded:!1,sessionsLoaded:!1,aggregateStatus:(0,ae.pr)([]),isClosed:(0,ae.D9)(e),closedAtMs:me(null===e||void 0===e?void 0:e.closedAt),isPendingClose:(0,re.Og)(e),projectLabel:(0,re.Jx)(e),canClose:(0,ae.zS)([]),schedule:(0,oe.vj)(e),projectLeadId:l||"",projectLeadName:(null===e||void 0===e?void 0:e.projectLeadName)||(null===e||void 0===e||null===(n=e.apoointmentDetails)||void 0===n?void 0:n.projectLeadName)||"",leadOnTeam:!1})},ve=(e,t)=>
1{const n=!!e.projectLeadId&&t.some((t=>ue(null===t||void 0===t?void 0:t.employeeId)===e.projectLeadId));return(0,i.A)((0,i.A)({},e),{},{openTeams:t,teamsLoaded:!0,sessionsLoaded:t.every((e=>!1!==e.sessionsLoaded)),aggregateStatus:(0,ae.pr)(t),canClose:(0,ae.zS)(t),leadOnTeam:n})},xe=(e,t)=>0===t.length&&e.openTeams.length>0?e:(0,i.A)((0,i.A)({},ve(e,t)),{},{sessionsLoaded:!0}),ge=new Map;const fe=function(){var e,t,n,s,a;const o=(0,l.useContext)(ne.A),r="companyUser"===(null===o||void 0===o||null===(e=o.userProfile)||void 0===e?void 0:e.role)?null===o||void 0===o||null===(t=o.userProfile)||void 0===t?void 0:t.id:null===o||void 0===o||null===(n=o.userProfile)||void 0===n?void 0:n.companyId,[d,c]=(0,l.useState)((()=>ge.get(r)||[])),u=(0,l.useRef)(d);u.current=d;const[m,p]=(0,l.useState)((()=>!ge.get(r))),[h,v]=(0,l.useState)(0),x=(0,l.useCallback)((()=>v((e=>e+1))),[]),g=(0,l.useRef)(new Set);(0,l.useEffect)((()=>{r&&d.length>0&&ge.set(r,d)}),[r,d]);const f=(0,l.useMemo)((()=>{const e=new Map;return((null===o||void 0===o?void 0:o.allEmp)||[]).forEach((t=>{var n;const i=ue(null!==(n=null===t||void 0===t?void 0:t.userId)&&void 0!==n?n:null===t||void 0===t?void 0:t.id);i&&e.set(i,!1!==(null===t||void 0===t?void 0:t.status)&&!(null!==t&&void 0!==t&&t.deleted))})),e}),[null===o||void 0===o?void 0:o.allEmp]),y=(0,l.useCallback)((async e=>{const t=await(0,ae.H)(e.id);return c((n=>n.map((n=>n.id!==e.id||n.sessionsLoaded?n:xe(n,t))))),xe(e,t)}),[]),A=(0,l.useCallback)((async e=>{const t=u.current.find((t=>t.id===e));return!t||t.sessionsLoaded?t:y(t)}),[y]),b=(0,l.useCallback)((async e=>{const t=(e||[]).map((e=>u.current.find((t=>t.id===e)))).filter((e=>e&&!e.teamsLoaded&&!g.current.has(e.id)));if(0===t.length)return;t.forEach((e=>g.current.add(e.id)));try{const e=await Promise.all(t.map((async e=>[e.id,await(0,ae.Bw)(e.id,{deriveMissingStatus:!e.isClosed})]))),n=new Map(e);c((e=>e.map((e=>n.has(e.id)&&!e.teamsLoaded?ve(e,n.get(e.id)):e))))}finally{t.forEach((e=>g.current.delete(e.id)))}const n=t.filter((e=>!e.isClosed));Promise.all(n.map((async e=>[e.id,await(0,ae.H)(e.id)]))).then((e=>{const t=new Map(e);c((e=>e.map((e=>t.has(e.id)&&!e.sessionsLoaded?xe(e,t.get(e.id)):e))))}))}),[]);(0,l.useEffect)((()=>{if(!r)return c([]),void p(!1);let e=!1;const t=u.current.length>0;return p(!t),(async()=>{const n=se()().add(-365,"days").startOf("day").format("YYYY-MM-DDTHH:mm:ss"),i=se()().add(15,"days").endOf("day").format("YYYY-MM-DDTHH:mm:ss"),l=await(0,ae.Du)(r,n,i);if(e)return;const s=l.map(he);if((0,ce.NO)("Dashboard (Open Work tab)","".concat(se()(n).format("YYYY-MM-DD")," \u2192 ").concat(se()(i).format("YYYY-MM-DD")," (+90-day lookback), Active: ").concat(s.filter((e=>!e.isClosed)).length,", Closed: ").concat(s.filter((e=>e.isClosed)).length),l,0,l),!t)return c(s),void p(!1);const a=new Map(u.current.map((e=>[e.id,e]))),o=await Promise.all(s.map((async e=>{var t;if(null===(t=a.get(e.id))||void 0===t||!t.teamsLoaded)return e;const n=await(0,ae.H)(e.id);return xe(e,n)})));e||(c(o),p(!1))})().catch((t=>{e||(console.error("Error loading Open Work summary:",t),c([]),p(!1))})),()=>{e=!0}}),[r,h]);const j=(0,l.useCallback)((e=>[...e].sort(((e,t)=>{const n=null!==e&&void 0!==e&&e.appointmentDateTime?new Date(e.appointmentDateTime).getTime():0;return(null!==t&&void 0!==t&&t.appointmentDateTime?new Date(t.appointmentDateTime).getTime():0)-n}))),[]);return{isLoading:m,activeProjects:(0,l.useMemo)((()=>j(d.filter((e=>!e.isClosed))).map((e=>pe(e,f)))),[d,j,f]),closedProjects:(0,l.useMemo)((()=>j(d.filter((e=>e.isClosed))).map((e=>pe(e,f)))),[d,j,f]),isCompanyAdmin:(0,l.useMemo)((()=>{var e,t;const n=null===o||void 0===o||null===(e=o.userProfile)||void 0===e?void 0:e.role,i=Array.isArray(n)?n:[n];return!!i.includes(de.gg.COMPANYUSER)||i.includes(de.gg.EMPLOYEE)&&[de.Po.ADMIN,"Team Admin"].includes(null===o||void 0===o||null===(t=o.userProfile)||void 0===t?void 0:t.employeerole)}),[null===o||void 0===o||null===(s=o.userProfile)||void 0===s?void 0:s.role,null===o||void 0===o||null===(a=o.userProfile)||void 0===a?void 0:a.employeerole]),closeProject:(0,l.useCallback)((async(e,t)=>{const n=await(0,ae.tL)(e,t);return n.success&&x(),n}),[x]),reopenProject:(0,l.useCallback)((async e=>{const t=await(0,ae.mP)(e);return t.success&&x(),t}),[x]),refreshProjectTeams:(0,l.useCallback)((async e=>{if(!e)return;const t=await(0,ae.H)(e);c((n=>n.map((n=>n.id===e?(0,i.A)((0,i.A)({},n),{},{openTeams:t,teamsLoaded:!0,sessionsLoaded:!0,aggregateStatus:(0,ae.pr)(t),canClose:(0,ae.zS)(t)}):n))))}),[]),ensureProjectSessions:A,loadTeamsFor:b,refresh:x}};var ye=n(68108),Ae=n(90983);const be=["S","M","T","W","T","F","S"],je="YYYY-MM-DD";function ke(e){let{workedDays:t,selectedDay:n,onSelect:i,timezone:s}=e;const a=(0,l.useMemo)((()=>new Set(t||[])),[t]),[o,r]=(0,l.useState)((()=>(n?Q()(n,je):Q()()).startOf("month")));(0,l.useEffect)((()=>
1{if(!n)return;const e=Q()(n,je).startOf("month");r((t=>t.isSame(e,"month")?t:e))}),[n]);const d=(s?Q().tz(s):Q()()).format(je),c=(0,l.useMemo)((()=>{const e=o.clone().startOf("month"),t=e.day(),n=e.daysInMonth(),i=[];for(let l=0;l<t;l+=1)i.push(null);for(let l=1;l<=n;l+=1)i.push(e.clone().date(l).format(je));return i}),[o]),u="h-7 w-7 inline-flex items-center justify-center rounded-full border-0 bg-transparent cursor-pointer text-[#475569] hover:bg-[#F1F5F9] dark:text-[#CBD5E1] dark:hover:bg-[#2c3440]";return(0,F.jsxs)("div",{"data-testid":"open-work-days-calendar",className:"rounded-lg border border-[#E2E8F0] dark:border-[#334155] bg-white dark:bg-[#1A1F2C] p-2",style:{maxWidth:260},children:[(0,F.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,F.jsx)("button",{type:"button","aria-label":"Previous month",className:u,onClick:()=>r((e=>e.clone().subtract(1,"month"))),children:(0,F.jsx)(ye.A,{size:16})}),(0,F.jsx)("span",{className:"text-sm font-semibold text-[#020817] dark:text-white","data-testid":"open-work-calendar-month",children:o.format("MMMM YYYY")}),(0,F.jsx)("button",{type:"button","aria-label":"Next month",className:u,onClick:()=>r((e=>e.clone().add(1,"month"))),children:(0,F.jsx)(Ae.A,{size:16})})]}),(0,F.jsxs)("div",{className:"grid text-center",style:{gridTemplateColumns:"repeat(7, 1fr)",rowGap:2},children:[be.map(((e,t)=>(0,F.jsx)("span",{className:"text-[11px] font-medium text-[#94A3B8]",children:e},"".concat(e,"-").concat(t)))),c.map(((e,t)=>{if(!e)return(0,F.jsx)("span",{},"blank-".concat(t));const l=a.has(e),s=e===n,o=e===d;return(0,F.jsx)("button",{type:"button",onClick:()=>null===i||void 0===i?void 0:i(e),"aria-pressed":s,"aria-label":"".concat(Q()(e,je).format("MMMM D, YYYY")).concat(l?", worked":""),"data-testid":"open-work-calendar-day-".concat(e),"data-worked":l?"true":"false",className:"mx-auto h-7 w-7 rounded-full border-0 text-xs cursor-pointer transition-colors ".concat(l?"bg-[#078037] text-white font-semibold":"bg-transparent text-[#020817] dark:text-white hover:bg-[#F1F5F9] dark:hover:bg-[#2c3440]"," ").concat(o&&!l?"font-bold underline underline-offset-2":""),style:s?{boxShadow:"0 0 0 2px #fff, 0 0 0 4px "+(l?"#078037":"#64748B")}:void 0,children:Q()(e,je).date()},e)}))]})]})}const we="YYYY-MM-DD",Ce=e=>{var t;return(null===e||void 0===e||null===(t=e.apoointmentDetails)||void 0===t?void 0:t.calendarTimezone)||(null===e||void 0===e?void 0:e.calendarTimezone)||"America/New_York"},Ne=(e,t)=>{const n=(e=>{if(!e)return null;if("function"===typeof e.toDate)return e.toDate();if(null!=e.seconds)return new Date(1e3*e.seconds);const t=new Date(e);return Number.isNaN(t.getTime())?null:t})(null===e||void 0===e?void 0:e.checkInDateTime);return n?Q()(n).tz(t).format(we):null},Se=e=>{const t=Ce(e),n=new Map;return((null===e||void 0===e?void 0:e.openTeams)||[]).forEach((e=>{(Array.isArray(null===e||void 0===e?void 0:e.sessions)?e.sessions:[]).forEach((i=>{const l=Ne(i,t);l&&(n.has(l)||n.set(l,new Set),n.get(l).add(String(e.employeeId)))}))})),n},De=e=>{const t=[...Se(e).keys()].sort();return t.length?t[t.length-1]:Q()().tz(Ce(e)).format(we)};var Te=n(17317),Ie=n(99792),Pe=n(25728),Me=n(30537),Fe=n(51233),Ee=n(13217),Oe=n(49853),Be=n(30782),Le=n(23850),Re=n(17662);const ze={Started:{label:"Started",dotColor:"#078037",textColor:"#078037",backgroundColor:"rgba(7, 128, 55, 0.15)"},Break:{label:"On Break",dotColor:"#EF9F27",textColor:"#EF9F27",backgroundColor:"rgba(239, 159, 39, 0.15)"},Active:{label:"Active",dotColor:"#2563EB",textColor:"#2563EB",backgroundColor:"rgba(37, 99, 235, 0.15)"},Scheduled:{label:"Scheduled",dotColor:"#F9BC0A",textColor:"#F9BC0A",backgroundColor:"rgba(235, 221, 65, 0.15)"}},We={label:"Closed",dotColor:"#64748B",textColor:"#64748B",backgroundColor:"rgba(100, 116, 139, 0.15)"},Ye={label:"Pending Close",dotColor:"#B45309",textColor:"#B45309",backgroundColor:"rgba(245, 158, 11, 0.18)"},He=e=>null==e||""===e?null:String(e).trim()||null,_e=e=>[null===e||void 0===e?void 0:e.firstName,null===e||void 0===e?void 0:e.lastName].filter(Boolean).join(" ")||(null===e||void 0===e?void 0:e.email)||"Team member",Ue=e=>{let{status:t,closed:n,pendingClose:i}=e;const l=n?We:i?Ye:ze[t]||ze.Scheduled;return(0,F.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",backgroundColor:l.backgroundColor,color:l.textColor,padding:"2px 10px",borderRadius:"9999px",fontSize:"0.85rem",fontWeight:600,whiteSpace:"nowrap"},"data-testid":i&&!n?"open-work-pending-close-pill":"open-work-status-pill",children:[(0,F.jsx)("span",{style:{width:8,height:8,backgroundColor:l.dotColor,borderRadius:"50%",marginRight:6}}),l.label]})},Ve=(e,t)=>{if(null===e||void 0===e||!e.tasks)return 0;const n=new Set;let i=0;for(const l in e.tasks){const s=e.tasks[l];null!==s&&void 0!==s&&s.tasksList&&s.tasksList.forEach((e=>{const l=(null===e||void 0===e?void 0:e.taskId)||(null===e||void 0===e?void 0:e.id);l&&!n.has(l)&&(n.add(l),(t||null!==e&&void 0!==e&&e.completed)&&(i+=1))}))}return i},qe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(null===e||void 0===e||!e.tasks)return[];const n=new Set,i=[];for(const l in e.tasks){const s=e.tasks[l];null!==s&&void 0!==s&&s.tasksList&&s.tasksList.filter((e=>1===t&&"Opentasks"===(null===e||void 0===e?void 0:e.shname)||0===t&&"Opentasks"!==(null===e||void 0===e?void 0:e.shname)||2===t&&(null===e||void 0===e?void 0:e.completed))).forEac
1h((e=>{null!==e&&void 0!==e&&e.title&&!n.has(e.title)&&(n.add(e.title),i.push(e.title))}))}return i},Ke=()=>(0,F.jsx)("span",{"aria-label":"Worked this day",style:{display:"inline-block",width:8,height:8,borderRadius:"50%",backgroundColor:"#078037",marginRight:8,flexShrink:0}}),Ge=(e,t,n)=>{const i=Q()().tz(n).format("Z"),l=Q()(t,"hh:mm A").format("HH:mm:ss");return new Date("".concat(e,"T").concat(l).concat(i))},Ze=e=>{let{icon:t=null,children:n}=e;return(0,F.jsxs)("h3",{className:"m-0 mb-1 flex items-center gap-2 text-[16px] font-bold leading-[24px] tracking-[0.01em] text-[#0F172A] dark:text-[#F1F5F9]",style:{fontFamily:"inherit"},children:[t,n]})},Je=e=>{let{project:t}=e;const n=qe(t,0),i=qe(t,1),l=qe(t,2);return(0,F.jsxs)(o.A,{spacing:.5,mt:1,children:[(0,F.jsxs)(r.A,{display:"flex",alignItems:"center",children:[(0,F.jsx)("span",{className:"".concat(Re.A.apptDetailTaskLabel," dark:text-[#CBD5E1]"),children:"Assigned:"}),(0,F.jsxs)(Me.jc,{children:[(0,F.jsx)(Me.d0,{asChild:!0,children:(0,F.jsx)(a.A,{className:Re.A.expandIcons,children:Ve(t,!0)})}),(0,F.jsxs)(Me.Et,{className:"bg-white dark:bg-gray-800 p-20 shadow-lg border border-gray-200 dark:border-gray-700 rounded-md z-50 text-[#020817] dark:text-white",align:"start",side:"right",sideOffset:5,children:[(0,F.jsxs)("div",{className:"max-w-xs",children:[(0,F.jsx)("h5",{className:"mb-10 font-semibold text-lg",children:"Assigned Tasks"}),(0,F.jsx)("div",{children:n.map(((e,t)=>(0,F.jsxs)("p",{className:"flex items-center mb-4",children:[(0,F.jsx)("span",{className:"w-1 h-1 bg-[#020817] dark:bg-white rounded-full mr-6 inline-block"}),(0,F.jsx)("span",{className:"ml-8",children:e})]},"regular-".concat(t))))})]}),i.length>0&&(0,F.jsxs)("div",{className:"max-w-xs mt-15",children:[(0,F.jsx)("h5",{className:"font-semibold text-lg mb-8",children:"Open Tasks"}),(0,F.jsx)("div",{children:i.map(((e,t)=>(0,F.jsxs)("p",{className:"flex items-center mb-4",children:[(0,F.jsx)("span",{className:"w-1 h-1 bg-[#020817] dark:bg-white rounded-full mr-6 inline-block"}),(0,F.jsx)("span",{className:"ml-5",children:e})]},"open-".concat(t))))})]})]})]})]}),(0,F.jsxs)(r.A,{display:"flex",alignItems:"center",children:[(0,F.jsx)("span",{className:"".concat(Re.A.apptDetailTaskLabel," dark:text-[#CBD5E1]"),children:"Completed:"}),(0,F.jsxs)(Me.jc,{children:[(0,F.jsx)(Me.d0,{asChild:!0,children:(0,F.jsx)(a.A,{className:Re.A.expandIcons,children:Ve(t,!1)})}),(0,F.jsx)(Me.Et,{className:"bg-white dark:bg-gray-800 p-20 shadow-lg border border-gray-200 dark:border-gray-700 rounded-md z-50 text-[#020817] dark:text-white",align:"start",side:"right",sideOffset:5,children:(0,F.jsxs)("div",{className:"max-w-xs",children:[(0,F.jsx)("h5",{className:"mb-10 font-semibold text-lg",children:"Completed Tasks"}),(0,F.jsx)("div",{children:l.map(((e,t)=>(0,F.jsxs)("p",{className:"flex items-center mb-4",children:[(0,F.jsx)("span",{className:"w-1 h-1 bg-[#020817] dark:bg-white rounded-full mr-2 inline-block"}),(0,F.jsx)("span",{className:"ml-2",children:e})]},"completed-".concat(t))))})]})})]})]})]})},Xe=e=>{let{project:t,team:n,canManage:i,onLeadChanged:s}=e;const[a,o]=(0,l.useState)(!1),[c,u]=(0,l.useState)(""),m=n.filter((e=>null===e||void 0===e?void 0:e.employeeId)).map((e=>({value:String(e.employeeId),label:_e(e)}))),p=t.projectLeadId&&m.some((e=>e.value===String(t.projectLeadId)))?String(t.projectLeadId):"";return i&&!t.isClosed&&m.length?(0,F.jsxs)(r.A,{mt:.5,"data-testid":"open-work-project-lead-select",style:{maxWidth:260},children:[(0,F.jsx)(Oe.A,{value:p||void 0,placeholder:t.projectLeadName?"".concat(t.projectLeadName," (not on team)"):"Choose a Project Lead",options:m,disabled:a,contentClass:"bg-white text-black border-gray-300 dark:bg-[#2c3440] dark:text-white dark:border-[#464c59]",itemClass:"hover:bg-gray-100 dark:hover:bg-[#3c4351]",onChange:async e=>{if(!e||e===p)return;o(!0),u("");const n=await(0,ae.i)(t.id,e);o(!1),n.success?null===s||void 0===s||s(t.id,n):u(n.error||"Could not update the Project Lead.")}}),a&&(0,F.jsx)("div",{className:"text-xs mt-4 text-[#64748B] dark:text-[#94A3B8]",children:"Saving\u2026"}),c&&(0,F.jsx)("div",{className:"text-xs mt-4",style:{color:"#B91C1C"},"data-testid":"open-work-project-lead-error",children:c})]}):(0,F.jsx)(d.A,{variant:"body2",className:"text-[#020817] dark:text-white font-medium mt
1-4",style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:t.projectLeadName||"Not set"})},Qe=e=>{var t,n,i;let{project:s,clientsMap:o,isExpanded:h,toggleShow:v,onOpen:x,onShiftChanged:g,clockState:f,canManageProject:y,onLeadChanged:A,selectedDay:b,onSelectDay:j,onCloseProject:k}=e;const w=He((null===s||void 0===s?void 0:s.clientId)||(null===s||void 0===s||null===(t=s.apoointmentDetails)||void 0===t?void 0:t.clientId)),C=w?o.get(w):null,N=(null===C||void 0===C?void 0:C.clientName)||(null===s||void 0===s?void 0:s.name)||(null===s||void 0===s||null===(n=s.apoointmentDetails)||void 0===n?void 0:n.calendar)||"Unknown Client",S=(null===s||void 0===s||null===(i=s.apoointmentDetails)||void 0===i?void 0:i.shiftName)||(null===s||void 0===s?void 0:s.shiftName)||"No Shift",D=(null===s||void 0===s?void 0:s.openTeams)||[],T=null===s||void 0===s?void 0:s.schedule,I=D.some((e=>(null===e||void 0===e?void 0:e.currentStatus)&&"idle"!==e.currentStatus)),[P,M]=(0,l.useState)(!1),[E,O]=(0,l.useState)(null),[B,L]=(0,l.useState)(!1),[R,z]=(0,l.useState)(""),W=(0,re.fW)(N,s.projectLabel),Y=D.filter((e=>"checked-in"===(null===e||void 0===e?void 0:e.currentStatus)||"on-break"===(null===e||void 0===e?void 0:e.currentStatus))).map((e=>({employeeId:null===e||void 0===e?void 0:e.employeeId,name:_e(e),status:null===e||void 0===e?void 0:e.currentStatus}))),H=async function(){let{forceCheckout:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};L(!0),z("");const t=await k(s.id,{forceCheckout:e});L(!1),t.success||("crew_on_clock"!==t.code||e?z(t.error||"Failed to close project."):O({projectName:t.projectName||W,crewOnClock:t.crewOnClock||[]}))},_=h?Se(s):null,U=(null===_||void 0===_?void 0:_.get(b))||new Set,G=D.map((e=>{const t=_e(e),n=U.has(String(e.employeeId));return{value:e.employeeId,label:n?(0,F.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,F.jsx)(Ke,{}),t]}):(0,F.jsx)("span",{style:{paddingLeft:16},children:t})}}));return(0,F.jsxs)(l.Fragment,{children:[(0,F.jsxs)(c.A,{className:"bg-white dark:bg-[#1A1F2C] text-[#020817] dark:text-white hover:bg-[#f8fafc] dark:hover:bg-[#2c3440] border-white dark:border-white",children:[(0,F.jsxs)(u.A,{style:{maxWidth:220},children:[(0,F.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0,maxWidth:"100%"},children:[(0,F.jsx)("span",{className:"font-medium text-[#020817] dark:text-white",style:{flex:"0 1 auto",minWidth:0,maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:N,children:N}),(0,F.jsx)(Ee.A,{appointment:s,size:16})]}),s.projectLabel?(0,F.jsx)("span",{className:"text-xs text-[#64748B] dark:text-[#94A3B8]",style:{display:"block",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2},title:s.projectLabel,"data-testid":"open-work-project-label",children:s.projectLabel}):null]}),(0,F.jsx)(u.A,{children:(0,F.jsx)(Ue,{status:s.aggregateStatus,closed:s.isClosed,pendingClose:s.isPendingClose})}),(0,F.jsx)(u.A,{children:(0,F.jsx)(Pe.$,{appointment:{id:s.id,shift:S,tasks:s.tasks,clientDetails:C,checkInDateTime:I},refreshData:()=>g(s.id),setShow:()=>{},readOnly:s.isClosed})}),(0,F.jsxs)(u.A,{children:[(0,F.jsx)(d.A,{variant:"caption",className:"".concat(Re.A.customHeader," text-[#020817] dark:text-white"),children:(null===T||void 0===T?void 0:T.startDate)||"-"}),(0,F.jsx)(d.A,{variant:"body2",className:"text-[#020817] dark:text-white",children:(null===T||void 0===T?void 0:T.startTime)||"-"})]}),(0,F.jsxs)(u.A,{children:[(0,F.jsx)(d.A,{variant:"caption",className:"".concat(Re.A.customHeader," text-[#020817] dark:text-white"),children:(null===T||void 0===T?void 0:T.endDate)||"-"}),(0,F.jsx)(d.A,{variant:"body2",className:"text-[#020817] dark:text-white",children:(null===T||void 0===T?void 0:T.endTime)||"-"})]}),(0,F.jsx)(u.A,{align:"right",children:(0,F.jsx)(m.A,{size:"small",onClick:()=>v(s.id),children:h?(0,F.jsx)(V.A,{className:"text-black dark:text-white"}):(0,F.jsx)(q.A,{className:"text-black dark:text-white"})})})]}),(0,F.jsx)(c.A,{children:(0,F.jsx)(u.A,{colSpan:6,sx:{p:0,border:0},children:(0,F.jsx)(p.A,{in:h,timeout:"auto",unmountOnExit:!0,children:(0,F.jsx)(r.A,{className:"px-6 py-4 bg-[#f8fafc] dark:bg-[#1A1F2C]",children:(0,F.jsxs)(r.A,{className:"grid gap-4 mb-2",sx:{gridTemplateColumns:{xs:"1fr",md:"repeat(2, minmax(0, 1fr))",lg:"minmax(0, 1fr) minmax(0, 0.8fr) minmax(260px, 1fr) minmax(0, 1.3fr)"}},children:[(0,F.jsxs)(r.A,{className:Re.A.apptDetailsSection,children:[(0,F.jsx)(Ze,{children:"Appointment Details"}),(0,F.jsxs)(r.A,{className:Re.A.apptDetailsActionsRow,children:[(0,F.jsx)("button",{type:"button",onClick:()=>x(s),className:"".concat(Re.A.apptDetailsAction," ").concat(Re.A.apptDetailsActionViewMore),children:"View More"}),y&&!s.isClosed&&(0,F.jsx)("button",{type:"button",onClick:()=>{s.teamsLoaded&&Y.length?O({projectName:W,crewOnClock:Y}):M(!0)},disabled:B,"data-testid":s.isPendingClose?"confirm-close-project-link":"close-project-link",className:"".concat(Re.A.apptDetailsAction," ").concat(Re.A.apptDetailsActionCancel," ").concat(B?Re.A.apptDetailsActionDisabled:""),children:B?"Closing\u2026":s.isPendingClose?"Confirm Close":"Close Project"})]}),R&&(0,F.jsx)("div",{className:"text-xs mt-4",style:{color:"#B91C1C"},"data-testid":"open-work-project-action-error",children:R}),(0,F.jsxs)(r.A,{mt:3,children:[(0,F.jsx)(d.A,{variant:"body",className:Re.A.customHeader,children:"Project Label"}),(0,F.jsx)(d.A,{variant:"body2",className:"text-[#020817] dark:text-white font-medium mt
1-4","data-testid":"open-work-project-label-expanded",children:s.projectLabel||"Not set"})]}),(0,F.jsxs)(r.A,{mt:3,children:[(0,F.jsx)(d.A,{variant:"body",className:Re.A.customHeader,children:"Project Lead"}),(0,F.jsx)(Xe,{project:s,team:D,canManage:y,onLeadChanged:A}),s.projectLeadNeedsReplacement&&(0,F.jsxs)(r.A,{mt:1,style:{display:"inline-flex",alignItems:"center",gap:4,color:"#B91C1C",fontSize:12,fontWeight:600},"data-testid":"open-work-lead-needs-replacement",children:[(0,F.jsx)(Z.A,{size:13})," Needs a replacement"]})]}),(0,F.jsx)(r.A,{mt:3,children:(0,F.jsx)(Le.A,{timesheet:s,openTeams:D,readOnly:s.isClosed,onChanged:()=>null===g||void 0===g?void 0:g(s.id),compact:!0})})]}),(0,F.jsxs)(r.A,{children:[(0,F.jsx)(Ze,{children:"Tasks"}),(0,F.jsx)(Je,{project:s})]}),(0,F.jsxs)(r.A,{"data-testid":"open-work-day-picker",children:[(0,F.jsx)(Ze,{children:"Days worked"}),(0,F.jsx)(r.A,{mt:1,children:(0,F.jsx)(ke,{workedDays:_?[..._.keys()]:[],selectedDay:b,onSelect:j,timezone:Ce(s)})})]}),(0,F.jsxs)(r.A,{children:[(0,F.jsx)(Ze,{icon:(0,F.jsx)(K.A,{fontSize:"small",className:"text-blue-500"}),children:"Clock Times"}),h&&f&&(0,F.jsxs)(r.A,{mt:1,children:[(0,F.jsx)(Pe.Q,{cellData:f.cellData,show:h,checkInDateTime:f.checkInDateTime,setCheckInDateTime:f.setCheckInDateTime,checkOutDateTime:f.checkOutDateTime,setCheckOutDateTime:f.setCheckOutDateTime,durationString:f.durationString,setDurationString:f.setDurationString,breakDurationString:f.breakDurationString,setBreakDurationString:f.setBreakDurationString,showTeamMemberSelect:!0,teamMemberOptions:G,selectedEmployeeId:f.selectedEmployeeId,onSelectEmployee:f.onSelectEmployee,openPriorSessionsWorkedMs:f.openPriorSessionsWorkedMs}),(0,F.jsxs)(r.A,{display:"flex",justifyContent:"flex-end",gap:1,mt:1,children:[(0,F.jsx)(a.A,{className:"dark:text-white ".concat(Re.A.apptDetailActionBtn),size:"small",variant:"outlined",onClick:f.onReset,disabled:s.isClosed,children:"Reset"}),(0,F.jsx)(a.A,{className:"saveButton text-white dark:bg-[#078037] dark:text-white ".concat(Re.A.apptDetailActionBtn),size:"small",variant:"contained",onClick:f.onSave,disabled:s.isClosed||!f.selectedEmployeeId,children:"Save"})]})]})]})]})})})})}),P&&(0,F.jsx)(Fe.h,{open:P,title:s.isPendingClose?"Confirm Close":"Close Project",message:"Close ".concat(W||"this Open Work project","? It moves to Closed Projects and can be reopened later from here."),buttonTitle:s.isPendingClose?"Confirm Close":"Close Project",onClose:()=>M(!1),onConfirm:()=>{M(!1),H()}}),E&&(0,F.jsx)(Fe.h,{open:!0,title:"Crew still working",message:(0,F.jsxs)("div",{"data-testid":"open-work-crew-on-clock-prompt",children:[(0,F.jsxs)("div",{children:["The crew is still working on ",(0,F.jsx)("strong",{children:E.projectName||"this project"}),". Do you wish to log them out and close the project?"]}),E.crewOnClock.length>0&&(0,F.jsx)("ul",{style:{margin:"10px 0 0 18px",listStyle:"disc"},children:E.crewOnClock.map((e=>(0,F.jsxs)("li",{children:[e.name,"on-break"===e.status?" (on break)":" (checked in)"]},e.employeeId||e.name)))})]}),buttonTitle:"Log Out & Close",onClose:()=>O(null),onConfirm:()=>{O(null),H({forceCheckout:!0})}})]})},$e=e=>{var t,n,o,m;let{onCountChange:p,tabStrip:y=null}=e;const A=(0,l.useContext)(ne.A),{isLoading:b,activeProjects:j,closedProjects:k,refreshProjectTeams:w,ensureProjectSessions:C,loadTeamsFor:N,refresh:S,isCompanyAdmin:D,closeProject:T}=fe(),I=(null===A||void 0===A||null===(t=A.userProfile)||void 0===t?void 0:t.id)||"user",[P,M]=(0,ie.A)("openWork.statusFilter.".concat(I),"active",(e=>"active"===e||"closed"===e)),[E,O]=(0,l.useState)(null),[B,L]=(0,l.useState)(1),[R,z]=(0,ie.A)("openWork.itemsPerPage.".concat(I),10,(e=>Number.isFinite(e)&&e>0)),[W,Y]=(0,ie.A)("openWork.closedSince.".concat(I),Q()().subtract(30,"days").format(we),(e=>Q()(e,we,!0).isValid())),[H,_]=(0,l.useState)(null),[V,q]=(0,l.useState)(null),[K,Z]=(0,l.useState)(!1),[X,le]=(0,s.ok)(),se=X.get("openWorkProject"),oe=(0,l.useRef)(!1),[re,de]=(0,l.useState)(""),[ce,ue]=(0,l.useState)(null),[me,pe]=(0,l.useState)(null),[he,ve]=(0,l.useState)("\u2014"),[xe,ge]=(0,l.useState)(null),[ye,Ae]=(0,l.useState)(null),be=(0,l.useMemo)((()=>{const e=new Map;
1return((null===A||void 0===A?void 0:A.clients)||[]).forEach((t=>{const n=He(null===t||void 0===t?void 0:t.id);n&&e.set(n,t)})),e}),[null===A||void 0===A?void 0:A.clients]),je=(0,l.useMemo)((()=>{const e=Q()(W,we).startOf("day").valueOf();return k.filter((t=>{var n;return(null!==(n=t.closedAtMs)&&void 0!==n?n:t.appointmentDateTime?new Date(t.appointmentDateTime).getTime():0)>=e}))}),[k,W]);(0,l.useEffect)((()=>{"function"!==typeof p||b||p(j.length+je.length)}),[j.length,je.length,p,b]);const ke="active"===P?j:je;(0,l.useEffect)((()=>{L(1)}),[P,R,W]);const Pe=Math.max(1,Math.ceil(ke.length/R)),Me=Math.min(B,Pe),Ee=(Me-1)*R,Oe=ke.slice(Ee,Ee+R);let Le=Oe;if(E&&!Oe.some((e=>e.id===E))){const e=ke.find((e=>e.id===E));e&&(Le=[e,...Oe.slice(0,Math.max(R-1,0))])}const Re=Le.map((e=>e.id)).join("|"),ze=("active"===P?je:j).slice(0,R).map((e=>e.id)).join("|"),We=Le.every((e=>e.teamsLoaded));(0,l.useEffect)((()=>{let e=!1;return(async()=>{await N(Re?Re.split("|"):[]),!e&&ze&&await N(ze.split("|"))})(),()=>{e=!0}}),[Re,ze,N]);const Ye=ke.find((e=>e.id===E))||null,_e=async e=>{if(E!==e){var t,n;let i=ke.find((t=>t.id===e));i&&!i.sessionsLoaded&&(i=await C(e)||i),O(e);const l=i?De(i):null,s=l?Se(i).get(l):null,a=(null===(t=i)||void 0===t?void 0:t.openTeams)||[],o=a.find((e=>null===s||void 0===s?void 0:s.has(String(e.employeeId))));_(l),de((null===(n=o||a[0])||void 0===n?void 0:n.employeeId)||"")}else O(null)},Ue=(null===Ye||void 0===Ye||null===(n=Ye.openTeams)||void 0===n?void 0:n.find((e=>e.employeeId===re)))||(null===Ye||void 0===Ye||null===(o=Ye.openTeams)||void 0===o?void 0:o[0]),Ve=H?((e,t,n)=>{const i=(Array.isArray(null===e||void 0===e?void 0:e.sessions)?e.sessions:[]).filter((e=>Ne(e,n)===t));if(!i.length){const t=(Array.isArray(null===e||void 0===e?void 0:e.sessions)?e.sessions:[]).filter((e=>!(null!==e&&void 0!==e&&e.checkInDateTime)));return t[t.length-1]||null}return[...i].reverse().find((e=>(null===e||void 0===e?void 0:e.checkInDateTime)&&!(null!==e&&void 0!==e&&e.checkOutDateTime)))||i[i.length-1]})(Ue,H,Ce(Ye)):(e=>{const t=Array.isArray(null===e||void 0===e?void 0:e.sessions)?e.sessions:[];return t.length&&([...t].reverse().find((e=>(null===e||void 0===e?void 0:e.checkInDateTime)&&!(null!==e&&void 0!==e&&e.checkOutDateTime)))||t[t.length-1])||null})(Ue),qe=Ye?(0,i.A)((0,i.A)({},Ye),{},{calendarTimezone:null===Ye||void 0===Ye||null===(m=Ye.apoointmentDetails)||void 0===m?void 0:m.calendarTimezone,checkInDateTime:(null===Ve||void 0===Ve?void 0:Ve.checkInDateTime)||null,checkOutDateTime:(null===Ve||void 0===Ve?void 0:Ve.checkOutDateTime)||null,breakTimes:(null===Ve||void 0===Ve?void 0:Ve.breakTimes)||{},location:(null===Ve||void 0===Ve?void 0:Ve.location)||null,shiftend_location:(null===Ve||void 0===Ve?void 0:Ve.shiftend_location)||null,checkInUpdatedBy:null===Ve||void 0===Ve?void 0:Ve.checkInUpdatedBy,checkOutUpdatedBy:null===Ve||void 0===Ve?void 0:Ve.checkOutUpdatedBy}):null,Ke=(0,l.useMemo)((()=>{const e=Array.isArray(null===Ue||void 0===Ue?void 0:Ue.sessions)?Ue.sessions:[],t=null!==Ve&&void 0!==Ve&&Ve.id?e.filter((e=>String(e.id)!==String(Ve.id))):e;return(0,Be.zP)(t)}),[Ue,Ve]),Ze=e=>{q(e),Z(!0)};return(0,l.useEffect)((()=>{if(oe.current||b||!se)return;const e=j.find((e=>e.id===se)),t=e?null:k.find((e=>e.id===se)),n=e||t;if(n){if(oe.current=!0,le((e=>{const t=new URLSearchParams(e);return t.delete("openWorkProject"),t}),{replace:!0}),M(e?"active":"closed"),t){var i;const e=Q()(W,we).startOf("day").valueOf();(null!==(i=t.closedAtMs)&&void 0!==i?i:0)<e&&Y(Q()(t.closedAtMs||void 0).format(we))}(async(e,t)=>{let i=n;i.sessionsLoaded||(i=await C(n.id)||i),O(n.id);const l=De(i),s=l?Se(i).get(l):null,a=(null===(e=i)||void 0===e?void 0:e.openTeams)||[],o=a.find((e=>null===s||void 0===s?void 0:s.has(String(e.employeeId))));_(l),de((null===(t=o||a[0])||void 0===t?void 0:t.employeeId)||"")})()}}),[b,se,j,k,W,C,le]),(0,F.jsxs)("div",{"data-testid":"open-work-dashboard",children:[(0,F.jsxs)(r.A,{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:2,mb:2,children:[(0,F.jsxs)(d.A,{variant:"h6",className:"text-gray-900 dark:text-white",style:{fontSize:"20px",lineHeight:"28px",fontWeight:"600"},children:[(0,F.jsx)(G.A,{className:"color-lightGreen mr-10 svg-icon"}),"Daily Summary"]}),(0,F.jsxs)(r.A,{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,children:["closed"===P&&(0,F.jsxs)(r.A,{display:"flex",alignItems:"center",gap:1,"data-testid":"open-work-closed-since",children:[(0,F.jsx)(d.A,{variant:"body2",className:"text-[#475569] dark:text-[#94A3B8]",style:{fontWeight:600,whiteSpace:"nowrap"},children:"Closed since"}),(0,F.jsx)($.$,{dateAdapter:te.Y,children:(0,F.jsx)(ee.l,{format:"MMMM D, YYYY",value:Q()(W,we),onChange:e=>
1{e&&e.isValid()&&Y(e.format(we))},maxDate:Q()(),closeOnSelect:!0,reduceAnimations:!0,slotProps:{textField:{name:"closedSince",size:"small",variant:"outlined",className:"field bg-white dark:bg-[#1A1F2C] text-black dark:text-white",sx:{minWidth:180,maxWidth:220,"& .MuiOutlinedInput-root":{backgroundColor:"inherit"},"& .MuiOutlinedInput-input":{padding:"8px 12px"}}}}})})]}),(0,F.jsxs)(r.A,{className:"dark:bg-[#0F172A] dark:border-[#334155]","data-testid":"open-work-status-filter",sx:{p:"4px",borderRadius:"999px",display:"inline-flex",alignItems:"center",gap:"4px",border:"1px solid",borderColor:"rgba(148,163,184,0.35)",backgroundColor:"#F1F5F9"},children:[(0,F.jsxs)(a.A,{"data-testid":"open-work-filter-active",size:"small",variant:"text",onClick:()=>M("active"),style:{textTransform:"none",minWidth:150,borderRadius:"999px",padding:"6px 14px",fontWeight:600,border:"1px solid transparent",transition:"all 180ms ease",backgroundColor:"active"===P?"hsl(var(--primary))":"transparent",color:"active"===P?"#FFFFFF":void 0,boxShadow:"none"},className:"active"===P?"":"text-[#475569] dark:text-[#94A3B8]",children:["Active Projects (",j.length,")"]}),(0,F.jsxs)(a.A,{"data-testid":"open-work-filter-closed",size:"small",variant:"text",onClick:()=>M("closed"),style:{textTransform:"none",minWidth:150,borderRadius:"999px",padding:"6px 14px",fontWeight:600,border:"1px solid transparent",transition:"all 180ms ease",backgroundColor:"closed"===P?"hsl(var(--primary))":"transparent",color:"closed"===P?"#FFFFFF":void 0,boxShadow:"none"},className:"closed"===P?"":"text-[#475569] dark:text-[#94A3B8]",children:["Closed Projects (",je.length,")"]})]})]})]}),y,(0,F.jsxs)(h.A,{component:v.A,children:[(0,F.jsxs)(x.A,{children:[(0,F.jsx)(g.A,{children:(0,F.jsxs)(c.A,{className:"bg-[#f8fafc] dark:bg-[#1A1F2C]",children:[(0,F.jsx)(u.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Client"}),(0,F.jsx)(u.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Status"}),(0,F.jsx)(u.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Shift"}),(0,F.jsx)(u.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Start"}),(0,F.jsx)(u.A,{className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"End"}),(0,F.jsx)(u.A,{align:"right",className:"text-[#020817] dark:text-[#94A3B8] font-medium",children:"Actions"})]})}),(0,F.jsx)(f.A,{children:b&&0===ke.length||!We?Array.from({length:Math.min(R,5)}).map(((e,t)=>(0,F.jsx)(c.A,{"data-testid":"open-work-loading","aria-busy":"true",children:(0,F.jsx)(u.A,{colSpan:6,children:(0,F.jsx)(U,{variant:"rounded",height:44,animation:"wave"})})},"open-work-skeleton-".concat(t)))):0===ke.length?(0,F.jsx)(c.A,{children:(0,F.jsx)(u.A,{colSpan:6,className:"text-center text-[#64748B] dark:text-[#94A3B8]",children:"active"===P?"No active Open Work projects.":"No Open Work projects closed since ".concat(Q()(W,we).format("MMMM D, YYYY"),".")})}):Le.map((e=>{const t=E===e.id;return(0,F.jsx)(Qe,{project:e,clientsMap:be,isExpanded:t,toggleShow:_e,onOpen:Ze,onShiftChanged:()=>S(),canManageProject:D,onCloseProject:T,onLeadChanged:()=>S(),selectedDay:t?H:null,onSelectDay:_,clockState:t?{cellData:qe,checkInDateTime:ce,setCheckInDateTime:ue,checkOutDateTime:me,setCheckOutDateTime:pe,durationString:he,setDurationString:ve,breakDurationString:xe,setBreakDurationString:ge,selectedEmployeeId:re,onSelectEmployee:de,openPriorSessionsWorkedMs:Ke,onSave:()=>Ae({type:"save"}),onReset:()=>Ae({type:"reset"})}:null},e.id)}))})]}),(0,F.jsx)(Te.A,{itemsPerPage:R,onItemsPerPageChange:e=>z(e),totalItems:ke.length,page:Me,onPageChange:L})]}),"save"===(null===ye||void 0===ye?void 0:ye.type)&&(0,F.jsx)(Fe.h,{open:!0,title:"Confirm Update",message:"Are you sure you want to update? This action will update the check-in and check-out data.",onClose:()=>Ae(null),onConfirm:async()=>{Ae(null),await(async()=>{var e,t;if(!Ye||null===Ue||void 0===Ue||!Ue.employeeId)return;if(!ce&&!me)return;const n=(null===Ye||void 0===Ye||null===(e=Ye.apoointmentDetails)||void 0===e?void 0:e.calendarTimezone)||"America/Ne
1w_York",i=H||Q()((null===Ye||void 0===Ye||null===(t=Ye.apoointmentDetails)||void 0===t?void 0:t.date)||(null===Ye||void 0===Ye?void 0:Ye.appointmentDateTime)).format("YYYY-MM-DD"),l={};ce&&(l.checkInDateTime=J.Dc.fromDate(Ge(i,ce,n))),me&&(l.checkOutDateTime=J.Dc.fromDate(Ge(i,me,n)));const s=Ve,a=Boolean((null===s||void 0===s?void 0:s.id)&&(null===s||void 0===s?void 0:s.checkInDateTime)&&!(null!==s&&void 0!==s&&s.checkOutDateTime));let o=!(null!==s&&void 0!==s&&s.id);if(!o&&!a&&l.checkInDateTime&&null!==s&&void 0!==s&&s.checkOutDateTime){var r,d,c;const e="function"===typeof(null===(r=s.checkOutDateTime)||void 0===r?void 0:r.toDate)?s.checkOutDateTime.toDate():null!=(null===(d=s.checkOutDateTime)||void 0===d?void 0:d.seconds)?new Date(1e3*s.checkOutDateTime.seconds):null,t="function"===typeof(null===(c=l.checkInDateTime)||void 0===c?void 0:c.toDate)?l.checkInDateTime.toDate():null;o=Boolean(e&&t&&t.getTime()>e.getTime())}null!==s&&void 0!==s&&s.id&&!o?await(0,ae.Yd)(Ye.id,Ue.employeeId,s.id,l):await(0,ae.Hj)(Ye.id,Ue.employeeId,l),await w(Ye.id)})()}}),"reset"===(null===ye||void 0===ye?void 0:ye.type)&&(0,F.jsx)(Fe.h,{open:!0,title:"Confirm Reset",message:"This will clear and reset the existing check-in and check-out data. Are you sure you want to proceed?",onClose:()=>Ae(null),onConfirm:async()=>{Ae(null),await(async()=>{Ye&&null!==Ue&&void 0!==Ue&&Ue.employeeId&&null!==Ve&&void 0!==Ve&&Ve.id&&(await(0,ae.Yd)(Ye.id,Ue.employeeId,Ve.id,{checkInDateTime:null,checkOutDateTime:null,breakTimes:{},location:null,shiftend_location:null}),await w(Ye.id))})()}}),V&&K&&(0,F.jsx)("div",{className:"modal-overlay active",onClick:e=>{var t,n;null!==(t=e.target)&&void 0!==t&&null!==(n=t.classList)&&void 0!==n&&n.contains("modal-overlay")&&Z(!1)},children:(0,F.jsx)("div",{className:"modal-content dark:bg-[#1A1F2C]",children:(0,F.jsx)(Ie.T,{selectedAppointment:V,isMobile:!1,isLandscape:!1,clientDetails:(null===A||void 0===A?void 0:A.clients)||[],employeeDetails:(null===A||void 0===A?void 0:A.allEmp)||[],appoinments:[V],auth:A,setIsModalOpen:Z,setCancelAppt:()=>{},settingsData:void 0,alerts:void 0,onProjectStatusChange:e=>{"string"===typeof e&&q((t=>t?(0,i.A)((0,i.A)({},t),{},{projectStatus:e}):t)),S()}})})})]})}},73257:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var i=n(9950),l=n(28429),s=n(72823),a=n(26833),o=n(75491),r=n(40887),d=n(17662),c=n(305),u=n(27783),m=n(73483),p=n(44414);const h=i.memo((e=>{var t,n,h,v,x,g;let{isFreemium:f=!1}=e;const y=(0,i.useContext)(s.A),A=(0,l.Zp)(),[b,j]=(0,i.useState)([]),[k,w]=(0,i.useState)([]),[C,N]=(0,i.useState)(!1),S=localStorage.getItem("clientId"),D=localStorage.getItem("companyId"),T="Client"===(null===y||void 0===y||null===(t=y.userProfile)||void 0===t?void 0:t.role)?D||(null===y||void 0===y||null===(n=y.userProfile)||void 0===n?void 0:n.companyId):"companyUser"===(null===y||void 0===y||null===(h=y.userProfile)||void 0===h?void 0:h.role)?null===y||void 0===y||null===(v=y.userProfile)||void 0===v?void 0:v.id:null===y||void 0===y||null===(x=y.userProfile)||void 0===x?void 0:x.companyId,I=S||(null===y||void 0===y||null===(g=y.userProfile)||void 0===g?void 0:g.client),P=(0,i.useCallback)((()=>{(0,a.Sz)(T,(async e=>{var t;const n=null===e||void 0===e?void 0:e.data;if(null===n||void 0===n||!n.length)return void N(!0);N(!1);const i="Client"===(null===y||void 0===y||null===(t=y.userProfile)||void 0===t?void 0:t.role)?[I]:null===n||void 0===n?void 0:n.map((e=>null===e||void 0===e?void 0:e.id));(0,c.rj)(T,i,(e=>{var t,n;w(null===e||void 0===e?void 0:e.channels);const i=new Map;null===e||void 0===e||null===(t=e.result)||void 0===t||t.forEach((e=>{var t;null===e||void 0===e||null===(t=e.messages)||void 0===t||t.forEach((t=>{var n;const l="".concat(null===e||void 0===e?void 0:e.channelId,"_").concat(null===t||void 0===t||null===(n=t.sender)||void 0===n?void 0:n.userId),s=i.get(l);var a,o,r,d,c,m;(!s||new Date(null===t||void 0===t?void 0:t.createdOn)>new Date(null===s||void 0===s?void 0:s.createdOn))&&(null===i||void 0===i||i.set(l,{user:(0,p.jsxs)(p.Fragment,{children:[null!==(a=null===t||void 0===t||null===(o=t.sender)||void 0===o?void 0:o.firstName)&&void 0!==a?a:""," ",null!==(r=null===t||void 0===t||null===(d=t.sender)||void 0===d?void 0:d.lastName)&&void 0!==r?r:""," ","(",null!==(c=null===e||void 0===e?void 0:e.channelName)&&void 0!==c?c:"",")"]}),time:(0,u.K6)(null===t||void 0===t?void 0:t.createdOn),preview:null!==(m=null===t||void 0===t?void 0:t.message)&&void 0!==m?m:"",id:null===e||void 0===e?void 0:e.channelId}))}))}));
1const l=null===(n=Array.from(i.values()))||void 0===n?void 0:n.sort(((e,t)=>new Date(null===t||void 0===t?void 0:t.time)-new Date(null===e||void 0===e?void 0:e.time)));j(null===l||void 0===l?void 0:l.slice(0,5))}))}))}),[null===y||void 0===y?void 0:y.userProfile,T,I]);return(0,i.useEffect)((()=>{P()}),[P]),(0,p.jsx)(r.A,{icon:(0,p.jsx)(o.A,{className:d.A.iconGreen}),updates:f?[]:b,title:"Client Messages",count:0,to:"/communications/message-board/live-chat",viewAll:"/communications/message-board/live-chat",client:!f&&C,channels:k,emptyMessage:f?(0,m.IV)("Client Messages"):"Communication messages will be posted soon",showUpgradeButton:f,upgradeButtonText:"Upgrade plan",onUpgradeClick:()=>{A("/account/upgrade")}})}))},80361:(e,t,n)=>{n.r(t),n.d(t,{default:()=>j});var i=n(89379),l=n(9950),s=n(28429),a=n(66220),o=n(72823),r=n(27783),d=n(97074),c=n(87810),u=n(23693),m=n(73483),p=n(75518),h=n(40887),v=n(17662),x=n(75491),g=n(44414);const f="alertssettings",y="/account/settings/alertsPageSetting",A=e=>e?"number"===typeof e?e:null!==e&&void 0!==e&&e.seconds?e.seconds:0:0,b=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.length?[...e].sort(((e,t)=>{const n=A(null===e||void 0===e?void 0:e.updatedAt),i=A(null===t||void 0===t?void 0:t.updatedAt);if(n!==i)return i-n;const l=A(null===e||void 0===e?void 0:e.createdAt);return A(null===t||void 0===t?void 0:t.createdAt)-l}))[0]:null};function j(e){var t,n,A,j,k,w;let{isFreemium:C=!1}=e;const N=(0,s.Zp)(),S=(0,l.useContext)(o.A),[D,T]=(0,l.useState)([]),[I,P]=(0,l.useState)({}),[M,F]=(0,l.useState)(7),[E,O]=(0,l.useState)(!1),[B,L]=(0,l.useState)(!0),R=(0,l.useRef)(null),z=Array.isArray(null===S||void 0===S||null===(t=S.userProfile)||void 0===t?void 0:t.role)?S.userProfile.role.includes("Client"):"Client"===(null===S||void 0===S||null===(n=S.userProfile)||void 0===n?void 0:n.role),W="undefined"!==typeof window?localStorage.getItem("companyId"):null,Y=z?W||(null===S||void 0===S||null===(A=S.userProfile)||void 0===A?void 0:A.companyId):"companyUser"===(null===S||void 0===S||null===(j=S.userProfile)||void 0===j?void 0:j.role)?null===S||void 0===S||null===(k=S.userProfile)||void 0===k?void 0:k.id:null===S||void 0===S||null===(w=S.userProfile)||void 0===w?void 0:w.companyId,H=()=>{N("/account/upgrade")},_=()=>{N(y)},U=(0,l.useCallback)((e=>({late_check_in:"Late Check-In",no_show:"No Show",end_shift_late:"End Shift Late",no_punch_out:"No Punch Out",break_too_long:"Break Too Long"}[e]||"Shift Alert")),[]),V=(0,l.useCallback)((function(){const e={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>{const n=null===t||void 0===t?void 0:t.id;n&&(e[n]=(null===t||void 0===t?void 0:t.clientName)||(null===t||void 0===t?void 0:t.name)||"Unknown Client")}
1)),e}),[]);(0,l.useEffect)((()=>{if(C||!Y)return;const e=(0,a.rJ)(p.IN,f),t=(0,a.P)(e,(0,a._M)("companyId","==",Y),(0,a.AB)(10)),n=(0,a.aQ)(t,(e=>{const t=[];e.forEach((e=>{t.push((0,i.A)({id:e.id},e.data()))}));const n=b(t.filter((e=>!(null!==e&&void 0!==e&&e.deleted))));L(!n||!1!==n.alerts_enabled)}),(e=>{console.error("Alert settings error:",e)}));return()=>n()}),[Y,C]),(0,l.useEffect)((()=>{if(C)return;const e=Array.isArray(null===S||void 0===S?void 0:S.clients)?S.clients:[];e.length>0?P(V(e)):Y&&(0,c.yr)(Y,(e=>{const t=Array.isArray(null===e||void 0===e?void 0:e.data)?e.data:[];P(V(t))}),(()=>{P({})}),(0,i.A)({fullFetch:!0},z?{clientIds:(0,u.SE)(S)}:{}))}),[null===S||void 0===S?void 0:S.clients,V,Y,C,z]);const q=(0,l.useCallback)((e=>{const t=e.map((e=>({id:e.id,user:"".concat(e.employeeName||"Unknown"," - ").concat(U(e.type)),time:(0,r.K6)(e.createdAt||0),preview:"".concat(I[e.clientId]||"Unknown Client"," - ").concat(e.shiftName||"Unknown Shift"),appointmentId:e.appointmentId||e.apptId||e.appoinmentId||""})));T(t),O(!1)}),[I,U]),K=(0,l.useCallback)((e=>{if(E)return;const{scrollTop:t,scrollHeight:n,clientHeight:i}=e.target,l=t+i>=n-20,s=D.length>=M;l&&s&&(O(!0),F((e=>e+7)))}),[D.length,M,E]);return(0,l.useEffect)((()=>{if(C)return;const e=R.current;if(!e)return;const t=Array.from(e.querySelectorAll("*")).find((e=>e instanceof HTMLElement&&e.scrollHeight>e.clientHeight));return t?(t.addEventListener("scroll",K),()=>{t.removeEventListener("scroll",K)}):void 0}),[D.length,K,C]),(0,l.useEffect)((()=>{if(C||!B)return;if(!Y)return;const e=(0,d.Ly)(Y,q,(e=>{console.error("Error loading alerts:",e),T([]),O(!1)}),M);return()=>{e&&"function"===typeof e&&e()}}),[M,Y,q,C,B]),(0,l.useEffect)((()=>{B||(T([]),O(!1))}),[B]),C?(0,g.jsx)(h.A,{icon:(0,g.jsx)(x.A,{className:v.A.iconOrange}),updates:[],title:"Real Time Status Alerts",count:0,showViewAll:!1,showArrow:!1,isItemClickable:!1,scrollContent:!0,contentMaxHeight:"360px",emptyMessage:(0,m.IV)("Real Time Status Alerts"),showUpgradeButton:!0,upgradeButtonText:"Upgrade plan",onUpgradeClick:H}):B?(0,g.jsx)(g.Fragment,{children:(0,g.jsx)("div",{ref:R,style:{display:"flex",flexDirection:"column",height:"100%",flex:1},children:(0,g.jsx)(h.A,{icon:(0,g.jsx)(x.A,{className:v.A.iconOrange}),updates:D,title:"Real Time Status Alerts",count:(null===D||void 0===D?void 0:D.length)||0,showViewAll:!1,showArrow:!1,isItemClickable:!1,scrollContent:!0,contentMaxHeight:"360px",emptyMessage:"Real time status alerts will be posted soon."})})}):(0,g.jsx)(h.A,{icon:(0,g.jsx)(x.A,{className:v.A.iconOrange}),updates:[],title:"Real Time Status Alerts",count:0,showViewAll:!1,showArrow:!1,isItemClickable:!1,scrollContent:!0,contentMaxHeight:"360px",emptyMessage:"Real-time shift alerts are currently disabled. Open Alerts Settings to enable notifications for late check-ins, no-shows, and other shift events.",showUpgradeButton:!0,upgradeButtonText:"Open Alerts Settings",onUpgradeClick:_})}},90158:(e,t,n)=>{n.r(t),n.d(t,{default:()=>me});var i=n(9950),l=n(54742),s=n(32988),a=n(39886),o=n(95888),r=n(24910),d=n(89135),c=n(65325),u=n(17065),m=n(72500),p=n(85247),h=n(12482),v=n(98179),x=n(41277),g=n(23693),f=n(17662),y=n(59051),A=n.n(y),b=n(72823),j=n(23235),k=n(44414);const w=(0,j.A)((0,k.jsx)("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),C=e=>{var t,n,l,a,o,r,d,c;const[u,m]=(0,i.useState)(),[p,y]=(0,i.useState)(A()().format(A().HTML5_FMT.DATE)),[j,C]=(0,i.useState)(0),[N,S]=(0,i.useState)(0),D=(0,i.useContext)(b.A),T=[{label:"Today",value:"".concat(A()().format(A().HTML5_FMT.DATE))},{label:"Yesterday",value:A()().subtract(1,"days").format(A().HTML5_FMT.DATE)}],I=Array.isArray(null===D||void 0===D||null===(t=D.userProfile)||void 0===t?void 0:t.role)?D.userProfile.role.includes("Client"):"Client"===(null===D||void 0===D||null===(n=D.userProfile)||void 0===n?void 0:n.role),P=(0,i.useMemo)((()=>{var e,t;if("undefined"!==typeof window){const e=localStorage.getItem("clientId");if(e&&String(e).trim())return String(e).trim()}const n=null===D||void 0===D||null===(e=D.userProfile)||void 0===e?void 0:e.client;if("string"===typeof n&&n.trim())return n.trim();if(n&&"object"===typeof n&&null!=n.id)return String(n.id);const i=((null===D||void 0===D||null===(t=D.userProfile)||void 0===t?void 0:t.email)||"").trim().toLowerCase(),l=null===D||void 0===D?void 0:D.clients;if(!i||!Array.isArray(l))return null;const s=l.find((e=>((null===e||void 0===e?void 0:e.contact)||[]).some((e=>((null===e||void 0===e?void 0:e.email)||"").trim().toLowerCase()===i))));return null!=(null===s||void 0===s?void 0:s.id)?String(s.id):null}),[null===D||void 0===D?void 0:D.clients,null===D||void 0===D||null===(l=D.userProfile)||void 0===l?void 0:l.client,null===D||void 0===D||null===(a=D.userProfile)||void 0===a?void 0:a.email]),M="undefined"!==typeof window?localStorage.getItem("companyId"):null,F=I?M||(null===D||void 0===D||null===(o=D.userProfile)||void 0===o?void 0:o.companyId):"companyUser"===(null===D||void 0===D||null===(r=D.userProfile)||void 0===r?void 0:r.role)?null===D||void 0===D||null===(d=D.userProfile)||void 0===d?void 0:d.id:null===D||void 0===D||null===(c=D.userProfile)||void 0===c?void 0:c.companyId,E=P;return(0,i.useEffect)((()=>
1{if(!F)return;if(I&&!E)return C(0),S(0),void m(0);(async()=>{var e,t;I&&await(0,g.Db)(D).catch((()=>{}));const n=I?A()().format(A().HTML5_FMT.DATE):p,i=await(0,x.pn)(n,n,F,I?E:null),l=null===i||void 0===i||null===(e=i.appointments)||void 0===e?void 0:e.filter((e=>{var t;return(null===e||void 0===e?void 0:e.companyId)===F&&(!I||E&&String(null!==(t=null===e||void 0===e?void 0:e.clientId)&&void 0!==t?t:"")===String(E))})),s=(null===l||void 0===l?void 0:l.length)||0,a=(null===l||void 0===l||null===(t=l.filter((e=>!0===(null===e||void 0===e?void 0:e.completed))))||void 0===t?void 0:t.length)||0,o=s?a/s*100:0;C(s),S(a),m(o)})()}),[p,F,E,I]),(0,i.useEffect)((()=>{I&&y(A()().format(A().HTML5_FMT.DATE))}),[I]),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(s.A,{item:!0,xs:12,sm:7,lg:12,className:"mb-20",children:[(0,k.jsxs)("div",{className:"d-flex flex-center mb-10",children:[(0,k.jsx)(w,{style:{color:"rgba(59, 130, 246, 1)"}}),(0,k.jsx)("p",{className:"p-0 m-0 ml-10 fonthe dark:text-white",children:"Appointments"})]}),(0,k.jsx)("div",{style:{marginBottom:"10px",width:"100%",border:"1px solid #E2E8F0"}}),(0,k.jsx)(v.A,{value:p,className:"field newonr",name:"frequency",onChange:e=>(e=>{y(e.target.value)})(e),options:T,disabled:I})]}),(0,k.jsxs)("ul",{children:[(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsxs)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:["Total "," "]}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:null!==j&&void 0!==j?j:0})})]})}),(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Pending"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:(null!==j&&void 0!==j?j:0)-(null!==N&&void 0!==N?N:0)})})]})}),(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Completed"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:null!==N&&void 0!==N?N:0})})]})})]}),(0,k.jsx)(s.A,{item:!0,xs:12,sm:5,lg:12,className:"text-right mt-10",children:(0,k.jsx)(h.A,{signt:"yes",value:isNaN(u)?0:u,wrapclass:"#2b6823",title:"Progress"})})]})},N=i.memo(C);var S=n(89379),D=n(66220),T=n(75518);async function I(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const a=(0,D.rJ)(T.IN,e),o=[],r=null!=(null===s||void 0===s?void 0:s.clientId)&&""!==String(s.clientId).trim()?String(s.clientId).trim():null,d=(null===s||void 0===s?void 0:s.clientField)||"clientId";i&&o.push((0,D._M)("companyId","==",i)),r&&o.push((0,D._M)(d,"==",r)),l&&o.push((0,D.AB)(l));const c=o.length>0?(0,D.P)(a,...o):a;try{const e=(await(0,D.GG)(c)).docs.map((e=>(0,S.A)({id:e.id},e.data())));t&&t(e)}catch(u){n&&n({status:!1,error:u.message})}}var P=n(55362),M=n(74959),F=n(39324);function E(e){var t,n,l;const a=(0,i.useContext)(b.A),[o,r]=(0,i.useState)(0),[d,c]=(0,i.useState)([]),[u,m]=(0,i.useState)(0),[p,x]=(0,i.useState)(0),[g,y]=(0,i.useState)("Supplies"),A="companyUser"===(null===a||void 0===a||null===(t=a.userProfile)||void 0===t?void 0:t.role)?null===a||void 0===a||null===(n=a.userProfile)||void 0===n?void 0:n.id:null===a||void 0===a||null===(l=a.userProfile)||void 0===l?void 0:l.companyId,j=e=>{r(e)};return(0,i.useEffect)((()=>{I(P.I.SUPPLIES_ORDER,(e=>{const t=e.filter((e=>!0!==e.archive));c(t);const n=t.filter((e=>"1"===e.priority));t.length?j(100/t.length*n.length):j(0)}),(e=>{console.log("reserror",e)}),A,1e3)}),[]),(0,i.useEffect)((()=>{var e,t,n;let i=[];"Clothing"===g?i=d.filter((e=>e.supplyItems.some((e=>void 0!==e.maxNumberAllowed))&&!["Delivered","Rejected"].includes(e.status))):"Supplies"===g&&(i=d.filter((e=>e.supplyItems.every((e=>!e.hasOwnProperty("maxNumberAllowed")))&&!["Delivered","Rejected"].includes(e.status))));const l=null===(e=i)||void 0===e||null===(t=e.filter((e=>"1"===e.priority)))||void 0===t?void 0:t.length,s=null===(n=i)||void 0===n?void 0:n.length;x(l),m(s);r(s?l/s*100:0)}),[g,d]),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(s.A,{item:!0,xs:12,sm:7,lg:12,className:"mb-20",children:[(0,k.jsxs)("div",{className:"d-flex flex-center mb-10",children:[(0,k.jsx)(M.g,{size:"xl",icon:F.br3,style:{color:"#f59e0b"}}),(0,k.jsx)("p",{className:"p-0 m-0 ml-10 fonthe dark:text-white",children:"Employee Requests"})]}),(0,k.jsx)("div",{style:{marginBottom:"10px",width:"100%",border:"1px solid #E2E8F0"}}),(0,k.jsx)(v.A,{value:g,className:"field newonr",name:"status",onChange:e=>(e=>{y(e.target.value)})(e),options:[{label:"Supplies",value:"Supplies"},{label:"Clothing",value:"Clothing"}]})]}),(0,k.jsxs)("ul",{children:[(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Open Requests"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:Number.isFinite(u)?u:0})})]})}),(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Urgent Request"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:Number.isFinite(p)?p:0})})]})})]}),(0,k.jsx)(s.A,{item:!0,xs:12,sm:5,lg:12,style:{marginTop:"42px"},children:(0,k.jsx)(h.A,{signt:"yes",value:o,wrapclass:"#f9bc0a",title:"Urgent Request Ratio"})})]})}const O=i.memo(E),B=(0,j.A)((0,k.jsx)("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}),"ReportProblem");function L(){var e,t,n,l,a,o,r,d;const c=(0,i.useContext)(b.A),[u,m]=(0,i.useState)(0),[p,x]=(0,i.useState)([]),[y,j]=(0,i.useState)(0),[w,C]=(0,i.useState)(0),[N,S]=(0,i.useState)(0),[D,T]=(0,i.useState)(0),[M,F]=(0,i.useState)("Urgent"),[E,O]=(0,i.useState)("open"),[L,R]=(0,i.useState)([]),z=Array.isArray(null===c||void 0===c||null===(e=c.userProfile)||void 0===e?void 0:e.role)?c.userProfile.role.includes("Client"):"Client"===(null===c||void 0===c||null===(t=c.userProfile)||void 0===t?void 0:t.role),W=(0,i.useMemo)((()=>{var e,t;if("undefined"!==typeof window){const e=localStorage.getItem("clientId");if(e&&String(e).trim())return String(e).trim()}const n=null===c||void 0===c||null===(e=c.userProfile)||void 0===e?void 0:e.client;if("string"===typeof n&&n.trim())return n.trim();if(n&&"object"===typeof n&&null!=n.id)return String(n.id);const i=((null===c||void 0===c||null===(t=c.userProfile)||void 0===t?void 0:t.email)||"").trim().toLowerCase(),l=null===c||void 0===c?void 0:c.clients;if(!i||!Array.isArray(l))return null;const s=l.find((e=>((null===e||void 0===e?void 0:e.contact)||[]).some((e=>((null===e||void 0===e?void 0:e.email)||"").trim().toLowerCase()===i))));return null!=(null===s||void 0===s?void 0:s.id)?String(s.id):null}),[null===c||void 0===c?void 0:c.clients,null===c||void 0===c||null===(n=c.userProfile)||void 0===n?void 0:n.client,null===c||void 0===c||null===(l=c.userProfile)||void 0===l?void 0:l.email]),Y="undefined"!==typeof window?localStorage.getItem("companyId"):null,H=z?Y||(null===c||void 0===c||null===(a=c.userProfile)||void 0===a?void 0:a.companyId):"companyUser"===(null===c||void 0===c||null===(o=c.userProfile)||void 0===o?void 0:o.role)?null===c||void 0===c||null===(r=c.userProfile)||void 0===r?void 0:r.id:null===c||void 0===c||null===(d=c.userProfile)||void 0===d?void 0:d.companyId,_=W,U=(e,t)=>{var n,i,l,s;const a=A()().format(A().HTML5_FMT.DATE);let o=[];o="open"===t?null===e||void 0===e?void 0:e.filter((e=>"Closed"!==e.status)):null===e||void 0===e?void 0:e.filter((e=>"Closed"===e.status&&A()(e.updatedAt).format(A().HTML5_FMT.DATE)===a));const r=null===(n=o)||void 0===n||null===(i=n.filter((e=>"High"===e.priority)))||void 0===i?void 0:i.length,d=null===(l=o)||void 0===l||null===(s=l.filter((e=>"High"!==e.priority)))||void 0===s?void 0:s.length,c=r+d;x(o),j(r),C(d),S(c),T(r),F("Urgent");m(c>0?r/c*100:0)};return(0,i.useEffect)((()=>
1{if(!H)return;if(z&&!_)return R([]),void U([],"open");let e=!1;return(async()=>{z&&await(0,g.Db)(c).catch((()=>{})),e||I(P.I.ISSUES,(t=>{if(e)return;const n=z?null===t||void 0===t?void 0:t.filter((e=>{var t,n;return!!_&&String(null!==(t=null===e||void 0===e||null===(n=e.client)||void 0===n?void 0:n.id)&&void 0!==t?t:"")===String(_)})):t;R(n),U(n,"open")}),(t=>{e||console.log("reserror",t)}),H,100,z&&_?{clientId:_,clientField:"client.id"}:void 0)})(),()=>{e=!0}}),[H,_,z]),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(s.A,{item:!0,xs:12,sm:7,lg:12,className:"mb-20",children:[(0,k.jsxs)("div",{className:"d-flex flex-center mb-10",children:[(0,k.jsx)(B,{style:{color:"rgba(59, 130, 246, 1)"}}),(0,k.jsx)("p",{className:"p-0 m-0 ml-10 fonthe dark:text-white",children:"Issues"})]}),(0,k.jsx)("div",{style:{marginBottom:"10px",width:"100%",border:"1px solid #E2E8F0"}}),(0,k.jsx)(v.A,{value:E,className:"field newonr",name:"status",onChange:e=>(e=>{const t=e.target.value;O(t),U(L,t)})(e),options:[{label:"Open Issues",value:"open"},{label:"Closed Issues",value:"closed"}]})]}),(0,k.jsxs)("ul",{children:[(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Standard Issues"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:Number.isFinite(w)?w:0})})]})}),(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Urgent Issues"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:Number.isFinite(y)?y:0})})]})})]}),(0,k.jsx)(s.A,{item:!0,xs:12,sm:5,lg:12,className:"mt-40",children:(0,k.jsx)(h.A,{signt:"yes",value:u,wrapclass:"#2d7bf4",title:"Urgent Issue Ratio"})})]})}const R=i.memo(L),z=(0,j.A)((0,k.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2m6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1z"}),"Notifications");var W=n(28429),Y=n(27783);function H(e){var t,n,l,a,o,r,d;const c=(0,i.useContext)(b.A),u=(0,W.Zp)(),[m,p]=(0,i.useState)([]),[x,g]=(0,i.useState)([]),[y,j]=(0,i.useState)(0),[w,C]=(0,i.useState)(0),[N,S]=(0,i.useState)(0),[D,T]=(0,i.useState)(0),[M,F]=(0,i.useState)("Today"),E="companyUser"===(null===c||void 0===c||null===(t=c.userProfile)||void 0===t?void 0:t.role)?null===c||void 0===c||null===(n=c.userProfile)||void 0===n?void 0:n.id:null===c||void 0===c||null===(l=c.userProfile)||void 0===l?void 0:l.companyId,O=(null===c||void 0===c||null===(a=c.userProfile)||void 0===a?void 0:a.planAccess)||(null===c||void 0===c||null===(o=c.userProfile)||void 0===o?void 0:o.plansAccess)||(null===c||void 0===c||null===(r=c.userProfile)||void 0===r?void 0:r.planaccess),B=Boolean(null===e||void 0===e?void 0:e.hasSmsAccess)||Boolean(null===c||void 0===c||null===(d=c.userProfile)||void 0===d?void 0:d.smsEnabled)||(0,Y.zl)(O,"sms"),L=(e,t)=>{const n=A()().startOf("day");return e.filter((e=>{const i=A()(null===e||void 0===e?void 0:e.createdOn);if(!i.isValid())return!1;if("Today"===t)return i.isSame(n,"day");if("Yesterday"===t)return i.isSame(n.clone().subtract(1,"day"),"day");if("Last7Days"===t){const e=n.clone().subtract(6,"days");return i.isBetween(e,n.clone().endOf("day"),void 0,"[]")}return!1}))},R=(e,t,n)=>{const i=L(t,e),l=L(n,e),s=i.length,a=l.length,o=s+a,r=o>0?Number((s/o*100).toFixed(2)):0,d=Math.min(r,100);j(s),C(a),S(r),H(d)},H=e=>{T(e)};return i.useEffect((()=>{I(P.I.NOTIFICATIONS,(e=>{const t=e,n=null===t||void 0===t?void 0:t.filter((e=>(Array.isArray(e.Type)?e.Type:[e.Type]).includes("Email"))),i=null===t||void 0===t?void 0:t.filter((e=>{const t=Array.isArray(e.Type)?e.Type:[e.Type];return t.includes("SMS")||t.includes("Sms")||t.includes("Push")||t.includes("PushNotification")}));p(n),g(i),R("Today",n,i)}),(e=>{console.log("reserror",e)}),E,100)}),[]),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(s.A,{item:!0,xs:12,sm:7,lg:12,className:"mb-20",children:[(0,k.jsxs)("div",{className:"d-flex flex-center mb-10",children:[(0,k.jsx)(z,{style:{color:"rgba(34, 197, 94, 1)"}}),(0,k.jsx)("p",{className:"p-0 m-0 ml-10 fonthe dark:text-white",children:"Notifications"})]}),(0,k.jsx)("div",{style:{marginBottom:"10px",width:"100%",border:"1px solid #E2E8F0"}}),(0,k.jsx)(v.A,{value:M,className:"field newonr",name:"frequency",onChange:e=>(e=>{const t=e.target.value;F(t),R(t,m,x)})(e),options:[{label:"Today",value:"Today"},{label:"Yesterday",value:"Yesterday"},{label:"Last 7 Days",value:"Last7Days"}]})]}),(0,k.jsxs)("ul",{children:[(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"Email"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:(0,k.jsx)("strong",{children:Number.isFinite(y)?y:0})})]})}),(0,k.jsx)("li",{className:f.A.listItem2,children:(0,k.jsxs)(s.A,{container:!0,spacing:1,children:[(0,k.jsx)(s.A,{item:!0,xs:6,sm:9,className:"text-gray-500 dark:text-gray-100",children:"SMS"}),(0,k.jsx)(s.A,{item:!0,xs:6,sm:3,className:"text-right dark:text-[#94A3B8]",children:B?(0,k.jsx)("strong",{children:Number.isFinite(w)?w:0}):(0,k.jsx)("button",{type:"button",onClick:()=>u("/account/upgrade"),className:"text-green-600 underline font-semibold cursor-pointer bg-transparent border-0 p-0",children:"Upgrade"})})]})})]}),(0,k.jsx)(s.A,{item:!0,xs:12,sm:5,lg:12,className:"mt-40",children:(0,k.jsx)(h.A,{signt:"yes",value:Number.isFinite(D)?D:0,wrapclass:"#21b792",title:"Email / SMS Ratio (%)"})})]})}const _=i.memo(H),U=(0,j.A)((0,k.jsx)("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"}),"BarChartOutlined");var V=n(75491),q=n(33722);const K=(0,j.A)((0,k.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H6l-2 2V4h16z"}),"ChatBubbleOutline");var G=n(10783),Z=n(10029),J=n(12645);const X=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,59352)))),Q=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,69065)))),$=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,54661)))),ee=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,31279)))),te=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,73257)))),ne=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,80361)))),ie=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,28144)))),le=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,14897)))),se=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,61804)))),ae=i.lazy((()=>Promise.all([n.e(7175),n.e(2537),n.e(4700),n.e(545),n.e(3521),n.e(3642),n.e(8339),n.e(5359),n.e(1403),n.e(1034),n.e(5970),n.e(8453),n.e(7865),n.e(9977),n.e(6400),n.e(4826),n.e(3412),n.e(7052),n.e(7962)]).then(n.bind(n,11023)))),oe=()=>null,re="OVERVIEW_MODULE",de="dashboard_overview_order",ce=["appointments","empRequests","issues","notifications"],ue=(0,i.memo)((function(e){let{id:t,onMove:n,children:l,dragDisabled:s=!1}=e;const a=(0,i.useRef)(null),[,o]=(0,d.H)({accept:re,hover(e){s||e.id!==t&&n(e.id,t)}}),[{isDragging:r},u]=(0,c.i)({type:re,item:{id:t},canDrag:!s,collect:e=>({isDragging:e.isDragging()})});return s?o(a):u(o(a)),(0,k.jsx)("div",{ref:a,style:{height:"100%",opacity:r?.4:1,transition:"opacity 0.15s ease",cursor:s?"default":r?"grabbing":"grab"},children:l})})),me=e=>{var t,n,d,c,h;const[v,x]=(0,i.useState)(A()().format("YYYY-MM-DD")),g=(0,i.useContext)(b.A),f=(0,Y.i7)((null===g||void 0===g?void 0:g.userProfile)||{}),y="freemium"===(0,Y.t9)((null===g||void 0===g?void 0:g.userProfile)||{}),[j,w]=(0,i.useState)("support"),C=Array.isArray(null===g||void 0===g||null===(t=g.userProfile)||void 0===t?void 0:t.role)?g.userProfile.role.includes("Client"):"Client"===(null===g||void 0===g||null===(n=g.userProfile)||void 0===n?void 0:n.role),S=(0,q.A)("(max-width:767px)"),D=(0,q.A)("(max-width:1199px)"),T=(0,i.useMemo)((()=>{var e,t;return(null===g||void 0===g||null===(e=g.userProfile)||void 0===e?void 0:e.planName)||(null===g||void 0===g||null===(t=g.userProfile)||void 0===t?void 0:t.packageName)||f}),[null===g||void 0===g||null===(d=g.userProfile)||void 0===d?void 0:d.planName,null===g||void 0===g||null===(c=g.userProfile)||void 0===c?void 0:c.packageName,f]),[I,P]=(0,i.useState)((()=>{try{const e=localStorage.getItem(de),t=e?JSON.parse(e):null;if(Array.isArray(t)){const e=[...new Set(t)];return[...e,...ce.filter((t=>!e.includes(t)))]}return ce}catch(e){return ce}})),M=(0,i.useMemo)((()=>I.filter((e=>("appointments"===e||"issues"===e||!C)&&"failedDeliveries"!==e))),[I,C]),F=(0,i.useMemo)((()=>S?"1fr":C?"repeat(2, minmax(0, 1fr))":D?"repeat(3, minmax(0, 1fr))":"repeat(4, minmax(0, 1fr))"),[S,C,D]),E=(0,i.useMemo)((()=>S?"1fr":C?"repeat(2, minmax(0, 1fr))":"repeat(3, minmax(0, 1fr))"),[S,C]),B=(0,i.useMemo)((()=>S||C?"1fr":"repeat(3, minmax(0, 1fr))"),[S,C]),L=(0,i.useCallback)((e=>"appointments"===e?(0,k.jsx)(N,{}):"empRequests"===e?(0,k.jsx)(O,{}):"issues"===e?(0,k.jsx)(R,{}):"notifications"===e?(0,k.jsx)(_,{userPlan:T}):(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(ae,{})})),[T]),z=(0,i.useCallback)(((e,t)=>{P((n=>{const i=n.indexOf(e),l=n.indexOf(t);if(-1===i||-1===l)return n;const s=[...n];return s.splice(i,1),s.splice(l,0,e),localStorage.setItem(de,JSON.stringify(s)),s}))}),[]);return(0,i.useEffect)((()=>{var e;(0,J.sx)(J.qn.DASHBOARD_VIEW,{user_id:null===g||void 0===g||null===(e=g.userProfile)||void 0===e?void 0:e.id})}),[null===g||void 0===g||null===(h=g.userProfile)||void 0===h?void 0:h.id]),(0,k.jsx)(k.Fragment,{children:(0,k.jsxs)(l.A,{children:[(0,k.jsx)(p.A,{pageTitle:"Dashboard",showBreadcrumb:[{label:"Home",to:"/"}],showLastSeen:!0}
1),(0,k.jsxs)("div",{className:"dashBoardCustom",children:[(0,k.jsxs)("div",{"data-tour":"overview-section","data-testid":"dashboard-overview",children:[(0,k.jsx)(s.A,{container:!0,alignItems:"center",children:(0,k.jsx)(s.A,{item:!0,xs:12,sm:6,children:(0,k.jsxs)(a.A,{variant:"h6",className:"text-gray-900 dark:text-white",style:{fontSize:"20px",lineHeight:"28px",fontWeight:"600"},children:[(0,k.jsx)(U,{className:"color-lightGreen svg-icon mr-10"}),"Overview / Summary"]})})}),(0,k.jsx)(u.Q,{backend:m.t2,children:(0,k.jsx)("div",{className:"mb-40",style:{display:"grid",gridTemplateColumns:F,gap:"16px",alignItems:"stretch"},children:M.map((e=>(0,k.jsx)(ue,{id:e,onMove:z,dragDisabled:C,children:(0,k.jsx)("div",{className:"sectionBox h-stretch8 radius hover-effect dark:bg-[#1A1F2C] dark:text-white shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]",children:L(e)})},e)))})})]}),!C&&(0,k.jsx)(s.A,{container:!0,spacing:3,className:"mb-40","data-tour":"daily-summary",children:(0,k.jsx)(s.A,{item:!0,xs:12,md:12,lg:12,children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)($,{ShiftWorkPanel:X,OpenWorkPanel:Q})})})}),(0,k.jsx)(s.A,{container:!0,spacing:3,className:"mb-20",children:(0,k.jsx)(s.A,{item:!0,xs:12,md:12,lg:12,container:!0,alignItems:"center",children:(0,k.jsx)(s.A,{item:!0,xs:12,sm:6,children:(0,k.jsxs)(a.A,{variant:"h6",className:"text-gray-900 dark:text-white",style:{fontSize:"20px",lineHeight:"28px",fontWeight:"600"},children:[(0,k.jsx)(V.A,{className:"color-lightGreen mr-10 svg-icon"}),"Communication Channel"]})})})}),(0,k.jsx)(o.A,{className:"mb-10 dark:bg-[#1A1F2C] dark:text-white border border-[#e5e7eb] dark:border-0 shadow-md dark:shadow-[0_0_12px_rgba(2,8,23,0.8)]",style:{minHeight:"400px",display:"flex",flexDirection:"column"},"data-tour":"communication-messages",children:(0,k.jsx)(r.A,{className:"pb-2",style:{flex:1,display:"flex",flexDirection:"column"},children:(0,k.jsxs)(Z.tU,{defaultValue:"messages",style:{display:"flex",flexDirection:"column",flex:1},children:[(0,k.jsxs)(Z.j7,{children:[(0,k.jsxs)(Z.Xi,{value:"messages",children:[(0,k.jsx)(K,{className:"icon"}),(0,k.jsx)("span",{className:"label",children:"Messages"})]}),(0,k.jsxs)(Z.Xi,{value:"support",children:[(0,k.jsx)(G.A,{className:"icon"}),(0,k.jsx)("span",{className:"label",children:"Support"})]})]}),(0,k.jsx)(Z.av,{value:"messages",style:{flex:1,display:"flex",flexDirection:"column"},children:(0,k.jsxs)("div",{style:{display:"grid",gridTemplateColumns:E,gap:"16px",alignItems:"stretch",flex:1},children:[(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(ee,{})})}),(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(te,{isFreemium:y})})}),!C&&(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(ne,{isFreemium:y})})})]})}),(0,k.jsx)(Z.av,{value:"support",style:{flex:1,display:"flex",flexDirection:"column"},children:(0,k.jsxs)("div",{style:{display:"grid",gridTemplateColumns:B,gap:"16px",alignItems:"stretch",flex:1},children:[(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(ie,{})})}),!C&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(le,{isFreemium:y})})}),(0,k.jsx)("div",{style:{display:"flex",flexDirection:"column",minHeight:"300px"},children:(0,k.jsx)(i.Suspense,{fallback:(0,k.jsx)(oe,{}),children:(0,k.jsx)(se,{isFreemium:y})})})]})]})})]})})})]})]})})}},97074:(e,t,n)=>{n.d(t,{Ly:()=>o,eA:()=>r});var i=n(89379),l=n(75518),s=n(66220),a=n(55362);function o(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;try{const o=(0,s.rJ)(l.IN,"alertHistory"),r=[];e&&r.push((0,s._M)("companyId","==",e)),r.push((0,s.My)("createdAt","desc")),r.push((0,s.AB)(a));const d=(0,s.P)(o,...r);return(0,s.aQ)(d,(e=>{const n=e.docs.map((e=>(0,i.A)({id:e.id},e.data())));t&&t(n)}),(e=>{console.error("Realtime alerts listener error:",e),n&&n(e)}))}catch(o){return console.error("Error setting up realtime alerts listener:",o),n&&n(o),()=>{}}}async function r(e,t){const n=(0,s.P)((0,s.rJ)(l.IN,a.I.ALERT),(0,s.My)("createdOn","desc"));try{const t=await(0,s.GG)(n);let l=[];t.forEach((e=>{let t=e.data();l.push((0,i.A)({id:e.id},t))})),e&&e(l)}catch(o){console.error("Error getting documents: ",o),t&&t(o)}}}}]);
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.