1"use strict";(self.webpackChunkmain=self.webpackChunkmain||[]).push([[1565],{23993(e,t,l){var i=l(74848),a=l(47237),o=l(51576),n=l(32912),s=l(98456),r=l(24495),d=l(60288),c=l(99273),u=l(94649);const m=({files:e,showViewButton:t=!1,onViewFilesClick:l,wrapperProps:m})=>{const{t:h}=(0,r.A)(),{theme:x}=(0,d.A)(),p=(0,c.A)(),g=(null==e?void 0:e.length)||0;return(0,i.jsxs)(i.Fragment,{children:[p.show?(0,i.jsx)(u.k,{}):null,(0,i.jsxs)(a.a,Object.assign({},m,{sx:Object.assign({width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},null==m?void 0:m.sx),children:[(0,i.jsxs)(n.A,{variant:"bodyXs",csp:"primary.500",lh:"130%",fwt:500,onClick:e=>{e.stopPropagation()},sx:{display:"flex",alignItems:"center",gap:1},children:[g?(0,i.jsx)(s.A,{sx:{fontSize:16,color:x.palette.otColors.primary[500],rotate:"315deg"}}):null,g?g+" "+(g>1?h("FILES")+" "+h("ATTACHED"):h("FILE")+" "+h("ATTACHED")):"-"]}),g>0&&t?(0,i.jsx)(o.$,{variant:"outlined",size:"small",onClick:t=>{var i;t.stopPropagation(),l?l():p.open({images:e,showFeedback:!1,type:"file",selected:null===(i=null==e?void 0:e[0])||void 0===i?void 0:i._id})},sx:{px:1,py:.25,mr:1},children:h(g>1?"VIEW_FILES":"VIEW_FILE")}):null]}))]})};l.d(t,["A",0,m])},91895(e,t,l){var i=l(74848),a=l(60288),o=l(96540),n=l(50936),s=l(60794),r=function(e,t){var l={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(l[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(l[i[a]]=e[i[a]])}return l};const d=(0,o.forwardRef)((e,t)=>{var{value:l}=e,o=r(e,["value"]);const{theme:d}=(0,a.A)(),{withEditableStyle:c=!1,withoutHoverStyle:u=!1}=o,m=r(o,["withEditableStyle","withoutHoverStyle"]);return(0,i.jsx)(n.A,Object.assign({ref:t,flexDirection:"row",alignItems:"center"},m,{sx:c?Object.assign(Object.assign({},(0,s.A)({theme:d,withoutHoverStyle:u})),m.sx):Object.assign({},m.sx),children:l}))});d.displayName="EditablePropWrapper",l.d(t,["h",0,d])},93536(e,t,l){var i=l(74848),a=l(73822),o=l(57296),n=l(75201),s=l(90516),r=l(99273),d=l(52318),c=l(16718),u=l(12092),m=l(10609),h=l(45234),x=l(35437),p=l(47237),g=l(36585),v=l(62846),y=l(4969),f=l(27753),b=l(9372),j=l(96540),A=l(14863),C=l(41180),_=l(71500),S=l(19749),E=l(40833),w=l(19678);l.d(t,["U",0,()=>{var e,t;const{scale:l,scalePercentage:F,handleZoomIn:T,handleZoomOut:O}=(0,C.n)(),{busy:N,markAsBusy:D,markAsNotBusy:I}=(0,s.A)(),{close:L,showData:M}=(0,r.A)(),k=(0,j.useRef)(null),R=M,V=(null==R?void 0:R.images)&&(null===(e=null==R?void 0:R.images)||void 0===e?void 0:e.find(e=>(null==e?void 0:e._id)===(null==R?void 0:R.selected))),{handleDownload:B}=(0,d.A)({content:()=>null==k?void 0:k.current,documentTitle:`${n.A.getFormattedName(V)}`}),W=()=>{V&&(D(),fetch(null==V?void 0:V.link).then(e=>e.blob()).then(e=>{const t=window.URL.createObjectURL(e),l=document.createElement("a");l.href=t,l.download=n.A.getFormattedName(V)||"file",l.click(),window.URL.revokeObjectURL(t),l.remove(),I()}).catch(e=>{I()}))};if(!V)return null;const z=(0,i.jsxs)(p.a,{sx:{width:"33.33%",pr:1},children:[(0,i.jsx)(f.o,{noWrap:!0,sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}},fontWeight:500,children:n.A.getFormattedName(V)}),(0,i.jsxs)(f.o,{variant:"bodySm",noWrap:!0,fontSize:14,sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}},children:[(null==V?void 0:V.sizeInBytes)?`${null==V?void 0:V.sizeInBytes} · `:"",o.Ay.get(null==V?void 0:V.createdAt).format(o.Ay.formatOptions.DATE_MONTH_YEAR)]})]}),$=(0,i.jsx)(p.a,{sx:Object.assign(Object.assign({},b.A.flexCenter),{width:"33.33%",pr:1}),gap:2,children:(0,i.jsxs)(p.a,{sx:Object.assign(Object.assign({},b.A.flexCenter),{backgroundColor:"#4E4E4E",borderRadius:1}),children:[(0,i.jsx)(y.K,{onClick:O,children:(0,i.jsx)(x.A,{sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}}})}),(0,i.jsxs)(f.o,{sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}},children:[F,"%"]}),(0,i.jsx)(y.K,{onClick:T,children:(0,i.jsx)(c.A,{sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}}})})]})}),P=(0,i.jsxs)(p.a,{sx:Object.assign(Object.assign({},b.A.flexEnd),{width:"33.33%",pr:1}),gap:2,children:[(0,i.jsx)(y.K,{sx:{cursor:N?"wait":"pointer"},disabled:N,onClick:W,children:(0,i.jsx)(m.A,{sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}}})}),(0,A.tt)(null==V?void 0:V.link)?(0,i.jsx)(y.K,{sx:{cursor:N?"wait":"pointer"},disabled:N,onClick:B,children:(0,i.jsx)(h.A,{sx:{color:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white}}})}):null]}),U=(0,i.jsx)(v.L,{sx:{backgroundColor:"#F2F4F7",height:44,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end"},children:(0,i.jsx)(y.K,{sx:{backgroundColor:e=>{var t,l,i;return null===(i=null===(l=null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.otColors)||void 0===l?void 0:l.base)||void 0===i?void 0:i.white},border:1,borderColor:e=>{var t;return null===(t=null==e?void 0:e.palette)||void 0===t?void 0:t.divider},borderRadius:1,padding:.5},onClick:L,children:(0,i.jsx)(u.A,{fontSize:"inherit"})})}),H=(0,i.jsxs)(g.C,{sx:{backgroundColor:"#1c1c1c"},children:[(0,i.jsxs)(p.a,{sx:Object.assign(Object.assign({width:"100%"},b.A.flexCenter),{justifyContent:"space-between",px:{md:1,sm:.2},py:1}),children:[z,(0,A.tt)(null==V?void 0:V.link)?$:null,P]}),(null==V?void 0:V.link)&&(0,A.sN)(null==V?void 0:V.link)?(0,i.jsx)(_.Ay,{style:{height:"90%",overflow:"hidden"},config:{header:{disableHeader:!0}},documents:[{uri:null==V?void 0:V.link}],pluginRenderers:_.tu}):null,(0,A.tt)(null==V?void 0:V.link)?(0,i.jsx)(p.a,{ref:k,sx:Object.assign(Object.assign({},b.A.flexCenter),{mt:2}),children:(null===(t=null==R?void 0:R.images)||void 0===t?void 0:t.length)&&(null==V?void 0:V.link)?(0,i.jsx)(a.Ay,{scale:l,imageUrl:null==V?void 0:V.link,style:{border:"none",borderColor:()=>"transparent"},handleZoomIn:()=>{},handleZoomOut:()=>{},scalePercentage:0,hideAnnotation:!0}):null}):null,(null==V?void 0:V.link)&&(0,A.Q5)(null==V?void 0:V.link)?(0,i.jsx)(S.A,{src:null==V?void 0:V.link,onComment:()=>{},ref:null,annotations:{},fileType:"audio"}):null,(null==V?void 0:V.link)&&(0,A.nr)(null==V?void 0:V.link)?(0,i.jsx)(S.A,{src:null==V?void 0:V.link,onComment:()=>{},ref:null,hideAnnotation:!0,annotations:{}}):null,(null==V?void 0:V.link)&&(0,A.Y3)(null==V?void 0:V.link)?(0,i.jsx)(E.n,{ref:null,file:V,onComment:()=>{},hideAnnotation:!0}):null,!(null==V?void 0:V.link)||(0,A.sN)(null==V?void 0:V.link)||(0,A.tt)(null==V?void 0:V.link)||(0,A.Q5)(null==V?void 0:V.link)||(0,A.Y3)(null==V?void 0:V.link)||(0,A.nr)(null==V?void 0:V.link)?null:(0,i.jsx)(w.A,{downloadButtonProps:{onClick:W}})]});return(0,i.jsxs)(i.Fragment,{children:[U,H]})}])},68575(e,t,l){var i=l(74848),a=l(58331),o=l(11848),n=l(64715),s=function(e,t){var l={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(l[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(l[i[a]]=e[i[a]])}return l};const r=(0,o.Ay)(e=>{var{className:t}=e,l=s(e,["className"]);return(0,i.jsx)(n.m,Object.assign({},l,{classes:{popper:t}}))})(({theme:e})=>({[`& .${a.A.tooltip}`]:{backgroundColor:e.palette.background.default,color:e.palette.otColors.secondary[400],maxWidth:"60ch",fontSize:e.typography.pxToRem(12),border:"1px solid #dadde9"}}));l.d(t,["l",0,r])},34791(e,t,l){var i=l(74848),a=l(14977),o=l(96540),n=l(60288),s=function(e,t){var l={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(l[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(l[i[a]]=e[i[a]])}return l};const r=(0,o.forwardRef)((e,t)=>{const l=s(e,[]),{theme:o}=(0,n.A)();return(0,i.jsx)(a.A,Object.assign({elevation:0,ref:t},l,{sx:Object.assign({display:"flex",flexDirection:"column",p:2,border:`1px solid ${o.palette.otColors.secondary[200]}`,boxShadow:"0px 1px 2px 0px rgba(16, 24, 40, 0.05)",borderRadius:"12px","& *":{lineHeight:1,button:{boxShadow:"none","&:hover":{boxShadow:"none"}}}},null==l?void 0:l.sx)}))});l.d(t,["Z",0,r])},43732(e,t,l){const i=e=>`custom_${e}`,a=(e,t,l)=>{var i,a,o;if(!e)return"";switch(t){case"text":return null!==(i=e.stringValue)&&void 0!==i?i:"";case"number":return null==e.numberValue?"":String(e.numberValue);case"boolean":return null==e.booleanValue?"":e.booleanValue?l("YES"):l("NO");case"singleSelect":case"multiSelect":return(null!==(a=e.arrayValue)&&void 0!==a?a:[]).filter(e=>"selected"===e.value).map(e=>e.label).join(", ");case"file":return(null!==(o=e.fileValue)&&void 0!==o?o:[]).map(e=>
1e.link||e.url||"").filter(Boolean).join(", ");default:return""}};l.d(t,["Kr",0,(e,t,l,o)=>Object.fromEntries(t.map(t=>{var n;const s=null===(n=e.customFields)||void 0===n?void 0:n.find(e=>"respond"===e.mode&&e[l]===t._id);return[i(t._id),a(s,t.type,o)]})),"kg",0,e=>e.map(e=>({label:e.name,key:i(e._id)})),"uT",0,(e,t)=>{const l=new Map,i=new Set;return e.forEach(e=>{var a;null===(a=e.customFields)||void 0===a||a.forEach(e=>{var a,o;const n=((e,t)=>"respond"===e.mode?e[t]:e._id)(e,t);if(!n)return;const s="respond"!==e.mode;(!l.has(n)||!i.has(n)&&s)&&(l.set(n,{_id:n,name:e.name||(null===(a=e.customField)||void 0===a?void 0:a.name)||"",type:(null===(o=e.customField)||void 0===o?void 0:o.type)||"text",isActive:Boolean(e.isActive)}),s&&i.add(n))})}),[...l.values()].filter(e=>e.isActive).map(({_id:e,name:t,type:l})=>({_id:e,name:t,type:l}))}])},52318(e,t,l){var i=l(69790),a=l(60895),o=l.n(a),n=l(57240),s=l(60288);const r=e=>{const t=(0,n.useReactToPrint)(e),{isDark:l,currentTheme:a,changeTheme:r}=(0,s.A)();return{handlePrint:t,handleDownload:()=>{if(l){const e=a;r(i.jy.LIGHT),o()(()=>{t(),o()(()=>{r(e)},500)},500)}else t()}}};l.d(t,["A",0,r])},15943(e,t,l){var i=l(96540),a=l(38409);const o=(e,t=[],l)=>{const o=(0,i.useRef)(null),[n,s]=(0,i.useState)(0),{isNone:r}=(0,a.A)(),d=(0,i.useRef)(null);return(0,i.useEffect)(()=>(d.current&&clearTimeout(d.current),o.current&&(d.current=setTimeout(()=>{var e;s(null===(e=o.current)||void 0===e?void 0:e.getBoundingClientRect().top)},null!=l?l:200)),()=>{d.current&&clearTimeout(d.current)}),[e.isLoading,r,...t]),{tableTop:o,tableTopHeight:n}};l.d(t,["A",0,o])},64189(e,t,l){var i=l(9598);const a=e=>{const t=String(null!=e?e:"").trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:`https://${t}`:""};l.d(t,["Go",0,e=>{const t=a(e);if(!t)return!0;try{const e=new URL(t);return e.hostname.includes(".")&&!e.hostname.endsWith(".")}catch(e){return!1}},"SG",0,(e,t)=>(0,i.yk)(e,t)||(0,i.e)(e),"no",0,(e,t)=>(0,i.BH)(e,t),"tw",0,a])},81565(e,t,l){l.r(t),l.d(t,{default:()=>fl});var i=l(74848),a=l(36165),o=l(8561),n=l(47237),s=l(59884),r=l(63064),d=l(43667),c=l(1887),u=l(96540),m=l(69790),h=l(54881),x=l(99708),p=l(61208),g=l(65837),v=l(24495),y=l(93446),f=l(42093),b=l(38842),j=l(67772),A=l(96102),C=l(91333),_=l(85971),S=l(73199),E=l(91367),w=l(72635),F=l(35778);var T=l(34791),O=l(27753),N=l(66762),D=l(89929),I=l(57296),L=l(15943);const M=()=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:(0,i.jsx)("path",{d:"M7.00008 4.08333C5.39008 4.08333 4.08341 5.39 4.08341 7C4.08341 8.61 5.39008 9.91667 7.00008 9.91667C8.61008 9.91667 9.91675 8.61 9.91675 7C9.91675 5.39 8.61008 4.08333 7.00008 4.08333ZM7.00008 1.16667C3.78008 1.16667 1.16675 3.78 1.16675 7C1.16675 10.22 3.78008 12.8333 7.00008 12.8333C10.2201 12.8333 12.8334 10.22 12.8334 7C12.8334 3.78 10.2201 1.16667 7.00008 1.16667ZM7.00008 11.6667C4.42175 11.6667 2.33341 9.57833 2.33341 7C2.33341 4.42167 4.42175 2.33333 7.00008 2.33333C9.57841 2.33333 11.6667 4.42167 11.6667 7C11.6667 9.57833 9.57841 11.6667 7.00008 11.6667Z",fill:"#98A2B3"})});var k=l(39781),R=l(60288),V=l(46093),B=l(51576),W=l(26436),z=l(78419),$=l(22827),P=l(98326),U=l(87349),H=l(96141),Y=l(8239),G=l(72312),q=l(94664),Q=l(58410),K=l(36636),Z=l(80728),X=l(7048),J=l(43247),ee=l(65491),te=l(38478),le=l(14917),ie=l(27793),ae=l(26528),oe=l(72498),ne=l(93197),se=l(41184),re=l(78707),de=l(30743),ce=l(87116),ue=l(26536),me=l(78624),he=l(87323);const xe={firstName:"First Name",lastName:"Last Name",closedWonDealAmount:"CLOSED_WON_DEAL_AMMOUNT",closedWonDealCurrency:"CURRENCY",contactLastEngagementType:"CONTACT_LAST_ENGAGEMENT_TYPE",firstOutreachDate:"FIRST_OUTREACH_DATE",lastActivityDate:"LAST_ACTIVITY_DATE",emailCount:"EMAIL_COUNT",meetingCount:"MEETING_COUNT",messageThreadCount:"MESSAGE_THREAD_COUNT",outreachActivityCount:"OUTREACH_ACTIVITY_COUNT"},pe=(0,J.Z)(),ge=["closedWonDealAmount","emailCount","meetingCount","messageThreadCount","outreachActivityCount"],ve=({field:e,value:t,setShowState:l,detailsData:o,roleId:s,setDetailsData:d})=>{var x;const{theme:p}=(0,R.A)(),g=(0,r.jE)(),{t:y}=(0,v.A)(),{schema:f}=(0,ce.A)(y),[b,j]=(0,u.useState)(t),[C,_]=(0,u.useState)(),[S,E]=(0,u.useState)(t),w=(0,X.f)(),T=(0,X.f)(),L=(0,X.f)(),{company:M}=(0,c.A)(),{commonToaster:k}=(0,ue.A)(),{sidebarModuleName:V}=(0,me.A)(),{successToaster:B,errorToaster:W,markAsBusy:z,markAsNotBusy:$,busy:P}=(0,A.A)(),{list:U=[],query:Y}=(0,h.A)(),J=(0,u.useMemo)(()=>U.filter(e=>
1e.role.role.name===m.z7.CLIENT&&"Client"!==e.status),[U]),ve="leadCompanyMember"===o.type||"clientCompany"===o.leadEntitySource||"company"===o.clientSelectionType,{list:ye=[],query:fe}=(0,le.A)({listApi:()=>a.Ay.label.category.list(),reactQueryAlias:m.E5.CATEGORY_LIST,listKey:"data"});(0,u.useEffect)(()=>{j(t),"category"===e&&Array.isArray(t)&&E(t)},[t,e]);const be=async(t,l=o._id)=>{g.setQueryData([m.E5.MEMBER_LIST,"client",s,{}],i=>i?Object.assign(Object.assign({},i),{acceptedMembers:i.acceptedMembers.map(i=>i._id===l?Object.assign(Object.assign({},o),{[e]:t.user[e]}):i)}):{count:0,acceptedMembers:[]}),d(Object.assign(Object.assign({},o),{[e]:t.user[e]})),B({message:y("__LEAD__",{moduleNameLead:y(V("item:lead").customNameSingular)}),type:"update"});try{ve||await(0,de.O)(d,g,o,s)}catch(e){}},je=new Set(ge),Ae=new Set(["emailCount","meetingCount","messageThreadCount","outreachActivityCount"]),Ce=i=>{var n,s;let r=null!=i?i:b,c=t;const u="string"==typeof r&&""===r.trim();if("category"===e&&(r=b),je.has(e))if(u)r="",c=null==t?"":`${t}`;else{const l="number"==typeof r?r:"string"==typeof r&&r.trim().length?Number(r):void 0;if(void 0!==l&&(Number.isNaN(l)||!Number.isFinite(l)))return void _({message:"INVALID_NUMBER"});if(void 0!==l&&Ae.has(e)&&(l<0||!Number.isInteger(l)))return void _({message:"VALUE_MUST_BE_NON_NEGATIVE_INTEGER"});r=l,c=null==t||""===t?void 0:Number(t)}else u&&(r="",c=t??"");const m=((e,t)=>{var l;const i=null===(l=f.safeParse({[e]:t}).error)||void 0===l?void 0:l.issues.find(t=>t.path[0]===e);return _({message:null==i?void 0:i.message}),!(null==i?void 0:i.message)})(e,r),h=[],x=[];if((null==S?void 0:S.length)&&"category"===e&&(null==S||S.forEach(e=>{var t;(null===(t=null==o?void 0:o.category)||void 0===t?void 0:t.some(t=>t.label._id===e._id))||h.push(e._id)})),(null===(n=null==o?void 0:o.category)||void 0===n?void 0:n.length)&&"category"===e&&(null===(s=null==o?void 0:o.category)||void 0===s||s.forEach(e=>{(null==S?void 0:S.some(t=>{var l;return t._id===(null===(l=e.label)||void 0===l?void 0:l._id)}))||x.push(e._id)})),m&&l(""),!("category"===e&&0==h.length&&0===x.length||"category"!==e&&r===c)&&m)if("email"===e){if(J.some(e=>r&&e.email===(null==r?void 0:r.trim())))return void k("error",y("__LEAD_ALREADY_EXISTS__",{moduleNameLead:y(V("item:lead").customNameSingular)}));a.Ay.company.changeCLientEmail({companyId:M._id,body:{clientId:o._id,newEmail:r}}).then(({data:e})=>{be(e,o._id),ve&&d(e=>e?Object.assign(Object.assign({},e),{email:String(r||""),companyOwnerEmail:String(r||"")}):e)}).catch(e=>{W(e)})}else{const t=o._id,l=h.length>0||x.length>0?{accountId:t,insertCategory:h,removeCategory:x}:{accountId:t,[e]:r};a.Ay.company.memberUpdate({body:l}).then(({data:e})=>be(e,t)).catch(e=>{W(e)})}},_e=(0,i.jsx)(q.A,{open:!0,fullWidth:!0,filterSelectedOptions:!0,loading:Y.isLoading,value:null==U?void 0:U.find(e=>e._id===b),onChange:(e,t)=>
1j(t?t._id:null),onBlur:()=>{Ce(),l("")},renderInput:e=>(0,i.jsx)(G.p,Object.assign({},e,{autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{minHeight:"48px",height:"unset"},"& .MuiOutlinedInput-root .MuiAutocomplete-input":{p:0}},placeholder:y("__SELECT__",{name:y("ASSIGNEE")})})),options:U.filter(e=>e.role.role.name===m.z7.SUPERADMIN||e.role.role.name===m.z7.ADMIN||e.role.role.name===m.z7.PROJECT_MANAGER||e.role.role.name===m.z7.ASSIGNEE),getOptionLabel:e=>(null==e?void 0:e.firstName)?`${D.A.capitalize(null==e?void 0:e.firstName)} ${D.A.capitalize(null==e?void 0:e.lastName)}`:null==e?void 0:e.email,renderTags:(e,t)=>e.map((e,l)=>(0,i.jsx)(Q.c,Object.assign({},t({index:l}),{size:"small",variant:"outlined",label:(null==e?void 0:e.firstName)?`${D.A.capitalize(null==e?void 0:e.firstName)}`:null==e?void 0:e.email,avatar:(0,i.jsx)(N.A,{imageUrl:null==e?void 0:e.profileImage,name:null==e?void 0:e._id,clientName:(0,F.M)(null==e?void 0:e.firstName,null==e?void 0:e.lastName),size:16,hideImageBorder:!0}),sx:{bgcolor:p.palette.otColors.secondary[50],borderColor:p.palette.otColors.secondary[300],borderRadius:1,px:.5,minHeight:"28px"}}))),renderRow:e=>{var t,l,a,o,n,s,r,d;const{data:c,index:u,style:m}=e,h=c[u],x=Object.assign(Object.assign({},m),{top:m.top+8});return(0,i.jsx)(O.o,Object.assign({component:"li"},h[0],{noWrap:!0,style:x,children:(0,i.jsx)(H.e,{componentBeforeText:(0,i.jsx)(N.A,{imageUrl:null===(t=h[1])||void 0===t?void 0:t.profileImage,name:null===(l=h[1])||void 0===l?void 0:l._id,clientName:(0,F.M)(null===(a=h[1])||void 0===a?void 0:a.firstName,null===(o=h[1])||void 0===o?void 0:o.lastName),hideImageBorder:!0}),text:(null===(n=h[1])||void 0===n?void 0:n.firstName)?`${D.A.capitalize(null===(s=h[1])||void 0===s?void 0:s.firstName)} ${D.A.capitalize(null===(r=h[1])||void 0===r?void 0:r.lastName)}`:null===(d=h[1])||void 0===d?void 0:d.email})}))}}),Se=(e,t)=>(0,i.jsx)(ie.A,{open:e.isOpen,anchorEl:e.popoverEl,onClose:e.close,children:(0,i.jsx)(ae.A,{openTo:"day",value:t?I.Ay.get(t):void 0,onChange:e=>{if(!e)return;const t=I.Ay.get(e),l=I.Ay.get(),i=t.hour(l.hour()).minute(l.minute()).second(l.second()).millisecond(l.millisecond());j(i.toISOString())},onAccept:t=>{t&&(Ce(),e.close())},onClose:e.close})}),Ee=Se(w,o.lastContactedAt),we=(0,i.jsx)(ee.A,{freeSolo:!0,multiple:!0,filterSelectedOptions:!0,openOnFocus:!0,id:"client-category",loading:fe.isLoading||P,sx:{minWidth:"unset",mt:1,"& .MuiOutlinedInput-root .MuiAutocomplete-input":{p:0}},value:S,onBlur:()=>{Ce(),l("")},onChange:(e,t)=>
1{if(!Array.isArray(t))return;const l=null==t?void 0:t.find(e=>"string"!=typeof e&&!0===e.__isNew__||"string"==typeof e);if(l)return z(),void a.Ay.label.category.create({body:{name:"string"!=typeof l?l.inputValue:l,color:"string"!=typeof l?l.color:te.A.colors[l.charCodeAt(0)%te.A.colors.length],type:"category"}}).then(e=>{B({message:y("CATEGORY"),type:"create"}),$(),E(t.map(t=>t.__isNew__?e.data.label:t)),fe.refetch(),"string"==typeof l&&E(t.map(t=>"string"==typeof t?Object.assign({},e.data.label):t))}).catch(e=>{$(),W(e)});E(t)},renderTags:(e,t)=>e.map((e,l)=>(0,u.createElement)(Q.c,Object.assign({},t({index:l}),{key:e._id,label:e.name,variant:"contained-tonal",size:"small",sx:{px:0,bgcolor:`${e.color}15`,color:e.color,":hover":{bgcolor:`${e.color}25`}}}))),renderInput:e=>(0,i.jsx)(G.p,Object.assign({},e,{sx:{"& .MuiOutlinedInput-root":{minHeight:"48px",height:"unset"}},autoFocus:!0,placeholder:y("__SELECT__",{name:y("CATEGORY")})})),options:ye,getLimitTagsText:e=>`+${e}`,renderOption:(e,t)=>(0,i.jsx)(K.D,Object.assign({},e,{children:t.name})),getOptionLabel:e=>"string"==typeof e?e:e.name,filterOptions:(e,t)=>{const l=pe(e,t),{inputValue:i}=t,a=e.some(e=>i===e.name);return""===i||a||l.push({name:`Add "${i}"`,_id:`${Math.random()}`,__isNew__:!0,inputValue:i,color:te.A.colors[i.charCodeAt(0)%te.A.colors.length]}),l},isOptionEqualToValue:(e,t)=>e._id===t._id}),Fe=(0,i.jsx)(oe.n,{fullWidth:!0,id:"client-country",multiple:!1,value:t,onChange:(e,t)=>
1{"string"==typeof t&&j(t)},onBlur:()=>{Ce(),l("")},options:ne.F.map(e=>e.name),renderInput:e=>(0,i.jsx)(G.p,Object.assign({sx:{background:"transparent"},autoFocus:!0,placeholder:y("__SELECT__",{name:y("COUNTRY")})},e)),sx:{minWidth:"unset"}}),Te=(0,i.jsx)(oe.n,{fullWidth:!0,id:"contact-last-engagement-type",multiple:!1,value:null!=t?t:null,onChange:(e,t)=>{"string"==typeof t&&j(t)},onBlur:()=>{Ce(),l("")},options:[...Z.G],renderInput:e=>(0,i.jsx)(G.p,Object.assign({sx:{background:"transparent"},autoFocus:!0,placeholder:"Select a Type"},e)),sx:{minWidth:"unset"}}),Oe=(0,i.jsx)(ee.A,{fullWidth:!0,id:"closedWonDealCurrency",multiple:!1,value:null!==(x=he.Ay.list.find(e=>e.code===b))&&void 0!==x?x:null,onChange:(e,t,l)=>{var i;j("clear"!==l&&null!==(i=null==t?void 0:t.code)&&void 0!==i?i:"USD")},onBlur:()=>{Ce(),l("")},options:he.Ay.list,filterOptions:he.Ay.filterCurrencyOptions,renderInput:e=>(0,i.jsx)(G.p,Object.assign({},e,{autoFocus:!0,placeholder:y("__SELECT__",{name:y("CURRENCY")}),sx:{"& .MuiOutlinedInput-root .MuiAutocomplete-input":{p:0}}})),getOptionLabel:e=>`${e.name} (${e.symbol})`,isOptionEqualToValue:(e,t)=>e.code===(null==t?void 0:t.code),renderOption:(e,t)=>(0,i.jsx)(O.o,Object.assign({},e,{children:(0,i.jsx)(H.e,{id:t.name,text:`${t.name} (${t.symbol})`})})),sx:{"& .MuiOutlinedInput-root":{height:"unset"}}}),Ne=Se(T,o.firstOutreachDate),De=Se(L,o.lastActivityDate),Ie=e=>e?I.Ay.get(e).format(I.Ay.formatOptions.DATE_MONTH_TIME):"-",Le=(0,i.jsx)(oe.n,{fullWidth:!0,id:"lead-status",multiple:!1,value:t,onChange:(e,t)=>
1{j(t)},onBlur:()=>{Ce(),l("")},options:Z.B.filter(e=>e!==t).map(e=>e),renderInput:e=>(0,i.jsx)(G.p,Object.assign({sx:{background:"transparent"},autoFocus:!0,placeholder:y("__SELECT__",{name:y("STATUS")})},e)),sx:{minWidth:"unset"}});return"category"===e?we:(0,i.jsx)(n.a,{sx:{"& .MuiInputBase-root":{height:"2rem !important",padding:".5rem !important",borderRadius:".25rem !important"},"& input":{color:`${p.palette.otColors.secondary.dark} !important`,fontSize:".75rem !important",fontWeight:"500 !important",lineHeight:"130% !important"}},children:"contactLastEngagementType"===e?Te:"lastContactedAt"===e?(0,i.jsxs)(i.Fragment,{children:[Ee,(0,i.jsx)(H.e,{withEditableStyle:!0,text:Ie(o.lastContactedAt),onClick:w.open,componentBeforeText:o.lastContactedAt?(0,i.jsx)(se.A,{sx:{width:".875rem"}}):""})]}):"firstOutreachDate"===e?(0,i.jsxs)(i.Fragment,{children:[Ne,(0,i.jsx)(H.e,{withEditableStyle:!0,text:Ie(o.firstOutreachDate),onClick:T.open,componentBeforeText:o.firstOutreachDate?(0,i.jsx)(se.A,{sx:{width:".875rem"}}):""})]}):"lastActivityDate"===e?(0,i.jsxs)(i.Fragment,{children:[De,(0,i.jsx)(H.e,{withEditableStyle:!0,text:Ie(o.lastActivityDate),onClick:L.open,componentBeforeText:o.lastActivityDate?(0,i.jsx)(se.A,{sx:{width:".875rem"}}):""})]}):["agent","status","country","closedWonDealCurrency"].includes(e)?(0,i.jsxs)(i.Fragment,{children:["agent"===e&&_e,"status"===e&&Le,"country"===e&&Fe,"closedWonDealCurrency"===e&&Oe]}):(0,i.jsx)(G.p,{type:je.has(e)?"number":"text",inputMode:"closedWonDealAmount"===e?"decimal":je.has(e)?"numeric":void 0,value:null!=b?b:"",autoFocus:!0,onChange:e=>j(e.target.value),onBlur:()=>Ce(),error:Boolean(null==C?void 0:C.message),helperText:y(null==C?void 0:C.message,{name:y((0,re.g)(xe[e]?xe[e]:e))})})})};var ye=l(44699),fe=l(9372),be=l(9051);const je=({details:e,roleId:t,setDetailsData:l})=>{var a,o,s,r,d,c,m,h;const{t:x}=(0,v.A)(),{theme:p}=(0,R.A)(),[g,y]=(0,u.useState)(""),{sidebarModuleName:f}=(0,me.A)(),b="company"===(0,u.useMemo)(()=>"leadCompanyMember"===(null==e?void 0:e.type)||"company"===(null==e?void 0:e.clientSelectionType)?"company":!e.companyName||e.firstName&&e.lastName?"individual":"company",[null==e?void 0:e.type,null==e?void 0:e.clientSelectionType,e.companyName,e.firstName,e.lastName]),j={color:p.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"500",lineHeight:"130%",paddingY:"0.5rem",paddingLeft:"1.5rem"},A={color:p.palette.otColors.secondary[800],fontSize:".75rem",fontWeight:"500",lineHeight:"1.125rem"},C=b?[{label:"COMPANY_NAME_LITERAL",value:(0,i.jsx)(i.Fragment,{children:"companyName"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"companyName",value:e.companyName,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.companyName?e.companyName:"-",onClick:()=>y("companyName")})})},{label:"OWNER",value:(0,i.jsx)(i.Fragment,{children:"email"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"email",value:e.email,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.email||"-",onClick:()=>y("email")})})},{label:x("__LEAD_VALUE__",{moduleNameLead:x(f("item:lead").customNameSingular)}),value:(0,i.jsx)(i.Fragment,{children:"leadValue"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"leadValue",value:e.leadValue,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.leadValue?e.leadValue:"-",onClick:()=>y("leadValue")})})}]:[{label:"FIRST_NAME",value:(0,i.jsx)(i.Fragment,{children:"firstName"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"firstName",value:e.firstName,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.firstName,onClick:()=>y("firstName")})})},{label:"LAST_NAME",value:(0,i.jsx)(i.Fragment,{children:"lastName"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"lastName",value:e.lastName,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.lastName,onClick:()=>y("lastName")})})},{label:"PHONE_NUMBER",value:(0,i.jsx)(i.Fragment,{children:"contactNo"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"contactNo",value:e.contactNo,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.contactNo,onClick:()=>y("contactNo")})})},{label:"EMAIL",value:(0,i.jsx)(i.Fragment,{children:"email"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"email",value:e.email,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.email,sx:{"& a":{display:"block",maxWidth:"10rem",overflow:"hidden",
1whiteSpace:"nowrap",textOverflow:"ellipsis"}},onClick:e=>{e.preventDefault(),y("email")}})})},{label:"COMPANY_NAME_LITERAL",value:(0,i.jsx)(i.Fragment,{children:"companyName"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"companyName",value:e.companyName,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.companyName?e.companyName:"-",onClick:()=>y("companyName")})})},{label:x("__LEAD_VALUE__",{moduleNameLead:x(f("item:lead").customNameSingular)}),value:(0,i.jsx)(i.Fragment,{children:"leadValue"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"leadValue",value:e.leadValue,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.leadValue?e.leadValue:"-",onClick:()=>y("leadValue")})})}],S=[{label:"ASSIGNED_AGENT",value:(0,i.jsx)(i.Fragment,{children:"agent"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"agent",value:null===(a=e.agent)||void 0===a?void 0:a._id,setShowState:y,setDetailsData:l}):(0,i.jsx)(ye.g,{withEditableStyle:!0,imagesWithName:e.agent?[{image:e.agent.profileImage||e.agent._id,name:e.agent.firstName?`${D.A.capitalize(e.agent.firstName)} ${D.A.capitalize(e.agent.lastName)}`:e.agent.email}]:[],onClick:()=>y("agent")})})},{label:"STATUS",value:(0,i.jsx)(i.Fragment,{children:"status"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"status",value:e.status,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.status?e.status:"-",onClick:()=>y("status")})})},{label:"WEBSITE",value:(0,i.jsx)(i.Fragment,{children:"website"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"website",value:e.website,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.website?e.website:"-",onClick:()=>y("website"),truncateLength:20,componentBeforeText:e.website?(0,i.jsx)(be.A,{sx:{width:".875rem"}}):""})})},{label:"SOURCE",value:(0,i.jsx)(i.Fragment,{children:"source"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"source",value:e.source,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.source||"-",onClick:()=>y("source"),truncateLength:20,componentBeforeText:e.source?(0,i.jsx)(_.A,{sx:{width:".875rem"}}):void 0,sx:{"& p:nth-of-type(2)":{color:e=>e.palette.otColors.secondary[400]}}})})},{label:"LAST_INTERACTION",value:(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"lastContactedAt",value:e.lastContactedAt?e.lastContactedAt:"-",setShowState:y,setDetailsData:l})})},{label:"CATEGORY",value:(0,i.jsx)(i.Fragment,{children:"category"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"category",value:null===(o=e.category)||void 0===o?void 0:o.map(e=>e.label),setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,onClick:()=>y("category"),text:0===(null===(s=e.category)||void 0===s?void 0:s.length)?"-":"",componentBeforeText:e.category&&e.category.length>0?(0,i.jsx)(n.a,{sx:Object.assign(Object.assign({},fe.A.flexStart),{flexWrap:"wrap",gap:"4px"}),children:null===(r=e.category)||void 0===r?void 0:r.map(e=>(0,i.jsx)(Q.c,{label:e.label.name,variant:"contained-tonal",size:"small",sx:{px:0,bgcolor:`${e.label.color}15`,color:e.label.color,":hover":{bgcolor:`${e.label.color}25`}}},e._id))}):void 0})})}],E=[{label:"COUNTRY",value:(0,i.jsx)(i.Fragment,{children:"country"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"country",value:e.country,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.country?e.country:"-",onClick:()=>y("country")})})},{label:"STATE",value:(0,i.jsx)(i.Fragment,{children:"state"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"state",value:e.state,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.state?e.state:"-",onClick:()=>y("state")})})},{label:"CITY",value:(0,i.jsx)(i.Fragment,{children:"city"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"city",value:e.city,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.city?e.city:"-",onClick:()=>y("city")})})},{label:"ZIP_CODE",value:(0,i.jsx)(i.Fragment,{children:"zipCode"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"zipCode",value:e.zipCode,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.zipCode?e.zipCode:"-",onClick:()=>y("zipCode")})})},{label:"STREET_ADDRESS",value:(0,i.jsx)(i.Fragment,{children:"address"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"address",value:e.address,setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:e.address?e.address:"-",onClick:()=>y("address")})})}],w=(null===(c=null===(d=null==e?void 0:e.closedWonDealCurrency)||void 0===d?void 0:d.toUpperCase)||void 0===c?void 0:c.call(
1d))||(null===(h=null===(m=null==e?void 0:e.currency)||void 0===m?void 0:m.toUpperCase)||void 0===h?void 0:h.call(m))||"USD",F=[{label:"CURRENCY",value:(0,i.jsx)(i.Fragment,{children:"closedWonDealCurrency"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"closedWonDealCurrency",value:e.closedWonDealCurrency||(null==e?void 0:e.currency)||"USD",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:w,onClick:()=>y("closedWonDealCurrency")})})},{label:"CLOSED_WON_DEAL_AMMOUNT",value:(0,i.jsx)(i.Fragment,{children:"closedWonDealAmount"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"closedWonDealAmount",value:void 0!==e.closedWonDealAmount&&null!==e.closedWonDealAmount?e.closedWonDealAmount.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.closedWonDealAmount&&null!==e.closedWonDealAmount?`${e.closedWonDealAmount} ${w}`:"-",onClick:()=>y("closedWonDealAmount")})})},{label:"Last Engagement Type",value:(0,i.jsx)(i.Fragment,{children:"contactLastEngagementType"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"contactLastEngagementType",value:void 0!==e.contactLastEngagementType&&null!==e.contactLastEngagementType?e.contactLastEngagementType.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.contactLastEngagementType&&null!==e.contactLastEngagementType?`${e.contactLastEngagementType}`:"-",onClick:()=>y("contactLastEngagementType")})})},{label:"Disqualification Reason",value:(0,i.jsx)(i.Fragment,{children:"disqualificationReason"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"disqualificationReason",value:void 0!==e.disqualificationReason&&null!==e.disqualificationReason?e.disqualificationReason.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.disqualificationReason&&null!==e.disqualificationReason&&""!==e.disqualificationReason?`${e.disqualificationReason}`:"-",onClick:()=>y("disqualificationReason")})})},{label:"First Outreach Date",value:(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"firstOutreachDate",value:e.firstOutreachDate||"",setShowState:y,setDetailsData:l})},{label:"Last Activity Date",value:(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"lastActivityDate",value:e.lastActivityDate||"",setShowState:y,setDetailsData:l})},{label:"Email Count",value:(0,i.jsx)(i.Fragment,{children:"emailCount"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"emailCount",value:"number"==typeof e.emailCount?e.emailCount.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.emailCount&&null!==e.emailCount?`${e.emailCount}`:"-",onClick:()=>y("emailCount")})})},{label:"Meeting Count",value:(0,i.jsx)(i.Fragment,{children:"meetingCount"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"meetingCount",value:void 0!==e.meetingCount&&null!==e.meetingCount?e.meetingCount.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.meetingCount&&null!==e.meetingCount?`${e.meetingCount}`:"-",onClick:()=>y("meetingCount")})})},{label:"Message Thread Count",value:(0,i.jsx)(i.Fragment,{children:"messageThreadCount"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"messageThreadCount",value:void 0!==e.messageThreadCount&&null!==e.messageThreadCount?e.messageThreadCount.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.messageThreadCount&&null!==e.messageThreadCount?`${e.messageThreadCount}`:"-",onClick:()=>y("messageThreadCount")})})},{label:"Outreach Activity Count",value:(0,i.jsx)(i.Fragment,{children:"outreachActivityCount"===g?(0,i.jsx)(ve,{roleId:t,detailsData:e,field:"outreachActivityCount",value:void 0!==e.outreachActivityCount&&null!==e.outreachActivityCount?e.outreachActivityCount.toString():"",setShowState:y,setDetailsData:l}):(0,i.jsx)(H.e,{withEditableStyle:!0,text:void 0!==e.outreachActivityCount&&null!==e.outreachActivityCount?`${e.outreachActivityCount}`:"-",onClick:()=>y("outreachActivityCount")})})}],T=(e,t,l)=>(0,i.jsxs)(n.a,{id:`lead-details-${e}-row-${l}`,sx:{margin:"0px",display:"grid",gridTemplateColumns:"repeat(2, 1fr)"},children:[(0,i.jsx)(Y.Ay,{id:`lead-details-${e}-label-${l}`,item:!0,xs:2,sx:{"& .MuiTypography-root":j},children:(0,i.jsx)(O.o,{children:x(null==t?void 0:t.label)})}),(0,i.jsx)(Y.Ay,{id:`lead-details-${e}-value-${l}`,item:!0,xs:3,sx:{alignContent:"center","& .MuiTypography-root":A},children:(0,i.jsx)(O.o,{children:null==t?void 0:t.value})})]},l);return(0,i.jsxs)(n.a,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, 23rem)",justifyContent:"space-between","@media print":{display:"block"},[p.breakpoints.down("sm")]:{display:"block"}},children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(O.o,{sx:{padding:"1rem 1.5rem",color:p.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"700",lineHeight:"125%",borderBottom:`1px solid ${p.palette.otColors.secondary[200]}`,mb:".2rem"},children:x("__LEAD_INFORMATION__",{moduleNameLead:x(f("item:lead").customNameSingular)})}),null==C?void 0:C.map((e,t)=>T("lead-info",e,t))]}),(0,i.jsxs)(n.a,{sx:{mt:"2rem","@media print":{mt:"0rem"}},children:[(0,i.jsx)(O.o,{sx:{padding:"1rem 1.5rem",color:p.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"700",lineHeight:"125%",borderBottom:`1px solid ${p.palette.otColors.secondary[200]}`,mb:".2rem"},children:x("GENERAL_INFORMATION")}),null==S?void 0:S.map((e,t)=>T("general-info",e,t))]})]}),(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(O.o,{sx:{padding:"1rem 1.5rem",color:p.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"700",lineHeight:"125%",borderBottom:`1px solid ${p.palette.otColors.secondary[200]}`,mb:".2rem"},children:x("ADDRESS")}),null==E?void 0:E.map((e,t)=>T("address",e,t))]}),b?null:(0,i.jsxs)(n.a,{sx:{mt:"2rem","@media print":{mt:"0rem"}},children:[(0,i.jsx)(O.o,{sx:{padding:"1rem 1.5rem",color:p.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"700",lineHeight:"125%",borderBottom:`1px solid ${p.palette.otColors.secondary[200]}`,mb:".2rem"},children:x("OTHERS")}),null==F?void 0:F.map((e,t)=>T("others",e,t))]})]})]})},Ae=()=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:[(0,i.jsx)("path",{d:"M8.50001 1.33337C4.82001 1.33337 1.83334 4.32004 1.83334 8.00004C1.83334 11.68 4.82001 14.6667 8.50001 14.6667C12.18 14.6667 15.1667 11.68 15.1667 8.00004C15.1667 4.32004 12.18 1.33337 8.50001 1.33337ZM5.40001 12.3334C6.27334 11.7067 7.34001 11.3334 8.50001 11.3334C9.66001 11.3334 10.7267 11.7067 11.6 12.3334C10.7267 12.96 9.66001 13.3334 8.50001 13.3334C7.34001 13.3334 6.27334 12.96 5.40001 12.3334ZM12.5933 11.4134C11.4667 10.5334 10.0467 10 8.50001 10C6.95334 10 5.53334 10.5334 4.40668 11.4134C3.63334 10.4867 3.16668 9.30004 3.16668 8.00004C3.16668 5.05337 5.55334 2.66671 8.50001 2.66671C11.4467 2.66671 13.8333 5.05337 13.8333 8.00004C13.8333 9.30004 13.3667 10.4867 12.5933 11.4134Z",fill:"#475467"}),(0,i.jsx)("path",{d:"M8.50001 4.00004C7.21334 4.00004 6.16668 5.04671 6.16668 6.33337C6.16668 7.62004 7.21334 8.66671 8.50001 8.66671C9.78668 8.66671 10.8333 7.62004 10.8333 6.33337C10.8333 5.04671 9.78668 4.00004 8.50001 4.00004ZM8.50001 7.33337C7.94668 7.33337 7.50001 6.88671 7.50001 6.33337C7.50001 5.78004 7.94668 5.33337 8.50001 5.33337C9.05334 5.33337 9.50001 5.78004 9.50001 6.33337C9.50001 6.88671 9.05334 7.33337 8.50001 7.33337Z",fill:"#475467"})]});var Ce=l(812),_e=l(40530),Se=l(12582),Ee=l(73920),we=l(69316),Fe=l(16718),Te=l(10219),Oe=l(86218),Ne=l(75201),De=l(93536),Ie=l(99273),Le=l(99380);const Me=(e,t,l)=>e.map(e=>Object.assign(Object.assign({},e),{status:e.tempId===t?l:"uploading"})),ke=({details:e,setDetailsData:t})=>{const{theme:l}=(0,R.A)(),{t:o}=(0,v.A)(),{company:n}=(0,c.A)(),s=(0,r.jE)(),{errorToaster:d,successToaster:h}=(0,A.A)(),x=(0,Ie.A)(),{sidebarModuleName:p}=(0,me.A)(),[g,y]=(0,u.useState)(!1),[f,b]=(0,u.useState)(!1),[C,_]=(0,u.useState)([]),[S,E]=(0,u.useState)(),w=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==n?void 0:n.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[]),{downloadFilesHandler:F}=(0,Oe.l)(),T=async()=>{b(!0),(async()=>{const e=[];let t=C;for(const l of C)if("idle"===l.status){let i=!1;const o=new FormData;l.data&&o.append("files",l.data);const n=await a.Ay.file.uploadFiles({body:o,setFiles:_,file:l,setController:E}).catch(e=>{Le.A.isCancel(e)&&(i=!0)});n&&e.push(n),i?(t=t.filter(e=>e.tempId!==l.tempId).map(e=>Object.assign(Object.assign({},e),{status:"uploading"})),_(t),0===t.length&&(y(!1),b(!1))):(t=Me(t,l.tempId,"success"),_(t))}return e})().then(async l=>{var i,n;const r=l.flatMap(e=>e.data.files[0]),c=r.map(e=>e._id);0!==c.length&&await a.Ay.company.memberUpdate({body:{accountId:e._id,files:[...null!==(n=null===(i=e.files)||void 0===i?void 0:i.map(e=>e._id))&&void 0!==n?n:[],...c]}}).then(async()=>{var l;h({message:o("__FILE__",{moduleNameFile:o(p("item:file").customNameSingular)}),type:"create"}),t(Object.assign(Object.assign({},e),{files:[...null!==(l=e.files)&&void 0!==l?l:[],...r]})),s.setQueryData([m.E5.MEMBER_LIST,"client",w,{}],t=>t?Object.assign(Object.assign({},t),{acceptedMembers:t.acceptedMembers.map(t=>{var l;return t._id===e._id?Object.assign(Object.assign({},e),{files:[...null!==(l=e.files)&&void 0!==l?l:[],...r]}):t})}):{count:0,acceptedMembers:[]}),b(!1),y(!1),_([]);try{await(0,de.O)(t,s,e,w)}catch(e){}}).catch(e=>{d(e)})})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(B.$,{sx:{mt:".25rem",mb:".75rem",padding:"0.5rem 0.75rem",backgroundColor:l.palette.otColors.secondary.light,color:l.palette.otColors.secondary[600]},onClick:()=>y(!0),variant:"text",startIcon:(0,i.jsx)(Fe.A,{sx:{width:"1rem"}}),children:o("ADD_ATTACHMENT")}),(0,i.jsx)(Te.I,{files:e.files,deleteHandler:l=>{return i=l,t(Object.assign(Object.assign({},e),{files:null===(n=e.files)||void 0===n?void 0:n.filter(e=>e._id!==i._id)})),void a.Ay.file.delete({body:{fileIds:[i._id]}}).then(()=>{h({message:o("__FILE__",{moduleNameFile:o(p("item:file").customNameSingular)}),type:"delete"}),s.setQueryData([m.E5.MEMBER_LIST,"client",w,{}],t=>t?Object.assign(Object.assign({},t),{acceptedMembers:t.acceptedMembers.map(t=>{var l;return t._id===e._id?Object.assign(Object.assign({},e),{files:null===(l=e.files)||void 0===l?void 0:l.filter(e=>e._id!==i._id)}):t})}):{count:0,acceptedMembers:[]})}).catch(e=>{d(e)});var i,n},onDownload:e=>{F({arr:[null==e?void 0:e.link],fileName:Ne.A.getFormattedName(null==e?void 0:e.link),key:null==e?void 0:e._id})},onImageClick:t=>x.open({images:e.files,selected:t._id})}),(0,i.jsx)(we.s,{multiple:!0,header:(0,i.jsx)(Se.A,{label:o("ATTACHMENT")}),open:g,onClose:()=>y(!1),maxSize:1e9,formattedFiles:C,onChange:e=>{const t=e.map((e,t)=>({tempId:`${e.name}-${t}`,status:"idle",progress:0,data:e.data?e.data:e,name:e.name,size:e.size,type:e.type}));_(t)},cancelUpload:()=>null==S?void 0:S.abort(),handleFileUpload:()=>T(),instrunction:o("__COMMON_ALL_TYPE_FILE_UPLOAD_INSTRUCTION__",{moduleNameFile:o(p("item:file").customNameSingular)}),accept:Object.assign({},Ee.VJ),uploadButtonProps:{disabled:f}},`${g}`),x.show?(0,i.jsx)(j.l,{open:!0,onClose:x.close,fullScreen:!0,children:(0,i.jsx)(De.U,{})}):null]})};var Re=l(73131),Ve=l(9421),Be=l(2882),We=l(52318),ze=l(45234),$e=l(88591),Pe=l(12135),Ue=l(60877),He=l(56015),Ye=l(36545),Ge=l(29933),qe=l(64715);const Qe="profile",Ke="note",Ze="log",Xe="attachment";var Je=l(76880),et=l(26311),tt=l(43144),lt=l(32912),it=l(72796),at=l(91895),ot=l(6942),nt=l(82387),st=l(22984),rt=l(49785),dt=l(1275);const ct=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{var s;const[r,d]=(0,u.useState)("view"),h=(0,u.useRef)(null),{t:x}=(0,v.A)(),{errorToaster:p,commonToaster:g}=(0,ue.A)(),{company:y}=(0,c.A)(),f=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==y?void 0:y.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id}
1,[y]),{control:b,Controller:j,handleSubmit:A,onExtraSubmit:C,setFocus:_,getValues:S,setValue:E,isFormChanged:w}=(0,st.A)({schema:nt.A,defaultValues:{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type})]},onSubmit:async({form:i})=>{d("view");try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,stringValue:"stringValue"in i.customFields[0]&&i.customFields[0].stringValue||""}]}}),g("success",x("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),await o.refetch(),await it.queryClient.invalidateQueries([m.E5.MEMBER_LIST,"client",f,{}])}catch(t){E("customFields.0.stringValue",e.stringValue||""),p(t)}},hookFormMode:"onSubmit"}),{fields:F}=(0,rt.jz)({control:b,name:"customFields",keyName:"_id"});return(0,u.useEffect)(()=>{_("customFields.0.stringValue")},[r,_]),"edit"===r?(0,i.jsx)(dt.x,{onClickAway:()=>{w?A(C)():d("view")},children:(0,i.jsx)(n.a,{ref:h,children:null==F?void 0:F.map((e,t)=>(0,i.jsx)(j,{name:`customFields.${t}.stringValue`,control:b,render:({field:t,fieldState:{error:l}})=>(0,i.jsx)(ot.d,{previewInputProps:Object.assign(Object.assign({placeholder:(null==e?void 0:e.placeholder)||"",error:Boolean(null==l?void 0:l.message),helperText:(null==l?void 0:l.message)?x(String(null==l?void 0:l.message),{name:null==e?void 0:e.name}):null},t),{inputRef:t.ref})})},e._id))})}):(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{d("edit")},value:(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"secondary.800",lh:"130%",fwt:500,children:(null===(s=S("customFields.0.stringValue"))||void 0===s?void 0:s.length)?S("customFields.0.stringValue"):"-"})})},ut=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{const[s,r]=(0,u.useState)("view"),d=(0,u.useRef)(null),{t:h}=(0,v.A)(),{errorToaster:x,commonToaster:p}=(0,ue.A)(),{company:g}=(0,c.A)(),y=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==g?void 0:g.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[g]),{control:f,Controller:b,handleSubmit:j,onExtraSubmit:A,setFocus:C,getValues:_,setValue:S,isFormChanged:E}=(0,st.A)({schema:nt.A,defaultValues:{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type})]},onSubmit:async({form:i})=>{r("view");try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,numberValue:"numberValue"in i.customFields[0]?i.customFields[0].numberValue:null}]}}),p("success",h("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),o.refetch(),it.queryClient.invalidateQueries([m.E5.MEMBER_LIST,"client",y,{}])}catch(t){S("customFields.0.numberValue",e.numberValue||null),x(t)}},hookFormMode:"onSubmit"}),{fields:w}=(0,rt.jz)({control:f,name:"customFields",keyName:"_id"});return(0,u.useEffect)(()=>{C("customFields.0.numberValue")},[s,C]),"edit"===s?(0,i.jsx)(dt.x,{onClickAway:()=>{E?j(A)():r("view")},children:(0,i.jsx)(n.a,{ref:d,children:null==w?void 0:w.map((e,t)=>(0,i.jsx)(b,{name:`customFields.${t}.numberValue`,control:f,render:({field:t,fieldState:{error:l}})=>(0,i.jsx)(ot.d,{previewInputProps:Object.assign(Object.assign({type:"number",placeholder:(null==e?void 0:e.placeholder)||"",error:Boolean(null==l?void 0:l.message),helperText:(null==l?void 0:l.message)?h(String(null==l?void 0:l.message),{name:null==e?void 0:e.name}):null},t),{onChange:e=>{t.onChange(+e.target.value)},inputRef:t.ref})})},e._id))})}):(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{r("edit")},value:(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"secondary.800",lh:"130%",fwt:500,children:_("customFields.0.numberValue")||"-"})})};var mt=l(12265);const ht=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{const[s,r]=(0,u.useState)("view"),d=(0,u.useRef)(null),{t:h}=(0,v.A)(),{errorToaster:x,commonToaster:p}=(0,ue.A)(),{company:g}=(0,c.A)(),y=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==g?void 0:g.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[g]),{control:f,Controller:b,handleSubmit:j,onExtraSubmit:A,setFocus:C,getValues:_,setValue:S,isFormChanged:E}=(0,st.A)({schema:nt.A,defaultValues:{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type})]},onSubmit:async({form:i})=>{var n;r("view");try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,booleanValue:"booleanValue"in i.customFields[0]&&i.customFields[0].booleanValue||!1}]}}),p("success",h("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),o.refetch(),it.queryClient.invali
1dateQueries([m.E5.MEMBER_LIST,"client",y,{}])}catch(t){S("customFields.0.booleanValue",null!==(n=e.booleanValue)&&void 0!==n?n:null),x(t)}},hookFormMode:"onSubmit"}),{fields:w}=(0,rt.jz)({control:f,name:"customFields",keyName:"_id"});return(0,u.useEffect)(()=>{C("customFields.0.booleanValue")},[s,C]),"edit"===s?(0,i.jsx)(dt.x,{onClickAway:()=>{E?j(A)():r("view")},children:(0,i.jsx)(n.a,{ref:d,sx:{maxWidth:"fit-content"},children:null==w?void 0:w.map((e,t)=>(0,i.jsx)(b,{name:`customFields.${t}.booleanValue`,control:f,render:({field:t})=>(0,i.jsx)(mt.o,{labelProps:{sx:{display:"inline"}},switchProps:{checked:!!(null==t?void 0:t.value),onChange:(e,l)=>{t.onChange(l)},inputProps:{"aria-label":null==e?void 0:e.name}}})},e._id))})}):(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{r("edit")},value:(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"secondary.800",lh:"130%",fwt:500,children:null===_("customFields.0.booleanValue")?"-":_("customFields.0.booleanValue")?h("YES"):h("NO")})})};var xt=l(27558),pt=l(69360),gt=l(13272),vt=l(12092),yt=l(94601),ft=function(e,t){var l={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(l[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(l[i[a]]=e[i[a]])}return l};const bt=(0,i.jsx)(pt.A,{fontSize:"small"}),jt=(0,i.jsx)(gt.A,{fontSize:"small"}),At=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{const[s,r]=(0,u.useState)("view"),d=(0,u.useRef)(null),{t:h}=(0,v.A)(),{theme:x}=(0,R.A)(),{errorToaster:p,commonToaster:g}=(0,ue.A)(),{company:y}=(0,c.A)(),f=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==y?void 0:y.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[]),{control:b,Controller:j,handleSubmit:A,onExtraSubmit:C,setFocus:_,getValues:S,setValue:E,isFormChanged:w}=(0,st.A)({schema:nt.A,defaultValues:{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type})]},onSubmit:async({form:i})=>{r("view");try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,arrayValue:"arrayValue"in i.customFields[0]&&i.customFields[0].arrayValue||[]}]}}),g("success",h("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),o.refetch(),it.queryClient.invalidateQueries([m.E5.MEMBER_LIST,"client",f,{}])}catch(t){E("customFields.0.arrayValue",e.arrayValue||[]),p(t)}},hookFormMode:"onSubmit"}),{fields:F}=(0,rt.jz)({control:b,name:"customFields",keyName:"_id"});if((0,u.useEffect)(()=>{_("customFields.0.arrayValue")},[s,_]),"edit"===s)return(0,i.jsx)(dt.x,{onClickAway:()=>{w?A(C)():r("view")},children:(0,i.jsx)(n.a,{ref:d,children:null==F?void 0:F.map((e,t)=>(0,i.jsx)(j,{name:`customFields.${t}.arrayValue`,control:b,render:({field:t,fieldState:{error:l}})=>{const{value:a,onChange:o}=t,n=("arrayValue"in e?null==e?void 0:e.arrayValue:[])||[],s=[{label:h("SELECT_ALL"),value:"__all__",_id:"__all__"},...n],r=(a||[]).filter(e=>"selected"===e.value);return(0,i.jsx)(ee.A,Object.assign({},t,{ref:e=>{e&&t.ref({focus:()=>{const t=e.querySelector("input");t&&(t.focus(),t.scrollIntoView({behavior:"smooth",block:"center"}))}})},id:`multiSelect-${e.name}-${e._id}`,multiple:!0,disableCloseOnSelect:!0,options:s,value:r,onChange:(e,t)=>
1(({newSelected:e})=>{if(e.some(e=>"__all__"===e._id))if(r.length===n.length){const e=n.map(e=>Object.assign(Object.assign({},e),{value:"-"}));o(e)}else{const e=n.map(e=>Object.assign(Object.assign({},e),{value:"selected"}));o(e)}else{const t=n.map(t=>Object.assign(Object.assign({},t),{value:e.some(e=>e._id===t._id)?"selected":"-"}));o(t)}})({newSelected:t}),getOptionLabel:e=>e.label||"",isOptionEqualToValue:(e,t)=>e._id===t._id,renderOption:(e,t,{selected:l})=>{const{key:a}=e,o=ft(e,["key"]),s="__all__"===t._id,d=r.length===n.length;return(0,i.jsxs)("li",Object.assign({},o,{children:[(0,i.jsx)(xt.A,{icon:bt,checkedIcon:jt,style:{marginRight:8},checked:s?d:l}),t.label]}),a)},renderTags:(e,t)=>e.map((e,l)=>(0,i.jsx)(Q.c,Object.assign({},t({index:l}),{size:"small",variant:"contained-tonal",label:e.label,deleteIcon:(0,i.jsx)(vt.A,{sx:{fontWeight:500,color:e=>e.palette.otColors.secondary[600],":hover":{color:e=>e.palette.otColors.secondary[800]}}}),sx:{fontWeight:500,color:e=>e.palette.otColors.secondary[800],bgcolor:e=>e.palette.otColors.secondary[50],borderRadius:1,px:.5,minHeight:"28px"}}))),renderInput:t=>(0,i.jsx)(G.p,Object.assign({},t,{error:!!(null==l?void 0:l.message),helperText:(null==l?void 0:l.message)?h(String(null==l?void 0:l.message),{name:null==e?void 0:e.name}):null,placeholder:e.placeholder||h("SELECT"),sx:{height:"100%","& .MuiOutlinedInput-root":{minHeight:"48px",height:"unset"},"& .MuiOutlinedInput-root .MuiAutocomplete-input":{p:0}}}))}))}},e._id))})});const T=S("customFields.0.arrayValue").filter(e=>"selected"===e.value);return(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{r("edit")},value:(0,i.jsx)(n.a,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:T.length?null==T?void 0:T.map((e,t)=>(0,i.jsx)(yt.J,{color:x.palette.otColors.primary[500],children:null==e?void 0:e.label},t)):"-"})})};
1var Ct=function(e,t){var l={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(l[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(l[i[a]]=e[i[a]])}return l};const _t=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{const[s,r]=(0,u.useState)("view"),d=(0,u.useRef)(null),{t:h}=(0,v.A)(),{theme:x}=(0,R.A)(),{errorToaster:p,commonToaster:g}=(0,ue.A)(),{company:y}=(0,c.A)(),f=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==y?void 0:y.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[y]),{control:b,Controller:j,handleSubmit:A,onExtraSubmit:C,setFocus:_,getValues:S,setValue:E,isFormChanged:w}=(0,st.A)({schema:nt.A,defaultValues:{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type})]},onSubmit:async({form:i})=>{r("view");try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,arrayValue:"arrayValue"in i.customFields[0]&&i.customFields[0].arrayValue||[]}]}}),g("success",h("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),o.refetch(),it.queryClient.invalidateQueries([m.E5.MEMBER_LIST,"client",f,{}])}catch(t){E("customFields.0.arrayValue",e.arrayValue||[]),p(t)}},hookFormMode:"onSubmit"}),{fields:F}=(0,rt.jz)({control:b,name:"customFields",keyName:"_id"}),T=e.arrayValue||[];if((0,u.useEffect)(()=>{_("customFields.0.arrayValue")},[s,_]),"edit"===s)return(0,i.jsx)(dt.x,{onClickAway:()=>{w?A(C)():r("view")},children:(0,i.jsx)(n.a,{ref:d,children:null==F?void 0:F.map((e,t)=>(0,i.jsx)(j,{name:`customFields.${t}.arrayValue`,control:b,render:({field:t,fieldState:{error:l}})=>{var a,o,n;return(0,i.jsx)(ee.A,Object.assign({},t,{ref:e=>{e&&t.ref({focus:()=>{const t=e.querySelector("input");t&&(t.focus(),t.scrollIntoView({behavior:"smooth",block:"center"}))}})},id:`singleSelect-${e.name}-${e._id}`,multiple:!1,options:"arrayValue"in e?null===(a=null==e?void 0:e.arrayValue)||void 0===a?void 0:a.map(e=>({label:e.label,value:e.value,_id:e._id})):[],value:(null===(o=null==t?void 0:t.value)||void 0===o?void 0:o.length)>0?null===(n=null==t?void 0:t.value)||void 0===n?void 0:n.find(e=>"selected"===e.value):void 0,onChange:(e,l)=>{t.onChange((null==l?void 0:l._id)?t.value.reduce((e,t)=>(t._id===l._id?e.push(Object.assign(Object.assign({},t),{value:"selected"})):e.push(Object.assign(Object.assign({},t),{value:"-"})),e),[]):T.map(e=>Object.assign(Object.assign({},e),{value:"-"})))},disableCloseOnSelect:!1,getOptionLabel:e=>"string"==typeof e?e:(null==e?void 0:e.label)||"",renderOption:(e,t)=>{const{key:l}=e,a=Ct(e,["key"]);return(0,i.jsx)("li",Object.assign({},a,{children:t.label}),l)},renderInput:t=>(0,i.jsx)(G.p,Object.assign({},t,{error:!!(null==l?void 0:l.message),helperText:(null==l?void 0:l.message)?h(String(null==l?void 0:l.message),{name:null==e?void 0:e.name}):null,placeholder:e.placeholder||h("SELECT"),sx:{"& .MuiOutlinedInput-root .MuiAutocomplete-input":{p:0}}}))}))}},e._id))})});const O=S("customFields.0.arrayValue").filter(e=>"selected"===e.value);return(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{r("edit")},value:(0,i.jsx)(n.a,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:O.length?null==O?void 0:O.map((e,t)=>(0,i.jsx)(yt.J,{color:x.palette.otColors.primary[500],children:null==e?void 0:e.label},t)):"-"})})};var St=l(48239),Et=l(49861),wt=l(77888),Ft=l(62846),Tt=l(36585),Ot=l(83163),Nt=l(19276),Dt=l(51236),It=l(23993);const Lt=e=>{var t;return{customFields:[Object.assign(Object.assign({},e),{type:e.customField.type,fileValue:null===(t=e.fileValue)||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{name:e.name||Ne.A.getFormattedName(null==e?void 0:e.s3Key),size:e.size||Ne.A.fileSizeToBytes(null==e?void 0:e.sizeInBytes)}))})]}},Mt=({field:e,belongsTo:t="lead",resourceId:l,memberDetailsQuery:o})=>{var s;const[r,d]=(0,u.useState)("view"),[h,x]=(0,u.useState)({}),p=(0,u.useRef)(null),{t:g}=(0,v.A)(),{errorToaster:y,commonToaster:f}=(0,ue.A)(),{company:b}=(0,c.A)(),A=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==b?void 0:b.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[b]),{sidebarModuleName:C}=(0,me.A)(),_=(0,wt.A)(["updating"]),{control:S,Controller:E,handleSubmit:w,onExtraSubmit:F,setFocus:T,getValues:O,trigger:N,isFormChanged:D,reset:I}=(0,st.A)({schema:nt.A,defaultValues:Lt(e),onSubmit:async({form:i,dirtyFields:n})=>{var s,r,c;_.markAsBusy("updating");const u=await(0,et.Ay)({customFieldsFormData:null!==(s=null==i?void 0:i.customFields)&&void 0!==s?s:[],errorToaster:y,mode:"edit",dirtyFields:n});try{await a.Ay.customField.updateRespond({type:t,body:{data:[{_id:e._id,resourceId:l,fileValue:"fileValue"in u[0]&&(null===(r=u[0])||void 0===r?void 0:r.fileValue)||[]}]}}),f("success",g("CUSTOM_FIELD_UPDATED_SUCCESSFULLY")),o.refetch(),it.queryClient.invali
1dateQueries([m.E5.MEMBER_LIST,"client",A,{}]),d("view"),_.markAsNotBusy("updating"),I({customFields:[Object.assign(Object.assign({},e),{type:e.customField.type,fileValue:"fileValue"in u[0]&&(null===(c=u[0])||void 0===c?void 0:c.fileValue)||[]})]})}catch(e){_.markAsNotBusy("updating"),y(e)}},hookFormMode:"onSubmit"}),{fields:L}=(0,rt.jz)({control:S,name:"customFields",keyName:"_id"});(0,u.useEffect)(()=>{I(Lt(e))},[e,I]),(0,u.useEffect)(()=>{T("customFields.0.fileValue")},[r,T]),(0,u.useEffect)(()=>{const e={};L.forEach((t,l)=>{"file"===t.type&&"fileValue"in t&&t.fileValue&&(e[l]=t.fileValue.map(e=>Object.assign(Object.assign({},e),{name:e.name||Ne.A.getFormattedName(null==e?void 0:e.s3Key),size:e.size||Ne.A.fileSizeToBytes(null==e?void 0:e.sizeInBytes)})))}),x(e)},[L]);const M=()=>{d("view"),I(Lt(e))},k=(0,i.jsx)(St.l,{id:"custom-field-submit-button",startIcon:_.busy("updating")?(0,i.jsx)(Et.A,{size:16,color:"inherit"}):null,disabled:!D||_.busy("updating"),onClick:w(F),children:g("UPDATE")}),R=(0,i.jsx)(B.$,{id:"client-cancel-button",disabled:_.busy("updating"),variant:"outlined",onClick:M,children:g("CANCEL")}),W=(0,i.jsxs)(j.l,{open:"edit"===r,onClose:M,maxWidth:"sm",fullWidth:!0,scroll:"paper",PaperProps:{sx:{overflow:"visible"}},id:"client-edit-form",children:[(0,i.jsxs)(Ft.L,{sx:Object.assign(Object.assign({px:3,py:1.5},V.A.flexSpaceBetween),{alignItems:"center"}),children:[g("UPDATE")," ",null===(s=null==L?void 0:L[0])||void 0===s?void 0:s.name,(0,i.jsx)(Nt.A,{onClick:M})]}),(0,i.jsx)(Tt.C,{dividers:!0,sx:{px:4.75,py:3.5,pb:4.75},children:(0,i.jsx)(n.a,{ref:p,sx:{ml:2},children:null==L?void 0:L.map((e,t)=>(0,i.jsx)(E,{name:`customFields.${t}.fileValue`,control:S,render:({field:l,fieldState:{error:a}})=>(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(Dt.K,{previewInputProps:{label:(0,i.jsxs)(i.Fragment,{children:[null==e?void 0:e.name,(null==e?void 0:e.required)&&(0,i.jsx)("span",{style:{color:"red",marginLeft:"4px"},children:"*"})]}),multiple:!0,setFiles:e=>{const i=h[t]||[],a=(null==e?void 0:e.length)?((e,t)=>{const l=t.filter(t=>!e.some(e=>e.name===t.name));return[...e,...l]})(i,e):i;x(e=>Object.assign(Object.assign({},e),{[t]:a})),l.onChange(a),N(`customFields.${t}.fileValue`)},onRemove:e=>{const i=h[t].filter(t=>(null==t?void 0:t.name)!==e);x(e=>Object.assign(Object.assign({},e),{[t]:i})),l.onChange(i),N(`customFields.${t}.fileValue`)},files:l.value||[],error:(null==a?void 0:a.message)?g(null==a?void 0:a.message,{name:e.name,size:"5MB",moduleNameFile:g(C("item:file").customNameSingular)}):void 0}})})},e._id))})}),(0,i.jsxs)(Ot.i,{sx:Object.assign({px:3,py:1.5},V.A.flexEnd),children:[R,k]})]});return(0,i.jsxs)(i.Fragment,{children:["edit"===r?W:null,(0,i.jsx)(at.h,{withEditableStyle:!0,onClick:()=>{d("edit")},value:(0,i.jsx)(It.A,{files:O("customFields.0.fileValue"),showViewButton:!0})})]})};var kt=l(35025),Rt=l(72611),Vt=l(63710),Bt=l(83778);const Wt=({resourceId:e})=>{var t,l,o;const[s,r]=(0,u.useState)(!1),{t:d}=(0,v.A)(),{company:m}=(0,c.A)(),{navigate:h}=(0,Je.A)(),{theme:x}=(0,R.A)(),p=(0,Ve.I)({queryKey:["member-details",e],queryFn:()=>a.Ay.company.memberDetails({companyId:null==m?void 0:m._id,memberId:e||""}),enabled:Boolean(e&&(null==m?void 0:m._id)),refetchOnMount:"always"}),g=(0,u.useMemo)(()=>{var e,t,l,i;return(null===(i=null===(l=null===(t=null===(e=null==p?void 0:p.data)||void 0===e?void 0:e.data)||void 0===t?void 0:t.member)||void 0===l?void 0:l.customFields)||void 0===i?void 0:i.filter(e=>e.isActive))||[]},[null===(o=null===(l=null===(t=null==p?void 0:p.data)||void 0===t?void 0:t.data)||void 0===l?void 0:l.member)||void 0===o?void 0:o.customFields]),y=s?g.length||0:5;return(0,i.jsxs)(n.a,{sx:{py:3},children:[p.isLoading&&!g.length?(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({px:3},V.A.flexColumn),{gap:1,width:"100%"}),children:[(0,i.jsx)(He.E,{variant:"text",height:20,width:150}),(0,i.jsx)(He.E,{variant:"rectangular",height:200})]}):null," ",!p.isLoading&&g.length?(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({px:3},V.A.flexColumn),{gap:1}),children:[(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"secondary.500",lh:"140%",children:(0,i.jsx)(Vt.x6,{i18nKey:"YOU_CAN_ADD_AND_MANAGE_CUSTOM_FIELDS_FROM_WORKSPACE_CONFIG",components:{goToCreateCustomField:(0,i.jsx)("span",{onClick:()=>{(0,Bt.c)(h)},style:{color:x.palette.otColors.primary[400],cursor:"pointer",textDecoration:"underline"}})}})}),(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({px:3,py:1.5},V.A.flexColumn),{gap:1,border:`1px solid ${x.palette.otColors.secondary[100]}`,borderRadius:"8px",bgcolor:x.palette.otColors.secondary[50]}),children:[(0,i.jsx)(n.a,{sx:{display:"grid",gridTemplateColumns:"minmax(auto, 100px) minmax(auto, 400px)",alignItems:"center",columnGap:2.25,rowGap:1},children:g.slice(0,y).map((t,l)=>(0,i.jsxs)(u.Fragment,{children:[(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"secondary.600",lh:"130%",fwt:500,children:t.name}),"text"===t.customField.type?(0,i.jsx)(ct,{field:t,resourceId:e,memberDetailsQuery:p}):"number"===t.customField.type?(0,i.jsx)(ut,{field:t,resourceId:e,memberDetailsQuery:p}):"boolean"===t.customField.type?(0,i.jsx)(ht,{field:t,resourceId:e,memberDetailsQuery:p}):"multiSelect"===t.customField.type?(0,i.jsx)(At,{field:t,resourceId:e,memberDetailsQuery:p}):"singleSelect"===t.customField.type?(0,i.jsx)(_t,{field:t,resourceId:e,memberDetailsQuery:p}):"file"===t.customField.type?(0,i.jsx)(Mt,{field:t,resourceId:e,memberDetailsQuery:p}):null]},l))}),g.length>5?(0,i.jsx)(lt.A,{variant:"bodyXs",csp:"primary.500",lh:"130%",fwt:500,sx:{cursor:"pointer"},onClick:()=>{r(e=>!e)},children:s?d("SEE_LESS"):d("__SEE_MORE__",{count:g.length-5})+"..."}):null]})]}):null,p.isLoading||0!==g.length?null:(0,i.jsx)(n.a,{sx:Object.assign(Object.assign({px:6},V.A.flexCenter),{width:"100%"}),children:(0,i.jsx)(kt.A,{isShow:!0,text1:d("NO_CUSTOM_FIELD_CREATED_YET"),text2:d("LETS_START_ADDING_CUSTOM_FIELD_FROM_WORKSPACE_CONFIG"),svg:(0,i.jsx)(Rt.A,{}),buttonTitle:d("GO_TO_WORKSPACE_CONFIG"),onCreateButton:()=>{(0,Bt.c)(h)},createIcon:(0,i.jsx)(i.Fragment,{})})})]})};var zt=l(81450),$t=l(78431),Pt=l(22112),Ut=l(5217);const Ht=({detailsData:e,closeModal:t,roleId:l,openDetails:o,setDetailsData:s})=>{var x,p;const{t:g}=(0,v.A)(),{theme:y}=(0,R.A)(),f=(0,r.jE)(),[C,_]=(0,u.useState)(!1),[S,E]=(0,u.useState)(!1),[w,F]=(0,u.useState)("individual"),{sidebarModuleName:T}=(0,me.A)(),{queryObj:N}=(0,Je.A)(),{successToaster:L,errorToaster:M,showCreate:H,closeCreate:Y,openCreate:G,markAsBusy:q,markAsNotBusy:Q,busy:K}=(0,A.A)(),{company:Z}=(0,c.A)(),{isSuperAdmin:X,isAdmin:J}=(0,b.A)(),ee=(0,$t.MQ)({isSuperAdmin:X,isAdmin:J}),{agencySmtpUserName:te,agencySmtpFromAddress:ie,emailProvider:ae}=Z,oe=ie||te,ne=(0,h.A)(),{data:se}=(0,Ve.I)({queryKey:[m.E5.EMAIL_SETUP_LIST],queryFn:()=>a.Ay.email.emailSetuplist(),refetchOnMount:"always"}),re=(null===(x=null==se?void 0:se.data)||void 0===x?void 0:x.companyEmails)||[],de=(0,u.useMemo)(()=>
1{if("smtp"===ae)return[...oe?[{email:oe,isPrimary:!0}]:[]];return(null==re?void 0:re.filter(e=>null==e?void 0:e.isVerified))||[]},[re,oe]),{list:ce,query:ue}=(0,le.A)({listApi:()=>a.Ay.notes.get(e._id),reactQueryAlias:m.E5.MEMBER_NOTES,listKey:"data",aliasExtensions:[e._id],enabled:Boolean(e._id)}),he=(0,u.useMemo)(()=>{const{list:t}=ne;return e.isConvertedClient&&!(null==t?void 0:t.some(t=>t.email===e.email))},[ne.list,e.isConvertedClient,e.email]),xe=(0,u.useRef)(null),{handleDownload:pe}=(0,We.A)({content:()=>xe.current,documentTitle:"Lead Details"}),{value:ge,handleChange:ve}=(0,P.A)({defaultValue:(null==N?void 0:N.tab)||Qe}),ye=(0,u.useMemo)(()=>{const t=null==e?void 0:e.type,l=null==e?void 0:e.leadEntitySource;return"leadCompanyMember"===t||"company"===t||"clientCompany"===l||"company"===(null==e?void 0:e.clientSelectionType)?"company":!e.companyName||e.firstName&&e.lastName?"individual":"company"},[null==e?void 0:e.type,null==e?void 0:e.leadEntitySource,null==e?void 0:e.clientSelectionType,e.companyName,e.firstName,e.lastName]),{list:fe}=(0,le.A)({listApi:()=>a.Ay.activity.memberTimeline({memberId:e._id,limit:100,skip:0}),reactQueryAlias:m.E5.MEMBER_ACTIVITY_TIMELINE,listKey:"data",aliasExtensions:[e._id],enabled:Boolean(e._id)}),be=(0,u.useMemo)(()=>(null!=fe?fe:[]).map(e=>{var t,l,i,a,o,n;return Object.assign(Object.assign({},e),{name:`${D.A.capitalize(null===(t=null==e?void 0:e.account)||void 0===t?void 0:t.firstName)} ${D.A.capitalize(null===(l=null==e?void 0:e.account)||void 0===l?void 0:l.lastName)}`,image:null!==(a=null===(i=null==e?void 0:e.account)||void 0===i?void 0:i.profileImage)&&void 0!==a?a:"",comment:null!==(o=null==e?void 0:e.text)&&void 0!==o?o:"",id:null!==(n=null==e?void 0:e._id)&&void 0!==n?n:"",createdAt:I.Ay.get(null==e?void 0:e.createdAt).format("lll"),milliseconds:new Date(null==e?void 0:e.createdAt).getTime()})}).sort((e,t)=>t.createdAt<e.createdAt?-1:1),[fe]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.a,{sx:Object.assign({he
1ight:"44px",px:2,gap:1.25,bgcolor:y.palette.otColors.secondary[100]},V.A.flexSpaceBetween),children:[(0,i.jsx)(O.o,{sx:{color:y.palette.otColors.secondary[800],fontSize:"1.25rem",fontWeight:"600",lineHeight:"1.25rem"},children:g("__LEAD_DETAILS__",{moduleNameLead:g(T("item:lead").customNameSingular)})}),(0,i.jsx)(n.a,{id:"lead-details-close-modal",sx:Object.assign({width:"28px",height:"28px",border:`1px solid ${y.palette.otColors.secondary[300]}`,borderRadius:"4px",bgcolor:y.palette.otColors.base.white,cursor:"pointer"},V.A.flexCenter),onClick:t,children:(0,i.jsx)(k.A,{id:"lead-details-close-modal-icon",sx:{color:y.palette.otColors.secondary[600]}})})]}),(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({},V.A.flexEnd),{padding:"0.5rem 1.5rem",gap:".5rem"}),children:[(0,i.jsx)(B.$,{variant:"text",onClick:pe,startIcon:(0,i.jsx)(ze.A,{sx:{width:"1rem"}}),sx:{color:y.palette.otColors.secondary[600],fontSize:".75rem",lineHeight:"130%"},children:g("PRINT")}),ee?(0,i.jsx)(B.$,{id:"lead-details-send-email-action",variant:"text",onClick:()=>_(!0),startIcon:(0,i.jsx)(Ge.A,{sx:{width:"1rem"}}),sx:{color:y.palette.otColors.secondary[600],fontSize:".75rem",lineHeight:"130%"},children:g("SEND_EMAIL")}):null,(0,i.jsx)(qe.m,{title:he?g("__THIS_LEAD_IS_ALREADY_ADDED_AS_CLIENT__",{moduleName:g(T("item:client").customNameSingular)}):null,children:(0,i.jsx)("span",{children:(0,i.jsx)(B.$,{disabled:he,onClick:()=>{"company"!==ye?(F(ye),G()):E(!0)},startIcon:(0,i.jsx)(Be.A,{sx:{color:y.palette.otColors.secondary.contrastText,width:"1rem"}}),sx:{padding:".5rem .75rem",borderRadius:".25rem",fontSize:".75rem",lineHeight:"1.25rem"},children:"company"===ye?"Convert to Company":g("__CONVERT_TO_CLIENT__",{moduleName:g(T("item:client").customNameSingular)})})})})]}),(0,i.jsxs)(W.H,{value:ge,children:[(0,i.jsxs)(z.w,{onChange:ve,sx:{px:3,minHeight:40,"& .Mui-selected":{background:y.palette.otColors.secondary.contrastText,color:`${y.palette.otColors.secondary.dark} !important`,borderRadius:".25rem",boxShadow:"0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06)"},"& .MuiTabs-flexContainer":{background:y.palette.otColors.secondary.light,border:y.palette.otColors.secondary[200]},"& .MuiTabs-indicator":{display:"none"},"& .MuiButtonBase-root":{padding:"0.5rem 0.875rem",margin:"0.25rem 0.1875rem",color:y.palette.otColors.secondary[500]},"& .MuiTypography-root":{fontSize:".75rem"}},children:[(0,i.jsx)($.o,{icon:(0,i.jsx)(Ae,{}),iconPosition:"start",sx:{textTransform:"capitalize",minHeight:"unset",minWidth:"unset",gap:".25rem"},value:Qe,label:(0,i.jsx)(O.o,{variant:"bodySm",children:g("__CLIENT_PROFILE__",{moduleName:g(T("item:client").customNameSingular)})})}),(0,i.jsx)($.o,{icon:(0,i.jsx)($e.A,{sx:{width:"1rem"}}),iconPosition:"start",sx:{minHeight:"unset",minWidth:"unset",textTransform:"capitalize"},value:Ke,label:(0,i.jsx)(O.o,{variant:"bodySm",children:g("NOTES")})}),(0,i.jsx)($.o,{icon:(0,i.jsx)(Ce.A,{sx:{width:"1rem"}}),iconPosition:"start",sx:{textTransform:"capitalize",minHeight:"unset",minWidth:"unset",px:0,mr:1},value:Ze,label:(0,i.jsx)(O.o,{variant:"bodySm",children:g("ACTIVITY_LOG")})}
1),(0,i.jsx)($.o,{icon:(0,i.jsx)(_e.A,{sx:{width:"1rem",height:"1rem"}}),iconPosition:"start",sx:{textTransform:"capitalize",minHeight:"unset",minWidth:"unset",px:0,mr:1},value:Xe,label:(0,i.jsx)(O.o,{variant:"bodySm",children:g("ATTACHMENT")})}),(0,i.jsx)($.o,{icon:(0,i.jsx)(tt.A,{sx:{width:"1rem"}}),iconPosition:"start",sx:{minHeight:"unset",minWidth:"unset",textTransform:"capitalize"},value:"customFields",label:(0,i.jsx)(O.o,{variant:"bodySm",children:g("CUSTOM_FIELDS")})})]}),(0,i.jsx)(U.K,{value:"profile",sx:{height:"68vh",overflow:"auto"},children:(0,i.jsx)(je,{details:e,setDetailsData:s,roleId:l})}),(0,i.jsx)(U.K,{value:"note",sx:{p:"0rem",marginLeft:"1.5rem"},children:(0,i.jsx)(Pe.A,{details:e,query:ue,list:ce,roleId:l,setDetailsData:s})}),(0,i.jsx)(U.K,{value:"log",sx:{maxHeight:"68vh",overflow:"auto","@media (max-height: 800px)":{maxHeight:"65vh"}},children:(0,i.jsx)(u.Suspense,{fallback:(0,i.jsx)(He.E,{variant:"text",sx:{width:"100%",height:"15vh"}}),children:(0,i.jsx)(Ue.A,{list:be,sx:{maxHeight:"unset","& MuiTimelineItem-root":{"&:last-of-type":{minHeight:"unset"}},"& span:first-of-type":{fontSize:".875rem",fontWeight:"500",lineHeight:"1.25rem",color:y.palette.otColors.secondary[800]},"& .MuiTypography-caption":{color:y.palette.otColors.secondary[600]},"& .MuiTimelineConnector-root":{backgroundColor:y.palette.otColors.secondary[200]}}})})}),(0,i.jsx)(U.K,{value:"attachment",sx:{maxHeight:"68vh",overflow:"auto","@media (max-height: 800px)":{maxHeight:"65vh"}},children:(0,i.jsx)(ke,{details:e,setDetailsData:s})}),(0,i.jsx)(U.K,{value:"customFields",sx:{height:"68vh",overflow:"auto",p:0},children:(0,i.jsx)(Wt,{resourceId:e._id})})]}),(0,i.jsxs)(n.a,{ref:xe,sx:{display:"none",padding:"1.5rem","@media print":{display:"block"}},children:[(0,i.jsx)(O.o,{sx:{color:y.palette.otColors.secondary[800],fontSize:"1.25rem",fontWeight:"600",lineHeight:"1.25rem",ml:"1.5rem",mb:"1rem"},children:g("__LEAD_DETAILS__",{moduleNameLead:g(T("item:lead").customNameSingular)})}),(0,i.jsx)(je,{details:e,roleId:l,setDetailsData:s})]}),H&&"company"!==ye?(0,i.jsx)(j.l,{open:!0,onClose:Y,maxWidth:"sm",fullWidth:!0,scroll:"paper",PaperProps:{sx:{overflow:"visible"}},id:"client-edit-form",children:(0,i.jsx)(Re.A,{resourceId:e._id,title:g("__CONVERT_TO_CLIENT__",{moduleName:g(T("item:client").customNameSingular)}),defaultValues:Object.assign(Object.assign(Object.assign(Object.assign({},e),{profileImage:void 0,sendInvitationEmail:!!e.sendInvitationEmail}),(null===(p=null==e?void 0:e.category)||void 0===p?void 0:p.length)?{category:e.category.map(e=>e.label)}:{category:[]}),{customFields:[],clientSelectionType:w}),origin:"convertToClient",hideLeadEntitySwitch:!0,forcedClientSelectionType:ye,onSubmit:async({form:i,selectedCustomFields:o,dirtyFields:n})=>{var s,r,c,u,h,x,p,v;delete i.ownEmail,delete i.origin,q();const y=[],b=[];(null===(s=null==i?void 0:i.category)||void 0===s?void 0:s.length)&&(null===(r=i.category)||void 0===r||r.forEach(t=>{var l;(null===(l=null==e?void 0:e.category)||void 0===l?void 0:l.some(e=>e.label._id===t._id))||y.push(t._id)})),(null===(c=null==e?void 0:e.category)||void 0===c?void 0:c.length)&&(null===(u=null==e?void 0:e.category)||void 0===u||u.forEach(e=>{var t;(null===(t=i.category)||void 0===t?void 0:t.some(t=>{var l;return t._id===(null===(l=e.label)||void 0===l?void 0:l._id)}))||b.push(e._id)})),i.insertCategory=[...y],i.removeCategory=[...b];const j=await(0,et.Ay)({customFieldsFormData:null!==(h=null==i?void 0:i.customFields)&&void 0!==h?h:[],errorToaster:M,mode:"create",dirtyFields:n});delete i.customFields;const A=(0,d.c)(Object.assign(Object.assign(Object.assign(Object.assign({},i),{accountId:e._id,status:"Client",isConvertedClient:!0,profileImage:null!==(v=null===(p=null===(x=i.profileImage)||void 0===x?void 0:x[0])||void 0===p?void 0:p.link)&&void 0!==v?v:"",convertLeadCustomFieldIds:o,clientSelectionType:i.clientSelectionType||w}),"company"===i.clientSelectionType?{companyName:i.companyName,companyOwnerEmail:i.email}:{}),j.length>0?{clientCustomFields:j}:{}));a.Ay.company.memberUpdate({body:A}).then(()=>{f.setQueryData([m.E5.MEMBER_LIST,"client",l,{}],t=>t?Object.assign(Object.assign({},t),{acceptedMembers:t.acceptedMembers.map(t=>t._id===e._id?Object.assign(Object.assign({},e),{status:"Client",isConvertedClient:!0}):t)}):{count:0,acceptedMembers:[]}),Q(),Y(),t(),L({message:g("__LEAD__",{moduleNameLead:g(T("item:lead").customNameSingular)}),type:"convert"})}).catch(e=>{M(e)})},onClose:Y,submitLoading:K})}):null,S?(0,i.jsx)(j.l,{open:!0,onClose:()=>E(!1),maxWidth:"sm",fullWidth:!0,scroll:"paper",children:(0,i.jsx)(n.a,{sx:{p:2},children:(0,i.jsx)(zt.A,{mode:"create",title:"Convert to Company",submitButtonText:"Convert",onClose:()=>E(!1),onSubmit:({form:l})=>{var i,o;q(),a.Ay.clientCompany.create({body:{name:String(l.companyName||"").trim(),logo:(null===(o=null===(i=l.profileImage)||void 0===i?void 0:i[0])||void 0===o?void 0:o.link)||"",website:l.website||"",phone:l.phoneNumber||"",taxId:l.taxId||"",type:"client",industry:l.industry,ownerId:String(e._id),country:l.country||"",city:l.city||"",state:l.state||"",zipCode:l.zipCode||"",streetAddress:l.address||"",isActive:!0,leadId:String(e._id)}}).then(()=>{f.invalidateQueries([m.E5.CLIENT_COMPANY_LIST]),f.invalidateQueries([m.E5.MEMBER_LIST]),Q(),E(!1),t(),L({message:g("__LEAD__",{moduleNameLead:g(T("item:lead").customNameSingular)}),type:"convert"})}).catch(e=>{Q(),M(e)})},submitLoading:K,defaultValues:{profileImage:e.profileImage?[{link:e.profileImage}]:[],companyName:e.companyName||e.name||`${e.firstName||""} ${e.lastName||""}`.trim(),website:e.website||"",phoneNumber:e.contactNo||"",industry:"other",taxId:"",ownerId:e._id,ownerEmail:e.email||"",email:e.email||"",address:e.address||"",city:e.city||"",state:e.state||"",country:e.country||"",zipCode:e.zipCode||""}})})}):null,ee?(0,i.jsx)(Pt.A,{open:C,onRequestClose:Ut.x,children:(0,i.jsx)(Ye.A,{setShowSendEmail:_,details:e,isOpen:C,emailSetupList:de})}):null]})};var Yt=l(1795),Gt=l(26726),qt=l(67034),Qt=l(85314);const Kt=({refetch:e,company:t,item:l,automationIndex:a})=>{const{t:o}=(0,v.A)(),{theme:s}
1=(0,R.A)(),[r,d]=(0,u.useState)(!1),{sidebarModuleName:c}=(0,me.A)(),{showDelete:m,closeDelete:h,busy:x,openDelete:p,markAsBusy:g,successToaster:y,errorToaster:f,markAsNotBusy:b,commonToaster:j}=(0,A.A)(),{deleteMembers:C}=(0,Qt.Ay)();return(0,i.jsx)(dt.x,{onClickAway:()=>d(!1),children:(0,i.jsxs)("div",{onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(qe.m,{onClose:()=>d(!1),disableHoverListener:!0,placement:"bottom",open:r,title:(0,i.jsx)(n.a,{sx:{backgroundColor:"white","& .MuiButtonBase-root":{color:`${s.palette.otColors.secondary[900]}`,width:"10rem",justifyContent:"flex-start",fontWeight:"400"}},children:(0,i.jsx)(B.$,{id:`lead-board-card-delete-action-${a}`,variant:"text",onClick:e=>{e.stopPropagation(),p()},children:o("DELETE")})}),componentsProps:{tooltip:{sx:{bgcolor:`${s.palette.otColors.secondary.contrastText}`,boxShadow:1,padding:".5rem"}}},children:(0,i.jsx)(n.a,{id:`lead-board-card-three-dot-action-${a}`,"data-testid":`lead-board-card-three-dot-action-${a}`,"data-automation-id":`lead-board-card-three-dot-action-${a}`,onClick:e=>{e.stopPropagation(),d(!0)},sx:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},children:(0,i.jsx)(Yt.A,{sx:{color:`${s.palette.otColors.secondary[600]}`,width:".875rem"}})})}),(0,i.jsx)(Gt.u,{open:m,onClose:h,onCancel:h,onConfirm:async()=>{g();try{const{run:t,allDeleted:i,timedOut:a}=await C([l._id]);if(e(),h(),a)return void j("info",o("CLIENT_DELETE_STILL_RUNNING"));if(!i)return void j("error",(0,Qt.zZ)(t)||o("SOMETHING_WRONG"));y({message:o("__LEAD__",{moduleNameLead:o(c("item:lead").customNameSingular)}),type:"delete"})}catch(e){f(e)}finally{b()}},useTemplate:!0,actionName:"DELETE",itemName:o("__LEAD__",{moduleNameLead:o(c("item:lead").customNameSingular)}),icon:(0,i.jsx)(qt.A,{fontSize:"inherit"}),cancelButtonText:o(Gt.d.cancel.NO_KEEP_IT),confirmButtonText:o(Gt.d.confirm.YES_DELETE_IT),isComfirmLoading:x,cancelButtonVariant:"contained",cancelButtonProps:{sx:{bgcolor:e=>e.palette.otColors.primary[600],"&:hover":{bgcolor:e=>e.palette.otColors.primary[700]}}},confirmButtonVariant:"outlined"})]})})},Zt=()=>(0,i.jsxs)("svg",{width:"1156",height:"697",viewBox:"0 0 1156 697",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("rect",{width:"278",height:"46",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"17",y:"17",width:"121",height:"12",rx:"6",fill:"#F4F4F4"}),(0,i.jsx)("rect",{y:"58",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"16",y:"74",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"46",y:"80",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"108",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"168",y:"108",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"142",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"183",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{y:"219.724",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"16",y:"235.724",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"46",y:"241.724",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"269.724",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"168",y:"269.724",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"303.724",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"344.724",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{y:"381.447",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"16",y:"397.447",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"46",y:"403.447",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"431.447",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"168",y:"431.447",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"465.447",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"16",y:"506.447",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"294",width:"278",height:"46",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"311",y:"17",width:"121",height:"12",rx:"6",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"294",y:"58",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"310",y:"74",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"340",y:"80",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"108",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"462",y:"108",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"142",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"183",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"294",y:"219.724",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"310",y:"235.724",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"340",y:"241.724",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"269.724",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"462",y:"269.724",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"303.724",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"344.724",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"294",y:"381.447",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"310",y:"397.447",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"340",y:"403.447",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"431.447",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"462",y:"431.447",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"465.447",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"506.447",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"294",y:"543.171",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"310",y:"559.171",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"340",y:"565.171",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"593.171",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"462",y:"593.171",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"627.171",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"310",y:"668.171",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"588",width:"278",height:"46",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"605",y:"17",width:"121",height:"12",rx:"6",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"588",y:"58",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"604",y:"74",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"634",y:"80",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"108",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"756",y:"108",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"142",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"183",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"588",y:"219.724",width:"278",height:"153.724",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"604",y:"235.724",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"634",y:"241.724",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"269.724",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"756",y:"269.724",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"303.724",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"604",y:"344.724",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"882",width:"274",height:"46",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"899",y:"17",width:"121",height:"12",rx:"6",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"882",y:"58",width:"274",height:"154",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"898",y:"74",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"928",y:"80",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"108",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"1050",y:"108",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"142",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"183",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"882",y:"220",width:"274",height:"154",rx:"8",fill:"white"}),(0,i.jsx)("rect",{x:"898",y:"236",width:"22",height:"22",rx:"11",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"928",y:"242",width:"182",height:"12.25",rx:"6.125",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"270",width:"110",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"1050",y:"270",width:"59",height:"11",rx:"5.5",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"304",width:"80",height:"10.5",rx:"5.25",fill:"#F4F4F4"}),(0,i.jsx)("rect",{x:"898",y:"345",width:"133",height:"10.5",rx:"5.25",fill:"#F4F4F4"})]});var Xt=l(78873),Jt=l(22187),el=l(4969),tl=l(74354),ll=l(49432),il=l(33583),al=l(50505),ol=l(43732);const nl=(e,t,l=[])=>[{label:e("FIRST_NAME"),key:"firstName"},{label:e("LAST_NAME"),key:"lastName"},{label:e("EMAIL"),key:"email"},{label:e("COMPANY_NAME_LITERAL"),key:"companyName"},{label:e("CATEGORY"),key:"category"},{label:e("STATUS"),key:"status"},{label:e("SOURCE"),key:"source"},{label:e("__LEAD_VALUE__",{moduleNameLead:e(t("item:lead").customNameSingular)}),key:"leadValue"},{label:e("PHONE_NUMBER"),key:"phoneNumber"},{label:e("WEBSITE"),key:"website"},{label:e("AGENT"),key:"agent"},{label:e("LAST_INTERACTION"),key:"lastContactedAt"},{label:e("COUNTRY"),key:"country"},{label:e("STATE"),key:"state"},{label:e("CITY"),key:"city"},{label:e("ZIP_CODE"),key:"zip"},{label:e("STREET_ADDRESS"),key:"address"},...(0,ol.kg)(l)];var sl=l(87829),rl=l(50006),dl=l(72173),cl=l(58870),ul=l(68575),ml=l(78617),hl
1=l(85241),xl=l(76918),pl=l(64189);const gl=Z.B.map(e=>({header:e,title:e,id:e,status:e})),vl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,yl={title:"__LEAD__",listTitle:"__LEADS__",createTitle:"__CREATE_LEAD__",emptyListButtonTitle:"__ADD_LEAD__",emptyListButtonText1:"__NO_LEAD_HAS_BEEN_ADDED__",emptyListButtonText2:"__ADD_YOUR_LEADS_TO_THE_AGENCY_HANDY__",emptySearchedListText:"__EMPTY_SEARCHED_LIST_TEXT__",emptyFilteredListText:"__EMPTY_FILTERED_LIST_TEXT__",createApi:a.Ay.lead.leadBulkCreate,updateApi:a.Ay.company.memberUpdate,formDataUpdateTransformer:({form:e,accountId:t})=>(0,d.c)(Object.assign(Object.assign({},e),{accountId:t}))},fl=()=>{const{t:e,hasTranslation:t}=(0,v.A)(),{leadImportSchema:l}=(0,ce.A)(e),{theme:a}=(0,R.A)(),d=(0,r.jE)(),{navigate:W,setSearchParams:z}=(0,Je.A)(),{company:$}=(0,c.A)(),{hasAccessPermission:P}=(0,b.A)(),U=(0,il.A)(),{user:H}=(0,dl.Ay)(),{sidebarModuleName:Y}=(0,me.A)(),G=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==$?void 0:$.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.CLIENT}))||void 0===t?void 0:t._id},[]),q=(0,u.useMemo)(()=>{var e,t;return null===(t=null===(e=null==$?void 0:$.companyRoles)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.name)===m.z7.ASSIGNEE}))||void 0===t?void 0:t._id},[]),{refetch:Q,list:K,query:Z}=(0,h.A)({role:m.z7.CLIENT,queryOptions:{staleTime:1e4}}),{tableTop:X,tableTopHeight:J}=(0,L.A)(Z),{showCsvImport:ee,closeCsvImport:te,openCsvImport:le}=(0,al.A)({name:"csv_import"}),ie=(0,al.A)(),{openDetails:ae,showDetails:oe,closeDetails:ne,detailsData:se,successToaster:de,errorToaster:ue,markAsBusy:he,busy:xe,markAsNotBusy:pe,commonToaster:ge,setDetailsData:ve}=(0,A.A)(),ye=()=>{ne(),z(e=>(e.delete("tab"),e))},{specificUserSettings:fe,isUserSettingsComing:be,handleUserSettingsUpdate:je}=(0,ml.A)("lead"),Ae=(0,u.useMemo)(()=>{const e=K.filter(e=>e.agent&&!e.isConvertedClient).map(e=>{var t;return[null===(t=e.agent)||void 0===t?void 0:t.firstName,e.agent]});return[...new Map(e).values()]},[K]),Ce=(0,u.useMemo)(()=>{const e=K.filter(e=>e.leadValue&&!e.isConvertedClient).map(e=>e.leadValue);return[...new Set(e)]},[K]),Se=(0,u.useMemo)(()=>{const e=K.filter(e=>e.source&&!e.isConvertedClient).map(e=>e.source);return[...new Set(e)]},[K]),Ee=!(Z.isLoading||be),we=(0,u.useMemo)(()=>K.filter(e=>"leadCompanyMember"!==e.type&&"company"!==e.clientSelectionType),[K]),Te=(0,u.useMemo)(()=>K.filter(e=>"leadCompanyMember"===e.type||"company"===e.clientSelectionType),[K]),Oe=(0,u.useMemo)(()=>({getFilterOptions:()=>((e,t,l,a)=>[...e.length?[{label:"ASSIGNED_AGENT",iconBeforeLabel:(0,i.jsx)(S.A,{}),id:`${Math.random()}`,options:e.map(e=>({label:(0,F.M)(null==e?void 0:e.firstName,null==e?void 0:e.lastName),id:`${null==e?void 0:e._id}`,key:{item:{value:null==e?void 0:e._id},identifier:"agent._id"}}))}]:[],...t.length?[{label:(0,w.t)("__LEAD__",{moduleNameLead:(0,w.t)(a("item:lead").customNameSingular)}),iconBeforeLabel:(0,i.jsx)(E.A,{}),id:`${Math.random()}`,options:t.map(e=>({label:`${e}`,id:`${Math.random()}`,key:{item:{value:e},identifier:"leadValue"}}))}]:[],...l.length?[{label:"SOURCE",iconBeforeLabel:(0,i.jsx)(_.A,{}),id:`${Math.random()}`,options:l.map(e=>({label:`${e}`,id:`${Math.random()}`,key:{item:{value:e},identifier:"source"}}))}]:[],{label:"LAST_INTERACTION",id:`${Math.random()}`,iconBeforeLabel:(0,i.jsx)(C.A,{}),options:[{id:`${Math.random()}`,label:"Last Contacted At",key:{identifier:"lastContactedAt",item:{}},dateRange:{startDate:`${new Date}`,endDate:`${new Date}`,maxDate:new Date}}]}])(Ae,Ce,Se,Y),getGroupbyOptions:()=>[],getSortOptions:()=>[],defaultSelectionData:{filter:null==fe?void 0:fe.filter,sortedBy:null==fe?void 0:fe.sortedBy,sortOrder:"asc"===(null==fe?void 0:fe.sortOrder)?"+":"-"},dataIncoming:!Ee}),[Ae,Z.isLoading,be]),{activeButton:Ne,setActiveButton:De,searchValue:Ie,setSearchValue:Le,selectionData:Me,setSelectionData:ke,dropDownDataset:Re,setDropDownDataset:Ve}=(0,p.n)(Object.assign(Object.assign({},Oe),{handleUserSettingsUpdate:je})),{filteredList:Be}=(0,x.A)({search:Ie,list:[...we,...Te],customFilter:({item:e})=>{var t,l;return!((null===(l=null===(t=null==e?void 0:e.role)||void 0===t?void 0:t.role)||void 0===l?void 0:l.name)===m.z7.CLIENT&&"Client"===e.status&&e.isConvertedClient)&&(e=>{var t;return(null==H?void 0:H.role)!==q||(null==H?void 0:H._id)===(null===(t=e.agent)||void 0===t?void 0:t._id)})(e)},customSort:(e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime(),customOrder:e=>{const t=[],l=[];
1return e.forEach(e=>{e.removed?l.push(e):t.push(e)}),[...t,...l]},attributes:["firstName","lastName","email","companyName","name","companyOwnerEmail","country"],isExact:!1,selectionData:Me}),We=()=>{Q()},ze=e=>{const t=new URLSearchParams;(null==e?void 0:e.status)&&t.set("status",e.status);const l=t.toString();W(l?`${o.Ay.leadCreate.path}?${l}`:o.Ay.leadCreate.path)},Pe=(0,u.useMemo)(()=>({onCreate:P(m.T6.ADD_NEW_MEMBER_TO_COMPANY)?()=>ze({status:"New"}):void 0,onCreateTitle:e(yl.createTitle,{moduleNameLead:e(Y("item:lead").customNameSingular)}),onImport:P(m.T6.ADD_NEW_MEMBER_TO_COMPANY)?le:void 0,onExport:Be.length?U.open:void 0,slotProps:{create:{variant:"contained"},import:{variant:"outlined"},export:{variant:"outlined"}}}),[Be,e,Y,P]),Ue=(0,i.jsx)(hl.A,{open:ie.show,onClose:ie.close,anchor:"right",transitionDuration:{enter:300,exit:300},PaperProps:{sx:{minWidth:350,maxWidth:350,[a.breakpoints.down(350)]:{width:"100%",minWidth:"unset"}}},children:(0,i.jsx)(xl.A,{columnList:gl,preferenceToggle:ie,savedPreference:{columnList:null==fe?void 0:fe.columns},preferenceOf:"lead",updating:xe,disabledColumns:["New","Client"],handleSubmit:async e=>{await je(Object.assign(Object.assign({},null!=fe?fe:{}),e)),ie.close()}})}),He=(0,i.jsx)(n.a,{sx:{color:"var(--Neutral-700, #344054)",fontFamily:"Inter",fontSize:"16px",fontStyle:"normal",fontWeight:400,lineHeight:"140%",display:"flex",flexDirection:"column"},children:(0,i.jsxs)(n.a,{sx:Object.assign({},V.A.flexStart),children:[(0,i.jsxs)(O.o,{sx:{color:"var(--Neutral-700, #344054)",fontFamily:"Inter",fontSize:"16px",fontStyle:"normal",fontWeight:600,lineHeight:"140%",mr:.25},children:[e("NOTE"),":"]}),(0,i.jsx)(O.o,{children:e("IMPORT_LEAD_READER_DESCRIPTION_PART_2")})]})}),Ye=(0,i.jsxs)(j.l,{fullWidth:!0,open:ee,maxWidth:"md",keepMounted:!0,onClose:te,children:[(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({},V.A.flexSpaceBetween),{padding:".75rem 1.5rem",borderRadius:"0.5rem 0.5rem 0rem 0rem",borderBottom:`1px solid ${a.palette.otColors.secondary[200]}`}),children:[(0,i.jsx)(Ft.L,{sx:{padding:"0px"},children:e("__IMPORT_LEADS__",{moduleName:e(Y("item:lead").customNamePlural)})}),(0,i.jsx)(el.K,{id:"close-csv-import",onClick:te,"aria-label":"close settings drawer",sx:{padding:".25rem",borderRadius:"0.25rem",border:`1px solid ${a.palette.otColors.secondary[300]}`},children:(0,i.jsx)(k.A,{sx:{width:"1.25rem",height:"1.25rem"}})})]}),(0,i.jsx)(Tt.C,{sx:{minHeight:300,px:"0px",pb:"0px"},children:(0,i.jsx)(tl.w,{readerExtraContent:He,onSubmit:t=>(t=>{var l,i;he();const a=null===(i=null===(l=null==$?void 0:$.companyRoles)||void 0===l?void 0:l.find(e=>e.role.name===m.z7.CLIENT))||void 0===i?void 0:i._id,o=t.map(e=>Object.assign(Object.assign(Object.assign({},e),e.contactNo?{contactNo:(0,pl.SG)(e.contactNo,e.country)}:{}),{lastContactedAt:I.Ay.get(e.lastContactedAt).toISOString(),role:a}));yl.createApi({companyId:null==$?void 0:$._id,body:o.map(e=>{const t=Object.assign(Object.assign({},e),{type:"individual"});return Object.entries(t).forEach(([e,l])=>{""===l&&delete t[e]}),t})}).then(({data:t})=>{Q(),te(),pe(),t.data.notAddedLeads.length>0?ge("error",t.data.notAddedLeads.map(e=>e.reason).join("")):de({message:e(yl.title,{moduleNameLead:e(Y("item:lead").customNameSingular)}),type:"create"})}).catch(e=>{pe(),ue(e)})})(t.form),customLabel:({item:e})=>null==e?void 0:e.label,formFields:[{label:e("FIRST_NAME"),value:"firstName",fullWidth:!0},{label:e("LAST_NAME"),value:"lastName",fullWidth:!0},{label:e("EMAIL"),value:"email",fullWidth:!0},{label:e("STATUS"),value:"status",fullWidth:!0},{label:e("SOURCE"),value:"source",fullWidth:!0},{label:e("COMPANY_NAME_LITERAL"),value:"companyName",fullWidth:!0},{label:e("__LEAD_VALUE__",{moduleNameLead:e(Y("item:lead").customNameSingular)}),value:"leadValue",fullWidth:!0},{label:e("PHONE_NUMBER"),value:"contactNo",fullWidth:!0},{label:e("WEBSITE"),value:"website",fullWidth:!0},{label:e("LAST_INTERACTION"),value:"lastContactedAt",fullWidth:!0},{label:e("COUNTRY"),value:"country",fullWidth:!0},{label:e("STATE"),value:"state",fullWidth:!0},{label:e("CITY"),value:"city",fullWidth:!0},{label:e("ZIP"),value:"zipCode",fullWidth:!0},{label:e("ADDRESS"),value:"address",fullWidth:!0}
1],formFieldIdentifier:"value",schema:l,busy:xe,dropdownBasedFields:{status:[{label:"New",value:"New"},{label:"Client",value:"Client"},{label:"Proposal Sent",value:"Proposal Sent"},{label:"Qualified",value:"Qualified"},{label:"Negotiation",value:"Negotiation"},{label:"Working",value:"Working"},{label:"Contacted",value:"Contacted"}],country:cl.F.map(e=>({label:e.name,value:e.name}))}})})]},ee),Ge=(0,u.useMemo)(()=>(0,ol.uT)(Be,"leadCustomField"),[Be]),qe=(0,i.jsx)(ll.A,{items:Be,exportDialogProps:U,itemModifier:t=>((e,t,l=[])=>{var i,a,o,n,s,r,d,c,u,m,h,x,p;return Object.assign({firstName:e.firstName,lastName:e.lastName,email:e.email,createdAt:I.Ay.get(e.createdAt).format(I.Ay.formatOptions.DATE_MONTH_YEAR),phoneNumber:null!==(i=e.contactNo)&&void 0!==i?i:"",leadValue:null!==(a=e.leadValue)&&void 0!==a?a:"",agent:e.agent?`${e.agent.firstName} ${e.agent.lastName}`:"",status:null!==(o=e.status)&&void 0!==o?o:"",companyName:null!==(n=null==e?void 0:e.companyName)&&void 0!==n?n:"",website:null!==(s=e.website)&&void 0!==s?s:"",source:null!==(r=e.source)&&void 0!==r?r:"",lastContactedAt:I.Ay.get(e.lastContactedAt).format(I.Ay.formatOptions.DATE_MONTH_YEAR),category:`${null===(c=null===(d=null==e?void 0:e.category)||void 0===d?void 0:d.map(e=>e.label.name))||void 0===c?void 0:c.join(", ")}`,country:null!==(u=null==e?void 0:e.country)&&void 0!==u?u:"",state:null!==(m=null==e?void 0:e.state)&&void 0!==m?m:"",city:null!==(h=null==e?void 0:e.city)&&void 0!==h?h:"",zip:null!==(x=null==e?void 0:e.zipCode)&&void 0!==x?x:"",address:null!==(p=e.address)&&void 0!==p?p:""},(0,ol.Kr)(e,l,"leadCustomField",t))})(t,e,Ge),headers:nl(e,Y,Ge),name:`Lead List ${I.Ay.get().format(I.Ay.formatOptions.DATE_MONTH_YEAR)}`}),Qe=()=>gl.filter(e=>{var t;return void 0===(null==fe?void 0:fe.columns)||(null===(t=null==fe?void 0:fe.columns)||void 0===t?void 0:t.includes(e.id))});return(0,i.jsxs)(i.Fragment,{children:[Ue,Ye,qe,(0,i.jsx)(y.F,Object.assign({sx:{px:3,py:1},title:e(yl.listTitle,{moduleName:e(Y("item:lead").customNamePlural)})},Pe,{btnOrder:["onCreate","onConfiguration","onImport","onExport"]})),(0,i.jsx)(f.c,{}),(0,i.jsx)(n.a,{sx:{px:3,py:2,backgroundColor:e=>e.palette.action.hover},children:(0,i.jsx)(n.a,{sx:{borderRadius:1.5,overflow:"hidden",border:`1px solid ${a.palette.otColors.secondary[200]}`,backgroundColor:a.palette.common.white},children:(0,i.jsx)(g.m,{sx:{px:3},activeButton:Ne,setActiveButton:De,searchValue:Ie,setSearchValue:Le,searchPlaceholder:e("SEARCH_BY_PLACEHOLDER_IN_CLIENT_PAGE"),selectionData:Me,setSelectionData:ke,dropDownDataset:Re,setDropDownDataset:Ve,isFilter:!0,isSort:!1,viewLabel:e("PREFERENCE"),onView:ie.open,isLoading:Z.isLoading})})}),(0,i.jsxs)(n.a,{ref:X,sx:{p:3,pb:"0px",backgroundColor:e=>e.palette.action.hover,width:"100%",overflow:"auto",scrollbarGutter:"stable",minHeight:`calc(${window.innerHeight}px - ${J}px)`,"& div":{mb:"0px"}},children:[Ee?(0,i.jsx)(i.Fragment,{children:Be.length?(0,i.jsx)(s.y,{autoScroll:{acceleration:1},kanbanColumnContentMaxHeight:"calc(100vh - 290px)",kanbanColumnMinHeight:"calc(100vh - 180px)",buttonUnderColumn:({item:t})=>(0,i.jsx)(B.$,{id:"create-lead-in-kanban",variant:"text",startIcon:(0,i.jsx)(Fe.A,{sx:{width:"1rem"}}),sx:{width:"100%",marginTop:".75rem",backgroundColor:a.palette.otColors.secondary[200],color:a.palette.otColors.secondary[600],fontSize:".75rem",lineHeight:"1.25rem",marginBottom:"1rem"},onClick:()=>ze({status:t.status}),children:e("__ADD_LEAD__",{moduleNameLead:e(Y("item:lead").customNameSingular)})}),renderHeader:({item:l,count:o})=>(0,i.jsxs)(n.a,{sx:{display:"flex",gap:".25rem",padding:".75rem",alignItems:"center",borderRadius:".5rem",marginBottom:".25rem !important",background:e=>e.palette.secondary.contrastText},children:[(0,i.jsx)(M,{}),(0,i.jsx)(O.o,{color:a.palette.otColors.secondary[600],fontSize:".875rem",fontWeight:"600",lineHeight:"1.125rem",children:t(`__${(0,re.g)(l.title)}__`)?e(`__${(0,re.g)(l.title)}__`,{moduleNameLead:e(Y("item:lead").customNameSingular),moduleNameProposal:e(Y("item:proposal").customNameSingular),moduleName:e(Y("item:client").customNameSingular)}):e((0,re.g)(l.title),{moduleNameLead:e(Y("item:lead").customNameSingular)})}),(0,i.jsx)(n.a,{sx:{padding:"0.125rem 0.5rem",borderRadius:"1rem",background:e=>e.palette.otColors.secondary[100]},children:(0,i.jsx)(O.o,{sx:{color:e=>e.palette.otColors.secondary[700],fontSize:".75rem",fontWeight:"500",lineHeight:"1.125rem"},children:o})})]}),columns:Qe(),renderBody:({item:t})=>{var l,o,s,r,d,c,u,h,x,p,g,v,y,f,b,j;const A="leadCompanyMember"===(null==t?void 0:t.type)||"company"===(null==t?void 0:t.clientSelectionType)||t.companyName&&(!t.firstName||!t.lastName),C=String(t.firstName||"").trim(),_=`${C} ${String(t.lastName||"").trim()}`.trim(),S=A?t.companyName||t.name||"-":vl.test(C)?C:_||t.email||"-";return(0,i.jsxs)(T.Z,{id:`lead-board-card-${null!==(l=t.automationIndex)&&void 0!==l?l:0}`,onClick:()=>ae(t),sx:{borderRadius:".5rem",border:`1px solid ${a.palette.otColors.secondary[200]}`,gap:".75rem",cursor:"pointer",display:"flex",flexDirection:"column",minWidth:0,[a.breakpoints.up("xs")]:{padding:"1rem 1rem 0.5rem 1rem !important"}},children:[(0,i.jsxs)(n.a,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,minWidth:0},children:[(0,i.jsxs)(n.a,{sx:{display:"flex",gap:".625rem",alignItems:"center",minWidth:0},children:[A?(0,i.jsx)(n.a,{sx:{width:32,height:32,borderRadius:"50%",bgcolor:a.palette.otColors.secondary[400],display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,i.jsx)(sl.A,{sx:{fontSize:18,color:a.palette.otColors.base.white}})}):(0,i.jsx)(N.A,{imageUrl:t.profileImage,name:S,clientName:S,alt:D.A.capitalize(null===(o=t.agent)||void 0===o?void 0:o.firstName)+" "+D.A.capitalize(null===(s=t.agent)||void 0===s?void 0:s.lastName),hideImageBorder:!0}),(0,i.jsx)(O.o,{color:a.palette.otColors.secondary[700],fontWeight:"500",fontSize:".875rem",lineHeight:"140%",noWrap:!0,sx:{minWidth:0,textOverflow:"ellipsis",overflow:"hidden"},children:S}),A?(0,i.jsx)(rl.A,{sx:{fontSize:20,color:a.palette.otColors.secondary[400],flexShrink:0}}):null]}),P(m.T6.REMOVE_CLIENT)?(0,i.jsx)(Kt,{refetch:We,company:$,item:t,automationIndex:null!==(r=t.automationIndex)&&void 0!==r?r:0}):null]}),(0,i.jsxs)(n.a,{sx:{display:"flex",flexWrap:"wrap",width:"100%",gap:1,alignItems:"center"},children:[(0,i.jsxs)(O.o,{id:`lead-board-card-source-${null!==(d=t.automationIndex)&&void 0!==d?d:0}`,color:a.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"500",lineHeight:"130%",sx:{dis
1play:"flex",gap:.5,minWidth:0,flex:1,alignItems:"center"},children:[e("SOURCE"),":"," ",t.source?(0,i.jsx)(ul.l,{title:(0,i.jsx)(O.o,{fontSize:"inherit",lineHeight:"inherit",sx:{color:e=>e.palette.otColors.secondary[500]},children:t.source}),placement:"top-start",sx:{"& .MuiTooltip-tooltip":{height:"fit-content",maxHeight:"50vh",overflow:"auto"}},children:(0,i.jsx)(O.o,{component:"span",fontSize:"inherit",lineHeight:"inherit",sx:{maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block",verticalAlign:"bottom",color:e=>e.palette.otColors.secondary[600]},children:t.source})}):(0,i.jsx)(O.o,{component:"span",color:a.palette.otColors.secondary.main,fontSize:".875rem",lineHeight:"140%",children:"-"})]}),(0,i.jsxs)(O.o,{id:`lead-board-card-value-${null!==(c=t.automationIndex)&&void 0!==c?c:0}`,color:a.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"500",lineHeight:"130%",sx:{minWidth:0,display:"flex",alignItems:"center",gap:.5,"& span":{fontSize:".875rem",lineHeight:"140%"},maxWidth:"40%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"},children:[e("VALUE"),":"," ",t.leadValue?(0,i.jsx)("span",{style:{fontSize:"inherit",display:"inline-flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%",paddingTop:"2px"},children:t.leadValue}):(0,i.jsx)(O.o,{component:"span",lineHeight:"140%",children:"-"})]})]}),(0,i.jsxs)(n.a,{sx:{display:"flex",alignItems:"center",gap:".25rem"},children:[(0,i.jsxs)(O.o,{id:`lead-board-card-assigned-agent-${null!==(u=t.automationIndex)&&void 0!==u?u:0}`,color:a.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"500",lineHeight:"130%",children:[e("ASSIGNED_AGENT"),":"]}),t.agent?(0,i.jsx)(N.A,{imageUrl:null===(h=t.agent)||void 0===h?void 0:h.profileImage,name:t.agent._id,clientName:(0,F.M)(null===(x=t.agent)||void 0===x?void 0:x.firstName,null===(p=t.agent)||void 0===p?void 0:p.lastName),alt:D.A.capitalize(null===(g=t.agent)||void 0===g?void 0:g.firstName)+" "+D.A.capitalize(null===(v=t.agent)||void 0===v?void 0:v.lastName),hideImageBorder:!0}):(0,i.jsx)(O.o,{component:"span",color:a.palette.otColors.secondary.main,fontSize:".875rem",lineHeight:"140%",children:"-"})]}),(0,i.jsxs)(n.a,{sx:Object.assign(Object.assign({},V.A.flexSpaceBetween),{paddingY:"0.375rem",borderTop:`1px solid ${a.palette.otColors.secondary[200]}`}),children:[(0,i.jsxs)(O.o,{id:`lead-board-card-last-interaction-${null!==(y=t.automationIndex)&&void 0!==y?y:0}`,color:a.palette.otColors.secondary[600],fontSize:".75rem",fontWeight:"400",lineHeight:"130%",children:[e("LAST_INTERACTION"),":"," ",t.lastContactedAt?(0,i.jsx)(i.Fragment,{children:I.Ay.getTimeAgo(t.lastContactedAt)}):"-"]}),(0,i.jsxs)(O.o,{color:a.palette.otColors.secondary[500],fontSize:".75rem",fontWeight:"400",lineHeight:"130%",borderRadius:".25rem",padding:"0rem .25rem",sx:Object.assign(Object.assign({},V.A.flexCenter),{gap:".25rem",background:a.palette.otColors.secondary[50]}),children:[(0,i.jsx)($e.A,{id:`lead-board-card-note-action-${null!==(f=t.automationIndex)&&void 0!==f?f:0}`,onClick:e=>{e.stopPropagation(),ae(t),z(e=>(e.set("tab",Ke),e))},sx:{width:".875rem"}}),t.noteCount,(0,i.jsx)(_e.A,{id:`lead-board-card-attachment-action-${null!==(b=t.automationIndex)&&void 0!==b?b:0}`,onClick:e=>{e.stopPropagation(),ae(t),z(e=>(e.set("tab",Xe),e))},sx:{width:".875rem",transform:"rotate(50deg)"}}),null===(j=t.files)||void 0===j?void 0:j.length]})]})]})},list:Be.sort((e,t)=>e.positionInBoard-t.positionInBoard).map((e,t)=>Object.assign(Object.assign({},e),{automationIndex:t,statusName:null==e?void 0:e.status,columnId:e.status})),columnDisabled:()=>!0,columnIdentifier:"id",cardIdentifier:"_id",cardColumnIdentifier:"columnId",onChange:({current:t,items:l,currentIndex:i})=>{t&&((t,l,i)=>{const a=l.find(e=>e._id===t.item._id);d.setQueryData([m.E5.MEMBER_LIST,"client",G,{}],e=>e?Object.assign(Object.assign({},e),{acceptedMembers:l.map((e,l)=>e._id===t.item._id?Object.assign(Object.assign({},t.item),{status:a.columnId,positionInBoard:l+1}):Object.assign(Object.assign({},e),{positionInBoard:l+1}))}):{count:0,acceptedMembers:[]}),yl.updateApi({body:yl.formDataUpdateTransformer({accountId:t.item._id,form:{status:a.status===a.columnId?"":a.columnId,positionInBoard:i+1||i+2}})}).then(()=>{Q(),de({message:e(yl.title,{moduleNameLead:e(Y("item:lead").customNameSingular)}),type:"update"})}).catch(e=>{ue(e)})})(t,l,i)}},Qe().length):null}):(0,i.jsx)(Zt,{}),(0,i.jsx)(kt.A,{isShow:Z.isSuccess&&0===Be.length&&!!Ie,text2:e(yl.emptySearchedListText,{name:`"${Ie}"`}),svg:(0,i.jsx)(Xt.A,{})}),(0,i.jsx)(kt.A,{svg:(0,i.jsx)(Jt.A,{}),isShow:Z.isSuccess&&0===Be.length&&!Ie,buttonTitle:e(yl.emptyListButtonTitle,{moduleNameLead:e(Y("item:lead").customNameSingular)}),onCreateButton:P(m.T6.ADD_NEW_MEMBER_TO_COMPANY)?()=>ze({status:"New"}
1):void 0,text1:P(m.T6.ADD_NEW_MEMBER_TO_COMPANY)?e(yl.emptyListButtonText1,{moduleNameLead:e(Y("item:lead").customNameSingular)}):void 0,text2:P(m.T6.ADD_NEW_MEMBER_TO_COMPANY)?e(yl.emptyListButtonText2,{moduleName:e(Y("item:lead").customNamePlural)}).replaceAll("Agency Handy",null==$?void 0:$.name):void 0})]}),oe?(0,i.jsx)(j.l,{open:!0,onClose:ye,maxWidth:"md",fullWidth:!0,sx:{"& .MuiDialog-paper":{height:"85vh"}},children:(0,i.jsx)(Ht,{detailsData:se,setDetailsData:ve,closeModal:ye,roleId:G,openDetails:ae})}):null]})}}}]);
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.