1"use strict";(self.webpackChunkscip_react=self.webpackChunkscip_react||[]).push([[45850],{45850(e,s,t){t.r(s),t.d(s,{default:()=>E});var n=t(89379),l=t(5544),a=t(9950),r=t(97176),i=t(46114),c=t(84084),d=t(87537),o=t(5495),m=t(33483),h=t(65276),x=t(34940),u=t(65488),p=t(88156),f=t(46882),g=t(745),b=t(98455),j=t(9449),N=t(95961),v=t(20532),y=t(15845),A=t(91646),k=t(35887),w=t(25836),C=t(44414);const S=e=>{const s=(0,j.mN)(),t=(s.register,s.reset),n=s.watch,c=s.control,d=s.handleSubmit,o=s.formState.errors,m=n(),h=(0,a.useState)([]),x=(0,l.A)(h,2),u=(x[0],x[1]),p=(0,a.useState)([]),f=(0,l.A)(p,2),b=f[0],S=f[1],I=(0,a.useState)(),_=(0,l.A)(I,2),E=(_[0],_[1]),P=(0,a.useState)([]),T=(0,l.A)(P,2),R=T[0],D=T[1],L=(0,a.useState)([]),F=(0,l.A)(L,2),H=(F[0],F[1]),U=[{id:"entrepreneur",value:"ENTREPRENEUR"},{id:"investor",value:"INVESTOR"}];return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(N.A,{direction:"end",isOpen:e.show,id:"offcanvasExample",toggle:e.onCloseClick,className:"size-sm",children:(0,C.jsxs)("form",{onSubmit:d(s=>{s.id=e.modelName.id,g.A.postAPI({action:"/add-mail-to-user-dashboard",body:s,id:"add-to-dashboard-submit-btn"}).then(s=>{k.Ay.success(s.message),e.onCloseClick(!e.show),t({})}).catch(e=>{})}),className:"d-flex flex-column justify-content-end h-100",children:[(0,C.jsx)(v.A,{className:"bg-light",toggle:e.onCloseClick,children:"Add To Dashboard"}),(0,C.jsx)(y.A,{children:(0,C.jsx)(r.A,{children:(0,C.jsx)(i.A,{lg:12,children:(0,C.jsxs)("div",{className:"mb-2",children:[(0,C.jsx)(i.A,{lg:12,children:(0,C.jsxs)("div",{className:"mb-2",children:[(0,C.jsxs)(A.A,{htmlFor:"name-field",className:"form-label",children:["Select User Type",(0,C.jsx)("span",{className:"text-danger",children:"*"})]}),(0,C.jsx)(j.xI,{control:c,name:"role",rules:{required:!0},render:e=>{var s;let t=e.field;return(0,C.jsx)(w.A,{options:U,selected:null!==(s=t.value)&&void 0!==s?s:"",isSearchable:!0,placeholder:"Select User",onChange:e=>{t.onChange(e.id),u(e.id),"entrepreneur"==e.id?g.A.getAPI({action:"/get-company-list",body:null}).then(e=>{S(e.list)}).catch(e=>{}):g.A.getAPI({action:"/user-investor-dropdown-list-for-import",body:null}).then(e=>{var s=[];for(var t in e.list)s.push({id:e.list[t].userId,value:e.list[t].name});D(s)}).catch(e=>{})}})}}),o.role&&(0,C.jsx)("span",{className:"text-danger fs-12",children:"Please select user type"})]})}),"entrepreneur"==m.role&&(0,C.jsx)(i.A,{lg:12,children:(0,C.jsxs)("div",{className:"mb-2",children:[(0,C.jsxs)(A.A,{htmlFor:"name-field",className:"form-label",children:["Company Name",(0,C.jsx)("span",{className:"text-danger",children:"*"})]}),(0,C.jsx)(j.xI,{control:c,name:"comapny_id",rules:{required:!0},render:e=>{var s;let t=e.field;return(0,C.jsx)(w.A,{options:b,selected:null!==(s=t.value)&&void 0!==s?s:"",isSearchable:!0,placeholder:"Select User",onChange:e=>{t.onChange(e.id),E(e.id)}})}}),o.comapny_id&&(0,C.jsx)("span",{className:"text-danger fs-12",children:"Please select company name"})]})}),"investor"==m.role&&(0,C.jsx)(i.A,{lg:12,children:(0,C.jsxs)("div",{className:"mb-2",children:[(0,C.jsxs)(A.A,{htmlFor:"name-field",className:"form-label",children:["Investor",(0,C.jsx)("span",{className:"text-danger",children:"*"})]}),(0,C.jsx)(j.xI,{control:c,name:"user_id",rules:{required:!0},render:e=>{var s;let t=e.field;return(0,C.jsx)(w.A,{options:R,selected:null!==(s=t.value)&&void 0!==s?s:"",isSearchable:!0,placeholder:"Select Investor",onChange:e=>{t.onChange(e.id),H(e.id)}})}}),o.user_id&&(0,C.jsx)("span",{className:"text-danger fs-12",children:"Please select user"})]})})]})})})}),(0,C.jsxs)("div",{className:"offcanvas-footer border-top p-3 text-center hstack gap-2 justify-content-end",children:[(0,C.jsx)("button",{type:"submit",className:"btn btn-brand-theme-save",id:"add-to-dashboard-submit-btn",children:"Submit"}),(0,C.jsx)("button",{className:"btn btn-light",onClick:()=>{e.onCloseClick(!e.show),t()},children:"Cancel"})]})]})})})},I=e=>{var s;if(!e)return"ri-file-line";const t=null===(s=e.split(".").pop())||void 0===s?void 0:s.toLowerCase();return"pdf"===t?"ri-file-pdf-2-line":["png","jpg","jpeg","gif","webp"].includes(t||"")?"ri-image-line":["doc","docx"].includes(t||"")?"ri-file-word-2-line":["xl
1s","xlsx"].includes(t||"")?"ri-file-excel-2-line":["zip","rar"].includes(t||"")?"ri-file-zip-line":"ri-file-line"},_="780px",E=()=>{const e=(0,a.useState)(!1),s=(0,l.A)(e,2),t=s[0],j=s[1],N=(0,a.useState)([]),v=(0,l.A)(N,2),y=v[0],A=v[1],w=(0,a.useState)([]),E=(0,l.A)(w,2),P=E[0],T=E[1],R=(0,a.useState)({}),D=(0,l.A)(R,2),L=D[0],F=D[1],H=(0,a.useState)({}),U=(0,l.A)(H,2),M=U[0],W=U[1],z=(0,a.useState)(""),O=(0,l.A)(z,2),q=O[0],Y=O[1],B=(0,a.useState)(),K=(0,l.A)(B,2),V=K[0],G=K[1],J=(0,a.useState)(),Q=(0,l.A)(J,2),X=Q[0],Z=Q[1],$=(0,a.useState)(!1),ee=(0,l.A)($,2),se=ee[0],te=ee[1],ne=(0,a.useState)(!1),le=(0,l.A)(ne,2),ae=le[0],re=le[1],ie=(0,a.useState)([]),ce=(0,l.A)(ie,2),de=ce[0],oe=ce[1],me=(0,a.useState)(!1),he=(0,l.A)(me,2),xe=he[0],ue=he[1],pe=(0,a.useState)(!1),fe=(0,l.A)(pe,2),ge=fe[0],be=fe[1],je=(0,a.useRef)(!1),Ne=(0,a.useRef)(0),ve=(0,a.useState)({name:"",id:0}),ye=(0,l.A)(ve,2),Ae=ye[0],ke=ye[1];(0,a.useEffect)(()=>{Se(),Ce()},[]),(0,a.useEffect)(()=>{if(!ae)return void ue(!1);const e=y.map(e=>e.threadId).filter(e=>void 0!==e&&null!==e&&""!==e);if(0===e.length)return void ue(!1);const s=e.every(e=>de.includes(e));ue(s)},[de,y,ae]);const we=()=>{const e=y.map(e=>e.threadId).filter(e=>void 0!==e&&null!==e&&""!==e);if(0===e.length)return;const s=Array.from(new Set(e));xe?(oe([]),ue(!1)):(oe(s),ue(!0))},Ce=()=>{g.A.getAPI({action:"/emailoutlook/count",body:null}).then(e=>{void 0!==(null===e||void 0===e?void 0:e.count)&&G(e.count)}).catch(()=>{})},Se=e=>{if(je.current||-1===Ne.current)return;je.current=!0;const s=Ne.current,t={offset:s,limit:20};(q||e)&&(t.keyword=e||q),0===s?j(!1):te(!0),g.A.getAPI({action:"/load-more-email-inbox",body:t}).then(e=>{G(e.count);const t=e.list||[];A(e=>0===s?t:[...e,...t]),0===s&&t.length>0&&(Z(t[0].threadId),Ie(t[0].threadId)),void 0===e.next_offset||null===e.next_offset?Ne.current=-1:Ne.current=Number(e.next_offset),j(!0),te(!1)}).catch(e=>{console.error("EMAIL LIST ERROR:",e),te(!1),j(!0)}).finally(()=>{je.current=!1})},Ie=e=>{const s={id:e||X};g.A.getAPI({action:"/get-email-thread",body:s}).then(e=>{const s=e.result||[];if(T(s),s.length>0){var t,n;const e=s[s.length-1];F({[e.Id]:!0}),W({brand_name:(null===(t=s[0])||void 0===t?void 0:t.from_name)||(null===(n=s[0])||void 0===n?void 0:n.sender_name)||""})}}).catch(()=>{})},_e=(e,s)=>(0,C.jsxs)("div",{className:"d-flex align-items-center",style:{border:"1px solid #eaeaef",borderRadius:"8px",padding:"8px 12px",cursor:"pointer",maxWidth:"220px",backgroundColor:"#fafbfc",transition:"background-color 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f1f3f6"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#fafbfc"},onClick:s=>{var t;s.stopPropagation(),(t=e.attachment)&&window.open(t,"_blank")},title:e.attachmentName,children:[(0,C.jsx)("i",{className:"".concat(I(e.attachmentName)," fs-16 flex-shrink-0"),style:{color:"#405189",marginRight:"8px"}}),(0,C.jsx)("span",{className:"fs-12 text-truncate",style:{color:"#495057"},children:e.attachmentName}),(0,C.jsx)("i",{className:"ri-download-2-line fs-13 text-muted flex-shrink-0 ms-2"})]},s),Ee=function(){const e=["blue","purple","green"];return e[(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split("").reduce((e,s)=>e+s.charCodeAt(0),0)%e.length]};return(0,C.jsxs)(a.Fragment,{children:[(0,C.jsx)("div",{className:"page-content-message",children:(0,C.jsxs)(r.A,{className:"gx-2 mt-5 deal-email",children:[(0,C.jsx)(i.A,{md:4,style:{paddingLeft:"12px"},children:(0,C.jsxs)(c.A,{className:"mb-2 profile-content-card summary-card email-sidebar",children:[(0,C.jsxs)(d.A,{className:"d-flex align-items-center justify-content-between bg-white border-bottom px-3 py-2",style:{minHeight:"58px"},children:[(0,C.jsxs)("div",{className:"d-flex align-items-center",children:[(0,C.jsx)("h4",{className:"card-title fs-15 fw-semibold mb-0 ",children:"All Email"}),de.length>0&&(0,C.jsxs)("span",{className:"fs-12 text-muted ms-2",children:[de.length," selected"]})]}),(0,C.jsxs)("div",{className:"d-flex align-items-center gap-2",onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(o.A,{isOpen:ge,toggle:()=>be(!ge),children:[(0,C.jsxs)(m.A,{tag:"button",type:"button",className:"btn btn-sm btn-brand-theme d-flex align-items-center rounded-3",children:["New Email",(0,C.jsx)("i",{className:"ri-arrow-down-s-line ms-1 fs-14"})]}),(0,C.jsxs)(h.A,{end:!0,children:[(0,C.jsxs)(x.A,{onClick:()=>{window.location.href="/admin/email-outlook/archive"},children:[(0,C.jsx)("i",{className:"ri-archive-line me-2"}),"Archived"]}),(0,C.jsxs)(x.A,{onClick:()=>{window.location.href="/admin/email-outlook/deleted"},children:[(0,C.jsx)("i",{className:"ri-delete-bin-line me-2"}
1),"Deleted Emails"]})]})]}),ae&&de.length>0&&(0,C.jsx)("button",{type:"button",className:"btn btn-sm btn-brand-theme rounded-3",onClick:()=>{if(0===de.length)return void k.Ay.error("Please select at least one email");const e={ids:de};g.A.putAPI({action:"/email-status-change",body:e}).then(e=>{k.Ay.success(e.message||"Status updated successfully."),oe([]),ue(!1),re(!1),Ne.current=0,je.current=!1,A([]),Se()}).catch(()=>{})},children:"Inactive Mails"}),ae&&(0,C.jsxs)("div",{className:"d-flex align-items-center gap-1 px-2 py-1 border rounded-3",children:[(0,C.jsx)(u.A,{type:"checkbox",className:"form-check-input mt-0",checked:xe,onChange:we,style:{cursor:"pointer",width:"15px",height:"15px"}}),(0,C.jsx)("span",{className:"fs-12 text-muted",style:{whiteSpace:"nowrap",cursor:"pointer"},onClick:we,children:"Select All"})]}),(0,C.jsx)("button",{type:"button",title:ae?"Hide selection":"Select emails",onClick:()=>{re(e=>{const s=!e;return s||(oe([]),ue(!1)),s})},className:"btn btn-sm rounded-3 d-flex align-items-center justify-content-center ".concat(ae?"btn-soft-primary":"btn-light border"),style:{width:"34px",height:"34px"},children:(0,C.jsx)("i",{className:ae?"ri-checkbox-multiple-fill":"ri-checkbox-multiple-line",style:{fontSize:"17px"}})})]})]}),(0,C.jsx)(p.A,{style:{height:t?_:"200px"},className:t?"p-0":"card-loader p-0",children:t&&(0,C.jsxs)("div",{className:"px-3 pt-2 pb-2 flex-shrink-0",children:[(0,C.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-2",children:[(0,C.jsx)("span",{className:"fs-13 text-dark fw-medium",children:"Inbox"}),(0,C.jsx)("span",{className:"badge rounded-pill bg-soft-success text-success fs-11 px-2 py-1",children:V})]}),(0,C.jsxs)("div",{className:"search-box",children:[(0,C.jsx)(u.A,{type:"text",className:"form-control search",placeholder:"Search mail",value:q,onChange:e=>Y(e.target.value),onKeyUp:e=>{var s;"Enter"===e.key&&(s=q,Ne.current=0,je.current=!1,A([]),oe([]),ue(!1),Se(s))}}),(0,C.jsx)("i",{className:"ri-search-line search-icon",style:{left:"14px"}})]}),(0,C.jsxs)("div",{onScroll:e=>{const s=e.currentTarget;s.scrollTop+s.clientHeight>=s.scrollHeight-100&&!je.current&&-1!==Ne.current&&Se()},style:{maxHeight:"610px",overflowY:"scroll",marginTop:"10px"},children:[y&&y.length>0&&y.map((e,s)=>{const t=X==e.threadId,n=de.includes(e.threadId);return(0,C.jsxs)("div",{className:"d-flex align-items-center email-list-item rounded-4 mb-2 ".concat(t?"active":""," ").concat(n?"selected":""),onClick:()=>{Z(e.threadId),Ie(e.threadId)},children:[ae&&(0,C.jsx)("div",{className:"form-check flex-shrink-0",style:{marginRight:"10px",marginBottom:0},onClick:e=>e.stopPropagation(),children:(0,C.jsx)(u.A,{type:"checkbox",className:"form-check-input",checked:n,onChange:()=>{var s;void 0!==(s=e.threadId)&&null!==s&&""!==s&&oe(e=>e.includes(s)?e.filter(e=>e!==s):[...e,s])},style:{width:"15px",height:"15px",cursor:"pointer"}})}),(0,C.jsx)("span",{className:"avatar-xs rounded-circle d-flex align-items-center justify-content-center flex-shrink-0 me-2 email-avatar color-".concat(Ee(e.from_name)),children:e.from_name?e.from_name.charAt(0).toUpperCase():"?"}),(0,C.jsxs)("div",{className:"flex-grow-1",style:{minWidth:0},children:[(0,C.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,C.jsx)("h5",{className:"fs-14 mb-1 fw-semibold text-truncate",children:e.from_name}),(0,C.jsx)("span",{className:"fs-12 text-muted flex-shrink-0",children:e.date?b.A.getDateFormat(e.date):""})]}),(0,C.jsxs)("div",{className:"d-flex align-items-center",children:[(0,C.jsx)("p",{className:"fs-12 mb-0 text-truncate text-muted",children:e.subject}),e.no_of_attachment>0&&(0,C.jsx)("i",{className:"ri-attachment-2 text-muted fs-12 flex-shrink-0"})]})]})]},e.Id||s)}),se&&(0,C.jsxs)("div",{className:"d-flex justify-content-center align-items-center py-3",children:[(0,C.jsx)("span",{className:"spinner-border spinner-border-sm text-primary me-2",role:"status"}),(0,C.jsx)("span",{className:"fs-12 text-muted",children:"Loading more..."})]}),!se&&-1===Ne.current&&y.length>0&&(0,C.jsx)("div",{className:"text-center py-3",children:(0,C.jsx)("span",{className:"fs-12 text-muted",children:"No more emails"})}),y&&0===y.length&&(0,C.jsx)("div",{className:"profile-timeline mt-2",style:{paddingLeft:"4px",paddingRight:"4px"},children:(0,C.jsx)("div",{className:"accordion accordion-flush",children:(0,C.jsx)(f.A,{color:"info",className:"text-center",children:"No Data Found."})})})]})]})})]})}),(0,C.jsx)(i.A,{md:8,className:"social-icons",children:(0,C.jsxs)(c.A,{className:"mb-1 email-view-card",children:[(0,C.jsxs)(d.A,{className:"d-flex align-items-center justify-content-between bg-white border-bottom px-3 py-2",style:{minHeight:"58px"},children:[(0,C.jsx)("h4",{className:"card-title mb-0 me-2 fs-15 fw-semibold text-dark text-truncate",children:P&&P.length>0?P[0].subject:null===M||void 0===M?void 0:M.brand_name}),(0,C.jsx)("button",{type:"button",className:"btn btn-sm rounded-3 d-flex align-items-center justify-content-center btn-soft-primary",style:{width:"34px",height:"34px"},title:"Add to Dashboard",onClick:()=>{ke({name:"AddToDashboard"})},children:(0,C.jsx)("i",{className:"ri-add-line"})})]}),(0,C.jsx)(p.A,{style:{height:t?_:"200px",backgroundColor:"#fff"},className:t?"p-0":"card-loader p-0",children:t&&(0,C.jsx)("div",{style:{height:"100%",overflowY:"auto"},className:"px-3 py-2",children:P&&P.length>0&&P.map((e,s)=>{const t=!!L[e.Id],l=e.from_name?e.from_name.charAt(0).toUpperCase():"?",a=e.attachments||[];return(0,C.jsxs)("div",{className:"mb-2 rounded-3 border ".concat(t?"shadow-sm":""," bg-white overflow-hidden"),children:[(0,C.jsxs)("div",{className:"d-flex align-items-center justify-content-between px-3 py-3 rounded-3 ".concat(t?"bg-white":"bg-light"),style:{cursor:"pointer"},onClick:()=>{return s=e.Id,void F(e=>(0,n.A)((0,n.A)({},e),{},{[s]:!e[s]}));var s},children:[(0,C.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"12px",minWidth:0,flex:1},children:[(0,C.jsx)("span",{className:"avatar-xs rounded-circle d-flex align-items-center justify-content-center flex-shrink-0 me-2",style:{backgroundColor:"#e8f1ff",color:"#1769d1",fontWeight:600},children:l}),(0,C.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,C.jsxs)("div",{className:"d-flex align-items-center",style:{gap:"8px"},children:[(0,C.jsx)("span",{className:"fs-13 fw-semibold text-truncate",children:e.from_name}),a.length>0&&(0,C.jsx)("i",{className:"ri-attachment-2 text-muted fs-13 flex-shrink-0"}),!t&&(0,C.jsxs)("span",{className:"fs-12 text-muted text-truncate",style:{flex:1},children:["\u2014"," ",e.email_text?e.email_text.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,90):""]})]}),t&&(0,C.jsxs)("span",{className:"fs-12 text-muted",children:["to"," ",e.to_email]})]})]}),(0,C.jsx)("small",{className:"fs-12 text-muted flex-shrink-0 ms-3",children:e.date?b.A.getDateFormat(e.date):""})]}),!t&&a.length>0&&(0,C.jsx)("div",{className:"d-flex flex-wrap px-3 pb-2",style:{gap:"8px",paddingLeft:"68px"},children:a.map((e,s)=>_e(e,s))}),t&&(0,C.jsxs)("div",{className:"px-3 pb-3 ps-5",children:[e.cc&&(0,C.jsxs)("div",{className:"fs-12 text-muted mb-2",children:["Cc:"," ",e.cc]}),(0,C.jsx)("hr",{className:"my-2"}),(0,C.jsx)("div",{className:"email-view-p fs-13",style:{color:"#3c3c43",lineHeight:1.6},dangerouslySetInnerHTML:{__html:e.email_text}}),a.length>0&&(0,C.jsxs)("div",{className:"mt-3 pt-3",style:{borderTop:"1px solid #f1f1f5"},children:[(0,C.jsxs)("div",{className:"fs-12 text-muted mb-2",children:[a.length," ","Attachment",a.length>
11?"s":""]}),(0,C.jsx)("div",{className:"d-flex flex-wrap",style:{gap:"10px"},children:a.map((e,s)=>_e(e,s))})]})]})]},e.Id||s)})})})]})})]})}),"AddToDashboard"===Ae.name&&(0,C.jsx)(S,{show:"AddToDashboard"===Ae.name,onCloseClick:()=>ke(""),modelName:Ae})]})}}}]);
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.