PageSourceSearch

https://portalportal.onecompliance.co.uk/_next/static/chunks/pages…/client/[clientId]-10161d1a4b46a11f.js

js onecompliance.co.uk collected 2026-10-04 18:07:56 UTC 27,855 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6885],{2259:(e,a,n)=>{"use strict";n.d(a,{A:()=>i});var t=n(37876),l=n(31432),s=n(89099),c=n(14232);let i=(e,a)=>n=>{let{currentUser:i}=(0,l.A)(),r=(0,s.useRouter)();return((0,c.useEffect)(()=>{i&&a.includes(i.role)||r.push("/portal")},[i,r]),i&&a.includes(i.role))?(0,t.jsx)(e,{...n}):null}},37750:(e,a,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/portal/client/[clientId]",function(){return n(95236)}])},42368:(e,a,n)=>{"use strict";n.d(a,{Z:()=>t});let t=[{value:"financeAndBanking",label:"Finance and Banking"},{value:"healthcare",label:"Healthcare"},{value:"education",label:"Education"},{value:"governmentAndPublicSector",label:"Government and Public Sector"},{value:"retailAndEcommerce",label:"Retail and E-commerce"},{value:"technologyAndSoftwareDevelopment",label:"Technology and Software Development"},{value:"manufacturing",label:"Manufacturing"},{value:"energyAndUtilities",label:"Energy and Utilities"},{value:"telecommunications",label:"Telecommunications"},{value:"transportationAndLogistics",label:"Transportation and Logistics"},{value:"insurance",label:"Insurance"},{value:"legalServices",label:"Legal Services"},{value:"mediaAndEntertainment",label:"Media and Entertainment"},{value:"pharmaceuticalsAndBiotech",label:"Pharmaceuticals and Biotechnology"},{value:"hospitalityAndTourism",label:"Hospitality and Tourism"},{value:"aerospaceAndDefense",label:"Aerospace and Defense"},{value:"realEstate",label:"Real Estate"},{value:"agriculture",label:"Agriculture"},{value:"nonProfit",label:"Non-profit Organizations"},{value:"construction",label:"Construction"}]},95236:(e,a,n)=>{"use strict";n.r(a),n.d(a,{default:()=>M});var t,l,s=n(37876),c=n(14232),i=n(89099),r=n(70933),o=n(49057),d=n(82964),m=n(2259),u=n(31432),p=0,y=0,h=0,x=0,v=0,b=0,N="object"==typeof performance&&performance.now?performance:Date,j="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function f(){return v||(j(g),v=N.now()+b)}function g(){v=0}function A(){this._call=this._time=this._next=null}function C(){v=(x=N.now())+b,p=y=0;try{f(),++p;for(var e,a=t;a;)(e=v-a._time)>=0&&a._call.call(void 0,e),a=a._next;--p}finally{p=0,function(){for(var e,a,n=t,s=1/0;n;)n._call?(s>n._time&&(s=n._time),e=n,n=n._next):(a=n._next,n._next=null,n=e?e._next=a:t=a);l=e,E(s)}(),v=0}}function w(){var e=N.now(),a=e-x;a>1e3&&(b-=a,x=e)}function E(e){!p&&(y&&(y=clearTimeout(y)),e-v>24?(e<1/0&&(y=setTimeout(C,e-N.now()-b)),h&&(h=clearInterval(h))):(h||(x=N.now(),h=setInterval(w,1e3)),p=1,j(C)))}function S(e,a,n){var t=new A;return a=null==a?0:+a,t.restart(n=>{t.stop(),e(n+a)},a,n),t}A.prototype=(function(e,a,n){var t=new A;return t.restart(e,a,n),t}).prototype={constructor:A,restart:function(e,a,n){if("function"!=typeof e)throw TypeError("callback is not a function");n=(null==n?f():+n)+(null==a?0:+a),this._next||l===this||(l?l._next=this:t=this,l=this),this._call=e,this._time=n,E()},stop:function(){this._call&&(this._call=null,this._time=1/0,E())}};var k=n(9167),U=n(77328),P=n.n(U),T=n(42368),R=n(72529),L=n(75697),_=n(48230),O=n.n(_),D=n(96246),I=n(59708);let M=(0,m.A)(()=>{let{clientId:e}=(0,i.useRouter)().query,[a,n]=(0,c.useState)(null),[t,l]=(0,c.useState)([]),[m,p]=(0,c.useState)([]),[y,h]=(0,c.useState)([]),[x,v]=(0,c.useState)(!1),[b,N]=(0,c.useState)({name:!1,email:!1,phoneNumber:!1,companyPhone:!1,companyAddress:!1,companyName:!1,company:!1,billingAddress:!1,companyDayRate:!1}),[j,f]=(0,c.useState)({name:"",email:"",phoneNumber:"",companyPhone:"",companyName:"",companyAddress:{lineOne:"",lineTwo:"",city:"",postcode:""},billingAddress:{lineOne:"",lineTwo:"",city:"",postcode:""},company:"",companyDayRate:""}),[g,A]=(0,c.useState)([]),[C,w]=(0,c.useState)(null),[E,U]=(0,c.useState)(null),[_,M]=(0,c.useState)(null),[H,Z]=(0,c.useState)({name:"",email:"",phoneNumber:""}),[B,F]=(0,c.useState)(null),[$,Y]=(0,c.useState)(null),[q,V]=(0,c.useState)(null),[G,z]=(0,c.useState)(null),[X,W]=(0,c.useState)("None set"),[J,K]=(0,c.useState)("null"),[Q,ee]=(0,c.useState)("null"),[ea,en]=(0,c.useState)(!1),[et,el]=(0,c.useState)(null),[es,ec]=(0,c.useState)(""),[ei,er]=(0,c.useState)(!1),[eo,ed]=(0,c.useState)((null==a?void 0:a.companyNumber)||""),[em,eu]=(0,c.useState)(!1),[ep,ey]=(0,c.useState)(""),[eh,ex]=(0,c.useState)(""),[ev,eb]=(0,c.useState)((null==a?void 0:a.industry)||[]),[eN,ej]=(0,c.useState)(null),[ef,eg]=(0,c.useState)(null),[eA,eC]=(0,c.useState)(null),[ew,eE]=(0,c.useState)(!1),[eS,ek]=(0,c.useState)(!1),eU=(0,i.useRouter)(),{currentUser:eP}=(0,u.A)(),eT=(0,I.RT)(null==eP?void 0:eP.role);(0,c.useEffect)(()=>{(async()=>{try{let a=await o.kA.collection("company").doc(e).get();if(a.exists){let e=a.data();n({...e,id:e.id||a.id,companyUid:e.companyUid||a.id})}}catch(e){console.error("Error fetching company:",e)}})()},[e]),(0,c.useEffect)(()=>{(async()=>{try{let e=await o.kA.collection("users").doc(null==a?void 0:a.assignedSalesUid).get();if(e.exists){let a=e.data();W(null==a?void 0:a.name),K(null==a?void 0:a.email)}}catch(e){console.error("Error fetching company:",e)}})()},[null==a?void 0:a.assignedSalesUid]),(0,c.useEffect)(()=>{(async()=>
1{if(a&&a.companyUid)try{let e=await o.kA.collection("company").where("resellerCompanyUid","==",a.companyUid).get();if(e.empty)console.warn("No companies found for resellerCompanyUid: ".concat(a.companyUid)),l([]);else{let a=e.docs.map(e=>({id:e.id,...e.data()}));l(a)}}catch(e){console.error("Error fetching companies for resellerCompanyUid ".concat(a.companyUid,":"),e),l([])}})()},[a]),(0,c.useEffect)(()=>{(async()=>{if(null==a?void 0:a.companyContacts)try{let e=a.companyContacts.map(async e=>{try{let a=await o.kA.collection("users").doc(e.contactUid).get();if(a.exists)return a.data();return console.error("User with UID ".concat(e.contactUid," not found")),null}catch(a){return console.error("Error fetching user data for ".concat(e.contactUid,":"),a),null}}),n=(await Promise.all(e)).filter(e=>null!==e).filter(e=>!0!=e.archived);h(n)}catch(e){console.error("Error fetching contacts:",e)}})()},[a]),(0,c.useEffect)(()=>{(async()=>{if(null==a?void 0:a.resellerContactUid)try{let n=await o.kA.collection("users").doc(null==a?void 0:a.resellerContactUid).get();if(n.exists){var e;ec((null==(e=n.data())?void 0:e.name)||"None set")}}catch(e){console.error("Error fetching reseller contact name:",e)}})()},[null==a?void 0:a.resellerContactUid]),(0,c.useEffect)(()=>{(null==a?void 0:a.isReseller)===!0?en(!0):en(!1)},[null==a?void 0:a.isReseller]),(0,c.useEffect)(()=>{let n=async()=>{try{let a=await o.kA.collection("projects").where("companyUid","==",e).get(),n=await o.kA.collection("projects").where("resellerCompany","==",e).get(),t=[];a.forEach(e=>{let a=e.data();t.push({...a,id:e.id})}),n.forEach(e=>{let a=e.data();t.push({...a,id:e.id})});let l=Array.from(new Map(t.map(e=>[e.id,e])).values());p(l)}catch(e){console.error("Error fetching projects:",e)}};a&&a.companyName&&n()},[a,e]),(0,c.useEffect)(()=>{let e=async()=>{try{let e=await o.kA.collection("company").where("companyUid","==",null==a?void 0:a.resellerCompanyUid).get();if(e.empty)ee(null);else{let a=e.docs[0].data();ee(a.companyName)}}catch(e){console.error("Error fetching reseller name:",e)}};a&&a.resellerCompanyUid&&e()},[a,null==a?void 0:a.resellerCompanyUid]),(0,c.useEffect)(()=>{(null==a?void 0:a.billingAddresses)&&v(!0)},[a]),(0,c.useEffect)(()=>{(null==a?void 0:a.companyUid)&&(async()=>{let e=await o.kA.collection("company").doc(a.companyUid).get();if(e.exists){var n;A((null==(n=e.data())?void 0:n.billingAddresses)||[])}})()},[null==a?void 0:a.companyUid]);let eR=e=>{N(a=>({...a,[e]:!0})),f(n=>({...n,[e]:a&&a[e]||""}))},eL=async(e,a)=>{let n=a.uid,t=o.Cn.httpsCallable("disableUserAccount");try{ek(!0),await t({uid:n}),await o.kA.collection("users").doc(n).update({archived:!0,archivedAt:new Date}),h(a=>a.filter((a,n)=>n!==e)),F("User archived successfully!"),V(""),ek(!1),setTimeout(()=>{F("")},2e3)}catch(e){V("Error disabling user: ".concat(e.message)),ek(!1)}},e_=async()=>{if(!eO())return;let e=y[_];if(H.name!==e.name||H.email!==e.email||H.phoneNumber!==e.phoneNumber)try{let a=o.kA.collection("users").doc(e.uid);if(!(await a.get()).exists){console.error("Document does not exist:",e.uid),V("Contact does not exist.");return}await a.update({name:H.name,email:H.email,phoneNumber:H.phoneNumber});let n=[...y];n[_]={...e,...H},h(n),M(null),F("Contact details updated successfully!"),V(null),S(()=>F(""),3e3)}catch(e){console.error("Error updating contact details:",e),V("Failed to update contact details.")}else V("No changes detected.")},eO=()=>{let e=!0,a={};return/^\S+\s+\S+$/.test(H.name)||(e=!1,a.name="Name must have at least 2 parts.",V(a.name)),/\S+@\S+\.\S+/.test(H.email)||(e=!1,a.email="Invalid email address.",V(a.email)),/^\d{11}$/.test(H.phoneNumber)||(e=!1,a.phoneNumber="Phone number must contain exactly 11 digits.",V(a.phoneNumber)),e},eD=()=>{let e=!0,a={};return b.name&&!/^\S+\s+\S+$/.test(j.name)&&(e=!1,a.name="Name must have at least 2 parts.",V(a.name)),b.email&&!/\S+@\S+\.\S+/.test(j.email)&&(e=!1,a.email="Invalid email address.",V(a.email)),b.phoneNumber&&!/^\d{11}$/.test(j.phoneNumber)&&(e=!1,a.phoneNumber="Phone number must contain exactly 11 digits.",V(a.phoneNumber)),b.companyPhone&&!/^\d{11}$/.test(j.companyPhone)&&(e=!1,a.companyPhone="Company phone number must contain exactly 11 digits.",z(a.companyPhone)),b.company&&""===j.company.trim()&&(e=!1,a.company="Company name cannot be empty.",z(a.company)),b.companyAddress&&(""===j.companyAddress.lineOne.trim()&&(e=!1,a.companyAddressLineOne="Address Line 1 cannot be empty."),""===j.companyAddress.city.trim()&&(e=!1,a.companyAddressCity="City cannot be empty."),z(a.companyAddressLineOne||a.companyAddressCity||null)),e},eI=async t=>
1{if(eD()&&e&&j[t]!==(null==a?void 0:a[t]))try{if(await o.kA.collection("company").doc(e).update({[t]:j[t]}),n(e=>e&&{...e,[t]:j[t]}),"companyPhone"===t||"companyName"===t){Y("".concat((0,k.Zr)(t.replace(/([A-Z])/g," $1"))," updated successfully!")),z(null),N(e=>({...e,[t]:!1})),S(()=>{Y("")},3e3);return}F("".concat((0,k.Zr)(t.replace(/([A-Z])/g," $1"))," updated successfully!")),V(null),N(e=>({...e,[t]:!1})),S(()=>{F("")},3e3)}catch(e){console.error("Error updating ".concat(t,":"),e)}},eM=async()=>{if(eD()&&e)try{await o.kA.collection("company").doc(e).update({companyAddressLineOne:j.companyAddress.lineOne,companyAddressLineTwo:j.companyAddress.lineTwo,companyAddressCity:j.companyAddress.city,companyAddressPostcode:j.companyAddress.postcode}),n(e=>e&&{...e,companyAddressLineOne:j.companyAddress.lineOne,companyAddressLineTwo:j.companyAddress.lineTwo,companyAddressCity:j.companyAddress.city,companyAddressPostcode:j.companyAddress.postcode}),Y("Company Address updated successfully!"),N(e=>({...e,companyAddress:!1})),S(()=>{Y("")},3e3)}catch(e){console.error("Error updating address:",e)}},eH=async()=>{if(!ev||0===ev.length)return void eg("Please select at least one industry.");let e=null==a?void 0:a.companyUid;if(e)try{let a=(0,d.H9)(o.kA,"company/".concat(e));await (0,d.mZ)(a,{industry:ev}),n(e=>e&&{...e,industry:ev}),ej("Industry updated successfully!"),er(!1),S(()=>{ej("")},3e3)}catch(e){console.error("Error updating industry:",e),eg("Error updating industry.")}},eZ=async()=>{if(!eo||""===eo.trim())return void ex("Company number cannot be empty.");let e=null==a?void 0:a.companyUid;if(e)try{let a=(0,d.H9)(o.kA,"company/".concat(e));await (0,d.mZ)(a,{companyNumber:eo.trim()}),n(e=>e?{...e,companyNumber:eo.trim()}:null),ey("Company number updated successfully!"),eu(!1),setTimeout(()=>{ey("")},3e3)}catch(e){console.error("Error updating company number:",e),ex("Error updating company number.")}else ex("Invalid company ID.")};(0,c.useEffect)(()=>{(async()=>{if(null==a?void 0:a.assignedSalesUid)try{let e=await (0,d.x7)((0,d.H9)(o.kA,"users",null==a?void 0:a.assignedSalesUid));e.exists()?K(e.data().email):K(null)}catch(e){console.error("Failed to fetch assigned sales user")}else K(null)})()},[null==a?void 0:a.assignedSalesUid]);let eB=async e=>{let a=null==e?void 0:e.companyUid,n=null==e?void 0:e.companyContacts,t=o.Cn.httpsCallable("disableUserAccount");if(!n||0===n.length)return void console.log("No contacts to archive.");try{for(let e of(ek(!0),n)){let a=e.contactUid;a?(console.log(a),await t({uid:a}),await o.kA.collection("users").doc(a).update({archived:!0,archivedAt:new Date}),console.log("User ".concat(a," disabled and archived."))):console.error("Invalid UID:",e)}if(a){console.log(a);let e=await o.kA.collection("projects").where("companyUid","==",a).get(),n=o.kA.batch();e.forEach(e=>{n.update(e.ref,{archived:!0,archivedAt:new Date})}),await n.commit(),await o.kA.collection("company").doc(a).update({archived:!0,archivedAt:new Date})}alert("Client, contacts and associated projects successfully archived."),ek(!1),setTimeout(()=>{eU.push("/portal/clientList")},2e3)}catch(e){console.error("Error archiving client:",e),ek(!1)}},eF=async()=>{if(!E)return;let e=[...g];null!==C?e[C]=E:e.push(E),A(e),w(null),U(null),await o.kA.collection("company").doc(null==a?void 0:a.companyUid).update({billingAddresses:e})},e$=async()=>{let e=g.filter((e,a)=>a!==et);A(e),await o.kA.collection("company").doc(null==a?void 0:a.companyUid).update({billingAddresses:e}),el(null)},eY=()=>{el(null)};return(0,s.jsxs)("div",{className:"p-6 bg-gray-100 min-h-screen mt-4",children:[(0,s.jsxs)(P(),{children:[(0,s.jsx)("title",{children:null==a?void 0:a.companyName}),(0,s.jsx)("link",{rel:"icon",href:"/favicon.ico"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"p-4 bg-white rounded-custom shadow-custom",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsxs)("div",{className:"w-1/2",children:[(0,s.jsx)("p",{className:"title mb-2",children:"COMPANY"}),b.companyName?(0,s.jsxs)("div",{children:[(0,s.jsx)("input",{type:"text",value:j.companyName,onChange:e=>f(a=>({...a,companyName:e.target.value})),className:"input mr-2 w-full"}),(0,s.jsx)("button",{onClick:()=>eI("companyName"),className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)("p",{className:"simple-text",children:[null==a?void 0:a.companyName,eT&&(0,s.jsx)("button",{onClick:()=>eR("companyName"),className:"ml-4 btn btn-secondary",children:"Edit"})]})]}),(0,s.jsx)("div",{className:"w-1/2 text-right",children:(null==a?void 0:a.isReseller)==!0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"title mb-2 mr-16",children:"DAY RATE"}),(0,s.jsx)("div",{className:"relative inline-block text-left",children:b.companyDayRate?(0,s.jsxs)("div",{className:"flex items-center justify-start",children:["\xa3",(0,s.jsx)("input",{type:"number",value:j.companyDayRate,onChange:e=>f(a=>({...a,companyDayRate:e.target.value})),className:"input mr-2 w-24"}),(0,s.jsx)("button",{onClick:()=>eI("companyDayRate"),className:"btn btn-primary",children:"Save"})]}):(0,s.jsxs)("p",{className:"simple-text inline-flex items-center justify-start",children:["\xa3",null==a?void 0:a.companyDayRate,eT&&(0,s.jsx)("button",{onClick:()=>eR("companyDayRate"),className:"ml-4 btn btn-secondary",children:"Edit"})]})})]})})]}),(0,s.jsx)("p",{className:"title mt-4",children:"COMPANY PHONE NUMBER"}),b.companyPhone?(0,s.jsxs)("div",{children:[(0,s.jsx)("input",{type:"text",value:j.companyPhone,onChange:e=>f(a=>({...a,companyPhone:e.target.value})),className:"input mr-10"}),(0,s.jsx)("button",{onClick:()=>eI("companyPhone"),className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)("p",{className:"simple-text",children:[null==a?void 0:a.companyPhone,eT?(0,s.jsx)("button",{onClick:()=>eR("companyPhone"),className:"ml-4 btn btn-secondary",children:"Edit"}):null]}),(0,s.jsx)("p",{className:"title mt-4",children:"COMPANY ADDRESS"}),b.companyAddress?(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("input",{type:"text",placeholder:"Address Line 1",value:j.companyAddress.lineOne,onChange:e=>f(a=>({...a,companyAddress:{...a.companyAddress,lineOne:e.target.value}})),className:"input mr-10"}),(0,s.jsx)("input",{type:"text",placeholder:"Address Line 2",value:j.companyAddress.lineTwo,onChange:e=>f(a=>({...a,companyAddress:{...a.companyAddress,lineTwo:e.target.value}})),className:"input mt-2 mr-10"}),(0,s.jsx)("input",{type:"text",placeholder:"City",value:j.companyAddress.city,onChange:e=>f(a=>({...a,companyAddress:{...a.companyAddress,city:e.target.value}})),className:"input mt-2 mr-10"}),(0,s.jsx)("input",{type:"text",placeholder:"Postcode",value:j.companyAddress.postcode,onChange:e=>f(a=>({...a,companyAddress:{...a.companyAddress,postcode:e.target.value}})),className:"input mt-2 mr-10"}),(0,s.jsx)("button",{onClick:eM,className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-row",children:[(0,s.jsx)("p",{className:"simple-text",children:null==a?void 0:a.companyAddressLineOne}),eT?(0,s.jsx)("button",{onClick:()=>{N(e=>({...e,companyAddress:!0})),f(e=>({...e,companyAddress:{lineOne:(null==a?void 0:a.companyAddressLineOne)||"",lineTwo:(null==a?void 0:a.companyAddressLineTwo)||"",city:(null==a?void 0:a.companyAddressCity)||"",postcode:(null==a?void 0:a.companyAddressPostcode)||""}}))},className:"ml-6 text-lg btn btn-secondary",children:"Edit"}):null]}),(null==a?void 0:a.companyAddressLineTwo)&&(0,s.jsx)("p",{className:"simple-text",children:a.companyAddressLineTwo}),(0,s.jsx)("p",{className:"simple-text",children:null==a?void 0:a.companyAddressCity}),(0,s.jsx)("p",{className:"simple-text",children:null==a?void 0:a.companyAddressPostcode}),(0,s.jsx)("p",{className:"simple-text",children:null==a?void 0:a.companyAddressCountry})]}),!(null==a?void 0:a.resellerCompanyUid)&&(0,s.jsxs)("div",{className:"flex mt-2 items-center",children:[(0,s.jsx)("input",{type:"checkbox",className:"h-4 w-4 align-middle",onChange:e=>v(e.target.checked),checked:x,disabled:g.length>0}),(0,s.jsx)("label",{className:"ml-2",children:"Is billing address different to company address?"})]}),(x||g.length>0)&&(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"billing-addresses",children:[(0,s.jsx)("p",{className:"title mt-4",children:"BILLING ADDRESSES"}),g.map((e,a)=>(0,s.jsxs)("div",{className:"billing-address",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("strong",{children:"Alias:"})," ",e.alias]}),(0,s.jsx)("p",{children:e.lineOne}),e.lineTwo&&(0,s.jsx)("p",{children:e.lineTwo}),(0,s.jsx)("p",{children:e.city}),(0,s.jsx)("p",{children:e.postcode}),et===a?(0,s.jsxs)("div",{className:"flex space-x-2 mt-2",children:[(0,s.jsx)("button",{onClick:e$,className:"btn btn-danger",children:"Confirm"}),(0,s.jsx)("button",{onClick:eY,className:"btn btn-secondary",children:"Cancel"})]}):(0,s.jsxs)("div",{className:"flex space-x-2 mt-2",children:[(0,s.jsx)("button",{onClick:()=>(e=>{w(e),U(g[e])})(a),className:"btn btn-secondary",children:"Edit"}),(0,s.jsx)("button",{onClick:()=>{el(a)},className:"btn btn-danger",children:"Remove"})]})]},a)),E&&(0,s.jsxs)("div",{className:"edit-form",children:[(0,s.jsx)("input",{type:"text",placeholder:"Alias",value:E.alias,onChange:e=>U({...E,alias:e.target.value}),className:"input mt-2"}),(0,s.jsx)("input",{type:"text",placeholder:"Address Line 1",value:E.lineOne,onChange:e=>U({...E,lineOne:e.target.value}),className:"input mt-2"}),(0,s.jsx)("input",{type:"text",placeholder:"Address Line 2",value:E.lineTwo,onChange:e=>U({...E,lineTwo:e.target.value}),className:"input mt-2"}),(0,s.jsx)("input",{type:"text",placeholder:"City",value:E.city,onChange:e=>U({...E,city:e.target.value}),className:"input mt-2"}),(0,s.jsx)("input",{type:"text",placeholder:"Postcode",value:E.postcode,onChange:e=>U({...E,postcode:e.target.value}),className:"input mt-2"}),(0,s.jsxs)("div",{className:"flex space-x-2 mt-4",children:[(0,s.jsx)("button",{onClick:eF,className:"btn btn-primary",children:"Save Billing Address"}),(0,s.jsx)("button",{onClick:()=>{w(null),U(null)},className:"btn btn-secondary",children:"Cancel"})]})]}),(0,s.jsx)("button",{onClick:()=>{w(null),U({alias:"",lineOne:"",lineTwo:"",city:"",postcode:""})},className:"btn btn-primary mt-4",children:"+ Add New Billing Address"})]})}),$&&(0,s.jsx)("div",{className:"text-green-600",children:$}),G&&(0,s.jsx)("div",{className:"text-red-600",children:G})]}),(0,s.jsxs)("button",{className:"flex items-center w-full bg-white rounded-full shadow-custom py-1 px-4 text-gray-700 mb-8",onClick:()=>{eU.push({pathname:"/portal/createUser",query:{companyUid:(null==a?void 0:a.companyUid)||e}})},children:[(0,s.jsx)("span",{className:"text-2xl mr-6",children:"+"}),(0,s.jsx)("span",{children:"Add new contact"})]}),(0,s.jsxs)("div",{className:"p-4 bg-white rounded-custom shadow-custom",children:[(0,s.jsx)("p",{className:"title mb-2",children:"CONTACTS"}),y.map((e,a)=>(0,s.jsx)("div",{className:"mb-4",children:_===a?(0,s.jsxs)("div",{className:"space-y-2 flex flex-col",children:[(0,s.jsx)("input",{type:"text",value:H.name,onChange:e=>Z(a=>({...a,name:e.target.value})),className:"input mr-10"}),(0,s.jsx)("input",{type:"text",value:H.email,onChange:e=>Z(a=>({...a,email:e.target.value})),className:"input mr-10"}),(0,s.jsx)("input",{type:"text",value:H.phoneNumber,onChange:e=>Z(a=>({...a,phoneNumber:e.target.value})),className:"input mr-10"}),(0,s.jsx)("button",{onClick:e_,className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"title mt-4",children:"NAME"}),(0,s.jsx)("p",{className:"simple-text",children:e.name}),(0,s.jsx)("p",{className:"title mt-4",children:"EMAIL"}),(0,s.jsx)("p",{className:"simple-text",children:e.email}),(0,s.jsx)("p",{className:"title mt-4",children:"PHONE"}),(0,s.jsx)("p",{className:"simple-text",children:e.phoneNumber}),eT&&eA!==a&&(0,s.jsx)("button",{onClick:()=>(e=>{let a=y[e];
1M(e),Z({name:a.name,email:a.email,phoneNumber:a.phoneNumber})})(a),className:"btn btn-secondary mt-2",children:"Edit contact"}),eT&&eA!==a&&(0,s.jsx)("button",{onClick:()=>eC(a),className:"btn btn-secondary mt-2 ml-10",children:"Archive contact"}),eA===a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>eL(a,e),className:"btn btn-secondary mt-2",children:"Confirm"}),(0,s.jsx)("button",{onClick:()=>eC(null),className:"btn btn-secondary mt-2 ml-10",children:"Cancel"})]}),(0,s.jsx)("hr",{})]})},a)),B&&(0,s.jsx)("div",{className:"text-green-600",children:B}),q&&(0,s.jsx)("div",{className:"text-red-600",children:q})]})]}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"p-4 bg-white rounded-custom shadow-custom",children:[(0,s.jsxs)("div",{className:"flex justify-between",children:[(0,s.jsx)("p",{className:"title mb-2",children:"ACCOUNT MANAGER"}),(0,s.jsx)("p",{className:"title mb-2"}),!ew&&"admin"==eP.role&&(0,s.jsx)("button",{onClick:()=>eE(!0),className:"btn btn-primary mt-2 hover:underline hover:text-red-500",children:"ARCHIVE CLIENT"}),ew&&(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsx)("p",{className:"text-red-500",children:"Warning: Archiving Client will archive all associated contacts and projects!"}),(0,s.jsxs)("div",{className:"flex items-end space-x-4",children:[(0,s.jsx)("button",{onClick:()=>eB(a),className:"btn btn-primary hover:underline hover:text-red-500",children:"Confirm"}),(0,s.jsx)("button",{onClick:()=>eE(!1),className:"btn btn-primary hover:underline",children:"Cancel"})]})]})]}),(0,s.jsx)("a",{href:"mailto:".concat(J),className:"simple-text",title:"Email ".concat(X),children:X}),(null==a?void 0:a.resellerCompanyUid)&&(0,s.jsxs)(O(),{href:"/portal/client/".concat(a.resellerCompanyUid),passHref:!0,children:[(0,s.jsx)("p",{className:"title mb-2",children:"RESELLER COMPANY"}),(0,s.jsx)("p",{className:"simple-text mb-2",children:Q})]}),(null==a?void 0:a.resellerContactUid)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"title mb-2",children:"RESELLER CONTACT"}),(0,s.jsx)("p",{className:"simple-text mb-2",children:es})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"title mt-4",children:"INDUSTRY"}),ei?(0,s.jsxs)("div",{children:[(0,s.jsx)(R.Ay,{id:"industry",options:(null==a?void 0:a.isReseller)===!0?[{value:"Var",label:"VAR"}]:T.Z,className:"block w-full mb-4 p-2 border-b",classNamePrefix:"select",placeholder:"Select industries",onChange:e=>{eb(e?e.map(e=>e.value):[])},isMulti:!0,value:T.Z.filter(e=>ev.includes(e.value))}),(0,s.jsx)("button",{onClick:eH,className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)("div",{className:"simple-text",children:[(null==a?void 0:a.industry)&&a.industry.length>0?a.industry.map(e=>{if(e)return e.replace(/([a-z])([A-Z])/g,"$1 $2").split(" ").map(e=>"the"===e.toLowerCase()||"and"===e.toLowerCase()?e.toLowerCase():"var"===e.toLowerCase()?"VAR":e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}).join(", "):"None set",eT&&(0,s.jsx)("button",{onClick:()=>er(!0),className:"ml-6 text-lg btn btn-secondary",children:"Edit"})]})]}),eN&&(0,s.jsx)("div",{className:"text-green-600",children:eN}),ef&&(0,s.jsx)("div",{className:"text-red-600",children:ef}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"title mt-4",children:"COMPANY NUMBER"}),em?(0,s.jsxs)("div",{children:[(0,s.jsx)("input",{type:"text",id:"companyNumber",className:"block w-full mb-4 p-2 border-b",placeholder:"Enter company number",value:eo,onChange:e=>ed(e.target.value)}),(0,s.jsx)("button",{onClick:eZ,className:"btn btn-primary mt-2",children:"Save"})]}):(0,s.jsxs)("div",{className:"simple-text",children:[(null==a?void 0:a.companyNumber)?a.companyNumber:"None set",eT&&(0,s.jsx)("button",{onClick:()=>eu(!0),className:"ml-6 text-lg btn btn-secondary",children:"Edit"})]}),ep&&(0,s.jsx)("div",{className:"text-green-600",children:ep}),eh&&(0,s.jsx)("div",{className:"text-red-600",children:eh})]})]}),(0,s.jsx)("div",{className:"actions",children:(null==a?void 0:a.isReseller)==!0?(0,s.jsxs)("button",{className:"flex items-center w-full bg-white rounded-full shadow-custom py-1 px-4 text-gray-700 mb-8",onClick:()=>{eU.push({pathname:"/portal/createClient",query:{resellerCompanyUid:null==a?void 0:a.companyUid}})},children:[(0,s.jsx)("span",{className:"text-2xl mr-6",children:"+"}),"Create New Client for Reseller"]}):(0,s.jsxs)("button",{className:"flex items-center w-full bg-white rounded-full shadow-custom py-1 px-4 text-gray-700 mb-8",onClick:()=>{eU.push({pathname:"/portal/createProject",query:{companyUid:null==a?void 0:a.companyUid}})},children:[(0,s.jsx)("span",{className:"text-2xl mr-6",children:"+"}),"Create New Project"]})}),(null==a?void 0:a.isReseller)?(0,s.jsx)(L.A,{projects:m}):(0,s.jsx)(D.A,{projects:m}),(null==a?void 0:a.isReseller)&&(0,s.jsxs)("div",{className:"p-4 bg-white rounded-custom shadow-custom",children:[(0,s.jsx)("p",{className:"title mb-2",children:"CLIENTS"}),t.length>0?(0,s.jsx)("ul",{children:t.map(e=>(0,s.jsxs)("li",{className:"mb-2",children:[(0,s.jsxs)("div",{className:"flex justify-between space-x-4",children:[(0,s.jsx)(O(),{href:"/portal/client/".concat(e.companyUid),passHref:!0,children:(0,s.jsx)("p",{className:"simple-text hover:underline",children:e.companyName})}),(0,s.jsx)(O(),{href:"/portal/createProject?companyUid=".concat(e.companyUid),passHref:!0,children:(0,s.jsx)("button",{className:"bg-blue-500 py-1 px-3 rounded hover:underline",children:"+ Create Project"})})]}),0==e.companyContacts||!e.companyContacts&&!ea&&(0,s.jsx)("span",{className:"text-red-500",children:"Please make a contact before creating a project."})]},e.companyUid))}):(0,s.jsx)("p",{className:"text-gray-500",children:"No clients found."})]})]}),(0,s.jsx)(r.A,{loading:eS})]})]})},["sales","tester","pci","grc","admin"])}},e=>{e.O(0,[4938,6111,636,6593,8792],()=>e(e.s=37750)),_N_E=e.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.