(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8026],{91015:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard",function(){return s(45111)}])},45111:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return eg}});var n=s(85893),a=s(67294);s(98025);var r=s(39828),l=s(20238),i=s(27388),o=s(41664),d=s.n(o),c=s(11483),h=s(16742),m=s.n(h),u=s(91259);let p=()=>{let[e,t]=(0,a.useState)(),s=(0,c.Xs)("userCompanyName"),[o,h]=(0,a.useState)(!0),u=(0,c.th)(s),p=(0,c.ky)("scorecard-criteria","scorecard-criteria-doc");return(u&&(0,c.Ni)(u,p),(0,a.useEffect)(()=>{let e=async()=>{if(s){let e=(0,r.JU)(l.db,"co-my-clients",s),n=await (0,r.QT)(e).then(e=>e).catch(e=>console.log(e));n.exists()&&t(n.data()),h(!1)}};e()},[s]),o)?(0,n.jsx)("h3",{children:"Loading..."}):o?o?void 0:(0,n.jsx)(n.Fragment,{}):(0,n.jsx)("div",{style:{paddingBottom:"20px",borderRadius:"10"},className:"dashboardCoChild",children:(0,n.jsx)(d(),{href:"/dashboard/scorecard/Prestige Commercial",children:(0,n.jsx)(i.Z,{children:(0,n.jsxs)("div",{className:m().scorecard,style:{marginBottom:"15px"},children:[(0,n.jsx)("span",{children:(0,n.jsx)("b",{children:"Prestige Commercial:"})}),(0,n.jsxs)("span",{style:{float:"right",color:"#1189dd"},children:["Score: ",(0,n.jsx)("br",{}),(0,n.jsxs)("b",{children:[u?Math.round(u.overallScore):"Score Not Calculated","%"]})]}),(0,n.jsx)("p",{children:"See full scorecard"})]})})})})};var x=s(25675),g=s.n(x);let j=e=>{let t=e.companyName,[s,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),[h,m]=(0,a.useState)(""),[u,x]=(0,a.useState)([]);return(0,a.useEffect)(()=>{if(t){let e=async()=>{if(t){let e=(0,r.JU)(l.db,"co-my-clients",t),s=await (0,r.QT)(e),n=[];for(let e in s.data())n.push(s.data()[e]);x(n)}},s=async()=>{let e=(0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("company","==",t)),s=await (0,r.PL)(e),n=s.docs.map(e=>({id:e.id,...e.data()})),a=n.length;o(a)},n=async e=>{let s=(0,r.JU)(l.db,"toDoList",t);try{let e=await (0,r.QT)(s);if(e.exists()){let t=e.data().companyToDoList,s=t.filter(e=>!0===e.show);m(s.length);let n=s.filter(e=>"Approved"===e.status);c(n)}}catch(e){console.log("Error retrieving data: "+e)}};e(),s(),n()}},[t]),(0,n.jsx)("div",{className:"dashboardCoChild",children:(0,n.jsxs)(i.Z,{children:[(0,n.jsx)("h5",{style:{padding:"0 0 0 1.25rem"},children:"Client:"}),(0,n.jsx)("hr",{style:{margin:"0 0 0 1.25rem"}}),(0,n.jsxs)("div",{className:"statRow",children:[(0,n.jsx)(p,{companyData:e.userCompany}),(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:s||"..."}),(0,n.jsx)("p",{children:"Active Employee Profiles"})]}),(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:d?h-d.length:"..."}),(0,n.jsx)("p",{children:"Incomplete Tasks"})]})]})]})})};var f={src:"/_next/static/media/gr-checkmark.dd7f9464.png",height:512,width:512,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAHlBMVEVrzB5MaXFpzB1pyh5pyR5qzh1pyh1ryR9xxhxqzR43yFZdAAAACnRSTlOcAB6lOit5OQldPvAyCAAAAAlwSFlzAAALEwAACxMBAJqcGAAAADJJREFUeJxFy7kRwCAQwEDpPqD/hhnGgbMNJFwAJZWhkQWtcRpwy/gwOT5EjzZ//O3LCxS/AJRCGmOYAAAAAElFTkSuQmCC",blurWidth:8,blurHeight:8},v={src:"/_next/static/media/exclamation.d3db5bf6.png",height:512,width:512,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAGFBMVEVMaXH7MTD/MzP8MTD4Ly/2Ly/2MS74Ly9SyTbTAAAACHRSTlMAiQXMUjtddbABAhsAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAgSURBVHicY2BgYGBhZYAAZkYGJkIMdhYogxHGYANpBwAIegBB7K/CgAAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},y={src:"/_next/static/media/denied.8808b062.png",height:512,width:512,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAJ1BMVEX5MS70MC5MaXH7MjD6MS/3Lyr5MSz4MC/6Mi/4MC75MTD4MC75Mi/I8NmkAAAADXRSTlPtFwCzTS8zgvnBvtG3Vff3pAAAAAlwSFlzAAALEwAACxMBAJqcGAAAADZJREFUeJwFwYkBwCAMA7Gz8wLdf95KuA98ZZqRYos7dr4IkHNTgHLTgoiX9lxqQxoa1wen/QMkkAEDhFCmJwAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},A={src:"/_next/static/media/pending.f4dfbe94.png",height:512,width:512,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAFVBMVEX9gC36gC5MaXH9gC/7ei/+hC7/fwDW38WvAAAAB3RSTlOaPQApG1gC9x3NDAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAC9JREFUeJw1i8ENAEEQglDH7b/ki4/7kQBYADLikkMQtw5gd2Zw7SB+b0qcvfjfPxCFAHXgWYYoAAAAAElFTkSuQmCC",blurWidth:8,blurHeight:8};let b=e=>{let t=sessionStorage.getItem("userCompanyName"),[s,o]=(0,a.useState)(),[c,h]=(0,a.useState)(!1),[m,u]=(0,a.useState)(!1),[p,x]=(0,a.useState)(!0),[j,b]=(0,a.useState)(!0);(0,a.useEffect)(()=>{if(t){let e=async e=>{let s=(0,r.JU)(l.db,"toDoList",t);try{let e=await (0,r.QT)(s);e.exists()&&(o(e.data().companyToDoList),b(!1))}catch(e){console.log("Error retrieving data: "+e)}};e()}},[t]);let C=()=>{x(!0),h(!1),u(!1)},w=()=>{x(!1),h(!1),u(!0)},N=()=>{x(!1),h(!0),u(!1)};if(s)return(0,n.jsx)("div",{className:"dashboardCoChild",children:(0,n.jsxs)(i.Z,{children:[(0,n.jsx)("h5",{children:"Your Task List:"}),(0,n.jsx)("hr",{}),(0,n.jsx)("span",{children:(0,n.jsx)("button",{type:"button",className:"toDoButton",onClick:N,style:{marginLeft:"15px"},children:(0,n.jsx)("p",{children:"Complete Items"})})}),(0,n.jsx)("span",{children:(0,n.jsx)("button",{type:"button",className:"toDoButton",onClick:w,style:{marginLeft:"15px"},children:(0,n.jsx)("p",{children:"Incomplete Items"})})}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button",className:"toDoButton",onClick:C,style:{marginLeft:"15px"},children:(0,n.jsx)("p",{children:"Show All items"})}),"(",s.length,")"]}),(0,n.jsx)("hr",{}),(0,n.jsx)("div",{className:"vertical_scroll_custom",children:s.map(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return m&&e.show?(0,n.jsxs)("div",{children:["Incomplete"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)(d(),{href:e.link,children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:v,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})})},e.title):null,"Denied"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)(d(),{href:e.link,children:(0,n.jsxs)("div",{className:"toDoCard",children:[(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:y,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("hr",{}),(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Reason for denial:"})," ",e.csNotes]})]})]})})},e.title):null,"Pending"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:A,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})},e.title):null]},e.title):c&&e.show?(0,n.jsx)("div",{children:"Approved"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:"Approved"==e.status?(0,n.jsx)(g(),{src:f,alt:"Good to go",width:40,height:40}):(0,n.jsx)(g(),{src:v,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})}):null},e.title):p&&e.show?(0,n.jsxs)("div",{children:["Approved"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsxs)("div",{className:"todoComlumnContain",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:"Approved"==e.status?(0,n.jsx)(g(),{src:f,alt:"Good to go",width:40,height:40}):(0,n.jsx)(g(),{src:v,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("span",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})}):null,"Incomplete"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)(d(),{href:e.link,children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:v,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})})},e.title):null,"Denied"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)(d(),{href:e.link,children:(0,n.jsxs)("div",{className:"toDoCard",children:[(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:y,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("hr",{}),(0,n.jsxs)("p",{children:[(0,n.jsx)("strong",{children:"Reason for denial:"})," ",e.csNotes]})]})]})})},e.title):null,"Pending"==e.status?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"toDoCard",children:(0,n.jsxs)("div",{className:"toDoRow",children:[(0,n.jsx)("div",{className:"toDoColumnA",children:(0,n.jsx)(g(),{src:A,alt:"needs work",width:40,height:40})}),(0,n.jsxs)("div",{className:"toDoColumnB",children:[(0,n.jsx)("h6",{children:e.title}),(0,n.jsx)("p",{children:e.description})]}),(0,n.jsx)("div",{className:"toDoColumnC",children:(0,n.jsxs)("p",{children:["Status: ",(0,n.jsx)("strong",{children:e.status})]})})]})})},e.title):null]},e.title):void 0})})]})})};var C=s(66367),w=s(42896),N=s(58650),S=s(59100);function E(){let[e,t]=(0,a.useState)([]),[s,o]=(0,a.useState)({companyContactLastname:{value:null,matchMode:C.a6.STARTS_WITH},companyContactFirstname:{value:null,matchMode:C.a6.STARTS_WITH},companyEmail:{value:null,matchMode:C.a6.STARTS_WITH},roleName:{value:null,matchMode:C.a6.STARTS_WITH},company:{value:null,matchMode:C.a6.STARTS_WITH}}),[d,c]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=sessionStorage.getItem("userCompanyName"),s=async()=>{try{let s=await (0,r.PL)((0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("company","==",e))),n=s.docs.map(e=>({id:e.id,...e.data()}));t(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};s()},[]),(0,n.jsx)("div",{className:"dashboardCoChild",children:(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)("h5",{children:["Active Employees registered: ",e.length]}),(0,n.jsx)("hr",{}),(0,n.jsx)("div",{className:"dashboardCoChild",children:(0,n.jsxs)(w.w,{value:e,paginator:!0,rows:10,dataKey:"id",filters:s,showGridlines:!0,filterDisplay:"row",loading:d,emptyMessage:"Loading Users...",sortField:"companyEmail",sortOrder:1,children:[(0,n.jsx)(N.s,{field:"companyEmail",header:"User email",filter:!0,sortable:!0,filterPlaceholder:"Search",style:{maxWidth:"13rem"}}),(0,n.jsx)(N.s,{field:"companyContactFirstname",header:"firstname",filter:!0,sortable:!0,filterPlaceholder:"?",style:{maxWidth:"8rem"}}),(0,n.jsx)(N.s,{field:"companyContactLastname",header:"lastname",filter:!0,sortable:!0,filterPlaceholder:"?",style:{maxWidth:"8rem"}}),(0,n.jsx)(N.s,{field:"ui1",header:"Update",body:e=>(0,n.jsx)(S.Z,{compData:e}),style:{maxWidth:"10rem"}})]})})]})})}function T(e){return(0,n.jsxs)("div",{className:"dashboardCoRow",children:[(0,n.jsxs)("div",{className:"dashboardCoColumn",children:[(0,n.jsx)(j,{companyName:e.userCompany}),(0,n.jsx)(E,{})]}),(0,n.jsx)("div",{className:"dashboardCoColumn",children:(0,n.jsx)(b,{userCompany:e.userCompany})})]})}var R=s(43964),D=s(91444),O=s(65779),I=s.n(O);function P(){let[e,t]=(0,a.useState)(!1),[s,i]=(0,a.useState)([]),[o,d]=(0,a.useState)(""),[c,h]=(0,a.useState)(""),[m,u]=(0,a.useState)(""),[p,x]=(0,a.useState)("");return((0,a.useEffect)(()=>{let e=async()=>{try{let e=(0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("roleName","==","Contractor")),t=await (0,r.PL)(e),s=t.docs.map(e=>({id:e.id,...e.data()}));i(s);let n=s.length;d(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};e()},[]),(0,a.useEffect)(()=>{let e=async()=>{try{let e=(0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("roleName","==","Client")),t=await (0,r.PL)(e),s=t.docs.map(e=>({id:e.id,...e.data()})),n=s.length;h(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};e()},[]),(0,a.useEffect)(()=>{let e=async()=>{try{let e=(0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("roleName","==","Admin")),t=await (0,r.PL)(e),s=t.docs.map(e=>({id:e.id,...e.data()})),n=s.length;u(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};e()},[]),(0,a.useEffect)(()=>{let e=async()=>{try{let e=(0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("roleName","==","CS")),t=await (0,r.PL)(e),s=t.docs.map(e=>({id:e.id,...e.data()})),n=s.length;x(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};e()},[]),e)?(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"70vh"},children:[(0,n.jsx)("div",{children:(0,n.jsx)(I(),{height:100,width:12,color:"#1289dd"})}),(0,n.jsx)("br",{}),(0,n.jsx)("div",{})]}):e?void 0:(0,n.jsxs)("div",{children:[(0,n.jsx)(D.Ix,{}),(0,n.jsx)("h2",{children:"ADMINISTRATION "}),(0,n.jsx)(R.s,{header:"System Overview",toggleable:!0,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{children:"Users registered in system:"}),(0,n.jsx)("hr",{}),(0,n.jsxs)("h5",{children:["Admins: ",m]}),(0,n.jsxs)("h5",{children:["Customer Service: ",p]}),(0,n.jsxs)("h5",{children:["Clients: ",c]}),(0,n.jsxs)("h5",{children:["Contractors: ",o]})]})})]})}var k=s(13308),B=s(13643),M=s(23652).V.extend({defaultProps:{__TYPE:"Chart",id:null,type:null,data:null,options:null,plugins:null,width:null,height:null,style:null,className:null,children:void 0}}),F=function(){try{return Chart}catch(e){return null}}(),z=a.memo(a.forwardRef(function(e,t){var n=a.useContext(C.Ou),r=M.getProps(e,n),l=M.setMetaData({props:r}).ptm,i=a.useRef(null),o=a.useRef(null),d=a.useRef(null),c=function(){h();var e={type:r.type,data:r.data,options:r.options,plugins:r.plugins};F?o.current=new F(d.current,e):Promise.all([s.e(2196),s.e(5555)]).then(s.bind(s,9085)).then(function(t){h(),d.current&&t&&(t.default?o.current=new t.default(d.current,e):o.current=new t(d.current,e))})},h=function(){o.current&&(o.current.destroy(),o.current=null)};a.useImperativeHandle(t,function(){return{props:r,getCanvas:function(){return d.current},getChart:function(){return o.current},getBase64Image:function(){return o.current.toBase64Image()},getElement:function(){return i.current},generateLegend:function(){return o.current&&o.current.generateLegend()},refresh:function(){return o.current&&o.current.update()}}}),a.useEffect(function(){c()}),(0,k.zq)(function(){h()});var m=(0,B.AK)("p-chart",r.className),u=Object.assign({width:r.width,height:r.height},r.style),p=r.options&&r.options.plugins&&r.options.plugins.title&&r.options.plugins.title.text,x=r.ariaLabel||p,g=(0,B.dG)({id:r.id,ref:i,style:u,className:m},M.getOtherProps(r),l("root")),j=(0,B.dG)({ref:d,width:r.width,height:r.height,role:"img","aria-label":x},l("canvas"));return a.createElement("div",g,a.createElement("canvas",j))}),function(e,t){return e.data===t.data&&e.options===t.options&&e.type===t.type});z.displayName="Chart";var L=s(99403),U=s(57858),J=s(6094);let V=async(e,t)=>{let s={subject:"Please join us on the JJ Safety LLC VCMS.",text:e+" has invited you to the JJ Safety LLC VCMS!",html:'<!doctype html>\n<html lang="en">\n  <head>\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n    <title>Invitation to Join JJ Safety LLC VCMS</title>\n    <style media="all" type="text/css">\n    /* -------------------------------------\n    GLOBAL RESETS\n    ------------------------------------- */\n    body {\n      font-family: Helvetica, sans-serif;\n      -webkit-font-smoothing: antialiased;\n      font-size: 16px;\n      line-height: 1.3;\n      -ms-text-size-adjust: 100%;\n      -webkit-text-size-adjust: 100%;\n      background-color: #f4f5f6;\n      margin: 0;\n      padding: 0;\n    }\n\n    table {\n      border-collapse: separate;\n      mso-table-lspace: 0pt;\n      mso-table-rspace: 0pt;\n      width: 100%;\n    }\n\n    table td {\n      font-family: Helvetica, sans-serif;\n      font-size: 16px;\n      vertical-align: top;\n    }\n\n    .container {\n      margin: 0 auto !important;\n      max-width: 800px;\n      padding: 0;\n      padding-top: 24px;\n      width: 800px;\n    }\n\n    .content {\n      box-sizing: border-box;\n      display: block;\n      margin: 0 auto;\n      max-width: 600px;\n      padding: 0;\n    }\n\n    .main {\n      background: #ffffff;\n      border: 1px solid #eaebed;\n      border-radius: 16px;\n      width: 100%;\n    }\n\n    .wrapper {\n      box-sizing: border-box;\n      padding: 24px;\n    }\n\n    .footer {\n      clear: both;\n      padding-top: 24px;\n      text-align: center;\n      width: 100%;\n    }\n\n    .footer td,\n    .footer p,\n    .footer span,\n    .footer a {\n      color: #9a9ea6;\n      font-size: 16px;\n      text-align: center;\n    }\n\n    p {\n      font-family: Helvetica, sans-serif;\n      font-size: 22px;\n      font-weight: normal;\n      margin: 0;\n      margin-bottom: 26px;\n    }\n\n    a {\n      color: #0867ec;\n      text-decoration: underline;\n    }\n\n    .registerButton {\n      background-color: #005ea4;\n      color: white !important;\n      padding: 14px 25px;\n      text-align: center;\n      text-decoration: none;\n      display: inline-block;\n      margin: 20px 0px 40px 0px;\n      border-radius: 10px;\n    }\n\n    a:hover, a:active {\n      background-color: #09436d;\n    }\n\n    .align-center {\n      text-align: center;\n    }\n\n    @media only screen and (max-width: 640px) {\n      .main p,\n      .main td,\n      .main span {\n        font-size: 16px !important;\n      }\n      .wrapper {\n        padding: 8px !important;\n      }\n      .content {\n        padding: 0 !important;\n      }\n      .container {\n        padding: 0 !important;\n        padding-top: 8px !important;\n        width: 100% !important;\n      }\n      .main {\n        border-left-width: 0 !important;\n        border-radius: 0 !important;\n        border-right-width: 0 !important;\n      }\n      .btn a {\n        font-size: 16px !important;\n        max-width: 100% !important;\n        width: 100% !important;\n      }\n    }\n\n    @media all {\n      .ExternalClass {\n        width: 100%;\n      }\n      .ExternalClass,\n      .ExternalClass p,\n      .ExternalClass span,\n      .ExternalClass font,\n      .ExternalClass td,\n      .ExternalClass div {\n        line-height: 100%;\n      }\n      .apple-link a {\n        color: inherit !important;\n        font-family: inherit !important;\n        font-size: inherit !important;\n        font-weight: inherit !important;\n        line-height: inherit !important;\n        text-decoration: none !important;\n      }\n      #MessageViewBody a {\n        color: inherit;\n        text-decoration: none;\n        font-size: inherit;\n        font-family: inherit;\n        font-weight: inherit;\n        line-height: inherit;\n      }\n    }\n    </style>\n  </head>\n  <body>\n    <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">\n      <tr>\n        <td>&nbsp;</td>\n        <td class="container">\n          <div class="content">\n\n            <!-- START CENTERED WHITE CONTAINER -->\n            \n            <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="main">\n\n              <!-- START MAIN CONTENT AREA -->\n              <tr>\n                <td class="wrapper">\n                  <img src="https://jjsafetyllc.com/wp-content/uploads/2023/12/VCMS-logo.png" alt="VCMS Logo" width="250" height="80">\n                  \n                  <p>Hello,</p>\n                  <p><strong>'+e+" </strong> has invited you to join their account on the JJ Safety LLC VCMS platform.</p>\n                  <p>To get started, please create your own account. This account will be linked to <strong>"+e+'</strong>’s parent account, giving you access to all the tools and resources available on our platform.</p>\n                  <p>Click the button below to register:</p>\n\n                  <div class="align-center">\n                    <a class="registerButton" href="https://www.jjvcms.app/register/?invited=true&client='.concat(e,'" target="_blank">Create Your Account</a>\n                  </div>\n                </td>\n              </tr>\n\n              <!-- END MAIN CONTENT AREA -->\n              </table>\n\n            <!-- START FOOTER -->\n            <div class="footer">\n              <table role="presentation" border="0" cellpadding="0" cellspacing="0">\n                <tr>\n                  <td class="content-block">\n                    <span class="apple-link">JJ Safety LLC, 2918 S Alma School Rd, Mesa, AZ 85210</span>\n                  </td>\n                </tr>\n                <tr>\n                  <td class="content-block powered-by">\n                    For support call: (602) 491-9324\n                  </td>\n                </tr>\n              </table>\n            </div>\n            <!-- END FOOTER -->\n\n          </div>\n        </td>\n        <td>&nbsp;</td>\n      </tr>\n    </table>\n  </body>\n</html>\n')};[{email:t}].forEach(e=>{(0,r.ET)((0,r.hJ)(l.db,"mail"),{message:s,to:e.email})})};var _=s(74420);let H=e=>{let{company:t,toggleAContractor:s}=e,[r,l]=(0,a.useState)(""),i=(0,a.useRef)(),o=e=>{var t;let s=null==e?void 0:null===(t=e.target)||void 0===t?void 0:t.value;l(s)},d=e=>{e.preventDefault(),c(),V(t,r),l(""),setTimeout(()=>{s()},1e3)},c=()=>{var e;null==i||null===(e=i.current)||void 0===e||e.show({severity:"success",summary:"Success",detail:"Email Sent!"})};return(0,n.jsxs)("div",{children:[(0,n.jsx)(_.F,{ref:i}),(0,n.jsx)("h4",{children:"Invite a contractor to: "}),(0,n.jsx)("h2",{children:t}),(0,n.jsx)("hr",{}),(0,n.jsxs)("form",{id:"AddContractor",style:{marginTop:"5%"},onSubmit:d,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"email",children:"Email (who you are inviting)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"email",type:"email",onChange:e=>o(e),required:!0})})]}),(0,n.jsx)(L.z,{style:{float:"right",marginTop:"15px"},children:"Invite"})]})]})};var W=s(65090);let q=e=>{let t=e.userCompany,[s,o]=(0,a.useState)(!1),[d,h]=(0,a.useState)([]),[m,u]=(0,a.useState)({}),[p,x]=(0,a.useState)({}),[g,j]=(0,a.useState)({}),[f,v]=(0,a.useState)({}),[y,A]=(0,a.useState)({});(0,c.Xs)("path");let{roleState:b}=(0,W.V_)();(0,a.useEffect)(()=>{let e=getComputedStyle(document.documentElement),t=async()=>{try{let t=await (0,r.PL)((0,r.IO)((0,r.hJ)(l.db,"companies"),(0,r.ar)("companyType.code","==","co"))),s=t.docs.map(e=>({id:e.id,...e.data()}));h(s);let n=w(s),a=n.length,i=N(s),o=i.length,d=S(s),c=d.length,m=T(s),p=m.length,g=E(s),f=g.length,y=R(s),A=y.length,b=D(s),C=b.length,P=O(s),k=P.length,B=I(s),M=B.length,F={labels:["Passing","Needs work","Not Passing"],datasets:[{data:[a,o,c],backgroundColor:[e.getPropertyValue("--green-500"),e.getPropertyValue("--yellow-500"),e.getPropertyValue("--red-500")],hoverBackgroundColor:[e.getPropertyValue("--green-400"),e.getPropertyValue("--yellow-400"),e.getPropertyValue("--red-400")]}]},z={labels:["Below 3.0 TRIR","Above 3.0 TRIR"],datasets:[{data:[p,f],backgroundColor:[e.getPropertyValue("--green-500"),e.getPropertyValue("--red-500")],hoverBackgroundColor:[e.getPropertyValue("--green-400"),e.getPropertyValue("--red-400")]}]},L={labels:["Below 1.0 EMR","Above 1.0 EMR"],datasets:[{data:[A,C],backgroundColor:[e.getPropertyValue("--green-500"),e.getPropertyValue("--red-500")],hoverBackgroundColor:[e.getPropertyValue("--green-400"),e.getPropertyValue("--red-400")]}]},U={labels:["No regulatory citations","Has citations"],datasets:[{data:[k,M],backgroundColor:[e.getPropertyValue("--green-500"),e.getPropertyValue("--red-500")],hoverBackgroundColor:[e.getPropertyValue("--green-400"),e.getPropertyValue("--red-400")]}]};u(F),x(z),j(L),v(U)}catch(e){console.error("Error fetching Firestore collection:",e)}};t(),A({plugins:{legend:{labels:{usePointStyle:!0}}}})},[]);let C=e=>{o(e)},w=e=>e.filter(e=>e.safetyScore>=80),N=e=>e.filter(e=>e.safetyScore>=70&&e.safetyScore<80),S=e=>e.filter(e=>e.safetyScore<70||null==e.safetyScore),E=e=>e.filter(e=>e.TRIR3Year>=3||null==e.TRIR3Year),T=e=>e.filter(e=>e.TRIR3Year<=3),R=e=>e.filter(e=>e.currentEMR<1),D=e=>e.filter(e=>e.currentEMR>=1||null==e.currentEMR),O=e=>e.filter(e=>"No"===e.regulatoryCitations||null==e.regulatoryCitations),I=e=>e.filter(e=>"Yes"===e.regulatoryCitations);return(0,n.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column"},children:[(0,n.jsxs)("div",{style:{width:"100%"},children:[" ",(0,n.jsxs)("h4",{style:{float:"left"},children:["Total Contractors:"," ",(0,n.jsx)("span",{style:{color:"#0a436d",fontSize:"34px",paddingLeft:"20px"},children:d&&d.length})]}),5003==b?(0,n.jsx)(L.z,{icon:"pi pi-plus",style:{float:"right"},onClick:()=>C(!0),children:(0,n.jsx)("span",{style:{padding:"0px 0px 0px 10px"},children:"Invite Contractor"})}):""]}),(0,n.jsx)("hr",{})]}),(0,n.jsxs)("div",{className:"statRow",children:[(0,n.jsx)("h4",{className:"m-0 p-0 w-max",children:"Overall Statistics:"}),(0,n.jsxs)("div",{className:"flex flex-wrap graphContainer",children:[(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:"Safety Scores:"}),(0,n.jsx)("div",{className:"chartColumns",children:(0,n.jsx)(z,{type:"pie",data:m&&m,options:y,className:"w-full md:w-20rem sm:w-10rem",pt:{root:{className:"sm:w-20rem"}}})})]}),(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:"TRIR 3 year averages:"}),(0,n.jsx)("div",{className:"chartColumns",children:(0,n.jsx)(z,{type:"pie",data:p&&p,options:y,className:"w-full md:w-20rem sm:w-10rem",pt:{root:{className:"sm:w-20rem"}}})})]}),(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:"Contractor EMR scores:"}),(0,n.jsx)("div",{className:"chartColumns",children:(0,n.jsx)(z,{type:"pie",data:g&&g,options:y,className:"w-full md:w-20rem sm:w-10rem",pt:{root:{className:"sm:w-20rem"}}})})]}),(0,n.jsxs)("div",{className:"statColumn",children:[(0,n.jsx)("h5",{children:"Contractors with citations:"}),(0,n.jsx)("div",{className:"chartColumns",children:(0,n.jsx)(z,{type:"pie",data:f&&f,options:y,className:"w-full md:w-20rem sm:w-10rem",pt:{root:{className:"sm:w-20rem"}}})})]})]})]})]}),(0,n.jsx)(U.V,{visible:s,className:"clientEmployeeUpdateCard",onHide:()=>C(!1),children:(0,n.jsx)(H,{company:t,toggleAContractor:C})})]})};function G(e){return(0,n.jsx)("div",{style:{paddingBottom:"20px"},children:(0,n.jsx)("div",{className:"hcDashboardCoRow",children:(0,n.jsx)("div",{className:"hcDashboardCoColumn",children:(0,n.jsx)(q,{userCompany:e.userCompany})})})})}var Q=s(56845),Z=s(36928),Y=s(11163),X=s(4427),K=s(78927),$=s(57074),ee=s(12519),et=s(43540);let es=e=>{let[t,s]=(0,a.useState)(),[i,o]=(0,a.useState)(0),[d,h]=(0,a.useState)(),m=(0,a.useRef)(null),u=(0,a.useRef)(null),p=(0,a.useRef)(),x=(0,c.Xs)("userCompanyName"),g=(0,c.Xs)("userEmail"),j=(0,c.Kx)(e.collectionName.replace(/ /g,"-")),f=(0,Y.useRouter)(),v=[];j&&j.map(e=>{e.user===g&&v.push(e)}),(0,a.useEffect)(()=>{let e=async()=>{if(t){let e=new Z.Z;for(let s of t)await e.add(s);await e.setMetadata({producer:"pdf-merger-js based script"});let s=await e.saveAsBlob();await e.saveAsBuffer();let n=URL.createObjectURL(s);return h({url:n,documentBlob:s})}};e().catch(e=>{throw e})},[t,h]);let y=e=>{setTimeout(()=>{s(m.current.getFiles())},1e3)},A=(e,t)=>{o(i-e.size),t()},b=()=>{o(0),console.log("function ran",i)},C=e=>{let{className:s,chooseButton:r,uploadButton:l,cancelButton:o}=e,d=m&&m.current?m.current.formatSize(i):"0 B";return(0,n.jsxs)(a.Fragment,{children:[(0,n.jsx)("p",{children:"multiple documents will be combined into a single document upon upload"}),(0,n.jsxs)("div",{className:s,style:{backgroundColor:"transparent",display:"flex",alignItems:"center"},children:[r,o,(0,n.jsx)(L.z,{ref:p,disabled:!t,onClick:T,children:"Upload"}),(0,n.jsxs)("div",{className:"flex align-items-center gap-3 ml-auto",children:[(0,n.jsxs)("span",{children:[d," / 1 MB"]}),(0,n.jsx)(K.k,{value:i/1e4,showValue:!1,style:{width:"10rem",height:"12px"}})]})]})]})},S=(e,t)=>(0,n.jsxs)("div",{className:"flex align-items-center flex-wrap",children:[(0,n.jsxs)("div",{className:"flex align-items-center",style:{width:"40%"},children:[(0,n.jsx)("iframe",{alt:e.name,role:"presentation",src:e.url,width:100}),(0,n.jsxs)("span",{className:"flex flex-column text-left ml-3",children:[e.name,(0,n.jsx)("small",{children:new Date().toLocaleDateString()})]})]}),(0,n.jsx)(ee.V,{value:t.formatSize,severity:"warning",className:"px-3 py-2"}),(0,n.jsx)(L.z,{type:"button",icon:"pi pi-times",className:"p-button-outlined p-button-rounded p-button-danger ml-auto",onClick:()=>A(e,t.onRemove)})]}),E=()=>(0,n.jsxs)("div",{className:"flex align-items-center flex-column",children:[(0,n.jsx)("i",{className:"pi pi-image mt-3 p-5",style:{fontSize:"5em",borderRadius:"50%",backgroundColor:"var(--surface-b)",color:"var(--surface-d)"}}),(0,n.jsx)("span",{style:{fontSize:"1.2em",color:"var(--text-color-secondary)"},className:"my-5",children:"Drag and Drop Files Here"})]}),T=()=>{p.current.disabled=!0;let t=(0,Q.iH)(l.tO,"".concat(x,"/").concat(e.collectionName,"/").concat(Date.now(),".pdf")),n=(0,r.hJ)(l.db,e.collectionName.replace(/ /g,"-")),a=(0,Q.B0)(t,d.documentBlob);a.on("state_changed",e=>{let t=e.bytesTransferred/e.totalBytes*100;switch(console.log("Upload is "+t+"% done"),e.state){case"paused":console.log("Upload is paused");break;case"running":console.log("Upload is running")}},e=>{},()=>{(0,Q.Jt)(a.snapshot.ref).then(t=>{console.log("File available at",t),(0,r.ET)(n,{uploaded:new Date,company:x,type:e.documentType.replace(/ /g,"-"),title:Date.now(),url:t,user:g}),console.log("sucessfully added duplicate file"),s(null),m.current.clear(),u.current.show({severity:"info",summary:"Success",detail:"File Uploaded"})}).catch(e=>{console.log(e,"couldn't add doc to firestore")})})},R=e=>(0,n.jsx)("span",{children:e.uploaded.toDate().toDateString()}),D=e=>(0,n.jsx)("span",{children:e.type.replace(/-/g," ")}),O=e=>{f.push(e.value.url)};return(0,n.jsxs)("div",{children:[(0,n.jsx)(_.F,{ref:u}),(0,n.jsx)($.u,{target:".custom-choose-btn",content:"Choose",position:"bottom"}),(0,n.jsx)($.u,{target:".custom-choose-btn",content:"Upload",position:"bottom"}),(0,n.jsx)($.u,{target:".custom-cancel-btn",content:"Clear",position:"bottom"}),(0,n.jsx)("h3",{children:(0,n.jsx)("i",{children:e.documentType&&e.documentType})}),(0,n.jsx)("p",{style:{fontWeight:"500"},children:"Current Documents:"}),(0,n.jsxs)(w.w,{style:{margin:"1rem 0rem"},value:v.length>0&&v,showGridlines:!0,selectionMode:"single",onSelectionChange:O,children:[(0,n.jsx)(N.s,{field:"uploaded",header:"Date",body:R}),(0,n.jsx)(N.s,{field:"type",header:"Document Type",body:D}),(0,n.jsx)(N.s,{field:"company",header:"Company",body:R}),(0,n.jsx)(N.s,{field:"user",header:"Uploaded By"})]}),(0,n.jsx)(et.J,{multiple:!0,children:(0,n.jsx)(et.U,{header:"Upload Center",children:(0,n.jsx)(X.p,{ref:m,name:"demo[]",multiple:!0,accept:"pdf/image/*",maxFileSize:1e6,onSelect:y,onError:b,onClear:b,headerTemplate:C,itemTemplate:S,emptyTemplate:E,chooseOptions:{icon:"pi pi-fw pi-images",iconOnly:!0,className:"custom-choose-btn p-button-rounded p-button-outlined"},uploadOptions:{icon:"pi pi-fw pi-cloud-upload",iconOnly:!0,className:"custom-upload-btn p-button-success p-button-rounded p-button-outlined"},cancelOptions:{icon:"pi pi-fw pi-times",iconOnly:!0,className:"custom-cancel-btn p-button-danger p-button-rounded p-button-outlined"}})})})]})};function en(e){(0,a.useRef)(null);let t=(0,c.Kx)("Contractor-Document-Types");return(0,n.jsx)(a.Fragment,{children:(0,n.jsx)(i.Z,{title:"Contractor Staff Document Center",children:(0,n.jsx)("div",{children:t&&t.map(e=>(0,n.jsx)(es,{collectionName:e.collectionName,documentType:e.documentType},e.id))})})})}var ea={src:"/_next/static/media/jjbuilding.f5d70d91.jpg",height:333,width:1671,blurDataURL:"data:image/jpeg;base64,/9j/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAACAAgDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAX/xAAdEAABBAIDAAAAAAAAAAAAAAABAAIEBREhAxIx/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAH/xAAVEQEBAAAAAAAAAAAAAAAAAAAAAf/aAAwDAQACEQMRAD8Aj19jOdWRu0yQczA055XbGRr1ERIlf//Z",blurWidth:8,blurHeight:2};let er=e=>(0,n.jsx)("div",{style:{width:"100%"},children:(0,n.jsxs)(i.Z,{style:{width:"90%"},children:[(0,n.jsx)("h4",{children:"JJVCMS Release/Patch Notes - Dec 4th, 2023"}),(0,n.jsx)("p",{children:"Hello team, this will be the first of our weekly patch notes going out to teammates assigned to work on the JJ VCMS project. The software development department pushed some changes to the live production today in an effort to assist with the demo video that Lexi and her team are preparing. However going forth the normal updates and patches will occur every Thursday before 4:00 PM. Release/patch notes will be sent out simultaneously as well."}),(0,n.jsx)("p",{children:"After review last week with management, some specific changes have been released to the JJVCMS web app. This is in an effort to provide the best possible demo version of the application for a potential client. We have added a number of features, but also removed assorted features as well."}),(0,n.jsx)("br",{}),(0,n.jsx)("h5",{children:"The changes are detailed below:"}),(0,n.jsx)("br",{}),(0,n.jsx)("h5",{children:"New Features: "}),(0,n.jsx)("p",{children:"Insurance expiration date is visible on contractor insurance reviews. First two companies should have updated data with insurance expiration for demo purposes. Once more insurance documents are uploaded. "}),(0,n.jsx)("p",{children:"Insurance expiration date is also visible inside document center via the expiration date column on table."}),(0,n.jsx)("p",{children:"New Contractor data card is now generated when a contracting company is selected from the hiring client dashboard contractor table."}),(0,n.jsx)("p",{children:"Login session length is set to only when the window is open. Closing the tab with the VCMS active will log out any user and require them to login again."}),(0,n.jsx)("br",{}),(0,n.jsx)("h5",{children:"Features Removed:"}),(0,n.jsx)("p",{children:"Sign-out button in side menu removed Employee training section removed from all logins until development is complete. Contractor Handshake feature removed as deemed unnecessary for the single client version we are trying to demo."}),(0,n.jsx)("br",{}),(0,n.jsx)("h5",{children:"Bugs Fixed: "}),(0,n.jsx)("p",{children:"Hiring Client login loading bug addressed and resolved Document center file upload There will be another release with minor updates this Thursday, along with more release notes. If you have any questions or have found a bug ( sadly there will always be a bug or two ) please contact either Joe or myself via email or in person. We will create a bug ticket and address for the following release."})]})});function el(e){return(0,a.useRef)(),(0,Y.useRouter)(),(0,n.jsxs)("div",{children:[(0,n.jsx)(D.Ix,{}),(0,n.jsx)("div",{style:{width:"100%",height:"300px",position:"relative",overflow:"hidden"},children:(0,n.jsx)(g(),{src:ea,objectFit:"cover",priority:!0,alt:"JJ logo"})}),(0,n.jsxs)(i.Z,{style:{width:"auto"},children:[(0,n.jsx)("h2",{children:"Customer Service Portal "}),(0,n.jsx)("hr",{}),(0,n.jsx)("h4",{children:"Announcements:"}),(0,n.jsx)(er,{})]})]})}var ei=s(61540);function eo(e){let t=(0,Y.useRouter)(),[s,r]=(0,a.useState)(!1),[l,i]=(0,a.useState)(""),[o,d]=(0,a.useState)(""),[c,h]=(0,a.useState)(""),[m,u]=(0,a.useState)(""),[p,x]=(0,a.useState)(!0),[g,j]=(0,a.useState)(!0),[f,v]=(0,a.useState)(""),y=(0,a.useRef)(),A=async e=>{e.preventDefault(),j(!1),(0,ei.vd)({uid:f,collectionType:"users"}).then(()=>{N(),setTimeout(()=>{t.reload()},"2500")}).catch(()=>{S(),setTimeout(()=>{t.reload()},"2500")})},b=()=>{r(!0),i(e.empdata.companyContactFirstname),d(e.empdata.companyContactLastname),h(e.empdata.company),v(e.empdata.userId)},C=e=>{u(e),e===l?x(!1):x(!0)},w=()=>{j(!0),u(""),r(!1)},N=()=>{y.current.show({severity:"success",summary:"Success",detail:"Selected user has been disabled!"})},S=()=>{y.current.show({severity:"danger",summary:"Error",detail:"Disabling the user failed. Please wait and try again."})};return(0,n.jsxs)("div",{children:[(0,n.jsx)(_.F,{ref:y}),(0,n.jsx)(U.V,{visible:s,style:{width:"30vw"},onHide:()=>w(),children:g?(0,n.jsx)("form",{onSubmit:A,id:"newUserForm",children:(0,n.jsxs)("div",{style:{textAlign:"center"},children:[(0,n.jsx)("h2",{children:"ARE YOU SURE?"}),(0,n.jsx)("h4",{children:"You are about to disable the following user:"}),(0,n.jsx)("hr",{}),(0,n.jsxs)("div",{style:{padding:"20px 0px 20px 0px"},children:[(0,n.jsx)("div",{children:(0,n.jsx)("em",{property:"italic",children:(0,n.jsxs)("h4",{children:[l," ",o,","]})})}),(0,n.jsx)("div",{children:(0,n.jsxs)("em",{property:"italic",children:["Employee of Company: ",c]})}),(0,n.jsx)("div",{style:{color:"red",paddingTop:"20px"},children:(0,n.jsx)("p",{children:"(This action will disable the user and remove their access to the platform permanently. Contact JJ Safety customer support if you need to re-enable the user.)"})})]}),(0,n.jsx)("hr",{}),(0,n.jsx)("h4",{children:"To proceed please type in the first name of the user listed above:"}),(0,n.jsx)("label",{htmlFor:"firstnameconfirmation",children:"First name:"}),(0,n.jsx)(J.o,{id:"firstnameconfirmation",type:"text",value:m,onChange:e=>C(e.target.value),required:!0}),p?(0,n.jsxs)("div",{style:{color:"red",paddingTop:"20px"},children:[(0,n.jsx)("p",{children:"Correctly type in first name to proceed"}),(0,n.jsx)("p",{children:"! CASE SENSITIVE !"})]}):(0,n.jsx)("div",{style:{paddingTop:"30px"},children:(0,n.jsx)("button",{type:"submit",disabled:p,className:"delete-button",children:"Confirm"})})]})}):(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{textAlign:"center"},children:(0,n.jsx)("h3",{children:"Deleting User Account"})}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"70vh"},children:(0,n.jsx)("div",{children:(0,n.jsx)(I(),{height:100,width:12,color:"#1289dd"})})})]})}),(0,n.jsx)(L.z,{icon:"pi pi-trash",label:"Remove",onClick:b})]})}var ed=s(39332),ec=s(31322),eh=s(6968);function em(e){let t=(0,ed.useRouter)(),[s,o]=(0,a.useState)(""),[d,c]=(0,a.useState)(""),h=e.company,[m,u]=(0,a.useState)(""),[p,x]=(0,a.useState)(""),[g,j]=(0,a.useState)(""),[f,v]=(0,a.useState)(""),[y,A]=(0,a.useState)(""),[b,C]=(0,a.useState)(""),[w,N]=(0,a.useState)(""),[S,E]=(0,a.useState)(""),[T,R]=(0,a.useState)(""),[D,O]=(0,a.useState)(""),[P,k]=(0,a.useState)("5004"),B=(0,a.useRef)(),[M,F]=(0,a.useState)("Staff"),[z,V]=(0,a.useState)(!1),[H,W]=(0,a.useState)(!1),[q,G]=(0,a.useState)(!1),[Q,Z]=(0,a.useState)("Enter in some of your details..."),Y=()=>{B.current.show({severity:"success",summary:"Success",detail:"New User Created!"})};(0,a.useEffect)(()=>{j(h)},[h]);let X=e=>{k(e),"5003"===e&&F("Client"),"5004"===e&&F("Client Staff")},K=()=>{(0,eh.d)(g,m,s,d)},$=async e=>{W(!0),e.preventDefault();try{let e=await (0,ei.vb)(s,d);e&&(console.log("response data:",e),await (0,r.pl)((0,r.JU)(l.db,"users",e),{companyContactUsername:y,companyEmail:s,companyContactFirstname:m,companyContactLastname:p,company:g,address1:b,address2:w,city:S,state:T,zip:D,courses:[],companyContactPhone:f,password:d,role:P,roleName:M,active:"false",userId:e,userBio:Q}),Y(),K(),ee(),setTimeout(()=>{W(!1),t.refresh()},2e3))}catch(e){console.log("Error:",e.message),W(!1),G(!0)}},ee=()=>{o(""),c(""),u(""),x(""),j(""),v(""),A(""),C(""),N(""),E(""),R(""),O(""),k("")};return H?(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"70vh"},children:[(0,n.jsx)(_.F,{ref:B}),(0,n.jsx)("div",{children:(0,n.jsx)(I(),{height:100,width:12,color:"#1289dd"})}),(0,n.jsx)("br",{})]}):H?void 0:(0,n.jsxs)("div",{children:[(0,n.jsx)(_.F,{ref:B}),(0,n.jsx)("h4",{children:"Add employee to: "}),(0,n.jsx)("h2",{children:h}),(0,n.jsx)("br",{}),(0,n.jsx)("hr",{style:{height:"2px"}}),(0,n.jsx)("h4",{children:"Enter New User Details:"}),(0,n.jsxs)("div",{style:{padding:"20px 10px 50px 10px"},children:[(0,n.jsxs)("form",{onSubmit:$,id:"newUserForm",children:[(0,n.jsx)("div",{className:"p-field",style:{paddingTop:10},children:(0,n.jsxs)("div",{className:"registrationRow",children:[(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"email",children:"User Email (Used for login)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"email",type:"email",value:s,onChange:e=>o(e.target.value),required:!0})})]}),(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsx)("label",{htmlFor:"password",children:"Password:"}),(0,n.jsx)("div",{children:(0,n.jsx)(ec.r,{id:"password",type:"text",value:d,onChange:e=>c(e.target.value),required:!0,toggleMask:!0})})]})]})}),(0,n.jsx)("div",{className:"p-field",style:{paddingTop:10},children:(0,n.jsxs)("div",{className:"registrationRow",children:[(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"firstName",children:"First Name:"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"firstName",type:"text",value:m,onChange:e=>u(e.target.value),required:!0})})]}),(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsx)("label",{htmlFor:"lastName",children:"Last Name:"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"lastName",type:"text",value:p,onChange:e=>x(e.target.value),required:!0})})]})]})}),(0,n.jsx)("div",{className:"p-field",style:{paddingTop:20},children:(0,n.jsxs)("div",{className:"registrationRow",children:[(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"companyName",children:"User Company Name:"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"companyName",type:"text",value:h,onChange:e=>j(e.target.value),required:!0,disabled:!0})})]}),(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsx)("label",{htmlFor:"companyPhoneNumber",children:"User Company Phone Number"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"companyPhoneNumber",type:"text",value:f,onChange:e=>v(e.target.value),required:!0})})]})]})}),(0,n.jsx)("div",{className:"p-field",style:{paddingTop:10},children:(0,n.jsx)("div",{className:"registrationRow",children:(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"address1",children:"Address Line 1: (NOT required)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"address1",type:"text",value:b,onChange:e=>C(e.target.value)})})]})})}),(0,n.jsx)("div",{className:"p-field",style:{paddingTop:10},children:(0,n.jsx)("div",{className:"registrationRow",children:(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsx)("label",{htmlFor:"address2",children:"Address Line 2: (NOT required)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"address2",type:"text",value:w,onChange:e=>N(e.target.value)})})]})})}),(0,n.jsx)("div",{className:"p-field",style:{paddingTop:10},children:(0,n.jsxs)("div",{className:"registrationRow",children:[(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"city",children:"City (NOT required)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"city",type:"text",value:S,onChange:e=>E(e.target.value)})})]}),(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsxs)("div",{className:"registrationColumn",style:{marginRight:"4%"},children:[(0,n.jsx)("label",{htmlFor:"state",children:"State (NOT required)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"state",type:"text",value:T,onChange:e=>R(e.target.value)})})]}),(0,n.jsxs)("div",{className:"registrationColumn",children:[(0,n.jsx)("label",{htmlFor:"zip",children:"Zip (NOT required)"}),(0,n.jsx)("div",{children:(0,n.jsx)(J.o,{id:"zip",type:"text",value:D,onChange:e=>O(e.target.value)})})]})]})]})}),(0,n.jsx)("div",{className:"registrationRow",children:(0,n.jsx)("div",{className:"registrationColumn",children:(0,n.jsxs)(i.Z,{children:[(0,n.jsx)("h5",{children:"Select User Role:"}),(0,n.jsxs)("div",{style:{paddingRight:"50px"},children:[(0,n.jsx)("br",{}),(0,n.jsx)("input",{type:"radio",id:"userRoleClient",name:"userRole",value:"5003",onChange:e=>X(e.target.value),required:!0}),(0,n.jsx)("label",{htmlFor:"userRoleClient",children:"Manager"}),(0,n.jsx)("br",{}),(0,n.jsx)("input",{type:"radio",id:"userRoleClientStaff",name:"userRole",value:"5004",onChange:e=>X(e.target.value)}),(0,n.jsx)("label",{htmlFor:"userRoleClientStaff",children:"Staff"}),(0,n.jsx)("br",{})]})]})})}),(0,n.jsx)("div",{className:"registrationrowSubmitButton",style:{paddingBottom:100},children:(0,n.jsx)("div",{className:"registrationColumnButton",children:(0,n.jsx)(L.z,{label:"Create New User",type:"submit"})})})]}),"\xa0"]}),(0,n.jsxs)(U.V,{visible:q,style:{width:"400px"},onHide:()=>G(!1),children:[(0,n.jsx)("h2",{style:{textAlign:"center"},children:"Sorry, that request cannot be completed."}),(0,n.jsx)("h2",{style:{textAlign:"center"},children:"This email already exists in the system."}),(0,n.jsx)("br",{}),(0,n.jsx)("div",{style:{textAlign:"center"},children:(0,n.jsx)(L.z,{label:"Try Again",size:"large"})})]})]})}function eu(e){let[t,s]=(0,a.useState)([]),[o,d]=(0,a.useState)(!1),[c,h]=(0,a.useState)(),m=(0,ed.useRouter)(),u=e.userCompany,[p,x]=(0,a.useState)({companyContactLastname:{value:null,matchMode:C.a6.STARTS_WITH},companyContactFirstname:{value:null,matchMode:C.a6.STARTS_WITH},companyEmail:{value:null,matchMode:C.a6.STARTS_WITH},roleName:{value:null,matchMode:C.a6.STARTS_WITH},company:{value:null,matchMode:C.a6.STARTS_WITH}}),[g,j]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=sessionStorage.getItem("userCompanyName"),t=sessionStorage.getItem("user");h(t);let n=async()=>{try{let t=await (0,r.PL)((0,r.IO)((0,r.hJ)(l.db,"users"),(0,r.ar)("company","==",e),(0,r.ar)("disabled","==",!1))),n=t.docs.map(e=>({id:e.id,...e.data()}));s(n)}catch(e){console.error("Error fetching Firestore collection:",e)}};n()},[]);let f=e=>e.id===c?(0,n.jsx)(L.z,{severity:"secondary",disabled:!0,children:"Disabled"}):(0,n.jsx)(eo,{empdata:e}),v=e=>"5003"===e.role?"Manager":"5004"===e.role?"Staff":void 0,y=()=>{d(!0)},A=()=>{d(!1),m.refresh()};return(0,n.jsxs)("div",{children:[(0,n.jsxs)(i.Z,{children:[(0,n.jsxs)("h4",{children:[u," employees: ",(0,n.jsx)("span",{style:{color:"#0a436d",fontSize:"34px",paddingLeft:"20px"},children:t.length})," "]}),(0,n.jsx)("hr",{}),(0,n.jsxs)(w.w,{value:t,paginator:!0,rows:10,dataKey:"id",filters:p,showGridlines:!0,filterDisplay:"row",loading:g,emptyMessage:"searching...",sortField:"role",sortOrder:1,children:[(0,n.jsx)(N.s,{field:"companyContactFirstname",header:"Firstname",filter:!0,sortable:!0,filterPlaceholder:"?",style:{maxWidth:"8rem"}}),(0,n.jsx)(N.s,{field:"companyContactLastname",header:"Lastname",filter:!0,sortable:!0,filterPlaceholder:"?",style:{maxWidth:"8rem"}}),(0,n.jsx)(N.s,{field:"companyEmail",header:"User email",filter:!0,sortable:!0,filterPlaceholder:"Search",style:{maxWidth:"13rem"}}),(0,n.jsx)(N.s,{field:"role",header:"Account type",body:v,sortable:!0,style:{maxWidth:"8rem"}}),(0,n.jsx)(N.s,{field:"ui1",header:"Update",body:e=>(0,n.jsx)(S.Z,{compData:e}),style:{maxWidth:"10rem"}}),(0,n.jsx)(N.s,{field:"ui2",header:"Remove",body:f})]}),(0,n.jsx)("div",{style:{marginBottom:"30px"},children:(0,n.jsx)(L.z,{icon:"pi pi-plus",onClick:y,children:(0,n.jsx)("span",{style:{padding:"0px 0px 0px 10px"},children:"Add Employee"})})})]}),(0,n.jsx)(U.V,{visible:o,className:"clientEmployeeUpdateCard",onHide:()=>A(),children:(0,n.jsx)(em,{company:u})})]})}let ep=e=>(0,n.jsx)("div",{style:{paddingBottom:"20px"},children:(0,n.jsx)("div",{className:"hcDashboardCoRow",children:(0,n.jsxs)("div",{className:"hcDashboardCoColumn",children:[(0,n.jsx)(q,{userCompany:e.userCompany}),(0,n.jsx)(eu,{userCompany:e.userCompany})]})})});var ex=s(31001);function eg(){let e=(0,c.Xs)("userCompanyName"),[t,s]=(0,a.useState)(),r=(0,u.v0)(),l=r.currentUser;(0,c.ky)("users",l.uid);let{roleState:i,updateRole:o}=(0,W.V_)(),d=(0,c.Xs)("userFirstName"),h=(0,c.Kx)("companies");return((0,a.useEffect)(()=>{setTimeout(()=>{l&&l.providerData.forEach(e=>{s(e.photoURL)})},300)},[l]),i)?"5001"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"large",className:"w-4rem h-4rem flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:[(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]}),(0,n.jsxs)("p",{children:["Company: ",(0,n.jsx)("strong",{children:e})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(P,{companies:h,userCompany:userCompany})]}):"5002"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"large",className:"w-4rem h-4rem flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:[(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]}),(0,n.jsxs)("p",{children:["Company: ",(0,n.jsx)("strong",{children:e})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(el,{companies:h,userCompany:e})]}):"5003"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"xlarge",className:"w-6rem h-6rem flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:[(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]}),(0,n.jsxs)("p",{children:["Company: ",(0,n.jsx)("strong",{children:e})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(ep,{companies:h,userCompany:e,user:l})]}):"5004"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"medium",className:"w-4rem h-4rem flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:[(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]}),(0,n.jsxs)("p",{children:["Company: ",(0,n.jsx)("strong",{children:e})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(G,{})]}):"5005"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"large",className:"w-4rem h-4rem flex-shrink-0"}),(0,n.jsx)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]})})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(T,{companyData:h,userCompany:e,user:l})]}):"5006"===i?(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex flex-column sm:flex-row align-items-center gap-3",children:[(0,n.jsx)(ex.q,{icon:"pi pi-user",shape:"circle",image:t,size:"large",className:"w-4rem h-4rem flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-column align-items-center sm:align-items-start",children:[(0,n.jsxs)("span",{className:"text-900 font-bold text-4xl",children:["Welcome, ",d]}),(0,n.jsxs)("p",{children:["Company: ",(0,n.jsx)("strong",{children:e})]})]})]}),(0,n.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,n.jsx)("div",{className:"header-row-details "}),(0,n.jsx)("div",{className:"header-row-details "})]})]})})}),(0,n.jsx)("hr",{})]}),(0,n.jsx)(en,{})]}):void 0:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"70vh"},children:[(0,n.jsx)("div",{children:(0,n.jsx)(I(),{height:100,width:12,color:"#1289dd"})}),(0,n.jsx)("br",{}),(0,n.jsx)("div",{})]})}},16742:function(e){e.exports={scorecard:"contractorMyClients_scorecard__y_w1_"}},43540:function(e,t,s){"use strict";s.d(t,{J:function(){return y},U:function(){return v}});var n=s(67294),a=s(66367),r=s(44388),l=s(13308),i=s(13643),o=s(23652),d=s(25508),c=s(92285);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,n=Array(t);s<t;s++)n[s]=e[s];return n}function m(e,t){if(e){if("string"==typeof e)return h(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if("Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s)return Array.from(e);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return h(e,t)}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var s=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=s){var n,a,r,l,i=[],o=!0,d=!1;try{if(r=(s=s.call(e)).next,0===t){if(Object(s)!==s)return;o=!1}else for(;!(o=(n=r.call(s)).done)&&(i.push(n.value),i.length!==t);o=!0);}catch(e){d=!0,a=e}finally{try{if(!o&&null!=s.return&&(l=s.return(),Object(l)!==l))return}finally{if(d)throw a}}return i}}(e,t)||m(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var x=o.V.extend({defaultProps:{__TYPE:"Accordion",id:null,activeIndex:null,className:null,style:null,multiple:!1,expandIcon:null,collapseIcon:null,transitionOptions:null,onTabOpen:null,onTabClose:null,onTabChange:null,children:void 0}}),g=o.V.extend({defaultProps:{__TYPE:"AccordionTab",className:null,contentClassName:null,contentStyle:null,disabled:!1,header:null,headerClassName:null,headerStyle:null,headerTemplate:null,style:null,tabIndex:0,children:void 0},getCProp:function(e,t){return i.gb.getComponentProp(e,t,g.defaultProps)},getCProps:function(e){return i.gb.getComponentProps(e,g.defaultProps)},getCOtherProps:function(e){return i.gb.getComponentDiffProps(e,g.defaultProps)}});function j(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)}return s}function f(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?j(Object(s),!0).forEach(function(t){!function(e,t,s){var n;n=function(e,t){if("object"!==u(e)||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!==u(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"===u(n)?n:String(n))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s}(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):j(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}var v=function(){},y=n.forwardRef(function(e,t){var s=n.useContext(a.Ou),o=x.getProps(e,s),u=p(n.useState(o.id),2),j=u[0],v=u[1],y=p(n.useState(o.activeIndex),2),A=y[0],b=y[1],C=n.useRef(null),w=o.onTabChange?o.activeIndex:A,N={props:o,state:{id:j,activeIndex:A}},S=x.setMetaData(f({},N)),E=S.ptm,T=S.ptmo,R=function(e,t){return T(D(e,"pt"),t,{props:e.props,parent:N})},D=function(e,t){return g.getCProp(e,t)},O=function(e,t,s){if(!D(t,"disabled")){var n=I(s),a=null;if(o.multiple){var r=w||[];a=n?r.filter(function(e){return e!==s}):[].concat(function(e){if(Array.isArray(e))return h(e)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||m(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[s])}else a=n?null:s;var l=n?o.onTabClose:o.onTabOpen;l&&l({originalEvent:e,index:s}),o.onTabChange?o.onTabChange({originalEvent:e,index:a}):b(a)}e.preventDefault()},I=function(e){return o.multiple?w&&w.some(function(t){return t===e}):w===e};if(n.useImperativeHandle(t,function(){return{props:o,getElement:function(){return C.current}}}),(0,l.nw)(function(){j||v((0,i.Th)())}),!j)return null;var P=function(e,t,s){var r=f(f({},D(e,"style")||{}),D(e,"headerStyle")||{}),l=(0,i.AK)("p-accordion-header",{"p-highlight":t,"p-disabled":D(e,"disabled")},D(e,"headerClassName"),D(e,"className")),h=j+"_content_"+s,m=D(e,"disabled")?-1:D(e,"tabIndex"),u=(0,i.dG)({className:"p-accordion-header-text"},R(e,"headertitle")),p=D(e,"headerTemplate")?i.gb.getJSXElement(D(e,"headerTemplate"),g.getCProps(e)):n.createElement("span",u,D(e,"header")),x=(0,i.dG)({className:"p-accordion-toggle-icon"},R(e,"headericon")),v=t?o.collapseIcon||n.createElement(c.v,x):o.expandIcon||n.createElement(d.X,x),y=i.Cz.getJSXIcon(v,f({},x),{props:o,selected:t}),A=t?(0,a.$2)("collapseLabel"):(0,a.$2)("expandLabel"),b=(0,i.dG)({className:l,style:r},R(e,"header")),C=(0,i.dG)({id:j+"_header_"+s,href:"#"+h,className:"p-accordion-header-link",role:"tab",tabIndex:m,onClick:function(t){return O(t,e,s)},"aria-label":A,"aria-controls":h,"aria-expanded":t},R(e,"headeraction"));return n.createElement("div",b,n.createElement("a",C,y,p))},k=function(e,t,s){var a=f(f({},D(e,"style")||{}),D(e,"contentStyle")||{}),l=(0,i.AK)("p-toggleable-content",D(e,"contentClassName"),D(e,"className")),d=n.createRef(),c=(0,i.dG)({id:j+"_content_"+s,ref:d,className:l,style:a,role:"region","aria-labelledby":j+"_header_"+s},R(e,"toggleablecontent")),h=(0,i.dG)({className:"p-accordion-content"},R(e,"content"));return n.createElement(r.K,{nodeRef:d,classNames:"p-toggleable-content",timeout:{enter:1e3,exit:450},in:t,unmountOnExit:!0,options:o.transitionOptions},n.createElement("div",c,n.createElement("div",h,D(e,"children"))))},B=(0,i.AK)("p-accordion p-component",o.className),M=n.Children.map(o.children,function(e,t){if(i.gb.isValidChild(e,"AccordionTab")){var s=I(t),a=P(e,s,t),r=k(e,s,t),l=(0,i.AK)("p-accordion-tab",{"p-accordion-tab-active":s}),o=(0,i.dG)({key:j+"_"+t,className:l},g.getCOtherProps(e),R(e,"root"));return n.createElement("div",o,a,r)}return null}),F=(0,i.dG)({id:j,ref:C,className:B,style:o.style},x.getOtherProps(o),E("root"));return n.createElement("div",F,M)});v.displayName="AccordionTab",y.displayName="Accordion"}},function(e){e.O(0,[5257,887,4420,4908,1518,1856,3421,1322,6928,4427,2399,2696,9774,2888,179],function(){return e(e.s=91015)}),_N_E=e.O()}]);