(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[111],{"7LKG":function(e,t,a){},HJiI:function(e,t,a){},"jQw+":function(e,t,a){"use strict";var n=a("Y+p1"),i=a.n(n),s=a("q1tI"),r=a.n(s),o=a("JI6e"),c=a("3Z9Z"),l=a("VyNe"),m=(a("7LKG"),a("r1Ps")),p=a("qnQ4"),d=a("yofi");a("bMVF");class u extends s.Component{constructor(e){super(e),this.state={timestamp:0}}componentDidMount(){this.timer=setTimeout(()=>{this.setState({timestamp:+new Date},()=>{window.dispatchEvent(new Event("resize"))})},500)}componentWillUnmount(){clearTimeout(this.timer)}render(){const{position:e,zoom:t}=this.props;return r.a.createElement(m.a,{ref:e=>this.map=e,dragging:!1,scrollWheelZoom:!1,zoomControl:!1,style:{height:"100%",width:"100%"},center:e,zoom:t},r.a.createElement(p.a,{attribution:" ",url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),r.a.createElement(d.a,{center:e}))}}var h=u;u.defaultProps={zoom:12.5};var f=a("uSQv"),g=a("85nz"),E=a("BvFm"),v=a("wd/R"),b=a.n(v),y=a("7Gv0"),x=a("LCzB"),S=a("XzT5"),C=a("ZXlx");class D extends s.Component{constructor(...e){super(...e),this.renderSubscriptionEnded=()=>{const{t:e}=this.props;return r.a.createElement("div",{className:"subscription-ended"},r.a.createElement("h1",null,e("farms.farmItem.subscriptionExpired")),Object(E.h)()&&r.a.createElement(f.a,{buttonColor:"info"},r.a.createElement("h4",null,e("farms.farmItem.extend"))))},this.navigateToFarmClick=({position:e})=>{-1!==navigator.platform.indexOf("iPhone")||-1!==navigator.platform.indexOf("iPod")||-1!==navigator.platform.indexOf("iPad")?window.open("maps://maps.google.com/maps?daddr=".concat(e[0],",").concat(e[1],"&ll=")):window.open("https://maps.google.com/maps?daddr=".concat(e[0],",").concat(e[1],"&ll="))}}shouldComponentUpdate(e,t){return!i()(this.props,e)}checkIfDisabled(){return!Object(g.b)(this.props.farm)}getEndingDays(){const{farm:{LicenseExpirationDate:e}}=this.props;return b()(e).diff(b()(),"days")}render(){const{farm:{FarmName:e,Adr:t,FarmCord:a},t:n,search:i,isService:s,onClick:m}=this.props;let p=0,d=0;try{let e=a.split(",");a.includes("'")?(p=+e[0].split("'").join(".")||0,d=+e[1].split("'").join(".")||0):(p=+e[0]||0,d=+e[1]||0)}catch(E){}let u=this.checkIfDisabled(),g=this.getEndingDays();return r.a.createElement(o.a,{className:"flex-column",xs:12,sm:6,md:6,lg:6,xl:3},r.a.createElement(l.a,{className:"farm-item ".concat(u?"disabled":s?"service-farm-item":""),onClick:s?void 0:m},u&&this.renderSubscriptionEnded(),r.a.createElement("div",{className:"farm-map hide-on-small-device sm"},r.a.createElement(h,{position:[p,d]})),r.a.createElement("div",{className:"farm-info"},r.a.createElement("h3",{className:"opacity-50"},r.a.createElement(C.a,{searchText:i,text:e})),r.a.createElement("div",{className:"farm-info-details"},r.a.createElement(C.a,{searchText:i,text:t})),s&&r.a.createElement(c.a,{className:"w-100 justify-content-center pt-1 farm-buttons"},r.a.createElement(f.a,{disabled:0===p&&0===d,buttonColor:"success",buttonStyle:"text",onClick:this.navigateToFarmClick.bind(this,{position:[p,d]})},r.a.createElement("i",{className:"fas fa-location-arrow mr-2"}),n("farms.farmItem.navigate")),r.a.createElement(f.a,{buttonStyle:"text",buttonColor:"success",onClick:m},r.a.createElement("i",{className:"fas fa-fw fa-door-open mr-2"}),n("farms.farmItem.visit")))),g0&&r.a.createElement("div",{className:"farm-expiring-soon ".concat(g{this.clearPolling();const e=Object(m.r)(this.props.devices);if(e)for(let t of e.values())t[c.d.SCALE].length&&this.devicePolling.push(p.a.startSendingDeviceState(t[c.d.SCALE],void 0,void 0,{keepAlive:!0})),t[c.d.CLIMATE].length&&this.devicePolling.push(p.a.startSendingDeviceState(t[c.d.CLIMATE],void 0,void 0,{keepAlive:!0}))},this.clearPolling=()=>{p.a.removeFromInterval(this.devicePolling)}}componentDidMount(){Object(u.isUsingFakeData)()&&(f.a.restore(),f.a.stub(p.a,"startSendingDeviceState").callsFake(g.a),f.a.stub(p.a,"createAndSendMessageObject").callsFake(()=>{}),f.a.stub(p.a,"sendRequestForAggregatedData").callsFake(()=>{})),this.startPolling()}componentDidUpdate(e,t,a){const{devices:n}=this.props,{devices:i}=e;n.length!==i.length&&this.startPolling()}componentWillUnmount(){this.clearPolling(),Object(u.isUsingFakeData)()&&f.a.restore()}render(){const{level:e,selectedLevel:t}=this.props;return console.log("deviceFarmMap -> ",this.props),e?i.a.createElement(i.a.Fragment,null,i.a.createElement(l.a,{key:"cl_".concat(t),farmMap:e.value,onElementClick:e=>console.log(e),dataProvider:d.a})):null}}t.a=Object(s.connect)((function(){const e=Object(o.c)();return function(t,a){return{level:Object(r.b)(t,a),devices:e(t,E)}}}))(v)},oRos:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),s=a("/MKj"),r=a("Qoyn"),o=a("lijG"),c=a("7xGa"),l=a("6qyL"),m=a("e/I0");class p extends n.Component{constructor(...e){super(...e),this.state={event:null,show:!1,left:0,top:0,width:0,selectedPlacementID:""},this.onChamberClick=({type:e,id:t})=>{const{buildingsMap:a}=this.props;if("chambers"===e&&a.has(t)){const e=document.getElementById(t),a=e.getBoundingClientRect();this.setState({show:!0,left:a.x,top:a.y,width:a.width,selectedPlacementID:t,element:e})}},this.onOutsideClick=()=>{this.setState({show:!1})}}render(){const{level:e,selectedLevel:t}=this.props,{show:a,top:n,left:s,width:r,selectedPlacementID:m,element:p}=this.state;return e?i.a.createElement(i.a.Fragment,null,i.a.createElement(o.a,{key:"bg_".concat(t),farmMap:e.value,onElementClick:this.onChamberClick}),i.a.createElement(c.a,{in:a,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement(l.a,{left:s,top:n,width:r,PlcmntID:m,onOutsideClick:this.onOutsideClick,element:p}))):null}}t.a=Object(s.connect)((function(){return function(e,t){return{level:Object(r.b)(e,t),buildingsMap:Object(m.a)(e)}}}))(p)},sMEB:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),s=a("/MKj"),r=a("wd/R"),o=a.n(r),c=a("7Gv0"),l=(a("HJiI"),a("v9qu")),m=a("JZab"),p=a("gg9n"),d=a("Ty5D"),u=a("LCzB"),h=a("XzT5");class f extends i.a.Component{constructor(e){super(e),this.onRetryAdminPayment=()=>{const{user:e}=this.props;"Canceled"===e.AdminSubscription.SubscriptionStatus||"Expired"===e.AdminSubscription.SubscriptionStatus?this.props.history.push("/farmSettings/admin/renew"):this.props.dispatch(Object(m.e)({clientID:e.ClientID}))},this.onRetryFarmPayment=()=>{const{farm:e}=this.state;"Canceled"===e.SubscriptionStatus||"Expired"===e.SubscriptionStatus?(this.props.dispatch({type:"CHANGE_FARM"}),this.props.history.push("/farmSettings/billing/farm/".concat(e.FarmID,"/renew"))):this.props.dispatch(Object(m.e)({farmID:e.FarmID}))};let t=e.farms.find(t=>t.FarmID===e.farm);this.state={farm:t}}UNSAFE_componentWillReceiveProps(e,t){if(this.props.farm!==e.farm){let t=e.farms.find(t=>t.FarmID===e.farm);this.setState({farm:t})}}getExpirationDays(){const{farm:e}=this.state;return e?o()(e.LicenseExpirationDate).diff(o()(),"days"):null}getAdminSubscriptionExpirationDays(){const{user:e}=this.props;return e.AdminSubscription?o()(e.AdminSubscription.LicenseExpirationDate).diff(o()(),"days"):null}getClassName(e,t,a,n){let i="farm-expiration-status";return Object(l.a)()&&(i+=" mobile"),e&&n0)}isAdminExpiring(e){return e0}shouldRenderDiv(e,t){return e||t}render(){let e=this.getExpirationDays(),t=this.isFarmExpiring(e),a=this.getAdminSubscriptionExpirationDays(),n=this.isAdminExpiring(a);if(!this.shouldRenderDiv(t,n))return null;const{t:s}=this.props;return i.a.createElement("div",{className:this.getClassName(n,t,e,a)},n&&i.a.createElement("div",null,h.a.t("farmExpirationTime.adminExpiring",{amount:a,type:s(1===a?"day":"days")}),i.a.createElement(p.a,{onClick:this.onRetryAdminPayment},s("farmExpirationTime.retryPayment"))),t&&i.a.createElement("div",null,h.a.t("farmExpirationTime.expiring",{amount:e,type:s(1===e?"day":"days")}),i.a.createElement(p.a,{onClick:this.onRetryFarmPayment},s("farmExpirationTime.retryPayment"))))}}f=Object(s.connect)(e=>({farm:e.location.farm,farms:e.farms.farms,user:e.user.user}))(f),f=Object(u.a)()(f),t.a=Object(d.o)(f)},tQsb:function(e,t,a){"use strict";var n=a("Y+p1"),i=a.n(n),s=a("q1tI"),r=a.n(s),o=a("udB/"),c=a("VyNe"),l=a("17x9"),m=a.n(l),p=(a("vni4"),a("wd/R")),d=a.n(p);class u extends r.a.Component{constructor(e){super(e),this.fetchEula=(e=this.props)=>{let t=e.path;this.setState({loading:!0,data:void 0},()=>{fetch(t).then(e=>200!==e.status?Promise.reject(e):e.text()).then(e=>{this.setState({data:e,loading:!1})}).catch(e=>{this.setState({loading:!1})})})},this.state={timeRead:0,data:void 0,loading:!0,accepted:!0}}UNSAFE_componentWillMount(){this.fetchEula(this.props)}UNSAFE_componentWillReceiveProps(e,t){const{path:a}=this.props;i()(a,e.path)||this.fetchEula(e)}render(){const{loading:e,data:t}=this.state,{header:a,time:n}=this.props;return r.a.createElement(c.a,{className:"documents-viewer",style:{minHeight:"10rem"}},a&&r.a.createElement("h4",{className:"align-content-center justify-content-between"},a,n&&r.a.createElement("small",null,d()(n).format())),e&&r.a.createElement(o.a,{isLoading:e}),!e&&r.a.createElement("div",{className:"document-content",dangerouslySetInnerHTML:{__html:t}}))}}u.propTypes={path:m.a.string.isRequired,header:m.a.string,time:m.a.number},t.a=u},vni4:function(e,t,a){}}]); //# sourceMappingURL=main~f598cb42.2793e73e.chunk.js.map