1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[3087],{76053(t,e,a){a.r(e),a.d(e,{default:()=>m});var n=a(41594),c=a(98483),o=a(26926),s=a(30596),i=a(39913),l=a(46023),d=a(28027),_=a(73882),h=a(63988);class r extends n.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:""});else{const e=this.props.getContact(t);this.setState({...e,contact_id:t})}}handleAddContact(t){t.preventDefault();const{contact_id:e,contact_name:a,contact_email:n}=this.state;if(e)if("ADD"===e){if(!a.trim()||!n.trim())return;this.setState({contact_id:"",contact_name:"",contact_email:""},()=>this.props.onAddNewContact(a,n))}else this.setState({contact_id:"",contact_name:"",contact_email:""},()=>this.props.onAddClientContact(e))}render(){const{client_contacts:t,index:e,onClosePopup:a}=this.props,{contact_id:n,contact_name:c,contact_email:o}=this.state;return(0,h.jsxs)("div",{"data-test-name":"AddShopContactPopup.render",className:"reveal tiny",style:{display:"block",zIndex:d.z+e,height:"initial",overflow:"visible"},children:[(0,h.jsxs)("div",{className:"row small-12 columns",children:[(0,h.jsx)("h3",{children:"Add Contact"}),(0,h.jsx)("a",{className:"button",style:{position:"absolute",right:"1rem",top:"1rem"},onClick:a,children:"Done"})]}),(0,h.jsxs)("div",{className:"row small-12 columns",children:[(0,h.jsx)(_.A,{options:t,value:n,placeholder:"Select from client",change:this.onChangeContact}),(0,h.jsx)("input",{type:"text",disabled:"ADD"!==n,value:c,placeholder:"ADD"===n?"Enter Full Name":"",onChange:t=>this.setState({contact_name:t.target.value})}),(0,h.jsx)("input",{type:"text",disabled:"ADD"!==n,value:o,placeholder:"ADD"===n?"Enter Email Address":"",onChange:t=>this.setState({contact_email:t.target.value})}),(0,h.jsx)("a",{className:"button",onClick:this.handleAddContact,children:"Add"})]})]})}}const m=(0,c.Ng)((t,e)=>({client_contacts:[{key:"ADD",value:"Add New"}].concat((0,s.jR)(t,{parent_id:e.client_id})),getContact:e=>{const a=(0,o.bl)(t,{contact_id:e})||{};return{contact_id:e,contact_name:`${a.contact_first_name} ${a.contact_last_name}`,contact_email:a.contact_email}}}),(t,e)=>({onClosePopup:()=>t((0,i.fs)()),onAddClientContact:a=>t((0,l.G4)(a,e.shop_id,"SHOP")),onAddNewContact:(a,n)=>t((0,l.es)({contact_name:a,contact_email:n,parent_id:e.shop_id,parent_type:"SHOP"}))}))(r)}}]); 2//# sourceMappingURL=components-AddShopContactPopup.ecd87d56.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.