text: (this.webpackJsonpfrontend=this.webpackJsonpfrontend||[]).push([[0],{111:function(e,t,a){e.exports=a(255)},116:function(e,t,a){},117:function(e,t,a){e.exports=a.p+"media/logo.5d5d9eef.svg"},118:function(e,t,a){},16:function(e,t,a){},255:function(e,t,a){"use strict";a.r(t);var n=a(0),s=a.n(n),l=a(18),o=a.n(l),r=(a(116),a(2)),i=a(3),c=a(5),u=a(4),h=a(6),d=(a(117),a(118),a(16),a(258)),m=a(13),p=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={value:""},a.handleChange=a.handleChange.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"handleChange",value:function(e){console.log(e.target.value),this.setState({value:e.target.value}),this.handleSubmit(e.target.value)}},{key:"handleSubmit",value:function(e){console.log("Searching: "+e),this.props.onChange(e)}},{key:"render",value:function(){return s.a.createElement("div",null,s.a.createElement("form",null,s.a.createElement("input",{type:"text",placeholder:"Search by date here",value:this.state.value,onChange:this.handleChange})))}}]),t}(n.Component),b=a(85),v=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).onChange=function(e){a.setState({search:e})},a.isSelected=function(e,t){var a;for(a=0;a<t.length;a++)if(t[a].date===e)return console.log("Element found"),!0;return!1},a.fuzzySearch=function(){var e={shouldSort:!0,threshold:0,location:0,distance:100,maxPatternLength:32,minMatchCharLength:1,keys:a.state.searchKeys};return new b(a.state.tableData,e).search(a.state.search)},a.state={tableData:a.props.tableData,tableName:a.props.tableName,keys:a.props.keys,searchKeys:a.props.searchKeys,search:""},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){var e=this,t=this.fuzzySearch();return console.log("Date Data: "+t),s.a.createElement("div",null,s.a.createElement(p,{onChange:this.onChange}),s.a.createElement(d.a,{celled:!0},s.a.createElement(d.a.Header,null,s.a.createElement(d.a.Row,null,s.a.createElement(d.a.HeaderCell,null,"Table: ",this.state.tableName)),s.a.createElement(d.a.Row,null,this.state.keys.map((function(e){return s.a.createElement(d.a.HeaderCell,null,e)})))),s.a.createElement(d.a.Body,null,this.state.tableData.map((function(a,n){return s.a.createElement(d.a.Row,{className:e.isSelected(a.date,t)?"Data-row-selected":"Data-row-unselected"},e.state.keys.map((function(e){return s.a.createElement(d.a.Cell,null,a[e])})))})))))}}]),t}(n.Component),g=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={tableData:a.props.tableData,tableName:"Events Hourly",keys:["date","hour","events"],searchKeys:["date"]},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return s.a.createElement("div",{className:"Data-table"},s.a.createElement(v,{tableData:this.state.tableData,tableName:this.state.tableName,keys:this.state.keys,searchKeys:this.state.searchKeys}))}}]),t}(n.Component),y=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={tableData:a.props.tableData,tableName:"Events Daily",keys:["date","events"],searchKeys:["date"]},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return s.a.createElement("div",{className:"Data-table"},s.a.createElement(v,{tableData:this.state.tableData,tableName:this.state.tableName,keys:this.state.keys,searchKeys:this.state.searchKeys}))}}]),t}(n.Component),f=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={tableData:a.props.tableData,tableName:"Stats Hourly",keys:["clicks","date","hour","impressions","revenue"],searchKeys:["date"]},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return s.a.createElement("div",{className:"Data-table"},s.a.createElement(v,{tableData:this.state.tableData,tableName:this.state.tableName,keys:this.state.keys,searchKeys:this.state.searchKeys}))}}]),t}(n.Component),D=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={tableData:a.props.tableData,tableName:"Stats Daily",keys:["clicks","date","impressions","revenue"],searchKeys:["date"]},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return s.a.createElement("div",{className:"Data-table"},s.a.createElement(v,{tableData:this.state.tableData,tableName:this.state.tableName,keys:this.state.keys,searchKeys:this.state.searchKeys}))}}]),t}(n.Component),E=a(28),O=(a(235),a(52),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={value:"",boxLabel:a.props.boxText},a.handleChange=a.handleChange.bind(Object(m.a)(a)),a.handleSubmit=a.handleSubmit.bind(Object(m.a)(a)),a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"handleChange",value:function(e){console.log(e.target.value),this.setState({value:e.target.value}),this.handleSubmit(e.target.value)}},{key:"handleSubmit",value:function(e){this.props.onChange(e)}},{key:"render",value:function(){return s.a.createElement("form",null,s.a.createElement("label",{className:"Form-label"},this.state.boxLabel),s.a.createElement("input",{type:"text",placeholder:"YYYY-MM-DD",value:this.state.value,onChange:this.handleChange}))}}]),t}(n.Component)),k=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).handleChange=function(e){a.setState({selectedOption:e.target.value}),a.handleSubmit(e.target.value)},a.handleSubmit=function(e){console.log("Handle Change: "+e),a.props.onChange(e)},a.state={selectedOption:C},a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return console.log("Current selected option: "+this.state.selectedOption),s.a.createElement("form",null,s.a.createElement("label",null,s.a.createElement("input",{type:"radio",name:"events",value:C,checked:this.state.selectedOption==C,onChange:this.handleChange}),"Events"),s.a.createElement("label",null,s.a.createElement("input",{type:"radio",name:"impressions",value:j,checked:this.state.selectedOption==j,onChange:this.handleChange}),"Impressions"),s.a.createElement("label",null,s.a.createElement("input",{type:"radio",name:"clicks",value:w,checked:this.state.selectedOption==w,onChange:this.handleChange}),"Clicks"),s.a.createElement("label",null,s.a.createElement("input",{type:"radio",name:"revenue",value:N,checked:this.state.selectedOption==N,onChange:this.handleChange}),"Revenue"))}}]),t}(n.Component),C="events",j="impressions",w="clicks",N="revenue",S=k,H="events";function I(e,t,a,n,s,l){console.log("Selected Category:",e);var o=e==H?t:a,r=function(e){for(var t={},a=(e=e,0);a<e.length;a++){var n=e[a].poi_id,s=e[a].lat,l=e[a].lon,o=e[a].name;t[n]={position:{lat:s,lng:l},name:o}}return t}(n),i=function(e,t,a){var n=[],s="";a=null;K(t=null)&&(t=new Date(t));K(a)&&(a=new Date(a));var l=null;l=null!=t&&null!=a?"interval":null!=a?"before":null!=t?"after":"all";for(var o=0;o<e.length;o++)s=new Date(e[o].date.replace(/-/g,"/")),"interval"===l?s>=t&&s<=a&&n.push(e[o]):"before"===l?s<=a&&n.push(e[o]):"after"===l?s>=t&&n.push(e[o]):n.push(e[o]);return n}(o,s,l);console.log("currDataset:",o),console.log("sortedPoiInfo:",r),console.log("filteredDataset:",i);for(var c,u={},h=e,d=0;d<i.length;d++)(c=r[i[d].poi_id]).name in u?u[c.name].count+=i[d][h]:u[c.name]={position:c.position,count:i[d][h]};return u}function K(e){return!isNaN(Date.parse(e))&&e.length>=4}var x="events",W=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).onStartChange=function(e){a.setState({startDate:e})},a.onEndChange=function(e){a.setState({endDate:e})},a.onRadioChange=function(e){a.setState({selectedCategory:e})},a.state={eventsData:a.props.eventsData,statsData:a.props.statsData,poiData:a.props.poiData,startDate:null,endDate:null,selectedCategory:x,selectedMarker:null,showInfoWindow:!1},function(e){var t,a=0,n=0;for(t=0;t<e.poiData.length;t++)a+=e.poiData[t].lat,n+=e.poiData[t].lon;e.center={lat:a/t,lng:n/t},console.log(e.center.lat),console.log(e.center.lng)}(a.state),a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){var e=this,t=I(this.state.selectedCategory,this.state.eventsData,this.state.statsData,this.state.poiData,this.state.startDate,this.state.endDate);return console.log("markerData:",t),console.log(t["EQ Works"]),console.log(t["CN Tower"]),console.log(t["Niagara Falls"]),console.log(t["Vancouver Harbour"]),s.a.createElement("div",{className:"Data-map"},s.a.createElement("div",{className:"Visual-forms"},s.a.createElement("div",{className:"Start-date-form"},s.a.createElement(O,{onChange:this.onStartChange,boxText:"Entries After: "})),s.a.createElement("div",{className:"End-date-form"},s.a.createElement(O,{onChange:this.onEndChange,boxText:"Entries Until: "})),s.a.createElement(S,{onChange:this.onRadioChange})),s.a.createElement(E.Map,{google:this.props.google,zoom:4,initialCenter:this.state.center},Object.keys(t).map((function(a){return s.a.createElement(E.Marker,{name:a,position:t[a].position,onClick:function(){console.log("Clicked marker position",t[a].position),e.setState({selectedMarker:t[a],showInfoWindow:!0})}})})),this.state.showInfoWindow&&s.a.createElement(E.InfoWindow,{position:{lat:this.state.selectedMarker.position.lat,lng:this.state.selectedMarker.position.lng},visible:this.state.showInfoWindow},s.a.createElement("div",{className:"Info-window"},s.a.createElement("h3",null,"Info"),s.a.createElement("h4",null,"Selected data category: ",s.a.createElement("span",{className:"Info-window-header"},this.state.selectedCategory)),s.a.createElement("span",null,this.state.selectedCategory,": ",this.state.selectedMarker.count)))))}}]),t}(n.Component);var A=Object(E.GoogleApiWrapper)({apiKey:"AIzaSyDKDPeHWUgW0LcMY6QHOovjUS6YAP98yGc"})(W),M=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(c.a)(this,Object(u.a)(t).call(this,e))).state={token:window.token,eventsHourly:JSON.parse(window.eventsHourly.replace(/&#34;/g,'"')),eventsDaily:JSON.parse(window.eventsDaily.replace(/&#34;/g,'"')),statsHourly:JSON.parse(window.statsHourly.replace(/&#34;/g,'"')),statsDaily:JSON.parse(window.statsDaily.replace(/&#34;/g,'"')),poiInfo:JSON.parse(window.poiInfo.replace(/&#34;/g,'"'))},console.log("Rendering Events Hourly Table..."),console.log(a.state.token),console.log(a.state.eventsHourly),console.log(a.state.eventsDaily),console.log(a.state.statsHourly),console.log(a.state.statsDaily),console.log(a.state.poiInfo),a}return Object(h.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return s.a.createElement("div",{className:"App"},s.a.createElement("header",{className:"App-header"},s.a.createElement("h1",null,"EQWorks Product Development Application: UI Interface")),s.a.createElement("div",{className:"App-body"},s.a.createElement("div",{className:"App-tables",style:{float:"left"}},s.a.createElement("div",{className:"Table-div"},s.a.createElement(g,{tableData:this.state.eventsHourly})),s.a.createElement("div",{className:"Table-div"},s.a.createElement(y,{tableData:this.state.eventsDaily}))),s.a.createElement("div",{className:"App-tables",style:{marginBottom:"30%"}},s.a.createElement("div",{className:"Table-div"},s.a.createElement(f,{tableData:this.state.statsHourly})),s.a.createElement("div",{className:"Table-div"},s.a.createElement(D,{tableData:this.state.statsDaily}))),s.a.createElement("div",{className:"App-map"},s.a.createElement(A,{eventsData:this.state.eventsHourly,statsData:this.state.statsHourly,poiData:this.state.poiInfo}))))}}]),t}(n.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));o.a.render(s.a.createElement(M,{token:window.token,eventsHourly:window.eventsHourly,eventsDaily:window.eventsDaily,statsHourly:window.statsHourly,statsDaily:window.statsDaily,poiInfo:window.poiInfo}),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))},52:function(e,t,a){}},[[111,1,2]]]);
  //# sourceMappingURL=main.bdfabe0e.chunk.js.map