1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[3694],{23172(t,n,a){a.r(n),a.d(n,{default:()=>p});var c=a(41594),e=a(98483),o=a(26926),s=a(30596),i=a(39913),l=a(46023),d=a(93351),r=a(28027),_=a(73882),h=a(63988);class m extends c.Component{constructor(t){super(t),this.state={contact_id:"",contact_name:"",contact_email:""},this.handleAddContact=this.handleAddContact.bind(this),this.onChangeContact=this.onChangeContact.bind(this)}onChangeContact(t){if("ADD"===t)this.setState({contact_id:t,contact_name:"",contact_email:""},function(){this.handleAddContact()});else{const n=this.props.getContact(t);this.setState({...n,contact_id:t},function(){this.handleAddContact()})}}handleAddContact(){const{contact_id:t,contact_name:n,contact_email:a}=this.state;t&&("ADD"===t?this.setState({contact_id:"",contact_name:"",contact_email:""},()=>this.props.onAddNewContact()):this.setState({contact_id:"",contact_name:"",contact_email:""},()=>this.props.onAddClientContact(t)))}render(){const{contacts:t,client_contacts:n,onRemoveContact:a,onClosePopup:c,title:e="Contact List",index:o}=this.props,{contact_id:s,contact_name:i,contact_email:l}=this.state;return(0,h.jsxs)("div",{"data-test-name":"ContactListPopup.render",className:"reveal large",style:{display:"block",zIndex:r.z+o,height:"initial",maxHeight:"100%"},children:[(0,h.jsxs)("div",{className:"row small-12 columns",children:[(0,h.jsx)("h3",{children:e}),(0,h.jsx)("a",{className:"button",style:{position:"absolute",right:"1rem",top:"1rem"},onClick:c,children:"Done"})]}),(0,h.jsxs)("div",{className:"row small-12 medium-8 columns",style:{padding:"10px 0px",marginRight:"15px",float:"left"},children:[(0,h.jsx)(_.A,{className:"small-8",style:{float:"left",marginLeft:"15px",marginRight:"10px"},options:n,value:s,placeholder:"Select from client",change:this.onChangeContact,inPopup:!0,withMarginBottom:!0}),s&&"ADD"!==s&&(0,h.jsxs)("div",{className:"small-12 columns",children:[(0,h.jsx)("p",{children:(0,h.jsx)("b",{children:i})}),(0,h.jsx)("p",{children:l})]})]}),(0,h.jsxs)("div",{className:"row small-12 columns",style:{overflow:"auto",height:"400px"},children:[(0,h.jsxs)("table",{children:[(0,h.jsx)("thead",{children:(0,h.jsxs)("tr",{children:[(0,h.jsx)("td",{children:"Contact Name"}),(0,h.jsx)("td",{children:"Actions"})]})}),(0,h.jsx)("tbody",{children:t.length?t.map((t,n)=>(0,h.jsxs)("tr",{children:[(0,h.jsxs)("td",{children:[(0,h.jsxs)("b",{children:[t.contact_first_name," ",t.contact_last_name]}),t.contact_email?` (${t.contact_email})`:""]}),(0,h.jsx)("td",{children:(0,h.jsx)("a",{onClick:c=>a(t,n),children:"delete contact"})})]},t.contact_id)):(0,h.jsx)("tr",{children:(0,h.jsx)("td",{children:"No contacts yet"})})})]}),(0,h.jsx)("br",{}),(0,h.jsx)("br",{})]})]})}}const p=(0,e.Ng)((t,n)=>{const a="BILLING"===n.type?["SHOP-BILLING","SHOP"]:["SHOP-SHIPPING","SHOP"],c=(0,s.o1)(t,n).filter(t=>-1!==a.indexOf(t.company_type)),e=c.reduce((t,n)=>(t[n.contact_first_name+n.contact_last_name+n.contact_email]=n,t),{});return{contacts:c,client_contacts:[{key:"ADD",value:"Add New Client Contact"}].concat((0,s.o1)(t,{parent_id:n.client_id}).filter(t=>!e[t.contact_first_name+t.contact_last_name+t.contact_email]).map(t=>({key:t.contact_id,value:`${t.contact_first_name} ${t.contact_last_name}`}))),getContact:n=>{const a=(0,o.bl)(t,{contact_id:n})||{};return{contact_id:n,contact_name:`${a.contact_first_name} ${a.contact_last_name}`,contact_email:a.contact_email}}}},(t,n)=>({onClosePopup:()=>t((0,i.fs)()),onRemoveContact:(a,c)=>{t((0,l.ir)(a)),0==c&&t((0,d.A1)(n.parent_id,`${n.type.toLowerCase()}_contact_type`,"LIST","TYPED"))},onAddClientContact:a=>t((0,l.G4)(a,n.parent_id,`SHOP-${n.type}`)),onAddNewContact:()=>{t((0,i._7)(null,n.client_id,null,null,n.client_id,"CLIENT",n.parent_id,`SHOP-${n.type}`))}}))(m)}}]); 2//# sourceMappingURL=components-ContactListPopup.f1a986af.chunk.js.map
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.