text: (window.webpackJsonp=window.webpackJsonp||[]).push([[6],{448:function(e,t,a){"use strict";a.r(t);var n=a(7),l=a(8),c=a(10),o=a(9),s=a(11),r=a(27),i=a(1),u=a.n(i),m=a(3),h=a(2),d=a.n(h),b=a(202),f=a.n(b),g=a(199),p=function(e){function t(e){var a;return Object(n.a)(this,t),(a=Object(c.a)(this,Object(o.a)(t).call(this,e))).handleContact=function(e){a.setState({selectedContact:e}),console.log("Category selected:",e.value)},a.handleClient=function(e){a.setState({selectedClient:e}),console.log("Client selected:",e.value)},a.toggle=a.toggle.bind(Object(r.a)(Object(r.a)(a))),a.handleClick=a.handleClick.bind(Object(r.a)(Object(r.a)(a))),a.handleInputs=a.handleInputs.bind(Object(r.a)(Object(r.a)(a))),a.state={activeTab:"1",dropdownOpen:new Array(6).fill(!1),clientList:[{value:"",label:""}],contactList:[{value:"",label:""}],selectedContact:"",selectedClient:""},a}return Object(s.a)(t,e),Object(l.a)(t,[{key:"componentDidMount",value:function(){this.fetchPost()}},{key:"fetchPost",value:function(){var e=this,t=[];fetch("https://brimis-crm-backend.herokuapp.com/crm/clientcontacts/").then(function(e){return console.log("fetched create lead clients"),e.json()}).then(function(e){t=e.map(function(e){return e})}).catch(function(e){console.log(e)}).then(function(){for(var a=[{value:"",label:""}],n=[{value:"",label:""}],l=0;l<t.length;l++)a[l]={value:t[l].client.id,label:t[l].client.name},n[l]={value:t[l].contact.id,label:t[l].contact.firstName},console.log(a[l].value);e.setState({clientlist:a.concat(),contactList:n.concat()})})}},{key:"toggle",value:function(e){this.state.activeTab!==e&&this.setState({activeTab:e})}},{key:"toggleDrop",value:function(e){var t=this.state.dropdownOpen.map(function(t,a){return a===e&&!t});this.setState({dropdownOpen:t})}},{key:"handleInputs",value:function(e){return function(t){var a={};a[e]=t.target.value,console.log(t.target.value),this.setState(a)}.bind(this)}},{key:"handleClick",value:function(){var e="";f.a.post("https://brimis-crm-backend.herokuapp.com/crm/leads/create/",{client:this.state.selectedClient.value,createdBy:1,clientContact:this.state.selectedContact.value}).then(function(){e=this.state.selectedClient,console.log(e)}).then(function(e){console.log(e)}).catch(function(e){console.log(e.response)})}},{key:"render",value:function(){var e=this.state,t=e.selectedContact,a=e.selectedClient;return u.a.createElement(m.F,null,u.a.createElement(m.k,null,u.a.createElement(m.F,null,u.a.createElement(m.k,{sm:"4"},u.a.createElement(m.y,{htmlFor:"clients"}," Client "),u.a.createElement(g.a,{value:a,onChange:this.handleClient,options:this.state.clientlist})),u.a.createElement(m.k,{sm:"4"},u.a.createElement(m.y,{htmlFor:"contact"}," Contact Person "),u.a.createElement(g.a,{value:t,onChange:this.handleContact,options:this.state.contactList}))),u.a.createElement(m.s,null,u.a.createElement(m.y,{htmlFor:"country"}," Lead Notes "),u.a.createElement(m.t,{type:"text",id:"country",placeholder:"Enter A Note",onChange:this.handleInputs("feedback")})),u.a.createElement(m.e,{type:"submit",size:"sm",color:"primary",onClick:this.handleClick}," ",u.a.createElement("i",{className:"fa fa-user"}," "),"Submit"),u.a.createElement(m.e,{type:"reset",size:"sm",color:"danger"},u.a.createElement("i",{className:"fa fa-ban"})," Reset")))}}]),t}(i.Component),v=a(81),E=a(34),C=function(e){function t(e){var a;return Object(n.a)(this,t),(a=Object(c.a)(this,Object(o.a)(t).call(this,e))).state={list:[],clientContact:""},a}return Object(s.a)(t,e),Object(l.a)(t,[{key:"update",value:function(e,t,a){console.log(a),Object(E.c)({client:e,createdBy:t,clientContact:a}),this.setState({clientContact:a})}},{key:"componentDidMount",value:function(){this.fetchPost()}},{key:"fetchPost",value:function(){var e=this,t=[];fetch("https://brimis-crm-backend.herokuapp.com/crm/leads/").then(function(e){return e.json()}).then(function(e){t=e.map(function(e){return e})}).then(function(){e.setState({list:t})}).catch(function(e){console.log(e)})}},{key:"render",value:function(){var e=this,t=this.state.list.map(function(t,a){return u.a.createElement(m.A,{key:a,tag:"a",href:"#/leads/details",onClick:function(){return e.update(t.client.name,t.createdBy.username,t.clientContact.firstName)}}," ",t.client.name," | ",t.clientContact.firstName," ",t.clientContact.lastName,console.log("printing out list in render:"+e.state.list),u.a.createElement("div",{className:"card-header-actions"},u.a.createElement("a",{href:"#",rel:"noreferrer noopener",className:"card-header-action"},u.a.createElement("small",{className:"text-muted"},"delete"))),u.a.createElement("div",{className:"card-header-actions"},u.a.createElement("a",{href:"#",rel:"noreferrer noopener",className:"card-header-action"},u.a.createElement("small",{className:"text-muted"},"edit"))))});return u.a.createElement(m.F,null,u.a.createElement(m.k,null,u.a.createElement(m.z,null,t)))}}]),t}(i.Component),k=Object(v.b)(null,function(e){return{getContactDetails:function(t){return e(Object(E.c)(t))}}})(C),j=function(e){function t(e){var a;return Object(n.a)(this,t),(a=Object(c.a)(this,Object(o.a)(t).call(this,e))).onUpdate=function(e){fetch("https://brimis-crm-backend.herokuapp.com/crm/leads/?"+e),console.log("lead: "+a.name_got)},a.toggle=a.toggle.bind(Object(r.a)(Object(r.a)(a))),a.toggleModals=a.toggleModals.bind(Object(r.a)(Object(r.a)(a))),a.toggleCustom=a.toggleCustom.bind(Object(r.a)(Object(r.a)(a))),a.handleChange=a.handleChange.bind(Object(r.a)(Object(r.a)(a))),a.submitHandler=a.submitHandler.bind(Object(r.a)(Object(r.a)(a))),a.state={activeTab:"1",dropdownOpen:new Array(6).fill(!1),modal:!1,custom:[!1,!1],name_got:""},a}return Object(s.a)(t,e),Object(l.a)(t,[{key:"submitHandler",value:function(e){e.preventDefault(),this.props.handlerFromParent(this.state.name_got),this.setState({name_got:""})}},{key:"handleChange",value:function(){this.setState({name_got:"Eureka!"})}},{key:"toggle",value:function(e){this.state.activeTab!==e&&this.setState({activeTab:e})}},{key:"toggleDrop",value:function(e){var t=this.state.dropdownOpen.map(function(t,a){return a===e&&!t});this.setState({dropdownOpen:t})}},{key:"toggleCustom",value:function(e){var t=this.state.custom.map(function(t,a){return e===a&&!t});this.setState({custom:t})}},{key:"toggleModals",value:function(){this.setState({modal:!this.state.modal})}},{key:"render",value:function(){var e=this;return u.a.createElement("div",null,u.a.createElement(m.F,null,u.a.createElement(m.k,{sm:"9"},u.a.createElement(m.B,{tabs:!0},u.a.createElement(m.C,null,u.a.createElement(m.D,{className:d()({active:"1"===this.state.activeTab}),onClick:function(){e.toggle("1")}},"Current Leads")),u.a.createElement(m.C,null,u.a.createElement(m.D,{className:d()({active:"2"===this.state.activeTab}),onClick:function(){e.toggle("2")}},"Create Lead"))),u.a.createElement(m.G,{activeTab:this.state.activeTab},u.a.createElement(m.H,{tabId:"1"},u.a.createElement(m.r,{action:"",method:"get",className:"form-horizontal"},u.a.createElement(m.s,{row:!0},u.a.createElement(m.k,{sm:"12"},u.a.createElement(m.t,{type:"search",name:"search",id:"leadSearch",placeholder:"Search Leads"})))),u.a.createElement(k,{onUpdate:this.onUpdate})),u.a.createElement(m.H,{tabId:"2"},u.a.createElement(p,null)))),u.a.createElement(m.k,{sm:"3",xl:"3"},u.a.createElement(m.f,null,u.a.createElement(m.j,null,u.a.createElement("strong",null,"Lead Statuses")),u.a.createElement(m.g,null,u.a.createElement(m.z,null,u.a.createElement(m.A,{className:"justify-content-between"},"New ",u.a.createElement(m.b,{className:"float-right",pill:!0,color:"warning"},"1")),u.a.createElement(m.A,{className:"justify-content-between"},"Contacted ",u.a.createElement(m.b,{className:"float-right",pill:!0,color:"warning"},"0")),u.a.createElement(m.A,{className:"justify-content-between"},"Converted ",u.a.createElement(m.b,{className:"float-right",pill:!0,color:"warning"},"0")),u.a.createElement(m.A,{className:"justify-content-between"},"Rejected ",u.a.createElement(m.b,{className:"float-right",pill:!0,color:"warning"},"0")),u.a.createElement(m.A,{className:"justify-content-between"},"Other ",u.a.createElement(m.b,{className:"float-right",pill:!0,color:"warning"},"0")),u.a.createElement(m.A,{className:"justify-content-between"},"Total Leads ",u.a.createElement(m.b,{className:"float-right",pill:!0},"1"))))))))}}]),t}(i.Component);t.default=j}}]);
  //# sourceMappingURL=6.692bf36a.chunk.js.map