(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[28],{"4H+U":function(e,t,a){"use strict";var s=a("Y+p1"),o=a.n(s),n=a("q1tI"),r=a.n(n),i=a("AAik"),c=a("vC5F"),l=a("VdWs"),m=a("/MKj"),h=a("17x9"),p=a.n(h),f=a("uSQv");class d extends r.a.Component{constructor(e){super(e),this.maskedNumberValueFormatter=e=>"".concat(e.substr(0,4)," ").concat(e.substr(4,4)," ").concat(e.substr(8,4)," ").concat(e.substr(12,4)),this.onClick=e=>{this.setState({event:e})},this.state={event:null}}render(){const{object:e}=this.props,{event:t}=this.state;return r.a.createElement("div",{className:"mobile-payment-method"},r.a.createElement("div",{className:"mobile-payment-method-data"},r.a.createElement("img",{src:e.imageUrl,alt:e.cardType}),r.a.createElement("div",null,r.a.createElement("div",{className:e.data.default?"font-weight-bold":""},this.maskedNumberValueFormatter(e.maskedNumber)),r.a.createElement("div",null,r.a.createElement("small",null,e.data.cardholderName," (",e.expirationDate,")\xa0")))),r.a.createElement(f.a,{buttonStyle:"text",icon:r.a.createElement("i",{className:"fas fa-ellipsis-v"}),onClick:this.onClick}),r.a.createElement(l.a,{showAsMenu:!0,event:t,value:e}))}}d.propTypes={object:p.a.object.isRequired};var u=d,g=(a("5M4b"),a("LCzB"));class E extends r.a.Component{constructor(e){super(e),this.maskedNumberValueFormatter=e=>"".concat(e.substr(0,4)," ").concat(e.substr(4,4)," ").concat(e.substr(8,4)," ").concat(e.substr(12,4)),this.state={paymentMethods:E.getData(this.props)}}static getData(e){return e.paymentMethods}componentDidUpdate(e,t,a){const{paymentMethods:s,creditCards:n}=this.props;o()(e.paymentMethods,s)&&o()(e.creditCards,n)||this.setState({paymentMethods:E.getData(this.props)})}render(){const{t:e}=this.props,{paymentMethods:t}=this.state,a=[{name:"",field:"imageUrl",component:r.a.createElement(c.a,null),headerClassName:"payment-method-image hide-on-small-device md",itemClassName:"payment-method-image hide-on-small-device md"},{name:e("cardNumber"),field:"maskedNumber",valueFormatter:this.maskedNumberValueFormatter},{name:e("owner"),field:"data.cardholderName"},{name:e("farmSettings.paymentMethods.expirationDate"),field:"expirationDate"},{name:e("farmSettings.paymentMethods.producer"),field:"cardType"},{name:"",component:r.a.createElement(l.a,null),headerClassName:"payment-method-buttons",itemClassName:"payment-method-buttons"}];return r.a.createElement(i.a,{data:t.sort((e,t)=>t.data.default-e.data.default),headers:a,mobileRow:r.a.createElement(u,null)})}}E=Object(m.connect)(e=>({paymentMethods:e.braintree.paymentMethodList}))(E);t.a=Object(g.a)()(E)},"5M4b":function(e,t,a){},"5WSC":function(e,t,a){"use strict";var s=a("q1tI"),o=a.n(s),n=(a("EXk3"),a("17x9")),r=a.n(n),i=a("v9qu");class c extends o.a.Component{constructor(e){super(e),this.handleScroll=e=>{const{onTriggered:t}=this.props;if(!this.state.triggered){this.setState({timeStamp:e.timeStamp});try{let a=this.inside.getClientRects()[0].height,s=Math.abs(this.inside.getClientRects()[0].top-this.area.getClientRects()[0].height-this.area.getClientRects()[0].y);console.log(a,s),Math.floor(a)<=Math.floor(s)&&this.setState({triggered:!0},()=>{t(e.timeStamp)})}catch(e){}}},this.state={triggered:!1,timeStamp:0}}componentDidMount(){this.area.addEventListener(Object(i.a)()?"touchmove":"scroll",this.handleScroll)}componentWillUnmount(){this.area.removeEventListener(Object(i.a)()?"touchmove":"scroll",this.handleScroll)}render(){const{style:e,children:t}=this.props,{timeStamp:a}=this.state;return o.a.createElement("div",{timestamp:a,className:"scroll-and-trigger",style:e,ref:e=>this.area=e},o.a.createElement("div",{className:"scroll-and-trigger-content",ref:e=>this.inside=e},t))}}c.propTypes={onTriggered:r.a.func},c.defaultProps={onTriggered:()=>{}},t.a=c},"6HiO":function(e,t,a){"use strict";a.r(t),a.d(t,"LeftSideBar",(function(){return f})),a.d(t,"_LeftSideBar",(function(){return d}));var s,o=a("q1tI"),n=a.n(o),r=a("/MKj"),i=a("Ty5D"),c=a("v9qu"),l=a("s506"),m=a("aG8S"),h=a("LCzB"),p=a("Z7e/");let f=Object(r.connect)(e=>({farm:e.location.farm,farms:e.farms.farms,unreadNotification:Object(p.b)(e),fetchedNotifications:e.notificationCenter.fetched}))(s=class extends o.Component{constructor(e){super(e),this.state={mute:!0}}UNSAFE_componentWillReceiveProps(e,t){this.props.fetchedNotifications!==e.fetchedNotifications&&(this.timer||(this.timer=setTimeout(()=>{this.setState({mute:!1})},500)))}componentWillUnmount(){clearTimeout(this.timer)}render(){const{unreadNotification:e,t:t}=this.props,a=this.props.farms.filter(e=>e.FarmID===this.props.farm)[0],s=[{iconClass:"fas fa-tasks",icon:"fas fa-tasks",locations:["tasks"],href:"/".concat(this.props.farm,"/farm/general"),name:t("tasks"),disRedirect:!0,isShowing:"general",roles:[l.c._GENERAL_READ],packages:{[l.a.ALARM]:l.b.EXTENDED}}],o=[{iconClass:"fas fa-siren-on",icon:"fas fa-siren-on",locations:["alarms"],href:"/".concat(this.props.farm,"/alarms"),name:t("alarms"),disRedirect:!0,isShowing:"alarms",roles:[l.c._GENERAL_READ],packages:{[l.a.ALARM]:l.b.EXTENDED}},{icon:"fas fa-utensils",locations:["feeding"],href:"/".concat(this.props.farm,"/farm/feeding"),name:t("feeding"),disRedirect:!0,isShowing:"feeding",roles:[l.c._GENERAL_READ],packages:{[l.a.DISPENSER]:l.b.BASIC}},{icon:"fas fa-thermometer-half",locations:["climate"],href:"/".concat(this.props.farm,"/farm/climate"),name:t("climate"),disRedirect:!0,isShowing:"climate",roles:[l.c._GENERAL_READ],packages:{[l.a.CLIMATE]:l.b.BASIC}},{icon:"fas fa-weight",locations:["weights"],href:"/".concat(this.props.farm,"/farm/weights"),name:t("weight"),disRedirect:!0,isShowing:"silo",roles:[l.c._GENERAL_READ],packages:{[l.a.SMALL_CAGE]:l.b.BASIC}},{icon:"fas fa-farm",locations:["silo"],href:"/".concat(this.props.farm,"/farm/silo"),name:t("siloses"),disRedirect:!0,isShowing:"silo",roles:[l.c._GENERAL_READ],packages:{[l.a.SILO]:l.b.BASIC}},{icon:"fas fa-door-open",locations:["cage"],href:"/".concat(this.props.farm,"/farm/cage"),name:t("cage"),disRedirect:!0,isShowing:"cage",roles:[l.c._GENERAL_READ],packages:{[l.a.CAGE]:l.b.BASIC}},{icon:"fas fa-faucet",locations:["water"],href:"/".concat(this.props.farm,"/farm/water"),name:t("water"),disRedirect:!0,isShowing:"water",roles:[l.c._GENERAL_READ],packages:{[l.a.FARM]:l.b.BASIC}},{icon:"fas fa-bolt",locations:["electricity"],href:"/".concat(this.props.farm,"/farm/electricity"),name:t("electricity"),disRedirect:!0,isShowing:"electricity",roles:[l.c._GENERAL_READ],packages:{[l.a.FARM]:l.b.BASIC}},{icon:"fas fa-link",locations:["chainFeeding"],href:"/".concat(this.props.farm,"/farm/chainFeeding"),name:t("chainFeeding"),disRedirect:!0,isShowing:"chainFeeding",roles:[l.c._GENERAL_READ],packages:{[l.a.FARM]:l.b.BASIC}},{icon:"fas fa-map",locations:["map"],href:"/".concat(this.props.farm,"/farm/map"),name:t("map"),disRedirect:!0,isShowing:"map",roles:[l.c._GENERAL_READ],packages:{[l.a.FARM]:l.b.BASIC}}],r=[{icon:"fas fa-warehouse",locations:["inventory"],href:"/".concat(this.props.farm,"/farm/inventory"),name:t("inventory"),disRedirect:!0,isShowing:"inventory",roles:[l.c._GENERAL_READ]},{icon:"fas fa-pig",locations:["eventChooser"],href:"/".concat(this.props.farm,"/mobile"),name:t("setEvent"),disRedirect:!0,isShowing:"eventChooser",roles:[l.c._BREEDING]},{icon:"fas fa-sack-dollar",locations:["sell"],href:"/".concat(this.props.farm,"/sell"),name:t("sale"),isShowing:"technolgyGroups",roles:[l.c._BREEDING]},{icon:"fas fa-list-alt",locations:["controlLists"],href:"/".concat(this.props.farm,"/controlLists/all"),name:t("controlLists.mainView.header"),isShowing:"controlLists",roles:[l.c._BREEDING]}],i=[{icon:"fas fa-cog",locations:["settings"],href:"/".concat(this.props.farm,"/settings"),name:t("settings.settings"),isShowing:"area",roles:[l.c._GENERAL_READ]},{icon:"fas fa-bell",locations:["notificationCenter"],href:"/".concat(this.props.farm,"/notificationCenter"),name:t("notifications.notifications"),isShowing:"area",roles:[l.c._GENERAL_READ],counter:e},{icon:"fas fa-info",locations:["help"],href:"/help",name:t("help"),isShowing:"area",roles:[l.c._GENERAL_READ]},{icon:"fas fa-history",locations:["logs"],href:"/logs",name:t("logs"),isShowing:"logs",roles:[l.c._SERVICE]}],h=[{iconClass:"fas fa-home",icon:"fas fa-home",locations:["map","farms","sectors","farm","sector","chamber"],href:"/".concat(this.props.farm,"/farm"),name:a?a.FarmName:t("farm"),disRedirect:!0,isShowing:"farm",roles:[l.c._GENERAL_READ],hide:Object(c.a)()},{icon:"fas fa-pig",locations:["eventChooser"],href:"/".concat(this.props.farm,"/eventChooser"),name:t("setEvent"),disRedirect:!0,isShowing:"eventChooser",roles:[l.c._BREEDING]},{icon:"fas fa-chart-line",locations:["reports"],href:"/".concat(this.props.farm,"/reports"),name:t("reports"),isShowing:"reports",roles:[l.c._REPORT_READ],hide:Object(c.a)()},{icon:"fas fa-sack-dollar",locations:["sell"],href:"/".concat(this.props.farm,"/sell"),name:t("sale"),isShowing:"technolgyGroups",roles:[l.c._BREEDING]},{icon:"fas fa-list-alt",locations:["controlLists"],href:"/".concat(this.props.farm,"/controlLists/all"),name:t("controlLists.mainView.header"),isShowing:"controlLists",roles:[l.c._BREEDING]},{icon:"fas fa-cog",locations:["settings"],href:"/".concat(this.props.farm,"/settings"),name:t("settings.settings"),isShowing:"area",roles:[l.c._GENERAL_READ]},{icon:"fas fa-bell",locations:["notificationCenter"],href:"/".concat(this.props.farm,"/notificationCenter"),name:t("notifications.notifications"),isShowing:"area",roles:[l.c._GENERAL_READ],counter:e?"".concat(e>100?"+99":e):""},{icon:"fas fa-info",locations:["help"],href:"/help",name:t("help"),isShowing:"area",roles:[l.c._GENERAL_READ]},{icon:"fas fa-history",locations:["logs"],href:"/logs",name:t("logs"),isShowing:"logs",roles:[l.c._SERVICE]},{icon:"fas fa-siren-on",locations:["alarms"],href:"/".concat(this.props.farm,"/alarms"),name:t("alarms"),isShowing:"alarms",roles:[l.c._GENERAL_READ],hide:!Object(c.a)()}];let p=!!e;return n.a.createElement(m.a,{devicesMenuItems:o,breedingMenuItems:r,bottomMenuItems:i,menuItems:h,showBadge:p,generalMenuItems:s})}})||s;const d=f;f=Object(i.o)(f),t.default=Object(h.a)()(f)},"8V3e":function(e,t,a){"use strict";var s=a("q1tI"),o=a.n(s),n=a("17x9"),r=a.n(n),i=(a("c8bL"),a("JI6e")),c=a("wQVC"),l=a("v9qu"),m=a("n/3K"),h=a.n(m);class p extends s.Component{constructor(e){super(e),this.handleStateChange=()=>{try{console.log(this.ref);const{opened:e}=this.props,{current:t}=this.ref;e?Object(c.c)(c.a.RIGHT_DRAWER):Object(c.d)(c.a.RIGHT_DRAWER),t.style.right=e?"0":"-".concat(t.getBoundingClientRect().width,"px")}catch(e){console.error(e)}},this.ref=o.a.createRef()}componentDidMount(){this.handleStateChange()}componentDidUpdate(e,t,a){const{opened:s,windowWidth:o,windowHeight:n}=this.props;e.opened===s&&e.windowWidth===o&&e.windowHeight===n||this.handleStateChange()}componentWillUnmount(){Object(c.d)(c.a.RIGHT_DRAWER)}render(){const{icon:e,iconId:t,onToggle:a,children:s,header:n}=this.props,r="fetura-right-drawer".concat(Object(l.a)()?" mobile":"");return o.a.createElement("div",{ref:this.ref,className:r},o.a.createElement("div",{className:"buttons"},o.a.createElement("i",{id:t,className:e,onClick:a})),o.a.createElement(i.a,{xs:12,className:"data"},o.a.createElement("h2",{className:"d-flex align-items-center"},o.a.createElement("i",{onClick:a,className:"fas pointer fa-times fa-fw"}),n),o.a.createElement("br",null),s,o.a.createElement("br",null)))}}p.propTypes={icon:r.a.object.isRequired,iconId:r.a.string,onToggle:r.a.func.isRequired,children:r.a.node.isRequired,opened:r.a.bool.isRequired},t.a=h()(p)},"8l2w":function(e,t,a){"use strict";var s=a("q1tI"),o=a.n(s),n=a("x5BS"),r=a.n(n),i=a("17x9"),c=a.n(i);class l extends o.a.Component{constructor(e){super(e),this.state={online:!0,interval:null}}async registerSync(){try{let e=await navigator.serviceWorker.ready;await e.sync.register("fetura-sync")}catch(e){console.error("Error while registering background sync",e)}}async componentDidMount(){const{onOnlineChange:e}=this.props;let t=await r()();e&&e(t),t?(localStorage.removeItem("offlineLogin"),localStorage.removeItem("offlinePass")):this.registerSync(),this.setState({online:t},()=>{let t=setInterval(async()=>{let t=await r()();e&&e(t),t?(localStorage.removeItem("offlineLogin"),localStorage.removeItem("offlinePass")):this.registerSync(),this.setState({online:t})},1e4);this.setState({interval:t})})}componentWillUnmount(){clearInterval(this.state.interval)}render(){return this.state.online?null:o.a.createElement("div",{className:"no-connection offline warning"},o.a.createElement("i",{className:"fa fa-wifi-slash"}))}}l.propTypes={onOnlineChange:c.a.func},t.a=l},EXk3:function(e,t,a){},VxUp:function(e,t,a){},c8bL:function(e,t,a){},fckJ:function(e,t,a){"use strict";var s=a("q1tI"),o=a.n(s),n=a("t8r4"),r=a.n(n),i=a("uSQv"),c=(a("VxUp"),a("i8i4")),l=a.n(c);function m(){return(m=Object.assign||function(e){for(var t=1;tthis.dev=e,"data-tip":t?e:""},o.a.createElement(i.a,{type:"button",className:"color-picker-button",style:{backgroundColor:this.props.input.value},onClick:()=>this.setState(e=>({showPicker:!e.showPicker}))},"\xa0"),this.state.showPicker&&l.a.createPortal(o.a.createElement("div",{className:"color-picker-window",style:{top:this.dev.getBoundingClientRect().top+15+window.scrollY,left:this.dev.getBoundingClientRect().left+15}},o.a.createElement(r.a,m({},this.props,this.props.input,{color:this.props.input.value,onChange:e=>this.onChange(e)}))),document.getElementById("root")||document.createElement("div")))}}t.a=h},i2xj:function(e,t,a){"use strict";var s=a("lSCD"),o=a.n(s),n=a("sEfC"),r=a.n(n),i=a("q1tI"),c=a.n(i),l=a("wQVC"),m=a("uSQv"),h=a("IXwn"),p=a("17x9"),f=a.n(p);class d extends i.Component{constructor(e){super(e),this.show=()=>{const{show:e}=this.props,{scrollTop:t}=this.state;return o()(e)?!!e({scrollTop:t}):!!e},this.handleScroll=r()(this.handleScroll.bind(this),150),this.state={externalScroll:!!e.externalScroll,scrollTop:e.externalScroll?e.scrollTop||0:d.getScroll(document)}}static getDerivedStateFromProps(e,t){return t.externalScroll&&e.scrollTop!==t.scrollTop?{scrollTop:e.scrollTop}:null}handleScroll(){this.setState({scrollTop:d.getScroll(document)})}componentDidMount(){this.state.externalScroll||window.addEventListener("scroll",this.handleScroll)}componentWillUnmount(){this.state.externalScroll||window.removeEventListener("scroll",this.handleScroll)}render(){const e=!!this.show();return c.a.createElement(h.a,{show:e,fixed:!0,renderInPortal:!0},c.a.createElement(m.a,{type:"button",onClick:l.k,buttonColor:"info",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-to-top"})}))}}d.getScroll=({scrollingElement:{scrollTop:e=0}={}}={})=>e,d.defaultProps={show:({scrollTop:e})=>e>100,scrollTop:0,externalScroll:!1},d.propTypes={show:f.a.func,externalScroll:f.a.bool,scrollTop:f.a.number},t.a=d},piEO:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var s=a("J2iB"),o=a.n(s),n=a("q1tI"),r=a.n(n),i=a("17x9"),c=a.n(i),l=a("v9qu"),m=a("4huo"),h=a("XoCd");function p(){return(p=Object.assign||function(e){for(var t=1;t{const o=[];for(let n=e;n<=t;n+=a)o.push({name:s(n),value:n});return o}}render(){const{mobile:e}=this.props;if(o()(e)?Object(l.a)():!!e){const e=this.generateOptions(this.props);return r.a.createElement(m.b,p({},this.props,{options:e}))}return r.a.createElement(h.a,this.props)}}f.propTypes={id:c.a.string,min:c.a.number.isRequired,max:c.a.number.isRequired,step:c.a.number,input:c.a.shape({value:c.a.number.isRequired,onChange:c.a.number.isRequired}),isRange:c.a.bool,disabled:c.a.bool,valueFormatter:c.a.func,tipFormatter:c.a.func},f.defaultProps={disabled:!1,step:1,min:0,max:100,meta:{},input:{},valueFormatter:e=>e}},rWuT:function(e,t,a){"use strict";var s=a("q1tI"),o=a.n(s),n=a("Ty5D"),r=a("wQVC");class i extends o.a.Component{componentDidUpdate(e){this.props.location.pathname!==e.location.pathname&&Object(r.k)({behaviour:""})}render(){return this.props.children}}t.a=Object(n.o)(i)}}]); //# sourceMappingURL=main~3c377b5e.eb9d75d0.chunk.js.map