(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[55],{"+nj3":function(e,t,a){"use strict";var n=a("J2iB"),s=a.n(n),r=a("lFKM"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("/MKj"),m=a("2wEF"),d=a("ZRKa"),u=a("P0Qa"),p=a("Ty5D"),g=a("D1y2"),f=a.n(g),h=a("BkRI"),b=a.n(h),E=a("Y+p1"),S=a.n(E),v=a("mwIZ"),D=a.n(v),y=a("3Z9Z"),O=a("JI6e"),N=a("d/v1"),w=a("3t43"),C=a("pJVQ"),I=a("tDQA"),j=a("VyNe"),T=a("26mJ"),A=a("zDJl"),F=a("fckJ"),x=a("y4iu"),P=a("uSQv"),R=a("ANjH"),k=a("f0zD"),_=a("AAik"),M=a("2UNB"),B=a("gLBR"),L=a("AF5L"),V=a("15cA"),z=a("hw2D"),U=a("kCVf"),W=a("a+pQ"),q=a("lAGl"),H=a("7TV9"),G=a("pxzG"),J=a("eASP"),Y=a("4ltZ"),Z=a("lM7y"),Q=a("LCzB");function K(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function X(e){for(var t=1;t{const{buildings:t}=e;return Object(V.g)(t).map(e=>e.chamber)},this.sumRenderer=(e=[])=>{const{t:t}=this.props;let a=0;return e.length?(e.forEach((t,n)=>{const s=e.get(n);let r;try{r=+s.percentage*+s.cost/100||0}catch(i){r=0}a+=r}),[o.a.createElement("div",{className:"text-right"},t("newSettings.feeding.forages.editEfficiency.cost"),o.a.createElement("strong",{className:"ml-1"},a.toFixed(2),"PLN/".concat(Object(G.j)(1e6,{showUnit:!0,unit:J.a.BIG,fixed:1}))))]):[]};const{defaultValue:t,initialize:a}=this.props,n=this.getChambersData(this.props);this.state={selectedChamber:null};const s=t?n.filter(e=>e.forageID===t.SetID).map(e=>({value:e.CID,name:e.CName})):[];a({efficiency:D()(t,"SetData.Efficiency",1e3),forageName:D()(t,"SetData.Name",""),color:D()(t,"SetData.Color","#FFFFFF"),recipe:D()(t,"SetData.Recipe",[]).map(e=>({name:e.Name,percentage:"".concat(e.Percentage),cost:"".concat(e.Cost)})),chambersSelect:n.map(e=>({name:e.CName,value:e.CID})),chambers:s,orgChambersIDs:s.map(e=>e.value)})}UNSAFE_componentWillReceiveProps(e,t){const{defaultValue:a,change:n}=e;if(a&&!S()(e.buildings,this.props.buildings)){const t=this.getChambersData(e),s=t.filter(e=>e.forageID===a.SetID).map(e=>({value:e.CID,name:e.CName}));n("chambersSelect",t),n("chambers",s)}}onDeleteClick(e){const{chambers:t,change:a}=this.props;a("chambers",b()(t).filter(t=>t.value!==e.value.value))}onAddClick(){const{chambers:e,change:t}=this.props,{selectedChamber:a}=this.state;if(a){const n=b()(e);n.push(a),t("chambers",n),this.setState({selectedChamber:null})}}render(){const{handleSubmit:e,t:t,chambers:a=[],chambersSelect:n=[]}=this.props,s=n.filter(e=>!a.find(t=>t.value===e.value)).map(e=>({name:e.name,value:e})),r=[{name:t("newSettings.feeding.forages.editEfficiency.chamberName"),field:"name"},{name:"",component:e=>o.a.createElement("i",{className:"fas fa-trash icon-component",onClick:()=>this.onDeleteClick(e)}),itemClassName:"index",headerClassName:"index"}],i=[{name:t("newSettings.feeding.forages.editEfficiency.ingredient"),field:"name",component:q.a,type:"text"},{name:t("newSettings.feeding.forages.editEfficiency.content"),field:"percentage",component:q.a,type:"number"},{name:t("newSettings.feeding.forages.editEfficiency.cost"),field:"cost",component:q.a,type:"number",unit:"PLN/".concat(Object(G.j)(1e6,{showUnit:!0,unit:J.a.BIG,fixed:1}))}];return o.a.createElement("div",{className:"overflow-hidden"},o.a.createElement(x.a,ee({},this.props,{handleSubmit:e,icon:o.a.createElement("i",{className:"fas fa-save"})}),o.a.createElement(y.a,{className:"justify-content-center"},o.a.createElement(O.a,{xs:12},o.a.createElement(j.a,null,o.a.createElement("h5",null,t("general")),o.a.createElement(N.a,{name:"forageName",id:"forageName",label:t("newSettings.feeding.forages.editEfficiency.forageName"),type:"text",component:T.a}),o.a.createElement("label",null,t("newSettings.feeding.forages.editEfficiency.color")),o.a.createElement(N.a,{name:"color",id:"color",component:F.a}))),o.a.createElement(O.a,{xs:12,xl:6},o.a.createElement(j.a,null,o.a.createElement("h5",null,t("newSettings.feeding.forages.editEfficiency.recipe")),o.a.createElement(w.a,{component:W.a,minLength:0,name:"recipe",addRemoveButton:!0,addAddButton:!0,bottomPinnedRows:this.sumRenderer,headers:i}))),o.a.createElement(O.a,{xs:12,xl:6},o.a.createElement(j.a,null,o.a.createElement("h5",null,t("chambers")),o.a.createElement(_.a,{className:"redux",data:a||[],headers:r,shouldIndex:!0}),!!s.length&&o.a.createElement(y.a,null,o.a.createElement(O.a,{xs:8},o.a.createElement(z.a,{value:this.state.selectedChamber,onChange:e=>this.setState({selectedChamber:e}),options:s})),o.a.createElement(O.a,{xs:4},o.a.createElement(P.a,{type:"button",className:"w-100",onClick:()=>this.onAddClick()},t("addChamber")))))))))}}ae=Object(C.a)({form:te,onSubmit:function(e,t,a){const{defaultValue:n,index:s,gateways:r,farm:i,buildings:c,forageIngredients:o}=a,{efficiency:l,forageName:m,color:d,recipe:p=[],chambers:g=[],orgChambersIDs:h=[]}=e,b=[];let E=M.a.createSetting(u.a.FEEDING_FORAGE,{Name:m,Efficiency:l,Index:s,Color:d,Recipe:[],Cost:void 0});p.forEach(e=>{const t=e.name.trim();let a=o.find(e=>e.WData.Name.toUpperCase()===t.toUpperCase());a||(a=H.a.createIngredient(t),b.push(a)),E.addIngredient(a,+e.percentage,+e.cost)}),E.SetData.Cost=E.getCost();const v=g.map(e=>e.value);for(let u of b)t(Object(Z.a)(u.prepareBeanToSave()));const D=0,y=1,O=3;let N=D;if(n){const e=X({},n.prepareBeanToSave(),{DtaModTime:0}),t=["SetID","DtaModTime","SetData.PrimeForageID"],a=X({},E.prepareBeanToSave(),{DtaModTime:0,SetID:n.SetID});for(let n of t)f()(a,n,null),f()(e,n,null);N=S()(e,a)?O:n.Name===E.Name&&n.getCost()===E.getCost()&&S()(n.getRecipe(),E.getRecipe())?y:D}switch(N){case D:if(n){let e=n.clone();e.deleteSetting(),t(Object(B.c)(e.prepareBeanToSave())),E.setOriginalForageID(n.getOriginalForageID())}t(Object(B.a)(E.prepareBeanToSave(),()=>{r.forEach(e=>{Object(L.q)(e,E)})}));break;case y:{E.SetID=n.SetID;let e=E.clone();e.setDtaModTime(),e.setOriginalForageID(n.getOriginalForageID()),t(Object(B.c)(e.prepareBeanToSave()));break}case O:default:E.SetID=n.SetID}let w=c;if(N===D||!S()(h,v)){w=Object(U.n)(w,null,n?n.SetID:E.SetID),w=c.map(e=>w.find(t=>t.BgID===e.BgID)||e),w=Object(U.a)(w,E.SetID,v);for(let e of w)t(Object(Y.e)(e))}a.history.push("/".concat(i,"/settings/feeding/forages"))},validate:function(e,t){const a={},{forageName:n,recipe:s=[]}=e,{t:r}=t;n||(a.forageName=r("required")),a.recipe=[];const i=[];let c=0;return s.forEach((e,t)=>{const n={};e.name&&e.name.trim()?i.includes(e.name.trim().toUpperCase())?n.name=r("errors.duplicate"):i.push(e.name.trim().toUpperCase()):n.name=r("required"),(!+e.cost||+e.cost<0)&&(n.cost=r("ired")),!+e.percentage||+e.percentage<0?n.percentage=r("required"):(c+=+e.percentage,c>100&&(n.percentage=r("errors.mustBeBelowOrEqual")+"".concat(100-(c-+e.percentage),"%"))),a.recipe[t]=n}),a}})(ae);const ne=Object(I.a)(te);ae=Object(l.connect)(e=>({stages:ne(e,"stages"),gateways:e.farmDevices.devices.filter(e=>e.DevType===A.d.GATEWAY),dispensers:e.farmDevices.devices.filter(e=>[A.d.DISPENSER_NRF,A.d.DISPENSER].includes(e.DevType)&&e.GatewayID),dispenser:ne(e,"dispenser"),chambers:ne(e,"chambers"),chambersSelect:ne(e,"chambersSelect"),recipe:ne(e,"recipe"),farm:e.location.farm,forageIngredients:e.dictionary.forageIngredients,buildings:e.farms.buildings}),e=>Object(R.b)({show:k.d},e))(ae),ae=Object(Q.a)()(ae);var se,re=Object(p.o)(ae),ie=a("qx5e"),ce=a("s506"),oe=a("wxkN");let le=Object(l.connect)(e=>({farm:e.location.farm}))(se=class extends o.a.Component{render(){const{match:{params:{index:e}}}=this.props;let t=i()(+e)?+e:null;const a=d.a.getSettingByIndexAndType(t,u.a.FEEDING_FORAGE);return s()(t)||t<0||t>8?o.a.createElement(m.a,null):o.a.createElement(o.a.Fragment,null,o.a.createElement(re,{defaultValue:a,index:t}),o.a.createElement(oe.a,null))}})||se;le=Object(p.o)(le);t.a=Object(ie.a)({roles:[ce.c._DEVICE_CONFIG],showComponent:!0})(le)},"+oSd":function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a("q1tI"),s=a.n(n),r=a("y4iu"),i=a("17x9"),c=a.n(i);a("5Tez");class o extends s.a.Component{render(){const{handleSubmit:e,children:t}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement("div",{className:"notification-settings"},t))}}o.propTypes={handleSubmit:c.a.func.isRequired}},"+wLG":function(e,t,a){},"1eYP":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("3Z9Z"),i=a("JI6e"),c=a("wQmL"),o=a("d/v1"),l=a("pJVQ"),m=a("/MKj"),d=a("4huo"),u=a("y4iu"),p=a("2HEh"),g=a("VyNe"),f=a("3xDe"),h=a("LCzB");const b="settings-profile-customize";class E extends s.a.Component{constructor(e){super(e),this.onThemeChange=(e,t)=>{const{cookies:a}=this.props;a.set("theme",t),Object(f.f)()};const{t:t}=this.props;this.state={themeOptions:[{name:t("newSettings.profile.customizeProfileView.light"),value:"normal"},{name:t("newSettings.profile.customizeProfileView.dark"),value:"dark"}]}}componentDidMount(){const{dispatch:e,cookies:t}=this.props;e(Object(c.c)(b,{themeStyle:t.get("theme")||"normal",showDeadAnimalsInSearch:!1}))}render(){const{handleSubmit:e,t:t}=this.props,{themeOptions:a}=this.state;return s.a.createElement(g.a,{className:b},s.a.createElement(u.a,{handleSubmit:e,showButtons:!1},s.a.createElement(r.a,{className:"justify-content-center"},s.a.createElement(i.a,{md:6},s.a.createElement(o.a,{id:"themeStyle",name:"themeStyle",component:d.b,label:t("newSettings.profile.customizeProfileView.themeStyle"),options:a,onChange:this.onThemeChange,clearButton:!1})))))}}E=Object(l.a)({form:b})(E),E=Object(m.connect)(e=>({farm:e.location.farm}))(E),E=Object(p.a)(E),t.a=Object(h.a)()(E)},"1zaY":function(e,t,a){"use strict";var n=a("BkRI"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("VyNe"),o=a("ROqK"),l=a("d/v1"),m=a("pJVQ"),d=a("tDQA"),u=a("/MKj"),p=a("Z0cm"),g=a.n(p),f=a("zDJl"),h=a("6uZD"),b=a("FPv+"),E=a("VfnB"),S=a("kCmh"),v=a("XzT5"),D=a("ztiR");var y=a("Ty5D"),O=a("qx5e"),N=a("s506"),w=a("w2lk"),C=a("3Z9Z"),I=a("JI6e"),j=a("4huo"),T=a("C07J"),A=a("LCzB");class F extends i.a.Component{render(){const{handleSubmit:e,address:t,device:a,devices:n,t:r,bridge:m,edit:d}=this.props,u=s()(n||[]).filter(e=>e instanceof T.a).map(e=>({name:e.Name,value:e.DevID}));return i.a.createElement(c.a,null,i.a.createElement(o.a,{handleSubmit:e,showInterfacePicker:!0,address:+t,device:a,showAdditionalButton:!!a,bridge:m,showHelp:!d},i.a.createElement(C.a,{className:"justify-content-center"},i.a.createElement(I.a,{lg:6},i.a.createElement("hr",null),i.a.createElement("h5",null,r("newSettings.devices.form.addons")),i.a.createElement(l.a,{name:"marker1",id:"marker1",component:w.a,label:r("newSettings.devices.form.marker1")}),i.a.createElement(l.a,{name:"marker2",id:"marker2",component:w.a,label:r("newSettings.devices.form.marker2")}),i.a.createElement(l.a,{name:"thermoeye",id:"thermoeye",component:j.b,options:u||[],label:r("newSettings.devices.form.thermoEye")})))))}}F=Object(m.a)({form:"cage",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,marker1:l,marker2:m,thermoeye:d,alias:u}=e;if(!c){let e={Marker:[]};d&&(e.ThermoeyeID=d),l&&(e.Marker[0]={Color:"#FFFFFF",Amount:0}),m&&(e.Marker[1]={Color:"#FFFFFF",Amount:0});const t=Object(E.d)(n,f.d.CAGE).map(t=>({DevType:f.d.CAGE,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:u,AdditionalData:{Settings:e}}));return Object(D.a)(t).then(e=>{a.reset(),Object(D.c)(e)}).catch(e=>{Object(D.b)(e)})}{let e=o.clone();e.Settings||(e.Settings=[]);const c=(t,a)=>{e.Settings.Marker&&g()(e.Settings.Marker)||(e.Settings.Marker=[]),t?e.Settings.Marker[a]||(e.Settings.Marker[a]={Color:"#FFFFFF",Amount:0}):delete e.Settings.Marker[a]};c(l,0),c(m,1),d?e.Settings.ThermoeyeID=d:delete e.Settings.ThermoeyeID,e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=u,e.Protocol=f.g.WST,e.VerHard="0.1",e.VerSoft="0.1",t(Object(h.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),!b.a.DEVICE_MANY_ADDR_CA.test("".concat(e.address))||e.edit&&!b.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=v.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(127..toString(16).toUpperCase(),")"),amount3:"125"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){Object(E.d)(e.address,f.d.CAGE).length>r.DevCagesLeft&&(a.address=v.a.t("errors.maxDevices",{amount:r.DevCagesLeft}))}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(E.d)(e.address,f.d.CAGE),s=[];for(let a of n){let n=S.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=v.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),a}})(F),F=Object(O.a)(e=>({roles:[N.c._DEVICE_CONFIG],showComponent:!0}))(F);const x=Object(d.a)("cage");F=Object(u.connect)(e=>({address:x(e,"address"),device:x(e,"device"),bridge:x(e,"bridge"),edit:x(e,"edit"),devices:e.farmDevices.devices,user:e.user.user,farm:e.location.farm}))(F),F=Object(A.a)()(F);t.a=Object(y.o)(F)},"2ULW":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("d/v1"),o=a("3t43"),l=a("pJVQ"),m=a("tDQA"),d=a("/MKj"),u=a("mwIZ"),p=a.n(u),g=a("zDJl"),f=a("6uZD"),h=a("FPv+"),b=a("VfnB"),E=a("0MVo"),S=a("kCmh"),v=a("ztiR");var D=a("Ty5D"),y=a("qx5e"),O=a("s506"),N=a("3Z9Z"),w=a("JI6e"),C=a("LCzB"),I=a("a+pQ"),j=a("lAGl"),T=a("XM6k");class A extends s.a.Component{constructor(e){super(e),this.props.device||this.props.initialize({aliases:[{name:""},{name:""},{name:""},{name:""}]})}render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:l,edit:m}=this.props,d=[{name:n("newSettings.devices.form.alias"),component:j.a,field:"name",type:"text"}];return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,address:+t,device:a,showAdditionalButton:!!a,bridge:l,showHelp:!m},s.a.createElement(N.a,{className:"justify-content-center"},s.a.createElement(w.a,{lg:6},s.a.createElement("hr",null),s.a.createElement(c.a,{name:"useVoltage",id:"useVoltage",component:T.a,label:n("newSettings.devices.form.useVoltage")}),s.a.createElement("h5",null,n("sensors")),s.a.createElement(o.a,{shouldIndex:!0,component:I.a,name:"aliases",headers:d})))))}}A=Object(l.a)({form:"chainFeeding",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,aliases:l=[],alias:m,useVoltage:d}=e;if(!c){let e={Aliases:[],UseVoltage:!!d};for(let a=0;a<4;a++)e.Aliases.push(p()(l[a],"name")?p()(l[a],"name"):void 0);const t=Object(b.d)(n,g.d.CHAIN_FEEDING).map(t=>({DevType:g.d.CHAIN_FEEDING,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:m,AdditionalData:{Settings:e}}));return Object(v.a)(t).then(e=>{a.reset(),Object(v.c)(e)}).catch(e=>{Object(v.b)(e)})}{let e=o.clone();e.Settings||(e.Settings={}),e.Settings.UseVoltage=!!d,Array.isArray(e.Settings.Aliases)||(e.Settings.Aliases=[]);for(let t=0;t<4;t++)e.Settings.Aliases.push(p()(l[t],"name")?p()(l[t],"name"):void 0);e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=m,e.Protocol=g.g.NRF,e.VerHard="0.1",e.VerSoft="0.1",t(Object(f.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),(!h.a.DEVICE_MANY_ADDR_SP.test("".concat(e.address))||e.edit&&!h.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=Object(E.d)(t.t("errors.addressError"),"0x1300","0xFF00","0x1500")),e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(b.d)(e.address,g.d.CHAIN_FEEDING),s=[];for(let a of n){let n=S.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=Object(E.d)(t.t("errors.takenAddress"),s.join(", ")))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),a}})(A),A=Object(y.a)(e=>({roles:[O.c._DEVICE_CONFIG],showComponent:!0}))(A);const F=Object(m.a)("chainFeeding");A=Object(d.connect)(e=>({address:F(e,"address"),device:F(e,"device"),bridge:F(e,"bridge"),edit:F(e,"edit"),devices:e.farmDevices.devices,user:e.user.user,farm:e.location.farm}))(A),A=Object(C.a)()(A);t.a=Object(D.o)(A)},"4tbe":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("S8cm"),i=a("OwcS"),c=(a("55Cu"),a("42xM")),o=a("LCzB"),l=a("ANjH"),m=a("IXwn"),d=a("uSQv"),u=a("CuyV");class p extends n.Component{constructor(e){super(e),this.onChange=e=>{this.setState({checked:e})},this.onNext=()=>{const{onNextStep:e}=this.props,{checked:t}=this.state;t?e():this.setState({submitFail:!0})},this.state={checked:!1,submitFail:!1}}render(){const{checked:e,submitFail:t}=this.state,{t:a,onCancel:n,onBackStep:o,isFirstStep:l}=this.props;return s.a.createElement("div",{className:"step"},s.a.createElement("div",null,s.a.createElement(c.a,{error:t},s.a.createElement("div",null,a("braintree.licenseText"))),s.a.createElement(r.a,{label:a("braintree.readAndAccept"),checked:e,onChange:this.onChange,id:Object(i.a)()})),s.a.createElement(m.a,{fixed:!0},t&&s.a.createElement(u.a,{tooltipContent:a("braintree.acceptAgreementErr"),type:"error"},s.a.createElement("i",{className:"fas fa-exclamation-circle error"})),s.a.createElement(d.a,{buttonColor:"error",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-times"}),onClick:n}),!l&&s.a.createElement(d.a,{buttonColor:"success",buttonStyle:"round",onClick:o,icon:s.a.createElement("i",{className:"fas fa-arrow-left"})}),s.a.createElement(d.a,{buttonColor:"success",onClick:this.onNext,buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-arrow-right"})})))}}t.a=Object(l.d)(Object(o.a)())(p)},"55Cu":function(e,t,a){},"5O/K":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("/MKj"),i=a("VyNe"),c=a("udB/"),o=a("bAtb"),l=a("zDJl"),m=a("3Z9Z"),d=a("JI6e"),u=a("6qI1"),p=a("vzZS"),g=a("ANjH"),f=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={loading:!1},this.onQrScan=e=>{this.setState({loading:!0}),Object(o.a)(l.d.SMALL_CAGE,e).then(e=>{Object(o.c)(e),this.setState({loading:!1})}).catch(e=>{Object(o.b)(e),this.setState({loading:!1})})}}render(){const{t:e}=this.props,{loading:t}=this.state;return s.a.createElement(i.a,null,s.a.createElement(c.a,{isLoading:t}),s.a.createElement(m.a,{className:"justify-content-center"},s.a.createElement(d.a,{lg:6},s.a.createElement(p.a,null,e("newSettings.devices.form.qrScannerInfo")),s.a.createElement(u.a,{onFound:this.onQrScan}))))}}t.a=Object(g.d)(Object(f.a)(),Object(r.connect)((function(e){return{farm:e.location.farm}})))(h)},"5Tez":function(e,t,a){},"6JL/":function(e,t,a){},"6Msq":function(e,t,a){},"8ke+":function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("d/v1"),o=a("pJVQ"),l=a("tDQA"),m=a("/MKj"),d=a("zDJl"),u=a("6uZD"),p=a("FPv+"),g=a("VfnB"),f=a("kCmh"),h=a("XzT5"),b=a("ztiR");var E=a("Ty5D"),S=a("qx5e"),v=a("s506"),D=a("26mJ"),y=a("3Z9Z"),O=a("JI6e"),N=a("LCzB"),w=a("XoCd");class C extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:o,edit:l}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,device:a,address:t,showAdditionalButton:a,bridge:o,showHelp:!l},s.a.createElement(y.a,{className:"justify-content-center"},s.a.createElement(O.a,{lg:6},s.a.createElement(c.a,{component:D.a,name:"Number",label:n("newSettings.devices.form.number"),type:"text",normalize:e=>e?e.slice(0,3).toUpperCase():null}),s.a.createElement(c.a,{name:"matsNumber",id:"matsNumber",component:w.a,min:0,max:8,step:1,label:n("settings.matsNumber")})))))}}C=Object(o.a)({form:"climateSK3",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,alias:l,matsNumber:m=0}=e;if(!c){const t=Object(g.d)(n,d.d.CLIMATE_SK3).map(t=>({DevType:d.d.CLIMATE_SK3,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:l,AdditionalData:{Number:e.Number||void 0,Settings:{MatSize:m}}}));return Object(b.a)(t).then(e=>{a.reset(),Object(b.c)(e)}).catch(e=>{Object(b.b)(e)})}{let c=o.clone();c.Address=+n,c.Name=r,c.ParentID=i.DevID,c.Interface=+s,c.Alias=l,c.Protocol=d.g.WST,c.VerHard="0.1",c.VerSoft="0.1",c.Number=e.Number||void 0,c.setMatSize(m),c.setDtaModTime(),t(Object(u.e)(c.prepareBeanToSave(),c.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),!p.a.DEVICE_MANY_ADDR_CL.test("".concat(e.address))||e.edit&&!p.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=h.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){Object(g.d)(e.address,d.d.CAGE).length>r.DevClimatesLeft&&(a.address=h.a.t("errors.maxDevices",{amount:r.DevClimatesLeft}))}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(g.d)(e.address,d.d.CLIMATE_SK3),s=[];for(let a of n){let n=f.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=h.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),e.Number&&!e.Number.match(new RegExp("^[0-9]{1,2}[A-Z]?$","g"))&&(a.Number=h.a.t("errors.shouldBeInFormat",{type:"1, 11, 11A"})),a},initialValues:{matsNumber:0}})(C),C=Object(S.a)(e=>({roles:[v.c._DEVICE_CONFIG],showComponent:!0}))(C);const I=Object(l.a)("climateSK3");C=Object(m.connect)(e=>({address:I(e,"address"),device:I(e,"device"),bridge:I(e,"bridge"),edit:I(e,"edit"),user:e.user.user,farm:e.location.farm}))(C),C=Object(N.a)()(C);Object(E.o)(C)},"9pRY":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("3Z9Z"),i=a("JI6e"),c=a("/MKj"),o=a("VyNe"),l=a("LCzB");class m extends s.a.Component{render(){const{attributes:{address:e,email:t,login:a,name:n,phone:c},t:l}=this.props;return s.a.createElement(o.a,{className:"settings-profile-general"},s.a.createElement(r.a,{className:"justify-content-center"},s.a.createElement(i.a,{md:12},s.a.createElement(r.a,null,s.a.createElement(i.a,{md:!0,className:"align-right"},l("newSettings.profile.generalView.login")),s.a.createElement(i.a,{md:!0},a)),s.a.createElement("hr",null),s.a.createElement(r.a,null,s.a.createElement(i.a,{md:!0,className:"align-right"},l("nameAndSurrname"),":"),s.a.createElement(i.a,{md:!0},n)),s.a.createElement(r.a,null,s.a.createElement(i.a,{md:!0,className:"align-right"},l("newSettings.profile.generalView.address")),s.a.createElement(i.a,{md:!0},e)),s.a.createElement("hr",null),s.a.createElement(r.a,null,s.a.createElement(i.a,{md:!0,className:"align-right"},l("email2"),":"),s.a.createElement(i.a,{md:!0},t)),s.a.createElement(r.a,null,s.a.createElement(i.a,{md:!0,className:"align-right"},l("phoneNumber"),":"),s.a.createElement(i.a,{md:!0},c)))))}}m=Object(c.connect)(e=>({farm:e.location.farm,attributes:e.user.attributes}))(m),t.a=Object(l.a)()(m)},AvdG:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("pJVQ"),o=a("tDQA"),l=a("/MKj"),m=a("zDJl"),d=a("6uZD"),u=a("FPv+"),p=a("VfnB"),g=a("XzT5"),f=a("ztiR");var h=a("Ty5D"),b=a("qx5e"),E=a("s506");class S extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,bridge:n,edit:c}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,device:a,address:t,showAdditionalButton:a,bridge:n,showHelp:!c}))}}S=Object(c.a)({form:"thermoEye",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,alias:l}=e;if(!c){const e=Object(p.d)(n,m.d.THERMOEYE).map(e=>({DevType:m.d.THERMOEYE,Name:r,Address:e,ParentID:i.DevID,Interface:+s,Alias:l}));return Object(f.a)(e).then(e=>{a.reset(),Object(f.c)(e)}).catch(e=>{Object(f.b)(e)})}{let e=o.clone();e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=l,e.Protocol=m.g.WST,e.VerHard="0.1",e.VerSoft="0.1",t(Object(d.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};return e.name||(a.name=g.a.t("required")),(!u.a.DEVICE_MANY_ADDR_TE.test("".concat(e.address))||e.edit&&!u.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=g.a.t("addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"})),e.bridge||(a.bridge=g.a.t("required")),e.interf||(a.interf=g.a.t("required")),a}})(S),S=Object(b.a)(e=>({roles:[E.c._DEVICE_CONFIG],showComponent:!0}))(S);const v=Object(o.a)("thermoEye");S=Object(l.connect)(e=>({address:v(e,"address"),device:v(e,"device"),bridge:v(e,"bridge"),edit:v(e,"edit"),user:e.user.user,farm:e.location.farm}))(S);t.a=Object(h.o)(S)},HkhQ:function(e,t,a){"use strict";var n=a("44Ds"),s=a.n(n),r=a("mwIZ"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("y4iu"),m=a("HIda"),d=a("d/v1"),u=a("pJVQ"),p=a("tDQA"),g=a("VyNe"),f=a("3Z9Z"),h=a("JI6e"),b=a("XoCd"),E=a("wd/R"),S=a.n(E),v=a("BkRI"),D=a.n(v),y=a("kCmh"),O=a("zDJl"),N=a("6uZD"),w=a("ZRKa"),C=a("gLBR"),I=a("2UNB"),j=a("P0Qa"),T=a("qzmO");function A(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function F(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var x=a("/MKj"),P=a("q17X"),R=a("15cA"),k=a("6/k7"),_=a("4huo"),M=a("LCzB"),B=a("XzT5"),L=a("mr+a");class V extends o.a.Component{constructor(...e){super(...e),this.getMaxDay=s()((e=[],t=1)=>{const a=e.find(e=>e.SetData.Index===t-1);return i()(a,Object(R.f)(a)===k.a.BOTH?"SetData.InseminationJumpTo":"SetData.Days.length",1)},(...e)=>JSON.stringify(e)),this.getOptions=(e="WST")=>{const{feedingCurves:t,t:a}=this.props,n=e=>({value:e.SetData.Index+1,name:B.a.t("newSettings.feeding.general.changeCurve",{type:e.SetData.Name})}),s=t.filter(t=>"WST"!==e||t.SetData.Index<5&&Object(R.f)(t)!==k.a.BOTH),r=s.filter(e=>[k.b.INDIVIDUAL,k.b.MATING].includes(e.SetData.Type)).map(n),i=s.filter(e=>[k.b.INDIVIDUAL,k.b.PARTURITION].includes(e.SetData.Type)).map(n);return i.unshift({value:0,name:a("newSettings.feeding.general.doNothing")}),r.unshift({value:0,name:a("newSettings.feeding.general.doNothing")}),{optionsParturition:i,optionsInsemination:r}},this.renderPunishment=e=>{const{t:t}=this.props,a="Punishment[".concat(e,"]");return o.a.createElement(m.a,{name:a},o.a.createElement("h5",null,t("punishment",{type:e+1})),o.a.createElement(d.a,{name:"Time",id:"".concat(a,"_time"),label:t("newSettings.feeding.general.time"),component:b.a,min:0,max:15,step:1,valueFormatter:e=>t("newSettings.feeding.general.timeFormatter",{value:e})}),o.a.createElement(d.a,{name:"Percentage",id:"".concat(a,"_percentage"),label:t("newSettings.feeding.general.percentage"),component:b.a,min:10,max:100,step:5,valueFormatter:e=>"".concat(e,"%")}),o.a.createElement(d.a,{name:"Trigger",id:"".concat(a,"_trigger"),label:t("newSettings.feeding.general.trigger"),component:b.a,min:1,max:15,step:1}))},this.renderSection=(e,t)=>{const{optionsInsemination:a,optionsParturition:n}=this.getOptions(e),{feedingCurves:s,t:r,[e]:{defaultInseminationCurveNumber:i,defaultParturitionCurveNumber:c}}=this.props,l=e=>Object(R.f)(s.find(t=>t.SetData.Index===e)),u={max:this.getMaxDay(s,i),show:!!i&&l(i-1)!==k.a.BOTH},p={max:this.getMaxDay(s,c),show:!!c&&l(c-1)!==k.a.BOTH};return o.a.createElement(m.a,{name:e},o.a.createElement(d.a,{component:_.b,name:"DefaultInseminationCurveNumber",label:B.a.t("newSettings.feeding.general.defaultInseminationCurveNumber",{type:t}),options:a}),u.show&&o.a.createElement(d.a,{component:b.a,name:"DefaultInseminationCurveDay",label:r("newSettings.feeding.general.setCurveDayTo"),min:1,step:1,max:u.max}),!u.show&&!!i&&B.a.t("newSettings.feeding.general.usingInseminationDayDefinedInCurve",{day:u.max}),o.a.createElement(d.a,{component:_.b,name:"DefaultParturitionCurveNumber",label:B.a.t("newSettings.feeding.general.defaultParturitionCurveNumber",{type:t}),options:n}),p.show&&o.a.createElement(d.a,{component:b.a,name:"DefaultParturitionCurveDay",label:r("newSettings.feeding.general.setCurveDayTo"),min:1,step:1,max:p.max}),!p.show&&!!c&&B.a.t("newSettings.feeding.general.usingParturitionDayDefinedInCurve",{day:p.max}))},this.acceptIndividualCurves=e=>e.SetData.Type===k.b.INDIVIDUAL,this.acceptMatingCurve=e=>e.SetData.Type===k.b.MATING,this.acceptParturitionCurve=e=>e.SetData.Type===k.b.PARTURITION,this.acceptBeforeCurve=e=>Object(R.f)(e)===k.a.BEFORE,this.acceptAfterCurve=e=>Object(R.f)(e)===k.a.AFTER,this.acceptBothCurve=e=>Object(R.f)(e)===k.a.BOTH,this.filterMatingCurves=e=>this.acceptMatingCurve(e)&&this.acceptBothCurve(e)||this.acceptIndividualCurves(e),this.filterSowsCurves=e=>this.acceptMatingCurve(e)&&(this.acceptAfterCurve(e)||this.acceptBothCurve(e)),this.filterDeliveryCurves=e=>this.acceptIndividualCurves(e)||this.acceptParturitionCurve(e)}componentDidMount(){const{farm:e}=this.props;let t=y.a.getDevices(e).find(e=>e.DevType===O.d.GATEWAY);const a=Object(P.getFeedingPunishmentSettings)();this.props.initialize({WST:{DefaultInseminationCurveDay:Object(P.getFeedingDefaultInseminationCurveDay)("WST"),DefaultInseminationCurveNumber:Object(P.getFeedingDefaultInseminationCurveNumber)("WST"),DefaultParturitionCurveDay:Object(P.getFeedingDefaultParturitionCurveDay)("WST"),DefaultParturitionCurveNumber:Object(P.getFeedingDefaultParturitionCurveNumber)("WST")},NRF:{DefaultInseminationCurveDay:Object(P.getFeedingDefaultInseminationCurveDay)("NRF"),DefaultInseminationCurveNumber:Object(P.getFeedingDefaultInseminationCurveNumber)("NRF"),DefaultParturitionCurveDay:Object(P.getFeedingDefaultParturitionCurveDay)("NRF"),DefaultParturitionCurveNumber:Object(P.getFeedingDefaultParturitionCurveNumber)("NRF")},Punishment:a,ParturitionFeedingBreakTime:i()(t,"Settings.ParturitionFeedingBreakTime",0),DefaultCurves:Object(P.getDefaultCurvesForSectors)()})}componentDidUpdate(e,t,a){const{change:n}=this.props;["WST","NRF"].forEach(t=>{const{[t]:{defaultInseminationCurveNumber:a,defaultParturitionCurveNumber:s}={}}=this.props,{[t]:{defaultInseminationCurveNumber:r,defaultParturitionCurveNumber:i}={}}=e;if(a!==r){const{optionsInsemination:e}=this.getOptions(t);e.find(e=>e.value===a)||n("".concat(t,".DefaultInseminationCurveNumber"),0)}if(s!==i){const{optionsParturition:e}=this.getOptions(t);e.find(e=>e.value===s)||n("".concat(t,".DefaultParturitionCurveNumber"),0)}})}renderSector(e,t,a){return o.a.createElement(d.a,{component:_.b,options:this.props.feedingCurves.filter(a).map(e=>({name:e.SetData.Name,value:e.SetID})),label:t,name:e})}render(){const{handleSubmit:e,t:t,initialized:a}=this.props;return o.a.createElement(l.a,{handleSubmit:e},o.a.createElement(f.a,null,o.a.createElement(h.a,{xl:6},o.a.createElement(g.a,null,o.a.createElement("h5",null,t("general")),o.a.createElement(d.a,{component:b.a,name:"ParturitionFeedingBreakTime",label:t("newSettings.feeding.general.parturitionFeedingBreakTime"),min:0,max:864e5,step:9e5,valueFormatter:e=>864e5===e?"24:00":S.a.utc(e).format("HH:mm")}),!!a&&o.a.createElement(o.a.Fragment,null,this.renderSection("WST","F1"),this.renderSection("NRF","F3/F5")))),o.a.createElement(h.a,{xl:6},o.a.createElement(g.a,null,!!a&&o.a.createElement(o.a.Fragment,null,this.renderPunishment(0),this.renderPunishment(1),this.renderPunishment(2))))),o.a.createElement(f.a,null,o.a.createElement(h.a,{xl:6},o.a.createElement(g.a,null,o.a.createElement("h5",null,t("newSettings.feeding.general.defaultCurvesHeader")),o.a.createElement(m.a,{name:"DefaultCurves"},this.renderSector("Mating",t("SType.0"),this.filterMatingCurves),this.renderSector("Sows",t("SType.1"),this.filterSowsCurves),this.renderSector("Delivery",t("SType.3"),this.filterDeliveryCurves),this.renderSector("Other",t("modals.feedingConditionModal.other"),this.acceptIndividualCurves))))))}}V=Object(u.a)({form:"generalFeeding",onSubmit:function(e,t,a){const{ParturitionFeedingBreakTime:n}=e,{farm:s,user:r}=a;let i=y.a.getDevices(s).filter(e=>e.DevType===O.d.GATEWAY).map(e=>{let t=e.clone();return t.Settings.ParturitionFeedingBreakTime=n,t.prepareBeanToSave()});const c=e.Punishment.map(e=>({time:e.Time,percentage:e.Percentage,trigger:e.Trigger}));if(i.length>0){t(Object(N.e)(i,s,r.ClientID,r.LocalUserID));for(let e of i)Object(T.x)(e.DevID,c)}const{ClientID:o}=r;let l=w.a.getSettingByID(o),m={WST:e.WST,NRF:e.NRF,Punishment:e.Punishment,DefaultCurves:e.DefaultCurves};if(l){let e=D()(l);e.SetData?e.SetData.Settings||(e.SetData=function(e){for(var t=1;t({farm:e.location.farm,user:e.user.user,feedingCurves:Object(L.c)(e),WST:{defaultInseminationCurveNumber:z(e,"WST.DefaultInseminationCurveNumber"),defaultParturitionCurveNumber:z(e,"WST.DefaultParturitionCurveNumber")},NRF:{defaultInseminationCurveNumber:z(e,"NRF.DefaultInseminationCurveNumber"),defaultParturitionCurveNumber:z(e,"NRF.DefaultParturitionCurveNumber")}}))(V);t.a=Object(M.a)()(V)},IM74:function(e,t,a){},MOoq:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("Ty5D"),i=a("qx5e"),c=a("s506"),o=a("LCzB"),l=a("/MKj"),m=a("VyNe"),d=a("IXwn"),u=a("uSQv"),p=a("3Z9Z"),g=a("JI6e"),f=a("26mJ"),h=a("d/v1"),b=a("pJVQ"),E=a("tDQA"),S=a("wd/R"),v=a.n(S),D=a("uuQq"),y=a("w2lk");class O extends s.a.Component{constructor(e){super(e),this.props.initialize({startTime:v()().format("YYYY-MM-DDTHH:mm"),endTime:v()().add(1,"hour").format("YYYY-MM-DDTHH:mm")})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(m.a,null,s.a.createElement("form",{onSubmit:e},s.a.createElement(p.a,{className:"justify-content-center"},s.a.createElement(g.a,{lg:12},s.a.createElement(h.a,{label:t("maintenance.maintenanceStartDate"),type:"datetime-local",component:f.a,name:"startTime"}),s.a.createElement(h.a,{label:t("maintenance.maintenanceEndDate"),type:"datetime-local",component:f.a,name:"endTime"}),s.a.createElement(h.a,{label:t("maintenance.sendMails"),component:y.a,name:"sendMail",id:"sendMail"}))),s.a.createElement(d.a,{fixed:!0,renderInPortal:!1},s.a.createElement(u.a,{icon:s.a.createElement("i",{className:"fad fa-paper-plane"}),buttonStyle:"round",buttonColor:"success"}))))}}O=Object(b.a)({form:"maintenanceSettingView",onSubmit:function(e,t,a){const{farm:n}=a,{startTime:s,endTime:r,sendMail:i}=e,c={startTime:+new Date(s),endTime:+new Date(r)};t(Object(D.d)(c,i,()=>a.history.push("/".concat(n,"/settings"))))},validate:function(e,t){const a={},{t:n}=t;return e.startTime||(a.startTime=n("required")),e.endTime||(a.endTime=n("required")),a}})(O);const N=Object(E.a)("maintenanceSettingView");O=Object(l.connect)(e=>({startTime:N(e,"startTime"),endTime:N(e,"endTime")}))(O),O=Object(r.o)(O),O=Object(i.a)({roles:[c.c._SERVICE],showComponent:!0})(O),t.a=Object(o.a)()(O)},MguO:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("d/v1"),o=a("pJVQ"),l=a("tDQA"),m=a("/MKj"),d=a("zDJl"),u=a("6uZD"),p=a("FPv+"),g=a("VfnB"),f=a("kCmh"),h=a("XzT5"),b=a("ztiR");var E=a("Ty5D"),S=a("qx5e"),v=a("s506"),D=a("26mJ"),y=a("3Z9Z"),O=a("JI6e"),N=a("LCzB");class w extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:o,edit:l}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,device:a,address:t,showAdditionalButton:a,bridge:o,showHelp:!l},s.a.createElement(y.a,{className:"justify-content-center"},s.a.createElement(O.a,{lg:6},s.a.createElement(c.a,{component:D.a,name:"Number",label:n("newSettings.devices.form.number"),type:"text",normalize:e=>e?e.slice(0,3).toUpperCase():null})))))}}w=Object(o.a)({form:"climateWST",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,alias:l}=e;if(!c){const t=Object(g.d)(n,d.d.CLIMATE).map(t=>({DevType:d.d.CLIMATE,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:l,AdditionalData:{Number:e.Number||void 0}}));return Object(b.a)(t).then(e=>{a.reset(),Object(b.c)(e)}).catch(e=>{Object(b.b)(e)})}{let c=o.clone();c.Address=+n,c.Name=r,c.ParentID=i.DevID,c.Interface=+s,c.Alias=l,c.Protocol=d.g.WST,c.VerHard="0.1",c.VerSoft="0.1",c.Number=e.Number||void 0,c.setDtaModTime(),t(Object(u.e)(c.prepareBeanToSave(),c.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),!p.a.DEVICE_MANY_ADDR_CL.test("".concat(e.address))||e.edit&&!p.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=h.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){Object(g.d)(e.address,d.d.CAGE).length>r.DevClimatesLeft&&(a.address=h.a.t("errors.maxDevices",{amount:r.DevClimatesLeft}))}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(g.d)(e.address,d.d.CLIMATE),s=[];for(let a of n){let n=f.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=h.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),e.Number&&!e.Number.match(new RegExp("^[0-9]{1,2}[A-Z]?$","g"))&&(a.Number=h.a.t("errors.shouldBeInFormat",{type:"1, 11, 11A"})),a}})(w),w=Object(S.a)(e=>({roles:[v.c._DEVICE_CONFIG],showComponent:!0}))(w);const C=Object(l.a)("climateWST");w=Object(m.connect)(e=>({address:C(e,"address"),device:C(e,"device"),bridge:C(e,"bridge"),edit:C(e,"edit"),user:e.user.user,farm:e.location.farm}))(w),w=Object(N.a)()(w);t.a=Object(E.o)(w)},NVg3:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("IXwn"),i=a("uSQv"),c=a("VyNe"),o=a("AAik"),l=a("/MKj"),m=a("zDJl"),d=a("qx5e"),u=a("s506"),p=a("BvFm"),g=a("VfnB"),f=a("55Ip"),h=a("LCzB"),b=a("yjtO");class E extends s.a.Component{constructor(e){super(e),this.onSelectionChange=e=>{this.setState({selectedDispensers:e})},this.state={selectedDispensers:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(g.t)(t),{selectedDispensers:l}=this.state;return Object(p.a)()?s.a.createElement(c.a,null,s.a.createElement(o.a,{data:e.filter(e=>(Object(p.i)()?[m.d.BROADCAST,m.d.DISPENSER_NRF_MULTI,m.d.DISPENSER_NRF]:[m.d.DISPENSER_NRF]).includes(e.DevType)),headers:n,shouldIndex:!0,mobileRow:s.a.createElement(b.a,null),selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageDispensersF3F5",swipePagination:!0,paginationItems:20,showFilter:!0,isSortable:!0,showPagination:!0}),s.a.createElement(r.a,{fixed:!0,renderInPortal:!1},s.a.createElement(f.Link,{to:{pathname:"/".concat(a,"/settings/feeding/f3f5/manage/configuration"),state:{selectedDispensers:l}},disabled:0===l.length},s.a.createElement(i.a,{buttonColor:"success",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===l.length})))):null}}let S=Object(l.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(E);S=Object(d.a)({roles:[u.c._DEVICE_CONFIG],showComponent:!0})(S),t.a=Object(h.a)()(S)},NdYj:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("+oSd"),i=a("HIda"),c=a("d/v1"),o=a("pJVQ"),l=a("/MKj"),m=a("VyNe"),d=a("3Z9Z"),u=a("JI6e"),p=a("w2lk"),g=a("P0Qa"),f=a("gLBR"),h=a("2UNB");var b=a("LCzB");class E extends s.a.Component{constructor(e){super(e);const{notifications:t}=this.props;t&&t.SetData.Events?this.props.initialize(t.SetData.Events):this.props.initialize({Info:{Treatment:!0},Warning:{InseminationTooFast:!0,USGNoInsemination:!0,NoPregnancyNoInsemination:!0,ParturitionNoInsemination:!0,ParturitionTooFast:!0,ParturitionNoPregnancy:!0,ParturitionNegativeUSG:!0,SeparationWrongAmount:!0,FallPigletWrongAmount:!0,MommyWrongAmount:!0},Error:{}})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement(m.a,null,s.a.createElement(i.a,{name:"Info"},s.a.createElement("h4",null,t("newSettings.notifications.events.info"),s.a.createElement("i",{className:"fas fa-info-circle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("scheduleOfTreatment")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"Treatment",component:p.a,label:"",id:"Treatment"})))))),s.a.createElement(m.a,null,s.a.createElement(i.a,{name:"Warning"},s.a.createElement("h4",null,t("newSettings.notifications.events.warning"),s.a.createElement("i",{className:"fas fa-exclamation-triangle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.inseminationTooEarly")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"InseminationTooFast",component:p.a,label:"",id:"InseminationTooFast"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.usgNoInsemination")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"USGNoInsemination",component:p.a,label:"",id:"USGNoInsemination"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.noPregnancyNoInsemination")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"NoPregnancyNoInsemination",component:p.a,label:"",id:"NoPregnancyNoInsemination"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.parturitionNoInsemination")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ParturitionNoInsemination",component:p.a,label:"",id:"ParturitionNoInsemination"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.parturitionTooEarly")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ParturitionTooFast",component:p.a,label:"",id:"ParturitionTooFast"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.parturitionNoPregnancy")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ParturitionNoPregnancy",component:p.a,label:"",id:"ParturitionNoPregnancy"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.parturitionNegativeUSG")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ParturitionNegativeUSG",component:p.a,label:"",id:"ParturitionNegativeUSG"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.separationWrongAmount")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"SeparationWrongAmount",component:p.a,label:"",id:"SeparationWrongAmount"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.fallPigletsWrongAmount")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"FallPigletWrongAmount",component:p.a,label:"",id:"FallPigletWrongAmount"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.events.mommyWrongAmount")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"MommyWrongAmount",component:p.a,label:"",id:"MommyWrongAmount"})))))))}}E=Object(o.a)({form:"events-notifications",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.Events=e,a.setDtaModTime(),t(Object(f.c)(a))}else{let a=h.a.createSetting(g.a.NOTIFICATIONS,{Events:e},s);delete a.FarmID,t(Object(f.a)(a))}}})(E),E=Object(l.connect)(e=>({notifications:e.settings.notifications,user:e.user.user}))(E);t.a=Object(b.a)()(E)},O1KL:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("y4iu"),i=a("d/v1"),c=a("pJVQ"),o=a("VyNe"),l=a("3Z9Z"),m=a("JI6e"),d=a("26mJ"),u=a("/MKj"),p=a("lPiR"),g=a.n(p),f=a("Akpi"),h=a("jjk5"),b=a("kiXb");const E=e=>b.a.t(e);var S=a("vzZS"),v=a("LCzB");class D extends s.a.Component{render(){const{handleSubmit:e,t:t,user:{LocalMqttSecret:a},error:n}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement(o.a,null,s.a.createElement(l.a,{className:"justify-content-center"},s.a.createElement(m.a,{md:6},n&&s.a.createElement(S.a,{boxColor:"error"},n),a&&s.a.createElement(i.a,{name:"passwordOld",id:"passwordOld",type:"password",component:d.a,label:t("login.password")}),s.a.createElement(i.a,{name:"password",id:"password",type:"password",component:d.a,label:t("newPassword")}),s.a.createElement(i.a,{name:"passwordConfirmation",type:"password",id:"passwordConfirmation",component:d.a,label:t("newSettings.profile.changePasswordView.passwordConfirmation")})))))}}D=Object(c.a)({form:"changeMQTTPassword",onSubmit:function(e,t,a){const{user:n,farm:s}=a,{passwordOld:r,password:i,passwordConfirmation:c}=e;let o=g()(i.trim()).toString();if(r){if(g()(r.trim()).toString()!==n.LocalMqttSecret)throw new h.a({_error:E("newSettings.profile.changePasswordView.wrongOldPasswod")})}if(i!==c)throw new h.a({_error:E("newSettings.profile.changePasswordView.diffrentPasswords")});t(Object(f.a)(o,n.ClientID,n.LocalUserID,s))},validate:function(e,t){const a={},{password:n,passwordConfirmation:s,passwordOld:r}=e,{t:i}=t;return r||(a.passwordOld=i("required")),s||(a.passwordConfirmation=i("required")),n||(a.password=i("required")),a}})(D),D=Object(u.connect)(e=>({user:e.user.user,farm:e.location.farm}))(D);t.a=Object(v.a)()(D)},O45h:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("3Z9Z"),i=a("JI6e"),c=a("Y+p1"),o=a.n(c),l=a("BkRI"),m=a.n(l),d=a("/MKj"),u=a("VyNe"),p=a("AAik"),g=a("uSQv"),f=a("78Kh"),h=a("e8/y"),b=a("ANjH"),E=a("f0zD"),S=a("lM7y"),v=a("17x9"),D=a.n(v),y=a("42VQ"),O=a("LCzB"),N=a("XzT5"),w=a("PRyg"),C=a("yjtO");function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function j(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class T extends s.a.Component{constructor(e){super(e),this.onDeleteConfirm=e=>{const{dictionary:t}=this.state;let a=m()(t);for(let n in a.WData){a.WData[n]=a.WData[n].filter(t=>t.ID!==e.value.ID&&!t.isDefault);for(let e of a.WData[n])delete e.isDefault,delete e.isShowing}delete a.$loki,this.props.dispatch(Object(S.d)(a,this.props.user.ClientID,this.props.user.LocalUserID)),e.handleHide()},this.state={lang:o()("cimode",this.props.lang)?"pl":this.props.lang,dictionary:T.getDictionary(e)}}componentDidUpdate(e,t,a){o()(this.props.lang,e.lang)&&o()(this.props.dictionary,e.dictionary)||this.setState({lang:o()("cimode",this.props.lang)?"pl":this.props.lang,dictionary:T.getDictionary(this.props)})}onDeleteClick(e){this.props.show(y.a,{text:N.a.t("newSettings.dictionary.manage.item.confirmDeleteText",{type:e.value.Value}),title:this.props.t("newSettings.dictionary.manage.item.confirmDeleteTitle"),confirmText:this.props.t("yes"),onConfirmed:t=>this.onDeleteConfirm(function(e){for(var t=1;t!e.value.isDefault&&s.a.createElement("i",{className:"fas fa-pencil-alt",onClick:()=>this.onEditClick(e)}),itemClassName:"index",headerClassName:"index",_floating:!0}),a.push({name:"",component:e=>!e.value.isDefault&&s.a.createElement("i",{className:"fas fa-trash",onClick:()=>this.onDeleteClick(e)}),itemClassName:"index",headerClassName:"index",_floating:!0}),s.a.createElement(u.a,null,s.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center"},this.getName(),s.a.createElement(g.a,{buttonColor:"primary",className:"text",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-plus"}),onClick:()=>this.onAddClick()})),s.a.createElement(p.a,{data:e.WData[t].sort((e,t)=>e.Value>t.Value?1:-1),headers:a,shouldIndex:!0,mobileRow:s.a.createElement(C.a,null)}))}}T.getDictionary=e=>{const{dictionary:t,type:a}=e;for(let n in t)if(t[n].Type===a)return t[n]},T=Object(d.connect)(e=>({dictionary:e.dictionary,lang:e.language.lang.lang,user:e.user.user}))(T),(T=Object(d.connect)(null,e=>Object(b.b)({show:E.d},e))(T)).propTypes={type:D.a.string.isRequired};var A=Object(O.a)()(T),F=a("ba6h"),x=a("qx5e"),P=a("s506");class R extends s.a.Component{render(){return s.a.createElement("div",{className:"overflow-hidden"},s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.clients})),s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.fallReasons}))),s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.feedingCurves})),s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.forageType}))),s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.graftingReason})),s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.weighting}))),s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.noPreganancy})),s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.race}))),s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.selectionReason})),s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.suppliers}))),s.a.createElement(r.a,null,s.a.createElement(i.a,{lg:6},s.a.createElement(A,{type:F.a.taskCategory}))),s.a.createElement(f.b,null),s.a.createElement(h.b,null))}}t.a=Object(x.a)({roles:[P.c._BREEDING],showComponent:!0})(R)},Pl9q:function(e,t,a){"use strict";var n=a("Y+p1"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("/MKj"),o=a("ANjH"),l=a("f0zD"),m=a("mwIZ"),d=a.n(m),u=a("BkRI"),p=a.n(u),g=a("gLBR"),f=a("17x9"),h=a.n(f),b=a("IXwn"),E=a("uSQv"),S=a("55Ip"),v=a("zDJl"),D=a("AF5L"),y=a("kB5K"),O=a("9jj8"),N=a("G7tO"),w=a("pxzG"),C=a("q17X"),I=a("15cA"),j=a("JI6e"),T=a("3Z9Z"),A=a("vYJ8"),F=a("6/k7"),x=a("LCzB");function P(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function R(e){for(var t=1;t{const{curve:t,t:a}=e;let n=p()(d()(t,"SetData.Days",[]));n=n.map((e,a)=>R({},e,{day:Object(I.d)(a+1,t)}));let s=Object(C.getFeedingUnit)();return{days:n,chartDef:[{color:"green",dataKey:"ForageAmount",name:a("dosage"),unit:Object(w.l)("weight",s),valueConverter:e=>Object(w.j)(e,{unit:s,showUnit:!1,fixed:2})}]}},this.onRemoveClick=this.onRemoveClick.bind(this),this.onUpdateOnDevicesClick=this.onUpdateOnDevicesClick.bind(this),this.state=R({deleting:!1,showCurve:!1},this.getChartData())}onUpdateOnDevicesClick(e){e.stopPropagation();const{gateways:t,curve:a}=this.props;a instanceof y.a&&t.forEach(e=>{Object(D.s)(e,a,!1)})}onRemoveClick(e){e.stopPropagation();const{dispatch:t,curve:a,show:n,t:s}=this.props;let r=p()(a);r=r instanceof y.a?r:Object(C.getSettingClass)(r),console.log(r),r instanceof y.a&&(r.deleteSetting(),n("confirm-modal",{title:s("newSettings.feeding.curves.feedingCurveItem.confirmDelete"),text:s("newSettings.feeding.curves.feedingCurveItem.confirmDeleteLong"),confirmText:s("yes"),onConfirmed:e=>{this.setState({deleting:!0},()=>{t(Object(g.c)(r,()=>{e.handleHide(),this.setState({deleting:!1})},()=>{this.setState({deleting:!1})}))})}}))}getRelatedItemByKey(e){if(!e)throw Error("Key must be present");const{curve:t}=this.props,a=d()(t,"SetData.Days",[]);let n=[];return a.forEach(t=>{n.includes(+t[e]+1)||n.push(+t[e]+1)}),n.join(", ")}shouldComponentUpdate(e,t,a){return!s()(this.props,e)||!s()(this.state,t)}UNSAFE_componentWillReceiveProps(e,t){s()(this.props,e)||this.setState(R({},this.getChartData(e)))}render(){const{curve:e,index:t,t:a}=this.props,{deleting:n,showCurve:s,chartDef:r,days:c}=this.state,o=d()(e,"SetData.Type");let l=p()(d()(e,"SetData.Days.length",0)),m=d()(e,"SetData.Name","Krzywa ".concat(t+1)),u=a("curves.".concat(o));if(u){let t="";switch(Object(I.f)(e)){case F.a.NORMAL:t=a("newSettings.feeding.curves.curveDescriptions.".concat(o,".normal.name"));break;case F.a.BEFORE:t=a("newSettings.feeding.curves.curveDescriptions.".concat(o,".before.name"));break;case F.a.AFTER:t=a("newSettings.feeding.curves.curveDescriptions.".concat(o,".after.name"));break;case F.a.BOTH:t=a("newSettings.feeding.curves.curveDescriptions.".concat(o,".both.name"))}t&&t!==u&&(u+=": ".concat(t))}let g=this.getRelatedItemByKey("DailyPlan"),f=this.getRelatedItemByKey("ForageType");return i.a.createElement(i.a.Fragment,null,i.a.createElement(O.a,{showNumber:!0,lp:t+1,index:t,key:1,className:e?"mh-5rem align-items-center pointer pt-3 pb-3 d-flex overflow-hidden position-relative":"mh-5rem d-flex align-items-center mh-5rem overflow-hidden position-relative pt-3 pb-3",onClick:()=>this.setState(e=>({showCurve:!e.showCurve}))},i.a.createElement(j.a,{xs:12},i.a.createElement(T.a,null,!!e&&i.a.createElement(i.a.Fragment,null,i.a.createElement(j.a,{xs:12,sm:5,xl:4},i.a.createElement("div",{className:"font-weight-bold"},m),i.a.createElement("div",{className:"opacity-75"},u||"?")),i.a.createElement(j.a,{className:"d-none d-sm-block",sm:3,xl:2},i.a.createElement("div",{className:"font-weight-bold"},l),i.a.createElement("div",{className:"opacity-75"},a("numberOfDays"))),i.a.createElement(j.a,{className:"d-none d-xl-block",xl:2},i.a.createElement("div",{className:"font-weight-bold"},g),i.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.curves.feedingCurveItem.relatedPlans"))),i.a.createElement(j.a,{className:"d-none d-xl-block",xl:2},i.a.createElement("div",{className:"font-weight-bold"},f),i.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.curves.feedingCurveItem.relatedForages")))),!e&&i.a.createElement(j.a,{xs:12,sm:8,xl:10,className:"opacity-50"},i.a.createElement("h5",{className:"justify-content-center"},a("newSettings.feeding.curves.feedingCurveItem.curveNotConfigured"))),i.a.createElement(j.a,{xs:12,sm:4,xl:2,className:"justify-content-end align-items-center d-flex"},i.a.createElement(b.a,{className:"m-0"},i.a.createElement(S.Link,{to:"/".concat(this.props.farm,"/settings/feeding/curves/edit/").concat(t)},i.a.createElement(E.a,{type:"button",icon:i.a.createElement("i",{className:"fas fa-pen"}),buttonStyle:"round"})),i.a.createElement(E.a,{type:"button",disabled:!e,icon:i.a.createElement("i",{className:"fas fa-share"}),buttonStyle:"round",onClick:this.onUpdateOnDevicesClick}),i.a.createElement(E.a,{type:"button",disabled:!e,isLoading:n,icon:i.a.createElement("i",{className:"fas fa-trash"}),buttonStyle:"round",buttonColor:e?"error":null,onClick:this.onRemoveClick})))))),i.a.createElement(A.a,{in:s&&e,mountOnEnter:!0,unmountOnExit:!0},i.a.createElement("div",{className:"d-flex w-100"},i.a.createElement(O.a,{className:"w-100 enable-overflow",style:{height:"20rem"},disableHover:!0,index:t},i.a.createElement(j.a,{xs:12,className:"h-100"},i.a.createElement(N.a,{dataDef:r,data:c,tooltipLabelFormatter:e=>"".concat(a("curveDay")," ").concat(e),Yaxis:{name:a("dosage")},Xaxis:{name:a("curveDay"),dataKey:"day"},referenceLines:[F.d.includes(o)?{x:"0",color:"blue",name:a("parturitionDate")}:null,F.c.includes(o)?{x:"0",color:"blue",name:a("inseminationDay")}:null].filter(e=>e),saveAsExcell:"curve"}))))))}}_.propTypes={curve:h.a.object.isRequired},_=Object(c.connect)(e=>({user:e.user.user,gateways:e.farmDevices.devices.filter(e=>e.DevType===v.d.GATEWAY),farm:e.location.farm}))(_),_=Object(c.connect)(null,e=>Object(o.b)({show:l.d},e))(_);var M,B=Object(x.a)()(_),L=a("0ajJ"),V=a("VyNe"),z=a("qx5e"),U=a("s506"),W=a("8O+7"),q=a("84Ez"),H=a("mr+a"),G=a("0gjr");function J(){return(J=Object.assign||function(e){for(var t=1;t({feedingCurves:Object(H.c)(e),license:Object(q.a)(e,{licenseName:U.a.DISPENSER})}))(M=class extends r.Component{shouldComponentUpdate(e,t,a){return!s()(this.props,e)}render(){const{feedingCurves:e,license:t,t:a}=this.props;let n=[];for(let s=0;se.SetData.Index===s),index:s};return i.a.createElement(V.a,{type:"container",className:"feeding-view-container"},i.a.createElement(L.a,{striped:!0,useFlexLayout:!1,showNumber:!0},i.a.createElement(W.a,{text:a("newSettings.feeding.curves.feedingCurveItem.compatibility",{type:"F1, F3, F5"}),key:"comp_WST"}),n.slice(0,G.a.FEEDING_CURVE_BASIC).map((e,t)=>i.a.createElement(B,J({key:"curve_".concat(e.index)},e))),t===U.b.EXTENDED&&i.a.createElement(i.a.Fragment,null,i.a.createElement(W.a,{text:a("newSettings.feeding.curves.feedingCurveItem.compatibility",{type:"F3, F5"}),key:"comp_NRF"}),n.slice(G.a.FEEDING_CURVE_BASIC,G.a.FEEDING_CURVE_EXTENDED).map((e,t)=>i.a.createElement(B,J({key:"curve_".concat(e.index)},e))))))}})||M;Y=Object(c.connect)(null,e=>Object(o.b)({show:l.d},e))(Y),Y=Object(x.a)()(Y);t.a=Object(z.a)({roles:[U.c._DEVICE_CONFIG],clientPackage:{[U.a.DISPENSER]:U.b.BASIC},showComponent:!0})(Y)},Q0ay:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("HIda"),i=a("d/v1"),c=a("pJVQ"),o=a("/MKj"),l=a("VyNe"),m=a("3Z9Z"),d=a("JI6e"),u=a("w2lk"),p=a("+oSd"),g=a("P0Qa"),f=a("gLBR"),h=a("2UNB");var b=a("LCzB");class E extends s.a.Component{constructor(e){super(e);const{notifications:t}=this.props;t&&t.SetData.Climate?this.props.initialize(t.SetData.Climate):this.props.initialize({Info:{},Warning:{NoCommunication:!0},Error:{EEPROM:!0,ResetTime:!0,TemperatureTooLow:!0,TemperatureTooHigh:!0,AbsoluteAlarm:!0,Humidity:!0,CO2:!0,NH3:!0,H2S:!0,Slurry:!0}})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(p.a,{handleSubmit:e},s.a.createElement(l.a,null,s.a.createElement(r.a,{name:"Error"},s.a.createElement("h4",null,t("newSettings.notifications.climate.errors"),s.a.createElement("i",{className:"fas fa-exclamation-circle"})),s.a.createElement(m.a,null,s.a.createElement(d.a,{lg:4},t("newSettings.notifications.climate.eeprom")),s.a.createElement(d.a,{lg:8,className:"notification-settings-right"},s.a.createElement(i.a,{name:"EEPROM",component:u.a,label:"",id:"EEPROM"}))),s.a.createElement(m.a,null,s.a.createElement(d.a,{lg:4},t("newSettings.notifications.climate.reset")),s.a.createElement(d.a,{lg:8,className:"notification-settings-right"},s.a.createElement(i.a,{name:"ResetTime",component:u.a,label:"",id:"ResetTime"}))),s.a.createElement(m.a,null,s.a.createElement(d.a,{lg:4},t("newSettings.notifications.climate.temperature")),s.a.createElement(d.a,{lg:8,className:"notification-settings-right"},s.a.createElement(i.a,{name:"TemperatureTooLow",component:u.a,label:t("newSettings.notifications.climate.tooLow"),id:"TemperatureTooLow"}),s.a.createElement(i.a,{name:"TemperatureTooHigh",component:u.a,label:t("newSettings.notifications.climate.tooHigh"),id:"TemperatureTooHigh"}))),s.a.createElement(m.a,null,s.a.createElement(d.a,{lg:4},t("newSettings.notifications.climate.absoluteAlarm")),s.a.createElement(d.a,{lg:8,className:"notification-settings-right"},s.a.createElement(i.a,{name:"AbsoluteAlarm",component:u.a,label:"",id:"AbsoluteAlarm"}))),s.a.createElement(m.a,null,s.a.createElement(d.a,{lg:4},t("newSettings.notifications.climate.sensors")),s.a.createElement(d.a,{lg:8,className:"notification-settings-right"},s.a.createElement(i.a,{name:"Humidity",component:u.a,label:t("newSettings.notifications.climate.humidity"),id:"Humidity"}),s.a.createElement(i.a,{name:"CO2",component:u.a,label:t("newSettings.notifications.climate.co2"),id:"CO2"}),s.a.createElement(i.a,{name:"NH3",component:u.a,label:"NH3",id:"NH3"}),s.a.createElement(i.a,{name:"H2S",component:u.a,label:t("newSettings.notifications.climate.h2s"),id:"H2S"}),s.a.createElement(i.a,{name:"Slurry",component:u.a,label:t("newSettings.notifications.climate.slurry"),id:"Slurry"}))))))}}E=Object(c.a)({form:"climate-notifications",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.Climate=e,a.setDtaModTime(),t(Object(f.c)(a))}else{let a=h.a.createSetting(g.a.NOTIFICATIONS,{Climate:e},s);delete a.FarmID,t(Object(f.a)(a))}}})(E),E=Object(o.connect)(e=>({notifications:e.settings.notifications,user:e.user.user}))(E);t.a=Object(b.a)()(E)},QDvx:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("3Z9Z"),c=a("JI6e"),o=a("d/v1"),l=a("pJVQ"),m=a("/MKj"),d=a("ANjH"),u=a("IXwn"),p=a("uSQv"),g=a("4huo"),f=a("LCzB"),h=a("uuQq");class b extends s.a.Component{render(){const{handleSubmit:e}=this.props,t=b.getFarmsOptions(this.props);return s.a.createElement(r.a,null,s.a.createElement("form",{onSubmit:e},s.a.createElement(i.a,{className:"justify-content-center"},s.a.createElement(c.a,{lg:12},s.a.createElement(o.a,{name:"FarmID",label:"Ferma z kt\xf3rej b\u0119d\u0105 usuni\u0119te dane:",options:t,component:g.b,init:!0}))),s.a.createElement(u.a,{fixed:!0,renderInPortal:!1},s.a.createElement(p.a,{icon:s.a.createElement("i",{className:"fas fa-trash"}),buttonStyle:"round",buttonColor:"error"}))))}}b.getFarmsOptions=e=>{const{farms:t}=e;return t.map(e=>({name:"Nazwa: ".concat(e.FarmName," | ID: ").concat(e.FarmID),value:e.FarmID}))},t.a=Object(d.d)(Object(f.a)(),Object(m.connect)((function(e){return{farms:e.farms.farms}})),Object(l.a)({form:"delete-farm-data",onSubmit:function(e,t,a){const{FarmID:n}=e;t(Object(h.c)(n,{AnimalKind:0,DeleteEvents:!1,DeleteAnimals:!1,DeleteNotifications:!1,DeleteTechnologyGroups:!1,DeleteAnimalGroups:!1,DeleteAll:!0},()=>a.history.goBack()))},validate:function(e,t){const a={};return e.FarmID||(a.FarmID=t.t("required")),a}}))(b)},ROqK:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("17x9"),i=a.n(r),c=a("IXwn"),o=a("uSQv"),l=a("d/v1"),m=a("26mJ"),d=a("vYJ8"),u=a("3Z9Z"),p=a("JI6e"),g=a("4huo"),f=a("/MKj"),h=a("zDJl"),b=a("I0xV"),E=a("9D2Z"),S=a("kG49"),v=(a("rSX7"),a("vzZS")),D=a("sZ7W"),y=a("Yh51"),O=a("r3a2"),N=a("Gaw7"),w=a("qzmO"),C=a("VfnB"),I=a("FPv+"),j=a("/S4a"),T=a("6qI1"),A=a("LCzB"),F=a("XzT5"),x=a("CuyV");class P extends s.a.Component{constructor(e){super(e),this.onSuccess=()=>{console.log("ON SUCCESS"),this.setState(e=>({loading:!1,time:(new Date).getTime()-e.sendTime}))},this.onError=(e,t)=>{console.log("ON ERROR",e,t),this.setState({loading:!1,error:!0})},this.onSend=()=>{this.setState({sendTime:(new Date).getTime()})},this.onButtonClick=e=>{this.setState({event:e})},this.onCheckConnectionClick=()=>{const{device:e}=this.props;switch(this.setState({didCheck:!0,loading:!0,error:!1}),e.DevType){case h.d.CAGE:Object(D.b)(e,this.onSuccess,this.onError,this.onSend);break;case h.d.CLIMATE:Object(y.a)(e,this.onSuccess,this.onError,this.onSend);break;case h.d.DISPENSER:Object(O.a)(e,this.onSuccess,this.onError,this.onSend);break;case h.d.SCALE:Object(N.a)(e,this.onSuccess,this.onError,this.onSend);break;case h.d.DISPENSER_NRF:Object(w.g)(e,this.onSuccess,this.onError,this.onSend);break;default:console.warn("Nie obs\u0142ugiwane")}},this.onSwitchChange=e=>{this.setState({switchValue:e})},this.onQrDecoded=e=>{this.props.onQrScan&&this.props.onQrScan(e)},this.state={gateways:e.devices.filter(e=>e.DevType===h.d.GATEWAY).map(e=>({name:e.Name,value:e})),bridges:e.devices.filter(e=>e.DevType===h.d.BRIDGE).map(e=>({name:e.Name,value:e})),event:null,didCheck:!1,loading:!1,error:!1,time:0,sendTime:0,switchValue:"form"}}getBoxColor(){const{loading:e,error:t}=this.state;return e?"info":t?"error":"success"}render(){const{gateways:e,bridges:t,didCheck:a,loading:n,error:r,time:i,switchValue:f}=this.state,{handleSubmit:h,showGatewayInsteadOfBridge:D,showInterfacePicker:y,fetching:O,address:N,device:w,showAdditionalButton:A,t:P,disableBridge:R,showAddress:k,qrScanner:_,showBridge:M,renderChildrenInQrScanner:B,bridge:L,showHelp:V}=this.props;return s.a.createElement("form",{onSubmit:h,className:"form-for-devices"},s.a.createElement(d.a,{in:a,unmountOnExit:!0},s.a.createElement("div",null,s.a.createElement(v.a,{boxColor:this.getBoxColor()},n&&s.a.createElement(s.a.Fragment,null,s.a.createElement("i",{className:"fas fa-circle-notch fa-spin fa-fw"}),P("newSettings.devices.form.checking")),!n&&s.a.createElement(s.a.Fragment,null,r&&s.a.createElement(s.a.Fragment,null,s.a.createElement("i",{className:"fas fa-exclamation-circle fa-fw"}),P("newSettings.devices.form.error")),!r&&i&&s.a.createElement(s.a.Fragment,null,s.a.createElement("i",{className:"fas fa-check fa-fw"}),F.a.t("newSettings.devices.form.received",{time:i})))))),_&&s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(j.a,{onChange:this.onSwitchChange,value:f,options:[{name:P("newSettings.devices.form.form"),value:"form"},{name:P("newSettings.devices.form.qrScanner"),value:"qr"}]}))),"qr"===f&&s.a.createElement(s.a.Fragment,null,s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(T.a,{onFound:this.onQrDecoded}))),B&&this.props.children),"form"===f&&s.a.createElement(s.a.Fragment,null,s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6,className:V?"with-help":null},s.a.createElement(l.a,{name:"name",component:m.a,type:"text",label:P("designation")}),V&&s.a.createElement(x.a,{tooltipContent:s.a.createElement("div",null,s.a.createElement("div",null,P("newSettings.devices.form.availablePatterns")),s.a.createElement("div",null,"{{#}}"," - ",P("newSettings.devices.form.insertIndex")),s.a.createElement("div",null,"{{#X}}",", ",P("newSettings.devices.form.insertIndexFrom")),s.a.createElement("div",null,"{{address}}"," - ",P("newSettings.devices.form.insertAddress"))),placement:"bottom",type:"info"},s.a.createElement("i",{className:"fas fa-question-circle"})))),s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(l.a,{name:"alias",component:m.a,type:"text",label:P("newSettings.devices.form.alias")}))),k&&s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(l.a,{name:"address",component:m.a,type:"text",label:P("adres")}))),D&&s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(l.a,{name:"gateway",component:g.b,label:P("newSettings.devices.form.gateway"),options:e}))),!D&&M&&s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(l.a,{name:"bridge",component:g.b,label:P("newSettings.devices.form.bridge"),options:t,disabled:R}))),this.props.children,y&&s.a.createElement(u.a,{className:"justify-content-center"},s.a.createElement(p.a,{lg:6},s.a.createElement(l.a,{name:"interf",component:b.a,addressToCheck:Object(C.d)(I.a.DEVICE_MANY_ADDR.test("".concat(N))?"".concat(N):""),device:w,bridge:L})))),s.a.createElement(c.a,{renderInPortal:!1,fixed:!0},A&&s.a.createElement(s.a.Fragment,null,s.a.createElement(o.a,{buttonStyle:"round",buttonColor:"info",icon:s.a.createElement("i",{className:"fas fa-ellipsis-v"}),type:"button",onClick:this.onButtonClick}),s.a.createElement(E.a,{event:this.state.event},s.a.createElement(S.a,{onClick:this.onCheckConnectionClick},P("newSettings.devices.form.check")))),s.a.createElement(o.a,{buttonStyle:"round",buttonColor:"success",icon:s.a.createElement("i",{className:"fas fa-plus"}),isLoading:O})))}}P.propTypes={handleSubmit:i.a.func.isRequired,showGatewayInsteadOfBridge:i.a.bool,showInterfacePicker:i.a.bool,address:i.a.number,device:i.a.object,showAdditionalButton:i.a.bool,disableBridge:i.a.bool,showAddress:i.a.bool,qrScanner:i.a.bool,showBridge:i.a.bool,onQrScan:i.a.func,renderChildrenInQrScanner:i.a.bool,bridge:i.a.object,showHelp:i.a.bool},P.defaultProps={showGatewayInsteadOfBridge:!1,showInterfacePicker:!1,showAddress:!0,showBridge:!0},P=Object(f.connect)(e=>({devices:e.farmDevices.devices,fetching:e.farmDevices.fetching}))(P),t.a=Object(A.a)()(P)},S403:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=(a("55Cu"),a("uSQv")),i=a("IXwn");class c extends n.Component{render(){const{onCancel:e,onSubscribe:t,onBackStep:a}=this.props;return s.a.createElement("div",{className:"step"},s.a.createElement("div",null,s.a.createElement("div",{className:"payment-confirmation"},s.a.createElement("p",null,"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."))),s.a.createElement(i.a,{fixed:!0,renderInPortal:!1},s.a.createElement(r.a,{buttonColor:"error",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-times"}),onClick:e}),s.a.createElement(r.a,{buttonColor:"success",buttonStyle:"round",onClick:a,icon:s.a.createElement("i",{className:"fas fa-arrow-left"})}),s.a.createElement(r.a,{buttonColor:"success",buttonStyle:"round",onClick:t,icon:s.a.createElement("i",{className:"fas fa-money-bill-wave"})})))}}t.a=c},SD4l:function(e,t,a){"use strict";var n=a("lFKM"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("VyNe"),o=a("ROqK"),l=a("d/v1"),m=a("pJVQ"),d=a("tDQA"),u=a("/MKj"),p=a("zDJl"),g=a("6uZD"),f=a("FPv+"),h=a("VfnB"),b=a("XzT5"),E=a("ztiR");var S=a("Ty5D"),v=a("qx5e"),D=a("s506"),y=a("26mJ"),O=a("4huo"),N=a("3Z9Z"),w=a("JI6e"),C=a("LCzB");class I extends i.a.Component{render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:r,edit:m}=this.props,d=[{name:b.a.t("newSettings.devices.form.Xphase",{type:1}),value:1},{name:b.a.t("newSettings.devices.form.Xphase",{type:3}),value:3}];return i.a.createElement(c.a,null,i.a.createElement(o.a,{handleSubmit:e,showInterfacePicker:!1,device:a,address:t,showHelp:!m,showAdditionalButton:a,bridge:r},i.a.createElement(N.a,{className:"justify-content-center"},i.a.createElement(w.a,{lg:6},i.a.createElement(l.a,{name:"phases",id:"phases",component:O.b,label:n("newSettings.devices.form.systemType"),options:d,format:e=>s()(e)?e:1,parse:e=>s()(e)?e:1}),i.a.createElement(l.a,{name:"number",id:"number",component:y.a,label:n("newSettings.devices.form.number"),type:"text",normalize:e=>e?e.slice(0,3).toUpperCase():null}),i.a.createElement(l.a,{name:"serial",id:"serial",component:y.a,label:n("newSettings.devices.form.serial"),type:"number",format:e=>s()(e)?"".concat(e):e||"",parse:e=>s()(parseInt(e))?parseInt(e):e})))))}}I=Object(m.a)({form:"electricityMeter",onSubmit:function(e,t,a){const{phases:n,address:r,serial:i,name:c,number:o,bridge:l,edit:m,device:d,alias:u}=e;if(!m){const e={};s()(i)&&(e.Serial=i),o&&(e.Number=o),e.Settings={},s()(n)&&(e.Settings.Phases=n);const t=Object(h.d)(r,p.d.ELECTRICITY_FLOW_METER).map(t=>({DevType:p.d.ELECTRICITY_FLOW_METER,Name:c,Address:t,ParentID:l.DevID,Interface:p.h.BRIDGE_MBUS,Alias:u,AdditionalData:e}));return Object(E.a)(t).then(e=>{a.reset(),Object(E.c)(e)}).catch(e=>{Object(E.b)(e)})}{let e=d.clone();e.Address=Number(r),e.Name=c,e.ParentID=l.DevID,e.Serial=+i,u?e.Alias=u:delete e.Alias,o?e.Number=o:delete e.Number,!e.Settings&&(e.Settings={}),s()(n)&&(e.Settings.Phases=n),e.Protocol=p.g.MODBUS,e.VerHard="0.1",e.VerSoft="0.1",t(Object(g.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};return e.name||(a.name=t.t("required")),(!f.a.DEVICE_MANY_ADDR_TE.test("".concat(e.address))||e.edit&&!f.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=b.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"})),e.bridge||(a.bridge=t.t("required")),s()(e.serial)||(a.serial=t.t("required")),a}})(I),I=Object(v.a)(e=>({roles:[D.c._DEVICE_CONFIG],showComponent:!0}))(I);const j=Object(d.a)("electricityMeter");I=Object(u.connect)(e=>({address:j(e,"address"),device:j(e,"device"),bridge:j(e,"bridge"),edit:j(e,"edit"),user:e.user.user,farm:e.location.farm}))(I),I=Object(C.a)()(I);t.a=Object(S.o)(I)},TQ9z:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("/MKj"),c=a("AAik"),o=a("r8wt"),l=a("IXwn"),m=a("uSQv"),d=a("ANjH"),u=a("f0zD"),p=a("Cpk7");class g extends s.a.Component{constructor(...e){super(...e),this.onEditClick=()=>{this.props.show(p.a,{medicine:this.props.value,edit:!0})}}render(){return s.a.createElement("div",{onClick:this.onEditClick},s.a.createElement("i",{className:"fas fa-edit pointer"}))}}var f=g=Object(i.connect)(e=>({}),e=>Object(d.b)({show:u.d},e))(g),h=a("lM7y"),b=a("42VQ"),E=a("LCzB"),S=a("XzT5");function v(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function D(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class y extends s.a.Component{constructor(...e){super(...e),this.onRemoveClick=()=>{const{value:e,user:t,t:a}=this.props;this.props.show(b.a,{title:S.a.t("newSettings.dictionary.medicines.removeTitle",{type:e.WData.Name}),text:S.a.t("newSettings.dictionary.medicines.removeText",{type:e.WData.Name}),confirmText:a("yes"),onConfirmed:a=>{let n=e.prepareBeanToSave();n.remove(),this.props.dispatch(Object(h.d)(n,t.ClientID,t.LocalUserID)),a.handleHide()}})}}render(){return s.a.createElement("div",{onClick:this.onRemoveClick},s.a.createElement("i",{className:"fas fa-trash pointer"}))}}y=Object(i.connect)(e=>({user:e.user.user}),e=>function(e){for(var t=1;t"".concat(e.Dose," ").concat(e.Unit),this.typeValueFormatter=e=>{const{t:t}=this.props;switch(e){default:case o.b.STIMULATOR:return t("newSettings.dictionary.medicines.stimulator");case o.b.FORAGE:return t("medicalFeed");case o.b.VACCINE:return t("newSettings.dictionary.medicines.vaccine");case o.b.DOSATRON:return t("dosatron")}},this.onAddClick=()=>{this.props.show(p.a,{})}}render(){const{medicines:e,t:t}=this.props,a=[{name:t("designation"),field:"WData.Name",_mobileHeader:!0},{name:t("dosage"),field:"WData",valueFormatter:this.doseValueFormatter},{name:t("newSettings.dictionary.medicines.gracePeriod"),field:"WData.GracePeriod"},{name:t("price"),field:"WData.Price"},{name:t("newSettings.dictionary.medicines.type"),field:"WData.Type",valueFormatter:this.typeValueFormatter},{name:t("newSettings.dictionary.medicines.color"),field:"WData.Color",component:e=>s.a.createElement("div",{style:{background:e.value||"#fff",height:"100%"}}),_mobileHide:!0},{name:"",component:s.a.createElement(f,null),headerClassName:"index",itemClassName:"index",_floating:!0},{name:"",component:s.a.createElement(O,null),headerClassName:"index",itemClassName:"index",_floating:!0}];return s.a.createElement(r.a,null,s.a.createElement(c.a,{data:e,headers:a,shouldIndex:!0,mobileRow:s.a.createElement(N.a,null)}),s.a.createElement(l.a,{fixed:!0},s.a.createElement(m.a,{buttonStyle:"round",buttonColor:"success",icon:s.a.createElement("i",{className:"fas fa-plus"}),onClick:this.onAddClick})),s.a.createElement(p.b,null))}}w=Object(i.connect)(e=>({medicines:e.dictionary.medicine}),e=>Object(d.b)({show:u.d},e))(w);t.a=Object(E.a)()(w)},VROb:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("y4iu"),i=a("d/v1"),c=a("pJVQ"),o=a("tDQA"),l=a("VyNe"),m=a("3Z9Z"),d=a("JI6e"),u=a("IXwn"),p=a("uSQv"),g=a("/MKj"),f=a("lAGl"),h=(a("IM74"),a("P0Qa")),b=a("gLBR"),E=a("2UNB");var S=a("LCzB");class v extends s.a.Component{constructor(e){super(e);const{notifications:t}=e;t&&t.SetData.General?this.props.initialize(t.SetData.General):this.props.initialize({Weekdays:[!0,!0,!0,!0,!0,!0,!0],Time:["00:00","23:59"]})}changeWeekDays(e){let t=this.props.weekdays.slice(0);t[e]=!t[e],this.props.change("Weekdays",t)}weekdaysContainsWeekDay(e){return this.props.weekdays&&this.props.weekdays[e]}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement(l.a,{className:"general-notifications"},s.a.createElement(m.a,{className:"justify-content-center"},s.a.createElement(d.a,{lg:6},s.a.createElement("span",null,t("newSettings.notifications.general.weekdays")),s.a.createElement("div",{className:"d-flex justify-content-center"},s.a.createElement(u.a,null,s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(0),buttonColor:this.weekdaysContainsWeekDay(0)?"success":""},t("newSettings.notifications.general.monday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(1),buttonColor:this.weekdaysContainsWeekDay(1)?"success":""},t("newSettings.notifications.general.tuesday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(2),buttonColor:this.weekdaysContainsWeekDay(2)?"success":""},t("newSettings.notifications.general.wednesday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(3),buttonColor:this.weekdaysContainsWeekDay(3)?"success":""},t("newSettings.notifications.general.thursday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(4),buttonColor:this.weekdaysContainsWeekDay(4)?"success":""},t("newSettings.notifications.general.friday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(5),buttonColor:this.weekdaysContainsWeekDay(5)?"success":""},t("newSettings.notifications.general.saturday")),s.a.createElement(p.a,{type:"button",onClick:()=>this.changeWeekDays(6),buttonColor:this.weekdaysContainsWeekDay(6)?"success":""},t("newSettings.notifications.general.sunday")))),s.a.createElement("span",null,t("newSettings.notifications.general.time")),s.a.createElement("div",{className:"general-notifications-time"},s.a.createElement("div",{className:"general-notifications-time-picker"},s.a.createElement(i.a,{name:"Time[0]",component:f.a,type:"time"})),s.a.createElement("div",{className:"general-notifications-time-separator"},"-"),s.a.createElement("div",{className:"general-notifications-time-picker"},s.a.createElement(i.a,{name:"Time[1]",component:f.a,type:"time"})))))))}}v=Object(c.a)({form:"general-notifications",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.General=e,a.setDtaModTime(),t(Object(b.c)(a))}else{let a=E.a.createSetting(h.a.NOTIFICATIONS,{General:e},s);delete a.FarmID,t(Object(b.a)(a))}}})(v);const D=Object(o.a)("general-notifications");v=Object(g.connect)(e=>({notifications:e.settings.notifications,user:e.user.user,weekdays:D(e,"Weekdays")}))(v);t.a=Object(S.a)()(v)},"W7+E":function(e,t,a){"use strict";var n=a("J2iB"),s=a.n(n),r=a("lFKM"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("/MKj"),m=a("mwIZ"),d=a.n(m),u=a("3Z9Z"),p=a("JI6e"),g=a("wQmL"),f=a("d/v1"),h=a("pJVQ"),b=a("tDQA"),E=a("VyNe"),S=a("y4iu"),v=a("26mJ"),D=a("4huo"),y=a("6/k7"),O=a("15cA"),N=a("nGfT"),w=a("y6dH"),C=a("zDJl"),I=a("vzZS"),j=a("VfnB"),T=a("LCzB"),A=a("XzT5");function F(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function x(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function P(){return(P=Object.assign||function(e){for(var t=1;t{const{dispatch:t}=this.props;t(Object(g.a)(R,"repetitionType",e))},this.curveDescriptions=({t:e}=this.props)=>({[y.b.PARTURITION]:[{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".before.name")),type:y.a.BEFORE,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".before.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".before.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".before.compatibility"))]},{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".both.name")),type:y.a.BOTH,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".both.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".both.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".both.compatibility"))]},{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".after.name")),type:y.a.AFTER,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".after.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".after.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.PARTURITION,".after.compatibility"))]}],[y.b.MATING]:[{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".before.name")),type:y.a.BEFORE,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".before.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".before.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".before.compatibility"))]},{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".both.name")),type:y.a.BOTH,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".both.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".both.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".both.compatibility"))]},{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".after.name")),type:y.a.AFTER,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".after.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".after.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.MATING,".after.compatibility"))]}],[y.b.INDIVIDUAL]:[{header:e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.INDIVIDUAL,".normal.name")),type:y.a.NORMAL,img:N.a,info:[e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.INDIVIDUAL,".normal.desc1")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.INDIVIDUAL,".normal.legend")),e("newSettings.feeding.curves.curveDescriptions.".concat(y.b.INDIVIDUAL,".normal.compatibility"))]}]}),this.renderCard=({type:e,header:t,img:a,info:n=[]})=>{const{index:s,repetitionType:r,devices:i}=this.props,c=s>4&&Object(j.s)(i,C.d.DISPENSER),l=Object.keys(k).map(t=>(console.log("DEVTYPE",t),c&&t===C.d.DISPENSER||!Object(j.s)(i,t)||Object(O.l)({devType:t,index:s,showingType:e})?null:k[t])).filter(e=>!!e).join(", ");return o.a.createElement(E.a,{onClick:()=>this.repetitionTypeChange(e),selected:r===e},o.a.createElement(u.a,null,o.a.createElement(p.a,{xs:12},!!l&&o.a.createElement(I.a,{boxColor:"warning"},A.a.t("newSettings.feeding.curves.editBasics.compatibilityIssueWithX",{type:l}))),o.a.createElement(p.a,{md:4},o.a.createElement(w.a,{src:a})),o.a.createElement(p.a,{md:8},o.a.createElement("h5",null,t),o.a.createElement("small",null,n.map((e,t)=>o.a.createElement("p",{className:"opacity-".concat(100-25*t)},e))))))};const{dispatch:t,defaultValue:a,keptValues:n}=this.props,r=n.curveType||Object.values(y.b).includes(d()(a,"SetData.Type",""))?d()(a,"SetData.Type",""):y.b.INDIVIDUAL;t(Object(g.c)(R,{curveName:n.curveName||d()(a,"SetData.Name",""),curveType:r,repetitionType:s()(n.repetitionType)?Object(O.f)(a):n.repetitionType}))}componentDidUpdate(e,t,a){const{curveType:n,dispatch:s,initialized:r}=this.props;r&&e.initialized&&n!==e.curveType&&s(Object(g.a)(R,"repetitionType",Object(O.f)({SetData:{Type:n}})))}render(){const{handleSubmit:e,t:t,curveType:a,devices:n,index:s}=this.props,r=s>4&&Object(j.s)(n,C.d.DISPENSER),i=Object.values(y.b).map(e=>({name:t("curves.".concat(e)),value:e})),c=this.curveDescriptions();return o.a.createElement(E.a,{className:R},o.a.createElement(S.a,P({},this.props,{handleSubmit:e,icon:o.a.createElement("i",{className:"fas fa-arrow-right"})}),o.a.createElement(u.a,{className:"justify-content-center"},o.a.createElement(p.a,{md:6},r&&o.a.createElement(I.a,{boxColor:"warning"},A.a.t("newSettings.feeding.curves.editBasics.compatibilityIssueWithCurveIndex",{dispenser:k[C.d.DISPENSER],type1:1,type2:5})),o.a.createElement(f.a,{name:"curveName",id:"curveName",type:"text",required:!0,component:v.a,label:t("newSettings.feeding.curves.editBasics.curveName")}),o.a.createElement(f.a,{name:"curveType",id:"curveType",component:D.b,required:!0,label:t("newSettings.feeding.curves.editBasics.curveType"),options:i}))),o.a.createElement(u.a,{className:"justify-content-center"},o.a.createElement(p.a,{md:6},!!a&&o.a.createElement(o.a.Fragment,null,(c[a]||[]).map(e=>this.renderCard(e)))))))}}_=Object(h.a)({form:R,onSubmit:function(e,t,a){const{data:n,onNextPage:s}=a,{curveName:r,curveType:i,repetitionType:c=y.a.NORMAL}=e;s(1,function(e){for(var t=1;t({farm:e.location.farm,curveType:M(e,"curveType"),repetitionType:M(e,"repetitionType"),devices:e.farmDevices.devices}))(_);var B=Object(T.a)()(_),L=a("TYy9"),V=a.n(L),z=a("BkRI"),U=a.n(z),W=a("3t43"),q=a("17x9"),H=a.n(q),G=a("XoCd"),J=a("uSQv"),Y=a("pxzG"),Z=a("q17X"),Q=a("P0Qa"),K=a("ZRKa"),X=a("s506"),$=a("0gjr"),ee=a("84Ez");function te(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ae(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function ne(){return(ne=Object.assign||function(e){for(var t=1;t{const{index:s,t:r,farm:i,data:{curveType:c,repetitionType:l},hasWST:m,defaultValue:g,license:h}=this.props,b=m&&Object(O.l)({devType:C.d.DISPENSER,showingType:l,index:s,curve:g});let S=[],N=[];const w=Math.min(b?2:$.a.FEEDING_FORAGE_EXTENDED,h===X.b.EXTENDED?$.a.FEEDING_FORAGE_EXTENDED:$.a.FEEDING_FORAGE_BASIC),I=Math.min(b?5:$.a.FEEDING_SCHEDULE_EXTENDED,h===X.b.EXTENDED?$.a.FEEDING_SCHEDULE_EXTENDED:$.a.FEEDING_SCHEDULE_BASIC);for(let o=0;oK.a.getSettingByIndexAndType(o,Q.a.FEEDING_FORAGE,i).SetData.Name,o+1),value:o});for(let o=0;oK.a.getSettingByIndexAndType(o,Q.a.FEEDING_SCHEDULE,i).SetData.Name,o+1),value:o});let j=0;e.forEach((t,a)=>{j+=e.get(a).days||0});let T=150-j;T=T<0?0:T;let F=0;e.forEach((t,a)=>{let n=e.get(a);F+=d()(n,"days",0)||0});let x=1,P=Object(Z.getFeedingUnit)();return o.a.createElement("div",null,e.map((t,a)=>{let n=e.get(a),s=n.name,i=x,m=x+n.days-1;l===y.a.BEFORE?(i=i-1-F,m=m-1-F):c===y.a.AFTER?(i--,m--):y.a.BOTH,x+=n.days;const d=1!==n.days;return o.a.createElement(E.a,null,o.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center"},A.a.t("newSettings.feeding.curves.editDays.dayNameSB",{type1:s,type2:m!==i?A.a.t("newSettings.feeding.curves.editDays.dayFromTo",{type1:i,type2:m}):i}),o.a.createElement(J.a,{onClick:()=>e.length>1&&e.remove(a),type:"button",buttonStyle:"round",className:"text",icon:o.a.createElement("i",{className:"fas fa-trash"})})),o.a.createElement(u.a,null,o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"".concat(t,".name"),id:"".concat(t,".name"),label:r("newSettings.feeding.curves.editDays.stageName"),type:"text",component:v.a})),o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"".concat(t,".plan"),id:"".concat(t,".plan"),options:N,label:r("newSettings.feeding.curves.editDays.plan"),component:D.b,clearButton:!1})),o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"".concat(t,".forage"),id:"".concat(t,".forage"),options:S,label:r("forage"),component:D.b,clearButton:!1}))),o.a.createElement(u.a,null,o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"".concat(t,".days"),id:"".concat(t,".days"),min:1,max:T+n.days,valueFormatter:e=>e?A.a.t("newSettings.feeding.curves.editDays.days",{count:e}):"-",label:r("newSettings.feeding.curves.editDays.stageDays"),component:G.a})),o.a.createElement(p.a,{md:d?4:8},o.a.createElement(f.a,{name:"".concat(t,".startingAmount"),id:"".concat(t,".startingAmount"),min:100,max:12e3,step:100,valueFormatter:e=>Object(Y.j)(e,{showUnit:!0,unit:P,fixed:P?2:0}),label:r(d?"newSettings.feeding.curves.editDays.startingDose":"dosage"),component:G.a})),d&&o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"".concat(t,".endingAmount"),id:"".concat(t,".endingAmount"),min:100,max:12e3,step:100,valueFormatter:e=>Object(Y.j)(e,{showUnit:!0,unit:P,fixed:P?2:0}),label:r("newSettings.feeding.curves.editDays.finishingDose"),component:G.a}))))}),!!T&&o.a.createElement(E.a,null,o.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center",onClick:()=>e.push(this.createNextStage(this.props))},r("newSettings.feeding.curves.editDays.addNextStage")," ",o.a.createElement("i",{className:"fas fa-plus"}))))},this.renderStages=this.renderStages.bind(this),this.createNextStage=this.createNextStage.bind(this);const{dispatch:t,defaultValue:a,keptValues:n,data:{repetitionType:s}={}}=this.props,r=s===y.a.BOTH?n.repetitionDay||d()(a,"SetData.InseminationJumpTo",0):void 0;let i=n.stages||Object(O.j)(d()(a,"SetData.Days",[]),d()(a,"SetData.Stages",[]));t(Object(g.c)(se,{stages:i.length?i:[this.createNextStage(this.props)],repetitionDay:r}))}createNextStage(e){const{stages:t}=e;let a=d()(t,"length",0);return{name:A.a.t("newSettings.feeding.curves.editDays.stageNameSB",{type:a+1||1}),startingAmount:a?t[a-1].endingAmount:1e3,endingAmount:a?t[a-1].endingAmount:1e3,days:1,forage:a?t[a-1].forage:0,plan:a?t[a-1].plan:0}}getName(e,t){try{return"".concat(t," - ").concat(e())}catch(a){return t}}render(){const{handleSubmit:e,onPrevPage:t,stages:a,t:n,data:{repetitionType:s,curveType:r}={}}=this.props,i=r===y.b.PARTURITION?n("parturitionDate"):r===y.b.MATING?n("inseminationDay"):"?";return o.a.createElement("div",{className:"".concat(se," overflow-hidden")},o.a.createElement(S.a,ne({},this.props,{optionalButtons:o.a.createElement(J.a,{buttonStyle:"round",type:"button",onClick:()=>t(0,{stages:a}),icon:o.a.createElement("i",{className:"fas fa-arrow-left"}),buttonColor:"secondary"}),handleSubmit:e,icon:o.a.createElement("i",{className:"fas fa-arrow-right"})}),o.a.createElement(u.a,{className:"justify-content-center"},o.a.createElement(p.a,{md:12},s===y.a.BOTH&&o.a.createElement("div",null,o.a.createElement(E.a,null,o.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center"},i),o.a.createElement(u.a,null,o.a.createElement(p.a,{md:4},o.a.createElement(f.a,{name:"repetitionDay",id:"repetitionDay",min:1,max:(a||[]).reduce((e,t)=>e+t.days,0),label:i,component:G.a}))))),o.a.createElement(W.a,{name:"stages",component:this.renderStages,rerenderOnEveryChange:!0})))))}}re.propTypes={data:H.a.shape({curveName:H.a.string.isRequired,curveType:H.a.string.isRequired,daysNumber:H.a.number.isRequired,repetitionType:H.a.number.isRequired}),defaultValue:H.a.object},re=Object(h.a)({form:se,onSubmit:function(e,t,a){const{data:n,onNextPage:s,defaultValue:r}=a,{stages:i,repetitionDay:c}=e;console.log(e,a);let o=U()(n),l=[],m=1,u=U()(i).map(e=>{l.push({name:e.name,start:m});let t=[];for(let a=0;a49?100-n%100:-n%100)})}return m+=e.days,t});o=function(e){for(var t=1;t{const t={};return i()(+e.forage)&&+e.forage>1&&(t.forage=A.a.t("newSettings.feeding.curves.editDays.selectedForageNotValid",{type:"F1"})),i()(+e.plan)&&+e.plan>4&&(t.plan=A.a.t("newSettings.feeding.curves.editDays.selectedPlanNotValid",{type:"F1"})),t})),a.stages=r,a},validate:function(e,t){const a={},{t:n}=t,{stages:s}=e;let r=[];return s?r=s.map(e=>{const t={};return(!+e.startingAmount||+e.startingAmount<50)&&(t.startingAmount=n("required")),(!+e.endingAmount||+e.endingAmount<50)&&(t.endingAmount=n("required")),i()(+e.forage)||(t.forage=n("required")),i()(+e.plan)||(t.plan=n("required")),e.name||(t.name=n("required")),t}):a.stages=n("required"),a.stages=r,a}})(re);const ie=Object(b.a)(se);re=Object(l.connect)(e=>({stages:ie(e,"stages"),farm:e.location.farm,hasWST:Object(j.s)(e.farmDevices.devices,C.d.DISPENSER),license:Object(ee.a)(e,{licenseName:X.a.DISPENSER})}))(re);var ce=Object(T.a)()(re),oe=a("AF5L"),le=a("Ty5D"),me=a("2UNB"),de=a("AAik"),ue=a("G7tO"),pe=a("eASP"),ge=a("S8cm");function fe(){return(fe=Object.assign||function(e){for(var t=1;t{const{dispatch:t,curvePreview:a}=this.props,n=U()(a);n[e].notify=!n[e].notify,t(Object(g.a)(he,"curvePreview",n))};const{dispatch:t,data:{days:a,curveType:n,repetitionType:s,repetitionDay:r}}=this.props,i=s===y.a.BOTH?r:s===y.a.AFTER?255:0,c=U()(a).map((e,t)=>({day:Object(O.d)(t+1,{SetData:{Days:a,InseminationJumpTo:i,Type:n}}),amount:e.amount,notify:e.notify,repetition:i===t+1}));t(Object(g.c)(he,{curvePreview:c}))}render(){const{handleSubmit:e,curvePreview:t,data:{curveType:a},updating:n,adding:s,t:r,onPrevPage:i}=this.props;let c=Object(Z.getFeedingUnit)();const l=[{name:r("day"),field:"day"},{name:r("forageAmount"),field:"amount",valueFormatter:e=>Object(Y.j)(e,{showUnit:!0,unit:c,fixed:c?2:0})},{name:r("newSettings.feeding.curves.editSpecialDays.conditionCheckDay"),field:"notify",component:({index:e,value:t})=>o.a.createElement(ge.a,{onChange:()=>this.toggleConditionDay(e),checked:t})}].filter(e=>e),m=[{color:"green",dataKey:"amount",name:r("forageAmount"),unit:Object(Y.l)("weight",pe.a.MEDIUM),valueConverter:e=>Object(Y.j)(e,{showUnit:!1,unit:c,fixed:c?2:0})}];return o.a.createElement(E.a,{className:he},o.a.createElement(S.a,fe({},this.props,{optionalButtons:o.a.createElement(J.a,{buttonStyle:"round",type:"button",onClick:()=>i(1),icon:o.a.createElement("i",{className:"fas fa-arrow-left"}),buttonColor:"secondary"}),handleSubmit:e,submitting:n||s}),o.a.createElement(u.a,{className:"justify-content-center"},o.a.createElement(p.a,{md:12},o.a.createElement("div",{style:{height:"20rem"}},o.a.createElement(ue.a,{dataDef:m,data:t||[],tooltipLabelFormatter:e=>"".concat(r("curveDay")," ").concat(e),Yaxis:{name:r("dosage")},Xaxis:{name:r("curveDay"),dataKey:"day"},referenceLines:[y.d.includes(a)?{x:"0",color:"blue",name:r("parturitionDate")}:null,y.c.includes(a)?{x:"0",color:"blue",name:r("inseminationDay")}:null].filter(e=>e),saveAsExcell:"curve"})),o.a.createElement(de.a,{data:t||[],headers:l})))))}}be.propTypes={data:H.a.shape({curveName:H.a.string.isRequired,curveType:H.a.string.isRequired,daysNumber:H.a.number.isRequired,days:H.a.array.isRequired}),defaultValue:H.a.object},be=Object(h.a)({form:he,onSubmit:(e,t,a)=>{const{curvePreview:n,data:{days:s,stages:r,curveType:i,curveName:c,repetitionDay:o,repetitionType:l},defaultValue:m,index:u,gateways:p}=U()(a);let g=s.map((e,t)=>({ForageAmount:e.amount,DailyPlan:e.plan,ForageType:e.forage,Notify:!!d()(n,"[".concat(t,"].notify"))})),f=r.map((e,t)=>({StartDay:e.start,Name:e.name}));const h=l===y.a.BOTH?o:l===y.a.AFTER?255:0;let b=me.a.createSetting(Q.a.FEEDING_CURVE,{InseminationJumpTo:h,ParturitionJumpTo:0,Days:g,Index:u,Stages:f||[],Type:i,Name:c});m&&(b.SetID=m.SetID,b.DtaModTime=+new Date);for(let d=0;d({})})(be);const Ee=Object(b.a)(he);be=Object(l.connect)(e=>({updating:e.settings.updating,adding:e.settings.adding,curvePreview:Ee(e,"curvePreview"),stages:Ee(e,"stages"),gateways:e.farmDevices.devices.filter(e=>e.DevType===C.d.GATEWAY),farm:e.location.farm}))(be);be=Object(T.a)()(be);var Se=Object(le.o)(be),ve=a("2wEF"),De=a("qx5e"),ye=a("BbMY"),Oe=a("erjJ"),Ne=a("mr+a");function we(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ce(e){for(var t=1;t{this.setState(n=>({data:t,active:e,keptValues:Ce({},n.keptValues,{},a)}))},this.onPrevPage=(e,t={})=>{this.setState(a=>({active:e,keptValues:Ce({},a.keptValues,{},t)}))},this.state={active:0,keptValues:{}}}render(){const{active:e,data:t,keptValues:a}=this.state,{match:{params:{index:n}},license:r,t:c,curves:l}=this.props;let m=i()(+n)?+n:null;const d=l.find(e=>e.SetData.Index===m),u=r===X.b.EXTENDED?$.a.FEEDING_CURVE_EXTENDED:$.a.FEEDING_CURVE_BASIC;return s()(m)||m<0||m>=u?o.a.createElement(ve.a,null):o.a.createElement(o.a.Fragment,null,o.a.createElement(ye.a,{activeStep:e+1,onClickStep:e=>this.onPrevPage(e-1)},o.a.createElement(o.a.Fragment,null,o.a.createElement(Oe.a,{label:c("general")}),o.a.createElement(Oe.a,{label:c("newSettings.feeding.curves.editDays.header")}),o.a.createElement(Oe.a,{label:c("summary")}))),0===e&&o.a.createElement(B,{index:m,defaultValue:d,keptValues:a,onNextPage:this.onNextPage}),1===e&&o.a.createElement(ce,{index:m,data:t,defaultValue:d,keptValues:a,onNextPage:this.onNextPage,onPrevPage:this.onPrevPage}),2===e&&o.a.createElement(Se,{index:m,defaultValue:d,keptValues:a,data:t,onPrevPage:this.onPrevPage}))}}je=Object(l.connect)(e=>({farm:e.location.farm,license:Object(ee.a)(e,{licenseName:X.a.DISPENSER}),curves:Object(Ne.c)(e)}))(je);je=Object(T.a)()(je),je=Object(le.o)(je);t.a=Object(De.a)({roles:[X.c._DEVICE_CONFIG],clientPackage:{[X.a.DISPENSER]:X.b.BASIC},showComponent:!0})(je)},WUlb:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("d/v1"),i=a("pJVQ"),c=a("VyNe"),o=a("3Z9Z"),l=a("JI6e"),m=a("4huo"),d=a("26mJ"),u=a("/MKj"),p=a("zDJl"),g=a("IXwn"),f=a("uSQv"),h=a("AF5L");var b=a("LCzB");class E extends s.a.Component{render(){const{devices:e,handleSubmit:t,t:a}=this.props;return s.a.createElement(c.a,null,s.a.createElement(o.a,{className:"justify-content-center"},s.a.createElement(l.a,{lg:6},s.a.createElement("form",{onSubmit:t},s.a.createElement(r.a,{name:"gateway",component:m.b,label:a("newSettings.devices.openSSH.gateway"),options:e.filter(e=>e.DevType===p.d.GATEWAY).map(e=>({name:e.Name,value:e}))}),s.a.createElement(r.a,{name:"port",component:d.a,label:a("newSettings.devices.openSSH.port"),type:"number",parse:e=>e?+e:null}),s.a.createElement(g.a,{fixed:!0,renderInPortal:!1},s.a.createElement(f.a,{buttonStyle:"round",buttonColor:"success",icon:s.a.createElement("i",{className:"fas fa-paper-plane"})}))))))}}E=Object(i.a)({form:"open-ssh",onSubmit:function(e,t,a){Object(h.m)(e.gateway,e.port)},validate:function(e,t){const a={},{t:n}=t;return e.gateway||(a.gateway=n("required")),e.port||(a.port=n("required")),a}})(E),E=Object(u.connect)(e=>({devices:e.farmDevices.devices}))(E);t.a=Object(b.a)()(E)},Wuxo:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("3Z9Z"),c=a("JI6e"),o=a("HIda"),l=a("d/v1"),m=a("pJVQ"),d=a("w2lk"),u=a("/MKj"),p=a("P0Qa"),g=a("gLBR"),f=a("2UNB");var h=a("+oSd"),b=a("LCzB"),E=a("XzT5");class S extends s.a.Component{constructor(e){super(e);const{notifications:t}=this.props;t&&t.SetData.Cage?this.props.initialize(t.SetData.Cage):this.props.initialize({Info:{Manual:!0,Training1:!0,Training2:!0,Training3:!0,Training4:!0,Separation:!0,Expedition:!0,Expedition25:!0,Expedition50:!0,Expedition75:!0,Expedition100:!0,Separation100:!0},Warning:{MarkerLow:!0},Error:{Entrance:!0,Middle:!0,Left:!0,Right:!0,Manual:!0,Training1:!0,Training2:!0,Training3:!0,Training4:!0,Separation:!0,Expedition:!0}})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(h.a,{handleSubmit:e},s.a.createElement(r.a,null,s.a.createElement(o.a,{name:"Info"},s.a.createElement("h4",null,t("newSettings.notifications.cage.info"),s.a.createElement("i",{className:"fas fa-info-circle"})),s.a.createElement(i.a,null,s.a.createElement(c.a,{lg:4},"Zmiana trybu pracy"),s.a.createElement(c.a,{lg:8,className:"notification-settings-right"},s.a.createElement(l.a,{name:"Manual",component:d.a,label:t("newSettings.notifications.cage.manual"),id:"Manual"}),s.a.createElement(l.a,{name:"Training1",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:1}),id:"Training1"}),s.a.createElement(l.a,{name:"Training2",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:2}),id:"Training2"}),s.a.createElement(l.a,{name:"Training3",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:3}),id:"Training3"}),s.a.createElement(l.a,{name:"Training4",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:4}),id:"Training4"}),s.a.createElement(l.a,{name:"Separation",component:d.a,label:t("newSettings.notifications.cage.separation"),id:"Separation"}),s.a.createElement(l.a,{name:"Expedition",component:d.a,label:t("newSettings.notifications.cage.expedition"),id:"Expedition"}))),s.a.createElement(i.a,null,s.a.createElement(c.a,{lg:4},t("newSettings.notifications.cage.expeditionPercent")),s.a.createElement(c.a,{lg:8,className:"notification-settings-right"},s.a.createElement(l.a,{name:"Expedition25",component:d.a,label:"25%",id:"Expedition25"}),s.a.createElement(l.a,{name:"Expedition50",component:d.a,label:"50%",id:"Expedition50"}),s.a.createElement(l.a,{name:"Expedition75",component:d.a,label:"75%",id:"Expedition75"}),s.a.createElement(l.a,{name:"Expedition100",component:d.a,label:"100%",id:"Expedition100"}))))),s.a.createElement(r.a,null,s.a.createElement(o.a,{name:"Error"},s.a.createElement("h4",null,t("newSettings.notifications.cage.errors"),s.a.createElement("i",{className:"fas fa-exclamation-circle"})),s.a.createElement(i.a,null,s.a.createElement(c.a,{lg:4},t("newSettings.notifications.cage.doorErrors")),s.a.createElement(c.a,{lg:8,className:"notification-settings-right"},s.a.createElement(l.a,{name:"Entrance",component:d.a,label:t("newSettings.notifications.cage.entrance"),id:"Entrance"}),s.a.createElement(l.a,{name:"Middle",component:d.a,label:t("newSettings.notifications.cage.middle"),id:"Middle"}),s.a.createElement(l.a,{name:"Left",component:d.a,label:t("left"),id:"Left"}),s.a.createElement(l.a,{name:"Right",component:d.a,label:t("right"),id:"Right"}))),s.a.createElement(i.a,null,s.a.createElement(c.a,{lg:4},t("worktype")),s.a.createElement(c.a,{lg:8,className:"notification-settings-right"},s.a.createElement(l.a,{name:"Manual",component:d.a,label:t("newSettings.notifications.cage.manual"),id:"ManualError"}),s.a.createElement(l.a,{name:"Training1",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:1}),id:"Training1Error"}),s.a.createElement(l.a,{name:"Training2",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:2}),id:"Training2Error"}),s.a.createElement(l.a,{name:"Training3",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:3}),id:"Training3Error"}),s.a.createElement(l.a,{name:"Training4",component:d.a,label:E.a.t("newSettings.notifications.cage.training",{count:4}),id:"Training4Error"}),s.a.createElement(l.a,{name:"Separation",component:d.a,label:t("newSettings.notifications.cage.separation"),id:"SeparationError"}),s.a.createElement(l.a,{name:"Expedition",component:d.a,label:t("newSettings.notifications.cage.expedition"),id:"ExpeditionError"}))))))}}S=Object(m.a)({form:"notification-settings",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.Cage=e,a.setDtaModTime(),t(Object(g.c)(a))}else{let a=f.a.createSetting(p.a.NOTIFICATIONS,{Cage:e},s);delete a.FarmID,t(Object(g.a)(a))}}})(S),S=Object(u.connect)(e=>({notifications:e.settings.notifications,user:e.user.user}))(S);t.a=Object(b.a)()(S)},Yavi:function(e,t,a){"use strict";var n=a("lSCD"),s=a.n(n),r=a("Y+p1"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("VyNe"),m=a("d/v1"),d=a("pJVQ"),u=a("tDQA"),p=a("3Z9Z"),g=a("JI6e"),f=a("4huo"),h=a("/MKj"),b=a("zDJl"),E=a("AF5L");var S=a("IXwn"),v=a("uSQv"),D=a("LCzB"),y=a("/kok"),O=a("vzZS");class N extends o.a.Component{constructor(...e){super(...e),this.state={waitingForState:!1},this.lastMessage=null,this.onGetShadowSuccess=e=>{e.MsgId===this.lastMessage&&this.setState({waitingForState:!1,error:!1})},this.onGetShadowFailure=(e,t)=>{t.MsgId===this.lastMessage&&this.setState({waitingForState:!1,error:!0})}}componentDidUpdate(e,t,a){if(!i()(this.props.currentDevice,e.currentDevice)){const{user:{ClientID:t,LocalUserID:a}}=this.props;e.currentDevice&&y.a.stopSendingDeviceState(t,a,e.currentDevice.GatewayID,[e.currentDevice.DevID]),this.lastMessage=y.a.startSendingDeviceState(this.props.currentDevice,this.onGetShadowSuccess,this.onGetShadowFailure),this.setState({waitingForState:!0})}}componentWillUnmount(){this.props.startedAddressing&&this.props.handleSubmit()}render(){const{waitingForState:e,error:t}=this.state,{handleSubmit:a,devices:n,isSubAddressing:r,t:i}=this.props;let c=n.filter(e=>e.DevType===b.d.DISPENSER_NRF_MULTI).map(e=>({name:s()(e.getSelectName)?e.getSelectName():e.Name,value:e}));return o.a.createElement(l.a,null,o.a.createElement("form",{onSubmit:a},o.a.createElement(p.a,{className:"justify-content-center"},o.a.createElement(g.a,{lg:6},t&&o.a.createElement(O.a,null,i("newSettings.devices.form.error")),o.a.createElement(m.a,{name:"device",component:f.b,label:i("device"),options:c}))),o.a.createElement(S.a,{fixed:!0,renderInPortal:!1},o.a.createElement(v.a,{buttonStyle:"round",buttonColor:r?"error":"success",icon:r?o.a.createElement("i",{className:"fas fa-stop"}):o.a.createElement("i",{className:"fas fa-paper-plane"}),disabled:e||t}))))}}N=Object(d.a)({form:"subaddressing",onSubmit:function(e,t,a){console.log(e);const{isSubAddressing:n}=a,{device:s}=e;n?Object(E.A)(s,!1):Object(E.A)(s,!0)},validate:function(e,t){const a={};return e.device||(a.device=t.t("required")),a}})(N);const w=Object(u.a)("subaddressing");N=Object(h.connect)(e=>{let t=w(e,"device"),a=!1;if(t){let n=e.shadows.shadows.get(t.DevID);n&&(a=n.subaddressingState||!1)}return{devices:e.farmDevices.devices,user:e.user.user,currentDevice:t,isSubAddressing:a}})(N);t.a=Object(D.a)()(N)},ZJCK:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=(a("+wLG"),a("ANjH")),i=a("LCzB"),c=a("f0zD"),o=a("/MKj"),l=a("/U+v"),m=a("Ty5D");function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function u(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class p extends n.Component{componentDidMount(){const{dispatch:e,logout:t,history:a}=this.props;t?setTimeout(()=>{e(Object(c.d)(l.a,{counter:10}))},2e3):setTimeout(()=>{a.replace({pathname:"/farmSettings/billing",state:{forceFetch:!0}})},2e3)}render(){const{t:e}=this.props;return s.a.createElement(s.a.Fragment,null,s.a.createElement("div",{className:"f-modal-alert"},s.a.createElement("div",{className:"f-modal-icon f-modal-success animate"},s.a.createElement("span",{className:"f-modal-line f-modal-tip animateSuccessTip"}),s.a.createElement("span",{className:"f-modal-line f-modal-long animateSuccessLong"}),s.a.createElement("div",{className:"f-modal-placeholder"}),s.a.createElement("div",{className:"f-modal-fix"})),s.a.createElement("p",{className:"successMsg"},e("success")),s.a.createElement("p",{className:"successRest"},e("subscriptions.summary.message"))))}}t.a=Object(r.d)(Object(i.a)(),m.o,Object(o.connect)((function(e){return function(e){for(var t=1;tObject(D.a)(e)}render(){const{handleSubmit:e,t:t,error:a}=this.props;return s.a.createElement(v.a,{className:T},s.a.createElement(b.a,C({},this.props,{handleSubmit:e}),s.a.createElement(r.a,{className:"justify-content-center"},s.a.createElement(i.a,{md:6},!!a&&s.a.createElement(S.a,{boxColor:"error"},this.messageMap(a)),s.a.createElement(o.a,{name:"passwordOld",id:"passwordOld",type:"password",component:E.a,label:t("login.password")}),s.a.createElement(o.a,{name:"password",id:"password",type:"password",component:E.a,label:t("newPassword")}),s.a.createElement(o.a,{name:"passwordConfirmation",type:"password",id:"passwordConfirmation",component:E.a,label:t("newSettings.profile.changePasswordView.passwordConfirmation")})))),s.a.createElement(h.b,{handleHide:O.b,counter:5,action:N.b,title:t("modals.logoutModal.title"),text:"modals.logoutModal.text",confirmButtonText:t("logout")}))}}t.a=Object(w.d)(Object(y.a)(),Object(m.connect)((function(e){return{error:A(e,"error"),farm:e.location.farm}}),(function(e){return function(e){for(var t=1;td.a.changePassword(e,s,n)).then(e=>(t(Object(g.addNotification)({id:Object(f.a)(),title:p.a.t("popNotifications.changePassword"),message:p.a.t("popNotifications.changePasswordSuccess"),status:"success",dismissible:!0,dismissAfter:5e3})),r(h.a),e)).catch(e=>{throw console.error(e),t(Object(g.addNotification)({id:Object(f.a)(),title:p.a.t("popNotifications.changePassword"),message:p.a.t("popNotifications.changePasswordFailure"),status:"error",dismissible:!0,dismissAfter:15e3})),new u.a({_error:e.message})})},validate:function(e,t){const a={},{password:n,passwordConfirmation:s,passwordOld:r}=e,{t:i}=t;return r||(a.passwordOld=i("required")),n!==s&&(a.passwordConfirmation=i("required")),n?n.length<6&&(a.password=p.a.t("errors.shouldBeAtleastXLong",{amount:6})):a.password=i("required"),a}}))(F)},Zpnk:function(e,t,a){"use strict";var n=a("Y+p1"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("VyNe"),o=a("d/v1"),l=a("pJVQ"),m=a("tDQA"),d=a("vYJ8"),u=a("3Z9Z"),p=a("JI6e"),g=a("4huo"),f=a("26mJ"),h=a("/MKj"),b=a("zDJl"),E=a("AF5L");var S=a("IXwn"),v=a("uSQv"),D=a("vzZS"),y=a("LCzB"),O=a("XzT5");class N extends i.a.Component{constructor(e){super(e),this.props.initialize({amount:1}),this.state={startedAddressing:!1}}UNSAFE_componentWillReceiveProps(e,t){this.props.startedAddressing!==e.startedAddressing&&e.startedAddressing&&this.setState({startedAddressing:!0}),s()(this.props.addressing,e.addressing)||e.addressing.howManyAdressed===e.addressing.toAddress&&setTimeout(()=>{this.props.dispatch({type:"CHANGE_ADDRESSING",payload:{state:!1}}),this.setState({startedAddressing:!1})},5e3)}componentWillUnmount(){this.props.startedAddressing&&this.props.handleSubmit()}render(){const{devices:e,handleSubmit:t,t:a,protocol:n,addressing:s}=this.props,{startedAddressing:r}=this.state;return i.a.createElement(c.a,null,i.a.createElement(d.a,{in:r},i.a.createElement("div",null,i.a.createElement(D.a,{boxColor:s.howManyAdressed===s.toAddress?"success":"info"},s.howManyAdressed!==s.toAddress&&i.a.createElement(i.a.Fragment,null,n===b.g.WST&&i.a.createElement("div",null,a("newSettings.devices.addressing.dispenser"),":",i.a.createElement("ol",null,i.a.createElement("li",null,a("newSettings.devices.addressing.f1_1")),i.a.createElement("li",null,a("newSettings.devices.addressing.f1_2")),i.a.createElement("li",null,a("newSettings.devices.addressing.f1_3"))),a("newSettings.devices.addressing.scale"),":",i.a.createElement("ol",null,i.a.createElement("li",null,a("newSettings.devices.addressing.scale_1")),i.a.createElement("li",null,a("newSettings.devices.addressing.scale_2")),i.a.createElement("li",null,a("newSettings.devices.addressing.scale_3")))),n===b.g.NRF&&i.a.createElement("ol",null,i.a.createElement("li",null,a("newSettings.devices.addressing.f3_1")),i.a.createElement("li",null,a("newSettings.devices.addressing.f3_2")),i.a.createElement("li",null,a("newSettings.devices.addressing.f3_3")),i.a.createElement("li",null,a("newSettings.devices.addressing.f3_4")))),i.a.createElement("div",null,O.a.t("newSettings.devices.addressing.addressed",{address:s.howManyAdressed})),i.a.createElement("div",null,O.a.t("newSettings.devices.addressing.toAddress",{address:s.toAddress-s.howManyAdressed})),!!s.howManyAdressed&&s.howManyAdressede.DevType===b.d.GATEWAY).map(e=>({name:e.Name,value:e})),disabled:r}),i.a.createElement(o.a,{component:g.b,name:"protocol",label:a("newSettings.devices.addressing.protocol"),options:[{name:"WST",value:b.g.WST},{name:"NRF",value:b.g.NRF}],disabled:r}),i.a.createElement(o.a,{component:f.a,name:"address",label:a("adres"),type:"number",parse:e=>e?+e:null,disabled:r}),i.a.createElement(o.a,{component:f.a,name:"amount",label:a("amount"),type:"number",parse:e=>e?+e:null}),i.a.createElement(o.a,{component:g.b,name:"interf",label:a("newSettings.devices.addressing.interf"),options:n===b.g.NRF?[{name:a("newSettings.devices.addressing.left"),value:0},{name:a("newSettings.devices.addressing.middle"),value:1},{name:a("newSettings.devices.addressing.right"),value:2}]:[{name:a("newSettings.devices.addressing.left"),value:0},{name:a("newSettings.devices.addressing.right"),value:1}],disabled:r}),i.a.createElement(o.a,{component:g.b,name:"mode",label:a("newSettings.devices.addressing.mode"),options:[{name:a("newSettings.devices.addressing.modeIgnore"),value:0},{name:a("newSettings.devices.addressing.modeNoIgnore"),value:1}],disabled:r}),i.a.createElement(S.a,{fixed:!0,renderInPortal:!1},i.a.createElement(v.a,{buttonStyle:"round",buttonColor:"success",icon:i.a.createElement("i",{className:"fas fa-paper-plane"})}))))))}}N=Object(l.a)({form:"address-devices",onSubmit:function(e,t,a){const{startedAddressing:n}=a,{gateway:s,protocol:r,address:i,amount:c,interf:o,mode:l}=e;if(n)switch(r){default:case b.g.WST:Object(E.z)(s,()=>t({type:"CHANGE_ADDRESSING",payload:{state:!1}}));break;case b.g.NRF:Object(E.y)(s,()=>t({type:"CHANGE_ADDRESSING",payload:{state:!1}}))}else{let e={startAddress:i,howMany:c,mode:l};switch(r){default:case b.g.WST:e.interface=o,Object(E.b)(s,e,()=>t({type:"CHANGE_ADDRESSING",payload:{state:!0,toAddress:c,protocol:b.g.WST}}));break;case b.g.NRF:e.nrf=o,Object(E.a)(s,e,()=>t({type:"CHANGE_ADDRESSING",payload:{state:!0,toAddress:c,protocol:b.g.NRF}}))}}},validate:function(e,t){const a={},{t:n}=t;return e.gateway||(a.gateway=n("required")),e.address||(a.address=n("required")),e.protocol||(a.protocol=n("required")),a}})(N);const w=Object(m.a)("address-devices");N=Object(h.connect)(e=>({devices:e.farmDevices.devices,startedAddressing:e.farmDevices.startedAddressing,addressing:e.farmDevices.addressing,protocol:w(e,"protocol")}))(N);t.a=Object(y.a)()(N)},ZvD3:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("d/v1"),o=a("pJVQ"),l=a("zDJl"),m=a("6uZD"),d=a("FPv+"),u=a("ztiR");var p=a("3Z9Z"),g=a("JI6e"),f=a("/MKj"),h=a("Ty5D"),b=a("qx5e"),E=a("s506"),S=a("tLYN"),v=a("ANjH"),D=a("LCzB");class y extends s.a.Component{constructor(e){super(e),this.props.initialize({Rs0Protocol:"WST",Rs1Protocol:"WST",BridgePeriphery:"None"},!0,{keepValues:!0})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showGatewayInsteadOfBridge:!0},s.a.createElement(p.a,{className:"justify-content-center"},s.a.createElement(g.a,{lg:6},s.a.createElement("label",null,"RS485 0"),s.a.createElement(c.a,{name:"Rs0Protocol",component:S.a,options:[{name:"MODBUS",value:"MBUS"},{name:"RFID",value:"RFID"},{name:"WST",value:"WST"}]}))),s.a.createElement(p.a,{className:"justify-content-center"},s.a.createElement(g.a,{lg:6},s.a.createElement("label",null,"RS485 1"),s.a.createElement(c.a,{name:"Rs1Protocol",component:S.a,options:[{name:"MODBUS",value:"MBUS"},{name:"RFID",value:"RFID"},{name:"WST",value:"WST"}]}))),s.a.createElement(p.a,{className:"justify-content-center"},s.a.createElement(g.a,{lg:6},s.a.createElement("label",null,t("periphery")),s.a.createElement(c.a,{name:"BridgePeriphery",component:S.a,options:[{name:t("grid.none"),value:"None"},{name:"LCD",value:"LCD"},{name:t("meters"),value:"Meters"}]})))))}}t.a=Object(v.d)(h.o,Object(D.a)(),Object(f.connect)(e=>({user:e.user.user,farm:e.location.farm})),Object(b.a)(e=>({roles:[E.c._DEVICE_CONFIG],showComponent:!0})),Object(o.a)({form:"bridge",onSubmit:function(e,t,a){const{address:n,name:s,gateway:r,edit:i,device:c,alias:o,Rs0Protocol:d,Rs1Protocol:p,BridgePeriphery:g}=e;if(!i)return Object(u.a)([{DevType:l.d.BRIDGE,Name:s,Address:1,ParentID:r.DevID,Rs0Protocol:d,Rs1Protocol:p,BridgePeriphery:g}]).then(e=>{a.reset(),Object(u.c)(e)}).catch(e=>{Object(u.b)(e)});{let e=c.clone();e.Address=Number(n),e.Name=s,e.ParentID=r.DevID,e.Interfaces[3]=d,e.Interfaces[4]=p,e.Alias=o,e.Protocol=l.g.SLIP,e.VerHard="0.1",e.VerSoft="0.1",e.Settings.BridgePeriphery=g,e.setDtaModTime(),t(Object(m.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const{t:a}=t,n={};return e.name||(n.name=a("required")),(!d.a.DEVICE_MANY_ADDR_BR.test("".concat(e.address))||e.edit&&!d.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(n.address=a("errors.addressError",{amount1:"1 (0x1)",amount2:"15 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"})),e.gateway||(n.gateway=a("required")),n}}))(y)},eAWT:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("/MKj"),i=a("ANjH"),c=a("f0zD"),o=a("4qC0"),l=a.n(o),m=a("mwIZ"),d=a.n(m),u=a("BkRI"),p=a.n(u),g=a("17x9"),f=a.n(g),h=a("IXwn"),b=a("uSQv"),E=a("55Ip"),S=a("zDJl"),v=a("9jj8"),D=a("PjVZ"),y=a("wd/R"),O=a.n(y),N=a("AF5L"),w=a("gLBR"),C=a("Zx0i"),I=a("JI6e"),j=a("3Z9Z"),T=a("LCzB"),A=a("XzT5");class F extends n.Component{constructor(e){super(e),this.onRemoveClick=this.onRemoveClick.bind(this),this.onUpdateOnDevicesClick=this.onUpdateOnDevicesClick.bind(this),this.state={deleting:!1}}onUpdateOnDevicesClick(e){e.stopPropagation();const{gateways:t,plan:a}=this.props;a instanceof C.a&&t.forEach(e=>{Object(N.u)(e,a,!1)})}onRemoveClick(e){e.stopPropagation();const{dispatch:t,plan:a,show:n,t:s}=this.props;let r=p()(a);r instanceof C.a&&(r.deleteSetting(),n("confirm-modal",{title:s("newSettings.feeding.plans.feedingPlanItem.confirmDelete"),text:s("newSettings.feeding.plans.feedingPlanItem.confirmDeleteLong"),confirmText:s("yes"),onConfirmed:e=>{this.setState({deleting:!0},()=>{t(Object(w.c)(r,()=>{e.handleHide(),this.setState({deleting:!1})},()=>{this.setState({deleting:!1})}))})}}))}render(){const{plan:e,index:t,t:a}=this.props,{deleting:n}=this.state;let r=d()(e,"SetData.Doses",[]),i=d()(e,"SetData.Name","Plan ".concat(t+1));return s.a.createElement(v.a,{showNumber:!0,lp:t+1,index:t,key:1,className:"d-flex align-items-center mh-5rem overflow-hidden position-relative pt-3 pb-3"},s.a.createElement(I.a,{xs:12},s.a.createElement(j.a,null,!!e&&s.a.createElement(s.a.Fragment,null,s.a.createElement(I.a,{xs:12,sm:4,xl:4},s.a.createElement("div",{className:"font-weight-bold"},i),s.a.createElement("div",{className:"opacity-75"},A.a.t("newSettings.feeding.plans.feedingPlanItem.planXdays",{type:r.length}))),s.a.createElement(I.a,{xs:12,sm:4,xl:6},s.a.createElement("div",null,r.map(e=>s.a.createElement("span",{className:"d-inline-block small mr-1"},s.a.createElement(D.a,{highlightColor:"secondary"},l()(e.Start)?e.Start:O()(e.Start).format("HH:mm"),s.a.createElement("bdi",{className:"hide-on-small-device sm"},"-",l()(e.Stop)?e.Stop:O()(e.Stop).format("HH:mm")),s.a.createElement(D.a,{highlightColor:"info"},e.Percent,"%"))))),s.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.plans.feedingPlanItem.doses")))),!e&&s.a.createElement(I.a,{xs:12,className:"opacity-50"},s.a.createElement("h5",{className:"justify-content-center"},a("newSettings.feeding.plans.feedingPlanItem.planNotConfigured"))),s.a.createElement(I.a,{xs:12,sm:4,xl:2,className:"justify-content-end align-items-center d-flex"},s.a.createElement(h.a,{className:"m-0"},s.a.createElement(E.Link,{to:"/".concat(this.props.farm,"/settings/feeding/schedules/edit/").concat(t)},s.a.createElement(b.a,{type:"button",icon:s.a.createElement("i",{className:"fas fa-pen"}),buttonStyle:"round"})),s.a.createElement(b.a,{type:"button",disabled:!e,icon:s.a.createElement("i",{className:"fas fa-share"}),buttonStyle:"round",onClick:this.onUpdateOnDevicesClick}),s.a.createElement(b.a,{type:"button",disabled:!e,isLoading:n,icon:s.a.createElement("i",{className:"fas fa-trash"}),buttonStyle:"round",buttonColor:e?"error":null,onClick:this.onRemoveClick}))))))}}F.propTypes={plan:f.a.object.isRequired},F=Object(r.connect)(e=>({user:e.user.user,gateways:e.farmDevices.devices.filter(e=>e.DevType===S.d.GATEWAY),farm:e.location.farm}))(F),F=Object(r.connect)(null,e=>Object(i.b)({show:c.d},e))(F);var x,P=Object(T.a)()(F),R=a("0ajJ"),k=a("VyNe"),_=a("qx5e"),M=a("s506"),B=a("8O+7"),L=a("mr+a"),V=a("84Ez"),z=a("0gjr");function U(){return(U=Object.assign||function(e){for(var t=1;t({feedingPlans:Object(L.f)(e),license:Object(V.a)(e,{licenseName:M.a.DISPENSER})}))(x=class extends n.Component{render(){const{feedingPlans:e,license:t}=this.props;let a=[];for(let n=0;ne.SetData.Index===n),index:n};return s.a.createElement(k.a,{type:"container",className:"feeding-view-container"},s.a.createElement(R.a,{striped:!0,useFlexLayout:!1,showNumber:!0},s.a.createElement(B.a,{text:A.a.t("newSettings.feeding.forages.feedingForageItem.compatibility",{type:"F1, F3, F5"}),key:"comp_WST"}),a.slice(0,z.a.FEEDING_SCHEDULE_BASIC).map((e,t)=>s.a.createElement(P,U({key:"plan_".concat(e.index)},e))),t===M.b.EXTENDED&&s.a.createElement(s.a.Fragment,null,s.a.createElement(B.a,{text:A.a.t("newSettings.feeding.forages.feedingForageItem.compatibility",{type:"F3, F5"}),key:"comp_NRF"}),a.slice(z.a.FEEDING_SCHEDULE_BASIC,z.a.FEEDING_SCHEDULE_EXTENDED).map((e,t)=>s.a.createElement(P,U({key:"plan_".concat(e.index)},e))))))}})||x;W=Object(r.connect)(null,e=>Object(i.b)({show:c.d},e))(W),W=Object(T.a)()(W);t.a=Object(_.a)({roles:[M.c._DEVICE_CONFIG],showComponent:!0})(W)},gypA:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("/MKj"),i=a("HS/c"),c=a.n(i),o=a("JZab"),l=(a("55Cu"),a("LCzB")),m=a("XzT5"),d=a("ANjH"),u=a("IXwn"),p=a("uSQv");class g extends n.Component{constructor(e){super(e),this.instance=void 0,e.dispatch(Object(o.d)())}render(){const{t:e,onCancel:t,onNextStep:a,dropinLoaded:n,paymentMethodRequestable:r,onBackStep:i}=this.props;return s.a.createElement("div",{className:"step"},s.a.createElement("div",{className:"dropin"},s.a.createElement("h4",null,m.a.t("subscriptions.steps.paymentSelection")),s.a.createElement(c.a,{options:{authorization:this.props.clientToken,locale:e("subscriptions.locale"),card:{cardholderName:!0}},onInstance:e=>{this.instance=e,this.props.dispatch(Object(o.g)(this.instance))},onPaymentMethodRequestable:()=>{this.instance.requestPaymentMethod(),this.props.dispatch(Object(o.f)(!0))},onNoPaymentMethodRequestable:()=>{this.props.dispatch(Object(o.f)(!1))},onPaymentOptionSelected:()=>{this.props.dispatch(Object(o.f)(!0))}})),s.a.createElement(u.a,{fixed:!0,renderInPortal:!1},s.a.createElement(p.a,{buttonColor:"error",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-times"}),onClick:t}),s.a.createElement(p.a,{buttonColor:"success",buttonStyle:"round",onClick:i,icon:s.a.createElement("i",{className:"fas fa-arrow-left"})}),s.a.createElement(p.a,{buttonColor:"success",buttonStyle:"round",onClick:a,icon:s.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:!n||!r})))}}t.a=Object(d.d)(Object(l.a)(),Object(r.connect)((function(e){return{clientToken:e.braintree.clientToken,fetched:e.braintree.fetched,dropinLoaded:e.braintree.dropinLoaded,paymentMethodRequestable:e.braintree.paymentMethodRequestable}})))(g)},h639:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("udB/"),i=a("3Z9Z"),c=a("JI6e"),o=a("mwIZ"),l=a.n(o),m=a("Y+p1"),d=a.n(m),u=a("1smR"),p=a("17x9"),g=a.n(p),f=a("r3a2"),h=a("/MKj"),b=a("Vv3o"),E=a("pxzG"),S=a("B/gD"),v=a("H7uW"),D=a("zTlQ"),y=a("q17X"),O=a("IBmF"),N=a("zDJl"),w=a("vzZS"),C=a("wd/R"),I=a.n(C),j=a("BvFm"),T=a("Q2bl"),A=a("LCzB"),F=a("XzT5");class x extends s.a.Component{constructor(e){super(e),this.getFeedingValues=(e=this.props)=>{const{dispensers:t,shadows:a}=e;let n=t[0];try{let e=a.get(n.DevID);return{maxSingularDose:e.configuration.maxSingularDose||50,timeBetweenDoses:e.configuration.timeBetweenDoses||1e3,autoFinish:e.configuration.autoFinish||!1,globalLock:e.configuration.globalLock||!1,maxCurrentFluctuation:e.configuration.maxCurrentFluctuation||0,maxOverfluctuationTime:e.configuration.maxCurrentFluctuation||0,overloadDetection:e.configuration.overloadDetection||!1,loadedDataFrom:N.i.SHADOW,SetTime:e.metadata.configuration,device:n}}catch(s){return{maxSingularDose:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".maxSingularDose"),50),timeBetweenDoses:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".timeBetweenDoses"),1e3),autoFinish:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".autoFinish"),!1),globalLock:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".globalLock"),!1),maxCurrentFluctuation:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".maxCurrentFluctuation"),0),maxOverfluctuationTime:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".maxOverfluctuationTime"),0),overloadDetection:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".overloadDetection"),!1),SetTime:l()(n,"Settings.Configuration.".concat(O.f.SET_CONFIGURATION,".SetTime"),0),loadedDataFrom:n&&n.Settings&&n.Settings.Configuration&&n.Settings.Configuration[O.f.SET_CONFIGURATION]?N.i.DYNAMO:N.i.NO_DATA,device:n}}},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(T.b)(this.state);e.forEach(e=>{Object(f.f)(e,t)})},this.setValue=(e,t)=>{this.setState({[e]:t,changed:!0})},this.state=this.getFeedingValues()}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(this.getFeedingValues(e))}shouldComponentUpdate(e,t,a){return!d()(this.state,t)}render(){const{t:e,dispensers:t}=this.props,{maxSingularDose:a,timeBetweenDoses:n,globalLock:r,maxCurrentFluctuation:i,maxOverfluctuationTime:c,overloadDetection:o,loadedDataFrom:l,SetTime:m,device:d}=this.state;let p=Object(y.getFeedingUnit)();return s.a.createElement(u.b,{title:e("newSettings.dispenserWST.feeding.title"),onButtonClick:this.onClick},l!==N.i.SHADOW&&s.a.createElement(s.a.Fragment,null,l===N.i.DYNAMO&&!d.Settings.Configuration[O.f.SET_CONFIGURATION].isSet&&s.a.createElement(w.a,{boxColor:"warning"},F.a.t("newSettings.devices.settingsInfo.dynamo",{date:I()(m).format("DD.MM.YYYY HH:mm")})),l===N.i.NO_DATA&&s.a.createElement(w.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),s.a.createElement(v.a,{deviceId:t[0].DevID,variablePath:"rtc.dateTime",metaPath:"metadata.rtc",renderComponent:t=>s.a.createElement(D.a,{label:e("newSettings.dispenserWST.feeding.time"),type:"text",value:t?t.format("HH:mm:ss"):"--:--:--",disabled:!0})}),s.a.createElement(b.a,{value:a,label:e("newSettings.dispenserWST.feeding.maxSingleDose"),min:50,max:1e3,step:50,valueFormatter:e=>Object(E.j)(e,{showUnit:!0,unit:p,fixed:p?2:0}),onChange:e=>this.setValue("maxSingularDose",e)}),s.a.createElement(b.a,{value:n,label:e("newSettings.dispenserWST.feeding.timeBetweenDoses"),min:1,max:255,step:1,valueFormatter:e=>"".concat(e,"s"),onChange:e=>this.setValue("timeBetweenDoses",e)}),s.a.createElement(S.a,{id:"globalLock",value:r,label:e("newSettings.dispenserWST.feeding.globalLock"),onChange:e=>this.setValue("globalLock",e)}),Object(j.i)()&&s.a.createElement(s.a.Fragment,null,s.a.createElement(S.a,{id:"overloadDetection",value:o,label:e("newSettings.dispenserWST.feeding.overloadDetection"),onChange:e=>this.setValue("overloadDetection",e)}),s.a.createElement(b.a,{disabled:!o,value:i,label:e("newSettings.dispenserWST.feeding.maxCurrentFluctuation"),min:0,max:2550,step:10,valueFormatter:e=>"".concat(e,"mA"),onChange:e=>this.setValue("maxCurrentFluctuation",e)}),s.a.createElement(b.a,{disabled:!o,value:c,label:e("newSettings.dispenserWST.feeding.maxOverfluctuationTime"),min:0,max:2550,step:10,valueFormatter:e=>"".concat(e,"ms"),onChange:e=>this.setValue("maxOverfluctuationTime",e)})))}}x.propTypes={dispensers:g.a.array.isRequired},x=Object(h.connect)(e=>({shadows:e.shadows.shadows}))(x);var P=Object(A.a)()(x),R=a("/kok"),k=a("J2iB"),_=a.n(k),M=a("VfnB"),B=a("e/I0");class L extends s.a.Component{constructor(e){super(e),this.onClick=()=>{const{dispensers:e}=this.props,{efficiency:t}=this.state,a=Object(M.r)(e);if(a){const e=[...t.map((e,t)=>({number:t+1,foodType1Yield:e,foodType2Yield:e}))];for(let t of a.values())t[N.d.DISPENSER].length&&Object(f.i)(t[N.d.DISPENSER],e)}},this.handleChangeEfficiencyTime=(e,t)=>{const a=this.state.efficiency.slice(0);a[t]=e,this.setState({efficiency:a,changed:!0})},this.timeFormatter=e=>{const{t:t}=this.props,a=Object(y.getFeedingUnit)();return t("newSettings.dispenserWST.efficiency.timeEfficiencyFormatter",{value:Object(E.j)(e,{unit:a,fixed:2*a,showUnit:!0})})},this.labelFormatter=e=>{const{t:t,dispensers:a}=this.props;if(1===a.length){const{buildingMap:n}=this.props,s=a[0].PlcmntID.find(t=>t.Adr===e);if(s){const a=n.get(s.PlcmntID);if(a)return t("newSettings.dispenserWST.efficiency.efficiencyForOut",{number:"".concat(e+1," (").concat(a.name.slice(-2).join(" - "),")")})}return t("newSettings.dispenserWST.efficiency.efficiencyForOut",{number:e+1})}return t("newSettings.dispenserWST.efficiency.efficiencyForOut",{number:e+1})},this.state=L.getSetup(this.props)}static getDerivedStateFromProps(e,t){if(!t.changed)return L.getSetup(e)}render(){const{t:e}=this.props,{loadedDataFrom:t,SetTime:a,device:n,efficiency:r}=this.state;return s.a.createElement(u.b,{title:e("newSettings.dispenserWST.efficiency.title"),onButtonClick:this.onClick},t!==N.i.SHADOW&&s.a.createElement(s.a.Fragment,null,t===N.i.DYNAMO&&!n.Settings.Configuration[O.f.SET_PARAM_OUTS].isSet&&s.a.createElement(w.a,{boxColor:"warning"},F.a.t("newSettings.devices.settingsInfo.dynamo",{date:I()(a).format("DD.MM.YYYY HH:mm")})),t===N.i.NO_DATA&&s.a.createElement(w.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),r.map((e,t)=>s.a.createElement(b.a,{key:t,valueFormatter:this.timeFormatter,label:this.labelFormatter(t),value:r[t],onChange:e=>this.handleChangeEfficiencyTime(e,t),min:30,max:2550,step:10})))}}L.getSetup=e=>{const{dispensers:t,shadows:a}=e;let n=t[0],s={efficiency:[]},r=[];try{r=a.get(n.DevID).dispensers,s.loadedDataFrom=r?N.i.SHADOW:N.i.NO_DATA,s.SetTime=l()(a.get(n.DevID),"metadata.dispensers",0)}catch(i){r=l()(n,"Settings.Configuration.".concat(O.f.SET_PARAM_OUTS)),s.loadedDataFrom=r?N.i.DYNAMO:N.i.NO_DATA,s.SetTime=l()(r,"SetTime",0)}for(let c=0;c<20;c++){const e=l()(r,"[".concat(c,"].foodType1Yield"));_()(e)&&(s.loadedDataFrom=N.i.NO_DATA),s.efficiency[c]=_()(e)?750:e}return s.device=n,s},L.propTypes={dispensers:g.a.array.isRequired},L=Object(h.connect)(e=>({shadows:e.shadows.shadows,buildingMap:Object(B.a)(e)}))(L);var V=Object(A.a)()(L);class z extends s.a.Component{constructor(e){super(e),this.state={selectedDispensers:this.props.location.state?this.props.location.state.selectedDispensers:[],loading:!0},this.setLoading=()=>{this.setState({loading:!1})},0===this.state.selectedDispensers.length&&this.props.history.push("/".concat(this.props.farm,"/settings/feeding/f1/manage")),R.a.startSendingDeviceState(this.state.selectedDispensers,this.setLoading,this.setLoading)}render(){const{selectedDispensers:e,loading:t}=this.state;return 0===e.length?null:s.a.createElement("div",{className:"position-relative overflow-hidden"},s.a.createElement(r.a,{isLoading:t}),s.a.createElement(i.a,null,s.a.createElement(c.a,{xl:4},s.a.createElement(P,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(V,{dispensers:e}))))}}z=Object(h.connect)(e=>({farm:e.location.farm}))(z);t.a=z},hLpH:function(e,t,a){"use strict";var n=a("QkVN"),s=a.n(n),r=a("mwIZ"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("XSU/"),m=a("ANjH"),d=a("LCzB"),u=a("wd/R"),p=a.n(u),g=a("2tEe"),f=a("VyNe"),h=a("BbMY"),b=a("erjJ"),E=a("3Z9Z"),S=a("JI6e"),v=a("d/v1"),D=a("pJVQ"),y=a("26mJ"),O=a("5Plf"),N=a("IXwn"),w=a("uSQv"),C=a("OwcS");function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function j(e){for(var t=1;t{const{selectedPlans:t}=this.props;return t.find(t=>t===e)}}render(){const{onSelect:e,t:t}=this.props,a=[{title:t("animalTypes.0"),class:"sows"},{title:t("animalTypes.3"),class:"porkers"}];return o.a.createElement(S.a,{md:4,className:"plan-container"},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,t("breeding"))),a.map((n,s)=>o.a.createElement("div",{key:s,className:"device-type"},o.a.createElement("div",{className:"addon-title"},o.a.createElement("h5",null,n.title)),o.a.createElement("div",{className:"plans ".concat(s+1===a.length?"last":"")},o.a.createElement("div",{className:this.checkIfClassIsActive("".concat(n.class,"-basic"))?"".concat(n.class,"-basic active"):"".concat(n.class,"-basic"),onClick:e},o.a.createElement("div",{className:"plan-type"},o.a.createElement("h6",null,t("subscriptions.plans.basic"))),o.a.createElement("div",{className:"plan-details"},o.a.createElement("p",null,"- Lorem Ipsum"))),o.a.createElement("div",{className:this.checkIfClassIsActive("".concat(n.class,"-extended"))?"".concat(n.class,"-extended active"):"".concat(n.class,"-extended"),onClick:e},o.a.createElement("div",{className:"plan-type"},o.a.createElement("h6",null,t("subscriptions.plans.extended"))),o.a.createElement("div",{className:"plan-details"},o.a.createElement("p",null,"- Lorem Ipsum"),o.a.createElement("p",null,"- Lorem Ipsum extra")))))))}}var q=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{selectedPlans:e.braintree.selectedPlans}})))(W);class H extends o.a.Component{constructor(...e){super(...e),this.checkIfClassIsActive=e=>{const{selectedPlans:t}=this.props;return t.find(t=>t===e)}}render(){const{onSelect:e,t:t}=this.props,a=[{title:t("siloses"),class:"siloses"},{title:t("climates"),class:"climates"},{title:t("cages"),class:"cages"},{title:t("dispensers"),class:"dispensers"},{title:t("dispensers5G"),class:"dispensers5G"},{title:t("meters"),class:"meters"},{title:t("weights"),class:"smallCages"},{title:t("chains"),class:"chains"},{title:t("alarms"),class:"alarms"}];return o.a.createElement(S.a,{md:4,className:"plan-container"},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,t("devices"))),a.map((n,s)=>o.a.createElement("div",{key:s,className:"addon-type"},o.a.createElement("div",{className:"addon-title"},o.a.createElement("h5",null,n.title)),o.a.createElement("div",{className:"plans ".concat(s+1===a.length?"last":"")},"dispensers5G"!==n.class&&o.a.createElement("div",{className:this.checkIfClassIsActive("".concat(n.class,"-basic"))?"".concat(n.class,"-basic active"):"".concat(n.class,"-basic"),onClick:e},o.a.createElement("div",{className:"plan-type"},o.a.createElement("h6",null,t("subscriptions.plans.basic"))),o.a.createElement("div",{className:"plan-details"},o.a.createElement("p",null,"- Lorem Ipsum"))),o.a.createElement("div",{className:this.checkIfClassIsActive("".concat(n.class,"-extended"))?"".concat(n.class,"-extended active"):"".concat(n.class,"-extended"),onClick:e},o.a.createElement("div",{className:"plan-type"},o.a.createElement("h6",null,t("subscriptions.plans.extended"))),o.a.createElement("div",{className:"plan-details"},o.a.createElement("p",null,"- Lorem Ipsum"),o.a.createElement("p",null,"- Lorem Ipsum extra")))))))}}var G=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{selectedPlans:e.braintree.selectedPlans}})))(H);class J extends o.a.Component{constructor(...e){super(...e),this.checkIfClassIsActive=e=>{const{selectedPlans:t}=this.props;return t.find(t=>t===e)}}render(){const{onSelect:e,t:t}=this.props;return o.a.createElement(S.a,{md:4,className:"plan-container"},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,t("administration"))),o.a.createElement("div",{className:"plans"},o.a.createElement("div",{className:this.checkIfClassIsActive("administration-basic")?"administration-basic active":"administration-basic",onClick:e},o.a.createElement("div",{className:"plan-details"},o.a.createElement("p",null,"- Lorem Ipsum"),o.a.createElement("p",null,"- Lorem Ipsum"),o.a.createElement("p",null,"- Lorem Ipsum"),o.a.createElement("p",null,"- Lorem Ipsum")))))}}var Y=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{selectedPlans:e.braintree.selectedPlans}})))(J),Z=a("CuyV");class Q extends o.a.Component{constructor(...e){super(...e),this.state={submitFail:!1},this.onNext=()=>{const{selectedPlans:e,onNextStep:t}=this.props;U()(e)?this.setState({submitFail:!0}):t()}}componentDidUpdate(e,t,a){const{selectedPlans:n}=this.props;V()(e.selectedPlans,n)||U()(n)||this.setState({submitFail:!1})}render(){const{onCancel:e,onUpdatePlan:t,selectedPlans:a,onBackStep:n,clearPlans:s,isFirstStep:r,t:i}=this.props,{submitFail:c}=this.state;return o.a.createElement(E.a,{className:"plan-picker"},o.a.createElement(q,{onSelect:t}),o.a.createElement(G,{onSelect:t}),o.a.createElement(Y,{onSelect:t}),o.a.createElement(N.a,{fixed:!0,renderInPortal:!1},c&&o.a.createElement(Z.a,{tooltipContent:i("subscriptions.plans.failMessagePick"),type:"error"},o.a.createElement("i",{className:"fas fa-exclamation-circle error"})),o.a.createElement(w.a,{buttonColor:"error",buttonStyle:"round",icon:o.a.createElement("i",{className:"fas fa-times"}),onClick:e}),o.a.createElement(w.a,{buttonColor:"warning",buttonStyle:"round",icon:o.a.createElement("i",{className:"fad fa-eraser"}),onClick:s,disabled:0===a.length}),!r&&o.a.createElement(w.a,{buttonColor:"success",buttonStyle:"round",onClick:n,icon:o.a.createElement("i",{className:"fas fa-arrow-left"})}),o.a.createElement(w.a,{buttonColor:"success",buttonStyle:"round",onClick:this.onNext,icon:o.a.createElement("i",{className:"fas fa-arrow-right"})})))}}var K=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{selectedPlans:e.braintree.selectedPlans}})))(Q),X=a("J2iB"),$=a.n(X),ee=a("HIda"),te=a("gNnm"),ae=a("AM6L"),ne=a("rmN1");class se extends o.a.Component{constructor(e){super(e),this.onRadioChange=(e,t,a)=>{const n=a.target.value;this.props.onSowsSizeUpdate(n)},this.getPlanType=e=>{const{selectedPlans:t,t:a}=this.props;return(t.find(t=>t.startsWith(e)).endsWith("basic")?a("subscriptions.plans.basic"):a("subscriptions.plans.extended")).toLowerCase()},this.checkIfPlanExists=e=>{const{selectedPlans:t}=this.props;return t.some(t=>e.includes(t))},this.numberValueParser=e=>$()(e)?e:parseInt(e);const{onSowsSizeUpdate:t,selectedPlans:a}=this.props;a.length>=1&&!!a.find(e=>e.startsWith("sows"))&&t("1")}render(){const{onCancel:e,handleSubmit:t,data:{BreedingModule:{sows:{size:a}}},onBackStep:n,t:s}=this.props,r=[{title:s("siloses"),class:"siloses"},{title:s("climates"),class:"climates"},{title:s("cages"),class:"cages"},{title:s("dispensers"),class:"dispensers"},{title:s("dispensers5G"),class:"dispensers5G"},{title:s("meters"),class:"meters"},{title:s("weights"),class:"smallCages"},{title:s("chains"),class:"chains"},{title:s("alarms"),class:"alarms"}],i=[{title:s("managersAcc"),class:"managersAmount"},{title:s("operatorsAcc"),class:"operatorsAmount"},{title:s("techAdvice"),class:"techAdviceAmount"},{title:s("techSupport"),class:"techSupportAmount"}];return o.a.createElement("form",{onSubmit:t},o.a.createElement(E.a,{className:"plan-picker"},this.checkIfPlanExists(["sows-basic","sows-extended","porkers-basic","porkers-extended"])&&o.a.createElement(S.a,{className:"plan-container",md:4},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,s("breeding"))),o.a.createElement("div",{className:"plan-addons"},o.a.createElement(ee.a,{name:"BreedingModule"},this.checkIfPlanExists(["sows-basic","sows-extended"])&&o.a.createElement("div",null,o.a.createElement("div",{className:"addon-options"},o.a.createElement("label",null,o.a.createElement("b",null,s("animalTypes.0")),o.a.createElement("p",null,this.getPlanType("sows"))),o.a.createElement("span",null,o.a.createElement(te.a,{checked:1===a,onChange:this.onRadioChange,label:s("addons.animalsRanges",{range:"".concat(ae.AnimalRanges.minSmall,"-").concat(ae.AnimalRanges.maxSmall)}),name:"sows.size",value:"1"}),o.a.createElement("b",null,"100z\u0142")),o.a.createElement("span",null,o.a.createElement(te.a,{checked:2===a,onChange:this.onRadioChange,label:s("addons.animalsRanges",{range:"".concat(ae.AnimalRanges.minMedium,"-").concat(ae.AnimalRanges.maxMedium)}),name:"sows.size",value:"2"}),o.a.createElement("b",null,"200z\u0142")),o.a.createElement("span",null,o.a.createElement(te.a,{checked:3===a,onChange:this.onRadioChange,label:s("addons.animalsRanges",{range:"> ".concat(ae.AnimalRanges.minLarge-1)}),name:"sows.size",value:"3"}),o.a.createElement("b",null,"300z\u0142")))),this.checkIfPlanExists(["porkers-basic","porkers-extended"])&&o.a.createElement("div",null,o.a.createElement("div",{className:"addon-options last"},o.a.createElement("label",{className:"porkers-container"},o.a.createElement("div",null,o.a.createElement("b",null,s("animalTypes.3")),o.a.createElement("p",null,this.getPlanType("porkers"))),o.a.createElement("i",{className:"fas fa-check"}))))))),this.checkIfPlanExists(["siloses-basic","siloses-extended","climates-basic","climates-extended","cages-basic","cages-extended","dispensers-basic","dispensers-extended","dispensers5G-extended","meters-basic","meters-extended","smallBasic-basic","smallBasic-extended","chains-basic","chains-extended","alarm-basic","alarm-extended"])&&o.a.createElement(S.a,{className:"plan-container",md:4},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,s("devices"))),o.a.createElement("div",{className:"plan-addons"},o.a.createElement(ee.a,{name:"DevicesModule"},o.a.createElement("div",{className:"addon-options"},r.map((e,t)=>this.checkIfPlanExists(["".concat(e.class,"-basic"),"".concat(e.class,"-extended")])&&o.a.createElement("div",{key:t},o.a.createElement("label",null,o.a.createElement("b",null,e.title.toLowerCase()),o.a.createElement("p",null,this.getPlanType(e.class))),o.a.createElement(v.a,{name:"".concat(e.class,".amount"),id:"dev.".concat(e.class),component:y.a,label:"2z\u0142/szt.",placeholder:s("amount"),type:"number",parse:this.numberValueParser}))))))),this.checkIfPlanExists(["administration-basic"])&&o.a.createElement(S.a,{className:"plan-container",md:4},o.a.createElement("div",{className:"plan-title"},o.a.createElement("h4",null,s("administration"))),o.a.createElement("div",{className:"plan-addons"},o.a.createElement(ee.a,{name:"AdministrationModule"},o.a.createElement("div",{className:"addon-options"},i.map((e,t)=>o.a.createElement("div",{key:t},o.a.createElement("label",null,o.a.createElement("b",null,e.title.toLowerCase())),o.a.createElement(v.a,{name:e.class,id:"admin.".concat(e.class),component:y.a,label:"2z\u0142/szt.",placeholder:s("amount"),type:"number",parse:this.numberValueParser})))))))),o.a.createElement(N.a,{fixed:!0,renderInPortal:!1},o.a.createElement(w.a,{buttonColor:"error",buttonStyle:"round",icon:o.a.createElement("i",{className:"fas fa-times"}),onClick:e}),o.a.createElement(w.a,{buttonColor:"success",buttonStyle:"round",onClick:n,icon:o.a.createElement("i",{className:"fas fa-arrow-left"})}),o.a.createElement(w.a,{buttonColor:"success",buttonStyle:"round",icon:o.a.createElement("i",{className:"fas fa-arrow-right"})})))}}var re=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{selectedPlans:e.braintree.selectedPlans,user:e.user.user}})),Object(D.a)({form:"plan-configuration-step",onSubmit:function(e,t,a){const{data:n}=a,r=s()(n,e),{user:{ClientID:i},farmExisted:c}=a,{BreedingModule:o,DevicesModule:l,AdministrationModule:m,FarmObject:{FarmID:d}}=r;if(c)return Object(ne.a)({addOns:{BreedingModule:o,DevicesModule:l,AdministrationModule:m}},{FarmID:d,ClientID:i}).then(()=>a.onNextStepData(e)).catch(e=>Object(ne.b)(e));a.onNextStepData(e)},validate:function(e,t){const a={BreedingModule:{},DevicesModule:{siloses:{},climates:{},cages:{},dispensers:{},dispensers5G:{},meters:{},smallCages:{},chains:{},alarms:{}},AdministrationModule:{managersAmount:"",operatorsAmount:"",techAdviceAmount:"",techSupportAmount:""}},{DevicesModule:n,AdministrationModule:s}=e,{t:r}=t;for(const c in a.DevicesModule)i()(n,"[".concat(c,"].amount"))||(a.DevicesModule[c].amount=r("required"));for(const c in a.AdministrationModule)i()(s,"[".concat(c,"]"))||(a.AdministrationModule[c]=r("required"));return a}}))(se),ie=(a("6Msq"),a("JZab")),ce=a("lodY"),oe=a("Gr13");function le(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function me(e){for(var t=1;t{const{dispatch:e,history:t}=this.props;e({type:"CHANGE_FARM"}),t.push("/farmSettings/billing")},this.onNextStep=()=>{this.setState(e=>({activeStep:e.activeStep+1}))},this.onBackStep=()=>{const{activeStep:e}=this.state,{dispatch:t,match:{params:{FarmID:a}}}=this.props;!a&&3===e||a&&2===e?(t({type:"BT_CLEAR_SELECTED_PLANS"}),this.setState(e=>({activeStep:e.activeStep-1,data:me({},e.data,{},ue)}))):this.setState(e=>({activeStep:e.activeStep-1}))},this.clearSelectedPlans=()=>{const{dispatch:e}=this.props;e({type:"BT_CLEAR_SELECTED_PLANS"}),this.setState(e=>({data:me({},e.data,{},ue)}))},this.onNextStepData=e=>{this.setState(t=>({data:s()(t.data,e),activeStep:t.activeStep+1}))},this.onUpdatePlan=e=>{const{dispatch:t}=this.props,a=e.currentTarget.className.split("-");if(a.length>1)if("sows"===a[0]||"porkers"===a[0]){const e="sows"===a[0]?me({},this.state.data.BreedingModule[a[0]],{extended:"extended"===a[1]}):me({},this.state.data.BreedingModule[a[0]],{size:+!a[1].includes("active"),extended:"extended"===a[1]});this.setState(t=>({data:me({},t.data,{BreedingModule:me({},t.data.BreedingModule,{[a[0]]:e})})}))}else if("administration"!==a[0]){const e="dispensers5G"===a[0]?me({},this.state.data.DevicesModule[a[0]]):me({},this.state.data.DevicesModule[a[0]],{extended:"extended"===a[1]});this.setState(t=>({data:me({},t.data,{DevicesModule:me({},t.data.DevicesModule,{[a[0]]:e})})}))}t(Object(ie.i)(e.currentTarget.className))},this.onSowsSizeUpdate=e=>{this.setState(t=>({data:me({},t.data,{BreedingModule:me({},t.data.BreedingModule,{sows:me({},t.data.BreedingModule.sows,{size:+e})})})}))},this.onSubscribe=async()=>{const{match:{params:{FarmID:e}},subscriptionList:t,dropinInstance:a,userData:n,dispatch:s}=this.props,{data:{FarmObject:r,BreedingModule:c,DevicesModule:o,AdministrationModule:l}}=this.state,m=e?t.filter(t=>t.id.startsWith(e)):[],d=m.length>0,u={trialDurationUnit:"day",trialDuration:p()().add(1,"month").endOf("month").diff(p()(),"days")+1,trialPeriod:!d},g=m.sort((e,t)=>p()(t.createdAt).toDate().getTime()-p()(e.createdAt).toDate().getTime()),f=g.length>0?i()(g[0],"balance","0.00"):"0.00";await Object(ce.a)("freePlanYearlyPLN",a,"peeleny",r,n.sub,u,{BreedingModule:c,DevicesModule:o,AdministrationModule:l},f).then(e=>{Object(ce.c)(e),this.onNextStep(),s(Object(oe.c)())}).catch(e=>Object(ce.b)(e)),s({type:"BT_CLEAR_SELECTED_PLANS"})};const{dispatch:t,customer:a,userData:{email:n,name:r,phone:c,sub:o},match:{params:{FarmID:l}},farms:m}=this.props;let d={};l&&(d=m.find(e=>e.FarmID===l)),this.state={activeStep:1,data:l?me({},ue,{FarmObject:{FarmID:d.FarmID,FarmName:d.FarmName,Adr:d.Adr}}):ue},a||t(Object(ie.a)(n,r,c,o))}render(){const{match:{params:{FarmID:e}},t:t}=this.props,{activeStep:a,data:{FarmObject:n},data:s}=this.state;return o.a.createElement("div",null,o.a.createElement(l.a,{text:e?t("subProcess.renew",{name:n.FarmName}):t("subProcess.new")}),o.a.createElement(g.a,{addPaddingForButtons:!0},o.a.createElement(f.a,null,o.a.createElement(h.a,{activeStep:a},o.a.createElement(o.a.Fragment,null,!e&&o.a.createElement(b.a,{label:t("subscriptions.steps.addFarm")}),o.a.createElement(b.a,{label:t("subscriptions.steps.planSelection")}),o.a.createElement(b.a,{label:t("subscriptions.steps.planConfiguration")}),o.a.createElement(b.a,{label:t("subscriptions.steps.agreementConditions")}),o.a.createElement(b.a,{label:t("subscriptions.steps.dataToInvoice")}),o.a.createElement(b.a,{label:t("subscriptions.steps.payment")}),o.a.createElement(b.a,{label:t("subscriptions.steps.confirmation")}),o.a.createElement(b.a,{label:t("summary")}))),1===a&&!e&&o.a.createElement(F,{onCancel:this.onCancelSubscription,onNextStepData:this.onNextStepData}),(1===a&&e||!e&&2===a)&&o.a.createElement(K,{onCancel:this.onCancelSubscription,isFirstStep:e,onNextStep:this.onNextStep,onBackStep:this.onBackStep,clearPlans:this.clearSelectedPlans,onUpdatePlan:this.onUpdatePlan}),(2===a&&e||!e&&3===a)&&o.a.createElement(re,{data:s,farmExisted:2===a,onSowsSizeUpdate:this.onSowsSizeUpdate,onBackStep:this.onBackStep,onNextStepData:this.onNextStepData,onCancel:this.onCancelSubscription}),(3===a&&e||!e&&4===a)&&o.a.createElement(x.a,{isFirstStep:!1,onBackStep:this.onBackStep,onNextStep:this.onNextStep,onCancel:this.onCancelSubscription}),(4===a&&e||!e&&5===a)&&o.a.createElement(R,{onBackStep:this.onBackStep,onNextStepData:this.onNextStepData,onCancel:this.onCancelSubscription}),(5===a&&e||!e&&6===a)&&o.a.createElement(k.a,{onBackStep:this.onBackStep,onNextStep:this.onNextStep,onCancel:this.onCancelSubscription}),(6===a&&e||!e&&7===a)&&o.a.createElement(_.a,{onBackStep:this.onBackStep,onCancel:this.onCancelSubscription,onSubscribe:this.onSubscribe}),(7===a&&e||!e&&8===a)&&o.a.createElement(o.a.Fragment,null,o.a.createElement(M.a,{logout:!1}),o.a.createElement(N.a,{fixed:!0},o.a.createElement(w.a,{buttonColor:"error",buttonStyle:"round",icon:o.a.createElement("i",{className:"fas fa-times"}),onClick:this.onCancelSubscription}))))))}}t.a=Object(m.d)(Object(d.a)(),Object(B.connect)((function(e){return{lang:e.language.lang.lang,selectedPlans:e.braintree.selectedPlans,agreementRead:e.braintree.agreementRead,userData:e.user.attributes,customer:e.braintree.customer,subscriptionList:e.braintree.subscriptionList,dropinInstance:e.braintree.dropinInstance,farms:e.user.user.FarmData}})))(pe)},"hTL/":function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("GQws"),c=a("En8b"),o=a("0hRy"),l=a("XZUa"),m=a("HHIC"),d=a("Hc9C"),u=a("RbfI"),p=a("S/e0"),g=a("548a"),f=a("D9/k"),h=a("ZOBY"),b=a("2x5x"),E=a("Ty5D"),S=a("/MKj"),v=a("qx5e"),D=a("s506"),y=a("LCzB");class O extends s.a.Component{constructor(e){super(e),this.onPickerChange=e=>{this.props.history.push("/".concat(this.props.farm,"/settings/devices/add/").concat(e))};const{user:{LicPackages:t},farm:a}=e;let n=null;t&&(n=t.find(e=>e.FarmID===a)),this.state={picker:void 0,farmLicense:n}}disableAddDevice(e,t){return!!e&&0===e[t]}render(){const{picker:e,farmLicense:t}=this.state,{t:a}=this.props,n=[{value:"bridge",label:a("newSettings.devices.addDevicesView.bridge"),svgPath:c.default},{value:"dispenserWST",label:a("newSettings.devices.addDevicesView.dispenserWST"),svgPath:o.default,disabled:this.disableAddDevice(t,"DevDispensersWSTLeft")},{value:"dispenserNRF",label:a("newSettings.devices.addDevicesView.dispenserNRF"),svgPath:l.default,disabled:this.disableAddDevice(t,"DevDispensersNRFLeft")},{value:"weightWST",label:a("newSettings.devices.addDevicesView.weightWST"),svgPath:m.default,disabled:this.disableAddDevice(t,"DevSilosesLeft")},{value:"climateWST",label:a("newSettings.devices.addDevicesView.climateWST"),svgPath:d.default,disabled:this.disableAddDevice(t,"DevClimatesLeft")},{value:"climateSK3",label:"".concat(a("newSettings.devices.addDevicesView.climateWST")," SK3"),svgPath:d.default,disabled:this.disableAddDevice(t,"DevClimatesLeft")},{value:"cage",label:a("newSettings.devices.addDevicesView.cage"),svgPath:u.default,disabled:this.disableAddDevice(t,"DevCagesLeft")},{value:"thermoEye",label:"ThermoEye",svgPath:p.a},{value:"antennaRFID",label:a("newSettings.devices.addDevicesView.antennaRFID"),svgPath:h.a},{value:"waterMeter",label:a("newSettings.devices.addDevicesView.waterFlowMeter"),svgPath:b.a},{value:"electricityMeter",label:a("newSettings.devices.addDevicesView.electricityMeter"),svgPath:g.a},{value:"chainFeeding",label:a("chainFeeding"),svgPath:f.a},{value:"pigletScale",label:a("newSettings.devices.addDevicesView.smallCage"),svgPath:g.a}];return s.a.createElement(r.a,null,s.a.createElement(i.a,{value:e,options:n,onChange:this.onPickerChange,showLabels:!0,itemsInRow:4}))}}let N=Object(S.connect)(e=>({farm:e.location.farm,devices:e.farmDevices.devices,user:e.user.user}))(O);O=Object(E.o)(N),O=Object(v.a)({roles:[D.c._DEVICE_CONFIG],showComponent:!0})(O),t.a=Object(y.a)()(O)},iSlo:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("ROqK"),i=a("d/v1"),c=a("pJVQ"),o=a("tDQA"),l=a("VyNe"),m=a("/MKj"),d=a("zDJl"),u=a("6uZD"),p=a("kCmh"),g=a("FPv+"),f=a("VfnB"),h=a("qzmO"),b=a("XzT5"),E=a("ztiR");var S=a("Ty5D"),v=a("qx5e"),D=a("s506"),y=a("3Z9Z"),O=a("JI6e"),N=a("w2lk"),w=a("LCzB");class C extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,edit:n,bridge:c,t:o,water:m,temperature:d}=this.props;return s.a.createElement(l.a,null,s.a.createElement(r.a,{handleSubmit:e,showInterfacePicker:!0,address:t,device:a,showAdditionalButton:!!a,disableBridge:n,bridge:c,showHelp:!n},s.a.createElement(y.a,{className:"justify-content-center"},s.a.createElement(O.a,{lg:6},s.a.createElement("hr",null),s.a.createElement("h5",null,o("newSettings.devices.form.addons")),s.a.createElement(i.a,{name:"temperature",id:"temperature",component:N.a,label:o("newSettings.devices.form.temperature")}),s.a.createElement(i.a,{name:"standingSensor",id:"standingSensor",component:N.a,disabled:!d,label:o("newSettings.devices.form.standingSensor")}),s.a.createElement(i.a,{name:"water",id:"water",component:N.a,label:o("newSettings.devices.form.water")}),s.a.createElement(i.a,{name:"flowMeter",id:"flowMeter",component:N.a,disabled:!m,label:o("newSettings.devices.form.flowMeter")})))))}}C=Object(c.a)({form:"dispenserNRF",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,alias:l,temperature:m,water:p,flowMeter:g,standingSensor:b}=e,S=!!p&&!!g;if(!c){let e=Object(f.d)(n,d.d.DISPENSER_NRF).map(e=>({DevType:d.d.DISPENSER_NRF,Name:r,Address:e,ParentID:i.DevID,Interface:+s,Alias:l,AdditionalData:{hasWater:!!p,hasTemperatureSensor:!!m,isTemperatureIndividual:!!b,hasFlowMeter:!!S}}));return Object(E.a)(e).then(e=>{a.reset(),Object(E.c)(e)}).catch(e=>{Object(E.b)(e)})}{let e=o.clone();e.Address=Number(n),e.Name=r,e.Interface=+s,e.Alias=l,e.setWater(!!p),e.setTemperatureSensor(!!m),e.setFlowMeter(!!S),e.setTemperatureIndividual(!!b),e.Protocol=d.g.NRF,e.VerHard="0.1",e.VerSoft="0.1",t(Object(u.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))})),p||Object(h.B)(e,{waterDoseType:0,waterEfficiency:0,waterInitDose:0,waterDose:0})}},validate:function(e,t){const a={};if(e.name||(a.name=b.a.t("required")),!g.a.DEVICE_MANY_ADDR_DI_NRF.test("".concat(e.address))||e.edit&&!g.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=b.a.t("errors.addressError",{amount1:"0x1301",amount2:"0xFF0F",amount3:"0x1509"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){Object(f.d)(e.address,d.d.DISPENSER_NRF).length>r.DevDispensersNRFLeft&&(a.address=b.a.t("errors.maxDevices",{amount:r.DevDispensersNRFLeft}))}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(f.d)(e.address,d.d.DISPENSER_NRF),s=[];for(let a of n){let n=p.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=b.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=b.a.t("required");return e.interf||(a.interf=b.a.t("required")),a}})(C),C=Object(v.a)(e=>({roles:[D.c._DEVICE_CONFIG],showComponent:!0}))(C);const I=Object(o.a)("dispenserNRF");C=Object(m.connect)(e=>({address:I(e,"address"),device:I(e,"device"),edit:I(e,"edit"),bridge:I(e,"bridge"),water:I(e,"water"),temperature:I(e,"temperature"),user:e.user.user,farm:e.location.farm}))(C),C=Object(w.a)()(C);t.a=Object(S.o)(C)},kpyk:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("IXwn"),i=a("uSQv"),c=a("VyNe"),o=a("AAik"),l=a("/MKj"),m=a("zDJl"),d=a("qx5e"),u=a("s506"),p=a("BvFm"),g=a("VfnB"),f=a("55Ip"),h=a("LCzB"),b=a("yjtO");class E extends s.a.Component{constructor(e){super(e),this.onSelectionChange=e=>{this.setState({selectedDispensers:e})},this.state={selectedDispensers:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(g.t)(t),{selectedDispensers:l}=this.state;return Object(p.a)()?s.a.createElement(c.a,null,s.a.createElement(o.a,{data:e.filter(e=>e.DevType===m.d.DISPENSER),headers:n,shouldIndex:!0,mobileRow:s.a.createElement(b.a,null),selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageDispensersF1"}),s.a.createElement(r.a,{fixed:!0,renderInPortal:!1},s.a.createElement(f.Link,{to:{pathname:"/".concat(a,"/settings/feeding/f1/manage/configuration"),state:{selectedDispensers:l}},disabled:0===l.length},s.a.createElement(i.a,{buttonColor:"success",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===l.length})))):null}}let S=Object(l.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(E);S=Object(d.a)({roles:[u.c._DEVICE_CONFIG],showComponent:!0})(S),t.a=Object(h.a)()(S)},lTfi:function(e,t,a){"use strict";var n=a("mwIZ"),s=a.n(n),r=a("BkRI"),i=a.n(r),c=a("J2iB"),o=a.n(c),l=a("q1tI"),m=a.n(l),d=a("/MKj"),u=a("AAik"),p=a("P5Co"),g=a("IXwn"),f=a("uSQv"),h=a("VyNe"),b=a("6uZD"),E=a("Ty5D"),S=a("ANjH"),v=a("f0zD"),D=a("kCVf"),y=a("zDJl");class O extends m.a.Component{constructor(...e){super(...e),this.onClick=()=>{this.props.onClick(this.props.value)}}render(){return[y.d.GATEWAY,y.d.DI_TIME,y.d.BRIDGE_CONF,y.d.BRIDGE_WORK,y.d.BROADCAST].includes(this.props.value.DevType)?null:m.a.createElement("i",{className:"fas fa-pencil-alt",onClick:this.onClick})}}var N=a("kCmh"),w=a("wQmL"),C=a("Y+p1"),I=a.n(C),j=a("CuyV"),T=(a("6JL/"),a("wd/R")),A=a.n(T),F=a("/kok"),x=a("udB/"),P=a("LCzB");class R extends m.a.Component{constructor(e){super(e),this.removeLoading=()=>{this.setState({loading:!1})},this.onClick=e=>{e.stopPropagation(),this.setState({loading:!0},()=>{F.a.startSendingDeviceState(this.props.value,this.removeLoading,this.removeLoading)})},this.state={loading:!1}}shouldComponentUpdate(e,t,a){if(!I()(this.state,t))return!0;if(!I()(this.props.value,e.value))return!0;let n=this.props.shadows.get(this.props.value.DevID),s=e.shadows.get(e.value.DevID);return!I()(n,s)}getTooltip(){const{value:e,shadows:t,t:a}=this.props;let n=t.get(e.DevID);if(!n)return a("newSettings.devices.connection.noData");let s=0;for(let r in n.metadata)n.metadata[r]>s&&(s=n.metadata[r]);return m.a.createElement("div",null,a("newSettings.devices.connection.lastAnswer"),m.a.createElement("strong",null,A()(s).format("DD.MM.YYYY HH:mm")))}getType(){const{value:e,shadows:t}=this.props;return t.get(e.DevID)?"success":"error"}render(){const{value:e,shadows:t}=this.props;if(e.DevType===y.d.GATEWAY||e.DevType===y.d.BRIDGE)return m.a.createElement("i",{className:"fas fa-minus"});let a=t.get(e.DevID);const{loading:n}=this.state;return m.a.createElement("div",{className:"connection"},m.a.createElement(x.a,{isLoading:n}),m.a.createElement(j.a,{tooltipContent:this.getTooltip(),type:this.getType()},m.a.createElement("div",{onClick:this.onClick},a&&m.a.createElement("i",{className:"fas fa-check"}),!a&&m.a.createElement("i",{className:"fas fa-times"}))))}}R=Object(d.connect)(e=>({shadows:e.shadows.shadows}))(R);var k=Object(P.a)()(R),_=a("pxzG"),M=a("s506"),B=a("qx5e"),L=a("q17X"),V=a("VfnB"),z=a("9D2Z"),U=a("kG49"),W=a("pJ06"),q=a("yjtO");function H(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function G(e){for(var t=1;te.getLocation().map(e=>e?e.BoxesName||e.CName||e.SName||e.BName:[]).join(", "),this.addressFormatter=e=>o()(e)?"":"".concat(e," / 0x").concat(e.toString(16).toUpperCase()),this.onAddButtonClick=()=>{this.props.history.push("/".concat(this.props.farm,"/settings/devices/add"))},this.onRemoveClick=()=>{let e=this.getChildrenDevices(this.state.selectedDevices);for(let a of this.state.selectedDevices)e=e.filter(e=>a.DevID!==e.DevID);let t=m.a.createElement("div",null,m.a.createElement("ul",null,this.state.selectedDevices.map((e,t)=>{let a=e.getLocation().map(e=>Object(D.k)(e)).filter(e=>e).join(", ");return m.a.createElement("li",{key:t},e.Name," ",a?"(".concat(a,")"):"")})),e.length>0&&m.a.createElement(m.a.Fragment,null,this.props.t("newSettings.devices.manage.removeDevicesAdditional"),m.a.createElement("ul",null,e.map((e,t)=>{let a=e.getLocation().map(e=>Object(D.k)(e)).filter(e=>e).join(", ");return m.a.createElement("li",{key:t},e.Name," ",a?"(".concat(a,")"):"")}))));this.props.show("confirm-modal",{title:this.props.t("newSettings.devices.manage.removeDevices"),text:this.props.t("newSettings.devices.manage.removeDevicesText"),confirmText:this.props.t("yes"),children:t,onConfirmed:t=>{let a=i()([...this.state.selectedDevices,...e]);for(let e of a)e.removeDevice(),e.prepareBeanToSave();this.props.dispatch(Object(b.e)(a,this.props.farm,this.props.user.ClientID,this.props.user.LocalUserID)),this.setState({selectedDevices:[]}),t.handleHide()}})},this.onEditClick=e=>{let t="/".concat(this.props.farm,"/settings/devices/add/"),a="";switch(e.DevType){case y.d.BRIDGE:a="bridge";break;case y.d.CAGE:a="cage";break;case y.d.DISPENSER:a="dispenserWST";break;case y.d.DISPENSER_NRF:a="dispenserNRF";break;case y.d.SCALE:a="weightWST";break;case y.d.CLIMATE:a="climateWST";break;case y.d.CLIMATE_SK3:a="climateSK3";break;case y.d.THERMOEYE:a="thermoEye";break;case y.d.BRIDGE_WORK:a="bridgeWork";break;case y.d.BRIDGE_CONF:a="bridgeConf";break;case y.d.BROADCAST:a="broadcast";break;case y.d.DISPENSER_NRF_MULTI:a="dispenserNRFMulti";break;case y.d.ANTENNA_RFID:a="antennaRFID";break;case y.d.WATER_FLOW_METER:a="waterMeter";break;case y.d.ELECTRICITY_FLOW_METER:a="electricityMeter";break;case y.d.CHAIN_FEEDING:a="chainFeeding";break;case y.d.SMALL_CAGE:a="pigletScaleEdit"}let n={name:e.Name,address:e.Address,edit:!0,alias:e.Alias,Number:e.Number,device:e},r=Object(L.getScaleUnit)();if(e.DevType===y.d.BRIDGE){n=G({},n,{gateway:N.a.getDeviceByID(e.ParentID)||null,Rs0Protocol:e.Interfaces[3],Rs1Protocol:e.Interfaces[4],BridgePeriphery:e.Settings.BridgePeriphery||"None"})}else{if(n=G({},n,{bridge:N.a.getDeviceByID(e.ParentID)||null,interf:e.Interface}),e.DevType===y.d.DISPENSER)n=G({},n,{dispensers:e.Dispensers});else if(e.DevType===y.d.SCALE)n=G({},n,{siloses:(e.Siloses||new Array(8).fill(1)).map((e,t)=>({Adr:t,Active:!!e.Active,Capacity:e.Capacity?Object(_.j)(e.Capacity,{fixed:r?2:0,unit:r,rawValue:!0}):0,Alias:e.Alias||null,Forage:e.Forage||null,Number:e.Number||null}))});else if(e.DevType===y.d.CAGE)n=G({},n,{thermoeye:s()(e,"Settings.ThermoeyeID"),marker1:!!s()(e,"Settings.Marker[0]"),marker2:!!s()(e,"Settings.Marker[1]")});else if(e.DevType===y.d.CLIMATE_SK3)n=G({},n,{matsNumber:e.getMatsSize()});else if(e.DevType===y.d.DISPENSER_NRF||e.DevType===y.d.DISPENSER_NRF_MULTI)n=G({},n,{address:"0x".concat((+e.Address||0).toString(16).toLowerCase()),temperature:e.DevType===y.d.DISPENSER_NRF&&e.hasTemperatureSensor(),water:e.DevType===y.d.DISPENSER_NRF&&e.hasWater()}),n.water&&(n.flowMeter=e.hasFlowMeter());else if([y.d.ELECTRICITY_FLOW_METER,y.d.WATER_FLOW_METER].includes(e.DevType))n=G({},n,{number:s()(e,"Number"),serial:s()(e,"Serial")}),y.d.ELECTRICITY_FLOW_METER&&(n.phases=s()(e,"Settings.Phases",1));else if(y.d.CHAIN_FEEDING===e.DevType){const t=[];for(let a=0;a<4;a++)t.push({name:s()(e,"Settings.Aliases[".concat(a,"]"),"")});n=G({},n,{aliases:t,useVoltage:!!s()(e,"Settings.UseVoltage"),address:"0x".concat((+e.Address||0).toString(16).toLowerCase())})}}this.props.dispatch(Object(w.c)(a,n)),this.props.history.push(t+a)},this.interfaceValueFormatter=e=>{let t=Object(V.n)(e);if(t)return"".concat(t," (").concat(e,")")},this.onMoreClick=e=>{this.setState({menuEvent:e})},this.onFixClick=()=>{const{t:e}=this.props;this.props.show("confirm-modal",{title:e("apiNotifications.addNecessaryDevicesTitle"),text:e("fixDevicesText"),confirmText:e("yes"),onConfirmed:e=>{Object(W.a)().then(e=>{Object(W.c)(e)}).catch(e=>{Object(W.b)(e)}),e.handleHide()}})},this.onSelectedRow=this.onSelectedRow.bind(this),this.addressFormatter=this.addressFormatter.bind(this),this.state={selectedDevices:[],menuEvent:null}}onSelectedRow(e){this.setState({selectedDevices:e})}componentDidMount(){this.props.dispatch(Object(b.d)(this.props.farm))}getChildrenDevices(e){let t=[];for(let a of e)if(a){let e=N.a.getDevicesWithParentID(a.DevID);t=[...t,...e]}return t}render(){const{devices:e,t:t}=this.props,a=[{name:t("newSettings.devices.manage.type"),field:"DevType",filterType:p.a.STRING},{name:t("newSettings.devices.manage.name"),field:"Name",filterType:p.a.STRING,_mobileHeader:!0},{name:t("adres"),field:"Address",valueFormatter:this.addressFormatter,filterType:p.a.DEV_ADDRESS},{name:t("newSettings.devices.manage.interface"),field:"Interface",filterType:p.a.NUMBER,valueFormatter:this.interfaceValueFormatter},{name:t("location"),valueFormatter:this.plcmntIDValueFormatter,filterColumn:"location"},{name:t("newSettings.devices.manage.response"),component:m.a.createElement(k,null),_mobileHide:!0},{name:"",component:m.a.createElement(O,{onClick:this.onEditClick}),itemClassName:"checkbox",headerClassName:"selected-header",_floating:!0}],{selectedDevices:n,menuEvent:s}=this.state;return m.a.createElement(h.a,{className:"settings-profile-general"},m.a.createElement(u.a,{headers:a,swipePagination:!0,data:e.sort((e,t)=>e.DevType>t.DevType?1:e.DevType===t.DevType?0:-1),selectableRow:!0,mobileRow:m.a.createElement(q.a,null),onSelectedRowsChanged:this.onSelectedRow,showFilter:!0,isSortable:!0,showPagination:!0,paginationItems:20,name:"manageDevices"}),m.a.createElement(g.a,{fixed:!0},m.a.createElement(f.a,{buttonColor:"info",buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-ellipsis-v"}),onClick:this.onMoreClick}),m.a.createElement(f.a,{disabled:!n.length,buttonColor:"error",buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-trash"}),onClick:this.onRemoveClick}),m.a.createElement(f.a,{buttonColor:"success",buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-plus"}),onClick:this.onAddButtonClick})),m.a.createElement(z.a,{event:s},m.a.createElement(U.a,{icon:m.a.createElement("i",{className:"fas fa-wrench"}),onClick:this.onFixClick},t("addMissingDevices"))))}}let Z=Object(d.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(Y);Y=Object(E.o)(Z),Y=Object(d.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm,user:e.user.user}),e=>G({dispatch:e},Object(S.b)({show:v.d},e)))(Y),Y=Object(B.a)({roles:[M.c._DEVICE_CONFIG],showComponent:!0})(Y);t.a=Object(P.a)()(Y)},m5Db:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("udB/"),i=a("3Z9Z"),c=a("JI6e"),o=a("/MKj"),l=a("/kok"),m=a("mwIZ"),d=a.n(m),u=a("Y+p1"),p=a.n(u),g=a("1smR"),f=a("17x9"),h=a.n(f),b=a("Vv3o"),E=a("pxzG"),S=a("VfnB"),v=a("RFJ0"),D=a("qzmO"),y=a("zDJl"),O=a("q17X"),N=a("BvFm"),w=a("IBmF"),C=a("vzZS"),I=a("wd/R"),j=a.n(I),T=a("Q2bl"),A=a("6/k7"),F=a("LCzB"),x=a("XzT5");class P extends s.a.Component{constructor(e){super(e),this.getWorkType=(e=this.props)=>{const{dispensers:t,shadows:a}=e;let n=t[0];try{let e=a.get(n.DevID);return{maxOneDose:e.workType.maxOneDose||50,initDose:e.workType.initDose||50,timeOrImpulse:e.workType.timeOrImpulse||"T",workType:e.workType.workType||"H",optButt:e.workType.optButt||0,loadedDataFrom:y.i.SHADOW,device:n}}catch(s){return{maxOneDose:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".maxOneDose"),50),initDose:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".initDose"),50),timeOrImpulse:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".timeOrImpulse"),"T"),workType:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".workType"),"H"),SetTime:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".SetTime"),0),optButt:d()(n,"Settings.Configuration.".concat(w.g.SET_WORK_TYPE,".optButt"),0),loadedDataFrom:n&&n.Settings&&n.Settings.Configuration&&n.Settings.Configuration[w.g.SET_WORK_TYPE]?y.i.DYNAMO:y.i.NO_DATA,device:n}}},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(S.r)(e);if(t){const e=Object(T.b)(this.state);for(let a of t.values())a[y.d.BROADCAST].length&&Object(D.C)(a[y.d.BROADCAST],e),a[y.d.DISPENSER_NRF_MULTI].length&&Object(D.C)(a[y.d.DISPENSER_NRF_MULTI],e),a[y.d.DISPENSER_NRF].length&&Object(D.C)(a[y.d.DISPENSER_NRF],e)}},this.setValue=(e,t)=>{this.setState({[e]:t,changed:!0})},this.state=this.getWorkType(e)}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(this.getWorkType(e))}shouldComponentUpdate(e,t,a){return!p()(this.state,t)}render(){const{t:e}=this.props,{maxOneDose:t,initDose:a,timeOrImpulse:n,workType:r,loadedDataFrom:i,SetTime:c,device:o,optButt:l}=this.state;let m=Object(O.getFeedingUnit)();const d=[{name:e("schedule"),value:A.g.SCHEDULE},{name:e("newSettings.dispenserNRF.workType.toy"),value:A.g.TRIGGER},{name:e("rfid"),value:A.g.RFID}],u=[{name:e("time"),value:"T"},{name:e("newSettings.dispenserNRF.workType.impulse"),value:"I"}],p=[{name:e("newSettings.dispenserNRF.workType.punishment"),value:0},{name:e("newSettings.dispenserNRF.workType.extraFeeding"),value:1}];return 0===l&&"Z"!==r&&this.setState({optButt:1}),s.a.createElement(g.b,{title:e("worktype"),onButtonClick:this.onClick},i!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,i===y.i.DYNAMO&&!o.Settings.Configuration[w.g.SET_WORK_TYPE].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(c).format("DD.MM.YYYY HH:mm")})),i===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),s.a.createElement(b.a,{value:t,label:e("newSettings.dispenserNRF.workType.maxOneDose"),min:50,max:2550,step:50,valueFormatter:e=>Object(E.j)(e,{showUnit:!0,unit:m,fixed:m?2:0}),onChange:e=>this.setValue("maxOneDose",e)}),s.a.createElement(b.a,{value:a,label:e("newSettings.dispenserNRF.workType.initDose"),min:50,max:2550,step:50,valueFormatter:e=>Object(E.j)(e,{showUnit:!0,unit:m,fixed:m?2:0}),onChange:e=>this.setValue("initDose",e)}),s.a.createElement(v.a,{label:e("newSettings.dispenserNRF.workType.workType"),options:d,value:r,onChange:e=>this.setValue("workType",e),clearButton:!1}),s.a.createElement(v.a,{label:e("newSettings.dispenserNRF.workType.buttonWorkType"),options:p.filter(e=>e.value||"Z"===r),value:l,onChange:e=>this.setValue("optButt",e),clearButton:!1}),Object(N.i)()&&s.a.createElement(v.a,{label:e("newSettings.dispenserNRF.workType.timeOrImpulse"),options:u,value:n,onChange:e=>this.setValue("timeOrImpulse",e),clearButton:!1}))}}P.propTypes={dispensers:h.a.array.isRequired},P=Object(o.connect)(e=>({shadows:e.shadows.shadows}))(P);var R=Object(F.a)()(P);class k extends s.a.Component{constructor(e){super(e),this.getMotorSetup=(e=this.props)=>{const{dispensers:t,shadows:a}=e;let n=t[0];try{let e=a.get(n.DevID);return{timeOn:e.motorSetup.timeOn||100,timeBetweenImpulses:e.motorSetup.timeBetweenImpulses||50,timeBreak:e.motorSetup.timeBreak||100,currentOverloadTime:e.motorSetup.currentOverloadTime||20,timeAbsent:e.motorSetup.timeAbsent||6e4,loadedDataFrom:y.i.SHADOW,device:n}}catch(s){return{timeOn:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".timeOn"),100),timeBetweenImpulses:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".timeBetweenImpulses"),50),timeBreak:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".timeBreak"),100),currentOverloadTime:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".currentOverloadTime"),20),timeAbsent:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".timeAbsent"),6e4),SetTime:d()(n,"Settings.Configuration.".concat(w.g.SET_MOTOR_SETUP,".SetTime"),0),loadedDataFrom:n&&n.Settings&&n.Settings.Configuration&&n.Settings.Configuration[w.g.SET_MOTOR_SETUP]?y.i.DYNAMO:y.i.NO_DATA,device:n}}},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(S.r)(e);if(t){const e=Object(T.b)(this.state);for(let a of t.values())a[y.d.BROADCAST].length&&Object(D.v)(a[y.d.BROADCAST],e),a[y.d.DISPENSER_NRF_MULTI].length&&Object(D.v)(a[y.d.DISPENSER_NRF_MULTI],e),a[y.d.DISPENSER_NRF].length&&Object(D.v)(a[y.d.DISPENSER_NRF],e)}},this.setValue=(e,t)=>{this.setState({[e]:t,changed:!0})},this.state=this.getMotorSetup()}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(this.getMotorSetup(e))}shouldComponentUpdate(e,t,a){return!p()(this.state,t)}render(){const{t:e}=this.props,{timeOn:t,timeBetweenImpulses:a,timeBreak:n,currentOverloadTime:r,timeAbsent:i,loadedDataFrom:c,SetTime:o,device:l}=this.state;return s.a.createElement(g.b,{title:e("newSettings.dispenserNRF.motorSetup.title"),onButtonClick:this.onClick},c!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,c===y.i.DYNAMO&&!l.Settings.Configuration[w.g.SET_MOTOR_SETUP].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(o).format("DD.MM.YYYY HH:mm")})),c===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),s.a.createElement(b.a,{value:n,label:e("newSettings.dispenserNRF.motorSetup.timeBreak"),min:0,max:3e5,step:5e3,valueFormatter:e=>"".concat(Math.floor(e/1e3),"s"),onChange:e=>this.setValue("timeBreak",e)}),Object(N.i)()&&s.a.createElement(s.a.Fragment,null,s.a.createElement(b.a,{value:t,label:e("newSettings.dispenserNRF.motorSetup.timeOn"),min:100,max:5e3,step:100,valueFormatter:e=>"".concat(e,"ms"),onChange:e=>this.setValue("timeOn",e)}),s.a.createElement(b.a,{value:a,label:e("newSettings.dispenserNRF.motorSetup.timeBetweenImpulses"),min:50,max:5e3,step:5,valueFormatter:e=>"".concat(e,"ms"),onChange:e=>this.setValue("timeBetweenImpulses",e)}),s.a.createElement(b.a,{value:r,label:e("newSettings.dispenserNRF.motorSetup.currentOverloadTime"),min:20,max:5e3,step:5,valueFormatter:e=>"".concat(e,"ms"),onChange:e=>this.setValue("currentOverloadTime",e)}),s.a.createElement(b.a,{value:i,label:e("newSettings.dispenserNRF.motorSetup.timeAbsent"),min:0,max:3e5,step:3e4,valueFormatter:e=>"".concat((e/6e4).toFixed(1),"min"),onChange:e=>this.setValue("timeAbsent",e)})))}}k.propTypes={dispensers:h.a.array.isRequired},k=Object(o.connect)(e=>({shadows:e.shadows.shadows}))(k);var _=Object(F.a)()(k),M=a("D1y2"),B=a.n(M),L=a("BkRI"),V=a.n(L);function z(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function U(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class W extends s.a.Component{constructor(e){super(e),this.getPunishmentSetup=(e=this.props)=>{const{dispensers:t,shadows:a}=e;let n=t[0],s={},r=[];try{r=a.get(n.DevID).punishment,s.loadedDataFrom=r?y.i.SHADOW:y.i.NO_DATA,s.SetTime=d()(r,"shadow.metadata.punishment",0)}catch(i){r=d()(n,"Settings.Configuration.".concat(w.g.SET_MINUS_CONFIG)),s.loadedDataFrom=r?y.i.DYNAMO:y.i.NO_DATA,s.SetTime=d()(r,"SetTime",0)}s.punishment=[],s.device=n;for(let c=0;c<3;c++)s.punishment[c]={percentage:d()(r,"[".concat(c,"].percentage"),10),time:d()(r,"[".concat(c,"].time"),5),trigger:d()(r,"[".concat(c,"].trigger"),1)};return s},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(S.r)(e);if(t){const e=Object(T.b)(this.state.punishment);for(let a of t.values())a[y.d.BROADCAST].length&&Object(D.x)(a[y.d.BROADCAST],e),a[y.d.DISPENSER_NRF_MULTI].length&&Object(D.x)(a[y.d.DISPENSER_NRF_MULTI],e),a[y.d.DISPENSER_NRF].length&&Object(D.x)(a[y.d.DISPENSER_NRF],e)}},this.setValue=(e,t)=>{let a=V()(this.state);B()(a,e,t),this.setState(function(e){for(var t=1;ts.a.createElement(s.a.Fragment,null,s.a.createElement("label",null,x.a.t("punishment",{type:e+1})),s.a.createElement(b.a,{value:this.state.punishment[e].time,label:this.props.t("newSettings.dispenserNRF.punishmentSetup.time"),min:0,max:15,step:1,valueFormatter:e=>"".concat(e,"m"),onChange:t=>this.setValue("punishment[".concat(e,"].time"),t)}),s.a.createElement(b.a,{value:this.state.punishment[e].percentage,label:this.props.t("newSettings.dispenserNRF.punishmentSetup.percentage"),min:10,max:100,step:5,valueFormatter:e=>"".concat(e,"%"),onChange:t=>this.setValue("punishment[".concat(e,"].percentage"),t)}),s.a.createElement(b.a,{value:this.state.punishment[e].trigger,label:this.props.t("newSettings.dispenserNRF.punishmentSetup.trigger"),min:1,max:15,step:1,valueFormatter:e=>"".concat(e),onChange:t=>this.setValue("punishment[".concat(e,"].trigger"),t)})),this.state=this.getPunishmentSetup()}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(this.getPunishmentSetup(e))}shouldComponentUpdate(e,t,a){return!p()(this.state,t)}render(){const{t:e}=this.props,{loadedDataFrom:t,SetTime:a,device:n}=this.state;return s.a.createElement(g.b,{title:e("punishmentSetup"),onButtonClick:this.onClick},t!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,t===y.i.DYNAMO&&!n.Settings.Configuration[w.g.SET_MOTOR_SETUP].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(a).format("DD.MM.YYYY HH:mm")})),t===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),this.renderStage(0),this.renderStage(1),this.renderStage(2))}}W.propTypes={dispensers:h.a.array.isRequired},W=Object(o.connect)(e=>({shadows:e.shadows.shadows}))(W);var q=Object(F.a)()(W),H=a("6uZD");class G extends s.a.Component{constructor(e){super(e),this.temperatureValueFormatter=e=>"".concat(e,"\xb0C"),this.onMinAlarmChange=e=>{this.setState({minimumTemperatureAlarm:e})},this.onMaxAlarmChange=e=>{this.setState({maximumTemperatureAlarm:e})},this.onClick=()=>{const{farm:e,user:t}=this.props,{minimumTemperatureAlarm:a,maximumTemperatureAlarm:n}=this.state;let s=[];for(let r of this.props.dispensers)if(r.DevType===y.d.DISPENSER_NRF){let e=r.clone();e.Settings.Temperature={Sensor:e.hasTemperatureSensor(),MinimumAlarm:a,MaximumAlarm:n},s.push(e.prepareBeanToSave())}s.length&&this.props.dispatch(Object(H.e)(s,e,t.ClientID,t.LocalUserID))},this.state={minimumTemperatureAlarm:d()(e.dispensers[0],"Settings.Temperature.MinimumAlarm",0),maximumTemperatureAlarm:d()(e.dispensers[0],"Settings.Temperature.MaximumAlarm",25)}}render(){const{t:e}=this.props,{minimumTemperatureAlarm:t,maximumTemperatureAlarm:a}=this.state;return s.a.createElement(g.b,{title:e("newSettings.dispenserNRF.temperature.title"),onButtonClick:this.onClick},s.a.createElement(b.a,{label:e("minTempAlarm"),value:t,valueFormatter:this.temperatureValueFormatter,min:0,max:25,step:.2,onChange:this.onMinAlarmChange}),s.a.createElement(b.a,{label:e("maxTempAlarm"),value:a,valueFormatter:this.temperatureValueFormatter,min:25,max:50,step:.2,onChange:this.onMaxAlarmChange}))}}G.propTypes={dispensers:h.a.array.isRequired},G=Object(o.connect)(e=>({farm:e.location.farm,user:e.user.user}))(G);var J=Object(F.a)()(G);class Y extends s.a.Component{constructor(e){super(e),this.setValue=e=>{this.setState({state:e,changed:!0})},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(S.r)(e);if(t){const{state:e}=this.state;for(let a of t.values())a[y.d.BROADCAST].length&&Object(D.z)(a[y.d.BROADCAST],e),a[y.d.DISPENSER_NRF_MULTI].length&&Object(D.z)(a[y.d.DISPENSER_NRF_MULTI],e),a[y.d.DISPENSER_NRF].length&&Object(D.z)(a[y.d.DISPENSER_NRF],e)}},this.state=this.getState(e)}getState(e){const{dispensers:t}=e;let a=t[0];return{state:d()(a,"Settings.Configuration.".concat(w.g.SET_SWITCH_MOTOR_ON_INFO,".state"),0),loadedDataFrom:a&&a.Settings&&a.Settings.Configuration&&a.Settings.Configuration[w.g.SET_SWITCH_MOTOR_ON_INFO]?y.i.DYNAMO:y.i.NO_DATA,device:a}}render(){const{state:e,loadedDataFrom:t,SetTime:a,device:n}=this.state;return s.a.createElement(g.b,{title:"Powiadomienia - status CAN",onButtonClick:this.onClick},t!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,t===y.i.DYNAMO&&!n.Settings.Configuration[w.g.SET_SWITCH_MOTOR_ON_INFO].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(a).format("DD.MM.YYYY HH:mm")})),t===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},x.a.t("newSettings.devices.settingsInfo.noData"))),s.a.createElement(v.a,{label:"Status",options:[{name:"W\u0142\u0105czone",value:1},{name:"Wy\u0142\u0105czone",value:0}],clearButton:!1,value:e,onChange:this.setValue}))}}Y=Object(o.connect)(e=>({}))(Y);var Z=a("VyNe"),Q=a("uSQv"),K=a("IXwn"),X=a("ANjH"),$=a("f0zD"),ee=a("42VQ"),te=a("0MVo");class ae extends s.a.Component{onConfirmed(e,t){const{dispensers:a}=this.props,n=Object(S.r)(a);if(n)for(let s of n.values())s[y.d.BROADCAST].length&&Object(D.o)(s[y.d.BROADCAST],t),s[y.d.DISPENSER_NRF_MULTI].length&&Object(D.o)(s[y.d.DISPENSER_NRF_MULTI],t),s[y.d.DISPENSER_NRF].length&&Object(D.o)(s[y.d.DISPENSER_NRF],t);e.handleHide()}getName(e){switch(e){case 0:return"logi";case 1:return"czas pracy silnika";case 2:return"NRF/SET FLAG";case 3:return"krzywe";case 4:return"harmonogramy";case 5:return"konfiguracje standardow\u0105";case 6:return"RFID";case 11:return"konfiguracje CAN";default:return""}}onButtonClick(e){this.props.show(ee.a,{text:Object(te.d)("Czy na pewno chcesz wyczy\u015bci\u0107 {1}?",this.getName(e)),title:"Czyszczenie pami\u0119ci",confirmText:"Tak",onConfirmed:t=>this.onConfirmed(t,e)})}render(){return s.a.createElement(Z.a,{className:"device-settings-card"},s.a.createElement("h5",null,"Czyszczenie pami\u0119ci"),s.a.createElement(K.a,{vertical:!0,className:"w-100 m-0"},s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(0)},"Wyczy\u015b\u0107 ",this.getName(0)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(1)},"Wyczy\u015b\u0107 ",this.getName(1)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(2)},"Wyczy\u015b\u0107 ",this.getName(2)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(3)},"Wyczy\u015b\u0107 ",this.getName(3)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(4)},"Wyczy\u015b\u0107 ",this.getName(4)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(5)},"Wyczy\u015b\u0107 ",this.getName(5)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(6)},"Wyczy\u015b\u0107 ",this.getName(6)),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick(11)},"Wyczy\u015b\u0107 ",this.getName(11))))}}var ne=ae=Object(o.connect)(null,e=>Object(X.b)({show:$.d},e))(ae);class se extends s.a.Component{constructor(e){super(e),this.setT=e=>{this.setState({t:e})},this.onClick=()=>{const{dispensers:e}=this.props,t=Object(S.r)(e);if(t){const{t:e}=this.state;for(let a of t.values())a[y.d.BROADCAST].length&&Object(D.w)(a[y.d.BROADCAST],e),a[y.d.DISPENSER_NRF_MULTI].length&&Object(D.w)(a[y.d.DISPENSER_NRF_MULTI],e),a[y.d.DISPENSER_NRF].length&&Object(D.w)(a[y.d.DISPENSER_NRF],e)}},this.state=this.getState(e)}getState(e){const{dispensers:t}=e;let a=t[0];return{t:d()(a,"Settings.Configuration.".concat(w.g.SET_NRF_POWER,".t"),0),loadedDataFrom:a&&a.Settings&&a.Settings.Configuration&&a.Settings.Configuration[w.g.SET_NRF_POWER]?y.i.DYNAMO:y.i.NO_DATA,device:a}}render(){const{loadedDataFrom:e,SetTime:t,device:a,t:n}=this.state;return s.a.createElement(g.b,{title:"Moc NRF",onButtonClick:this.onClick},e!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,e===y.i.DYNAMO&&!a.Settings.Configuration[w.g.SET_NRF_POWER].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(t).format("DD.MM.YYYY HH:mm")})),e===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},x.a.t("newSettings.devices.settingsInfo.noData"))),s.a.createElement(b.a,{value:n,label:"Moc",min:0,max:3,valueFormatter:e=>e,onChange:this.setT}))}}var re=se=Object(o.connect)(e=>({}))(se);class ie extends s.a.Component{onConfirmed(e,t){const{dispensers:a}=this.props,n=Object(S.r)(a);if(n)for(let s of n.values())s[y.d.BROADCAST].length&&Object(D.p)(s[y.d.BROADCAST],t),s[y.d.DISPENSER_NRF_MULTI].length&&Object(D.p)(s[y.d.DISPENSER_NRF_MULTI],t),s[y.d.DISPENSER_NRF].length&&Object(D.p)(s[y.d.DISPENSER_NRF],t);e.handleHide()}onButtonClick(e){this.props.show(ee.a,{text:Object(te.d)("Czy na pewno chcesz wyczy\u015bci\u0107 histori\u0119 z {1}?","DAY"===e?"dnia":"2 tygodni"),title:"Czyszczenie historii",confirmText:"Tak",onConfirmed:t=>this.onConfirmed(t,e)})}render(){return s.a.createElement(Z.a,{className:"device-settings-card"},s.a.createElement("h5",null,"Czyszczenie pami\u0119ci"),s.a.createElement(K.a,{vertical:!0,className:"w-100 m-0"},s.a.createElement(Q.a,{onClick:()=>this.onButtonClick("DAY")},"Wyczy\u015b\u0107 histori\u0119 z dnia"),s.a.createElement(Q.a,{onClick:()=>this.onButtonClick("ALL")},"Wyczy\u015b\u0107 histori\u0119 z 2 tygodni")))}}var ce=ie=Object(o.connect)(null,e=>Object(X.b)({show:$.d},e))(ie),oe=a("J2iB"),le=a.n(oe),me=a("d/v1"),de=a("pJVQ"),ue=a("tDQA"),pe=a("PbGg"),ge=a("eASP"),fe=a("XoCd"),he=a("4huo");class be extends n.Component{constructor(e){super(e),this.getState=(e=this.props)=>{const t={},{dispensers:a,shadows:n}=e,s=a[0],r="Settings.Configuration[".concat(w.g.SET_WATER_EFFICIENCY,"]"),i=s?n.get(s.DevID):null;return t.waterDoseType=d()(i,"efficiency.waterDoseType",d()(s,"".concat(r,".waterDoseType"),0)),t.waterEfficiency=d()(i,"efficiency.waterEfficiency",d()(s,"".concat(r,".waterEfficiency"),0)),t.waterInitDose=d()(i,"efficiency.waterInitDose",d()(s,"".concat(r,".waterInitDose"),0)),t.waterDose=d()(i,"efficiency.waterDose",d()(s,"".concat(r,".waterDose"),0)),t.SetTime=d()(i,"efficiency.workType",d()(s,"Settings.Configuration[".concat(w.g.SET_WATER_EFFICIENCY,"].SetTime"),0)),t.loadedDataFrom=le()(d()(i,"efficiency.waterInitDose"))?d()(s,"Settings.Configuration[".concat(w.g.SET_WATER_EFFICIENCY,"]"))?y.i.DYNAMO:y.i.NO_DATA:y.i.SHADOW,t},this.volumeFormatter=e=>Object(E.h)(e,{showUnit:!0,unit:ge.a.SMALL,fixed:2}),this.impulseFormatter=e=>{const{t:t}=this.props;return t("deviceRows.feeding.dispenserRow.efficiencyImpulsesLiter",{efficiency:e})},this.timeFormatter=e=>{const{t:t}=this.props;return t("deviceRows.feeding.dispenserRow.efficiencyTime",{efficiency:Object(E.h)(2*e,{showUnit:!0,unit:ge.a.SMALL,fixed:2})})},e.initialize(this.getState()),this.state={dirty:!!e.dirty}}static getDerivedStateFromProps(e,t){return t.dirty||t.dirty===e.dirty?null:{dirty:!!e.dirty}}componentDidUpdate(e,t,a){const{dispensers:n,shadows:s,waterDoseType:r,waterEfficiency:i,change:c,initialize:o}=this.props,{dirty:l}=this.state;let m=!0;if(l!==t.dirty){const e=n[0];(e?s.get(e.DevID):null)&&!l&&(o(this.getState(this.props)),m=!1)}m&&e.waterDoseType!==r&&c("waterEfficiency",Math.min(2500,i-i%10))}render(){const{t:e,submit:t,loadedDataFrom:a,SetTime:n,dispensers:r,waterDoseType:i}=this.props,c=r[0];return s.a.createElement(g.a,{title:e("water"),onButtonClick:t},a!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,a===y.i.DYNAMO&&!c.Settings.Configuration[w.g.SET_WATER_EFFICIENCY].isSet&&s.a.createElement(C.a,{boxColor:"warning"},e("newSettings.devices.settingsInfo.dynamo",{date:j()(n).format("DD.MM.YYYY HH:mm")})),a===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),s.a.createElement(me.a,{id:"waterDoseType",name:"waterDoseType",label:e("newSettings.dispenserNRF.water.waterDoseType"),component:he.b,clearButton:!1,parse:e=>[0,1].includes(e)?e:0,options:[{name:e("newSettings.dispenserNRF.water.time"),value:0},{name:e("newSettings.dispenserNRF.water.impulse"),value:1}]}),s.a.createElement(me.a,{id:"waterEfficiency",name:"waterEfficiency",label:e("newSettings.dispenserNRF.water.waterEfficiency"),component:fe.a,min:0,max:i?5e3:2500,step:i?1:10,valueFormatter:i?this.impulseFormatter:this.timeFormatter}),s.a.createElement(me.a,{id:"waterDose",name:"waterDose",label:e("newSettings.dispenserNRF.water.waterDose"),component:fe.a,min:0,max:5e3,step:10,valueFormatter:this.volumeFormatter}),s.a.createElement(me.a,{id:"waterInitDose",name:"waterInitDose",label:e("newSettings.dispenserNRF.water.waterInitDose"),component:fe.a,min:0,max:5e3,step:10,valueFormatter:this.volumeFormatter}))}}be=Object(de.a)({form:"nrfWaterEfficiency",onSubmit:(e,t,a)=>{const{dispensers:n}=a,{waterDoseType:s,waterEfficiency:r,waterDose:i,waterInitDose:c}=e,o={},l={waterDoseType:0,waterEfficiency:0,waterInitDose:0,waterDose:0};o.waterDoseType=s,o.waterEfficiency=r,o.waterInitDose=c,o.waterDose=i,n.forEach(e=>{Object(D.B)(e,e.hasWater()?o:l)})},initialValues:{}})(be);const Ee=Object(ue.a)("nrfWaterEfficiency");be=Object(o.connect)(e=>({SetTime:Ee(e,"SetTime"),loadedDataFrom:Ee(e,"loadedDataFrom"),waterDoseType:Ee(e,"waterDoseType"),waterEfficiency:Ee(e,"waterEfficiency"),dirty:Object(pe.a)("nrfWaterEfficiency")(e),shadows:e.shadows.shadows}))(be);var Se=Object(F.a)()(be);class ve extends s.a.Component{constructor(e){super(e),this.onClick=()=>{const{dispensers:e}=this.props,{efficiencyTime:t,efficiencyImpulse:a}=this.state,n=Object(S.r)(e),s=[y.d.BROADCAST,y.d.DISPENSER_NRF,y.d.DISPENSER_NRF_MULTI];if(n){const e={feedingTimeEfficiency:t,feedingDoseType:0},r={feedingImpulseEfficiency:a,feedingDoseType:1};for(let t of n.values())for(let a of s)t[a].length&&(Object(D.s)(t[a],e),Object(D.s)(t[a],r))}},this.handleChangeEfficiencyTime=e=>{this.setState({efficiencyTime:e,changed:!0})},this.handleChangeEfficiencyImpulse=e=>{this.setState({efficiencyImpulse:e,changed:!0})},this.impulseFormatter=e=>{const{t:t}=this.props;return t("newSettings.dispenserNRF.efficiency.impulseEfficiencyFormatter",{value:e,unit:Object(E.l)("weight",ge.a.SMALL,{overrideUnitSystem:"metric"})})},this.timeFormatter=e=>{const{t:t}=this.props,a=Object(O.getFeedingUnit)();return t("newSettings.dispenserNRF.efficiency.timeEfficiencyFormatter",{value:Object(E.j)(e,{unit:a,fixed:2*a,showUnit:!0})})},this.state=ve.getSetup(this.props)}static getDerivedStateFromProps(e,t){if(!t.changed)return ve.getSetup(e)}render(){const{t:e}=this.props,{loadedDataFrom:t,SetTime:a,device:n,efficiencyTime:r,efficiencyImpulse:i}=this.state;return s.a.createElement(g.b,{title:e("newSettings.dispenserNRF.efficiency.title"),onButtonClick:this.onClick},t!==y.i.SHADOW&&s.a.createElement(s.a.Fragment,null,t===y.i.DYNAMO&&!n.Settings.Configuration[w.g.SET_MOTOR_SETUP].isSet&&s.a.createElement(C.a,{boxColor:"warning"},x.a.t("newSettings.devices.settingsInfo.dynamo",{date:j()(a).format("DD.MM.YYYY HH:mm")})),t===y.i.NO_DATA&&s.a.createElement(C.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),s.a.createElement(b.a,{valueFormatter:this.timeFormatter,label:e("newSettings.dispenserNRF.efficiency.efficiencyTime"),value:r,onChange:this.handleChangeEfficiencyTime,min:0,max:2550,step:10}),Object(N.i)()&&s.a.createElement(b.a,{valueFormatter:this.impulseFormatter,label:e("newSettings.dispenserNRF.efficiency.efficiencyImpulse"),value:i,onChange:this.handleChangeEfficiencyImpulse,min:0,max:25}))}}ve.getSetup=e=>{const{dispensers:t,shadows:a}=e;let n=t[0],s={},r=[];try{r=a.get(n.DevID).efficiency,s.loadedDataFrom=r?y.i.SHADOW:y.i.NO_DATA,s.SetTime=d()(a.get(n.DevID),"metadata.efficiency",0)}catch(i){r=d()(n,"Settings.Configuration.".concat(w.g.SET_FEEDING_EFFICIENCY)),s.loadedDataFrom=r?y.i.DYNAMO:y.i.NO_DATA,s.SetTime=d()(r,"SetTime",0)}return s.efficiencyTime=d()(r,"feedingTimeEfficiency",1e3),s.efficiencyImpulse=d()(r,"feedingImpulseEfficiency",25),s.device=n,s},ve.propTypes={dispensers:h.a.array.isRequired},ve=Object(o.connect)(e=>({shadows:e.shadows.shadows}))(ve);var De=Object(F.a)()(ve);class ye extends s.a.Component{constructor(e){super(e),this.state={selectedDispensers:this.props.location.state?this.props.location.state.selectedDispensers:[],loading:!0},this.setLoading=()=>{this.setState({loading:!1})},0===this.state.selectedDispensers.length&&this.props.history.push("/".concat(this.props.farm,"/settings/feeding/f3f5/manage")),l.a.startSendingDeviceState(this.state.selectedDispensers,this.setLoading,this.setLoading)}render(){const{selectedDispensers:e,loading:t}=this.state,a=e.filter(e=>e.DevType===y.d.DISPENSER_NRF),n=!!a.find(e=>e.hasWater()),o=!!a.find(e=>e.hasTemperatureSensor());return 0===e.length?null:s.a.createElement("div",{style:{position:"relative"}},s.a.createElement(r.a,{isLoading:t}),s.a.createElement(i.a,null,s.a.createElement(c.a,{xl:4},s.a.createElement(R,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(_,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(De,{dispensers:e})),a.length>0&&s.a.createElement(s.a.Fragment,null,n&&s.a.createElement(c.a,{xl:8},s.a.createElement(Se,{dispensers:e})),o&&s.a.createElement(c.a,{xl:4},s.a.createElement(J,{dispensers:e}))),Object(N.i)()&&s.a.createElement(s.a.Fragment,null,s.a.createElement(c.a,{xl:4},s.a.createElement(Y,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(ne,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(re,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(ce,{dispensers:e})),s.a.createElement(c.a,{xl:4},s.a.createElement(q,{dispensers:e})))))}}ye=Object(o.connect)(e=>({farm:e.location.farm}))(ye);t.a=ye},pBWe:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("pJVQ"),o=a("tDQA"),l=a("/MKj"),m=a("FPv+"),d=a("VfnB"),u=a("zDJl"),p=a("kCmh"),g=a("6uZD"),f=a("XzT5"),h=a("ztiR");var b=a("Ty5D"),E=a("qx5e"),S=a("s506");class v extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,bridge:n,edit:c}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,address:+t,device:a,showAdditionalButton:!!a,bridge:n,showHelp:!c}))}}v=Object(c.a)({form:"antennaRFID",onSubmit:function(e,t,a){console.log("VALUES",arguments),console.log("PROPS",a);const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,alias:l}=e;if(!c){const e=Object(d.d)(n,u.d.ANTENNA_RFID).map(e=>({DevType:u.d.ANTENNA_RFID,Name:r,Address:e,ParentID:i.DevID,Interface:+s,Alias:l}));return Object(h.a)(e).then(e=>{a.reset(),Object(h.c)(e)}).catch(e=>{Object(h.b)(e)})}{let e=o.clone();e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=l,e.Protocol=u.g.RFID,e.VerHard="0.1",e.VerSoft="0.1",t(Object(g.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=f.a.t("required")),(!m.a.DEVICE_MANY_ADDR_ANT.test("".concat(e.address))||e.edit&&!m.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=f.a.t("errors.addressError",{amount1:"1 (0x1)",amount2:"16 (0x".concat(16..toString(16).toUpperCase(),")"),amount3:"2"})),e.bridge||(a.bridge=f.a.t("required")),!a.address&&e.address&&e.interf&&e.bridge){let n=Object(d.d)(e.address,u.d.ANTENNA_RFID),s=[];for(let a of n){let n=p.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length&&(a.address=f.a.t("errors.takenAddress",{type:s.join(", ")}))}return e.interf||(a.interf=f.a.t("required")),a}})(v),v=Object(E.a)(e=>({roles:[S.c._DEVICE_CONFIG],showComponent:!0}))(v);const D=Object(o.a)("antennaRFID");Object(l.connect)(e=>({address:D(e,"address"),device:D(e,"device"),edit:D(e,"edit"),devices:e.farmDevices.devices,user:e.user.user,farm:e.location.farm,bridge:D(e,"bridge")}))(v);t.a=Object(b.o)(v)},rSX7:function(e,t,a){},razv:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("+oSd"),i=a("HIda"),c=a("d/v1"),o=a("pJVQ"),l=a("VyNe"),m=a("/MKj"),d=a("3Z9Z"),u=a("JI6e"),p=a("w2lk"),g=a("2UNB"),f=a("P0Qa"),h=a("gLBR");var b=a("LCzB");class E extends s.a.Component{constructor(e){super(e);const{notifications:t}=this.props;t&&t.SetData.Silo?this.props.initialize(t.SetData.Silo):this.props.initialize({Info:{LowForage:!0},Warning:{LowForage:!0},Error:{NoForage:!0,ExceededMinimum:!0}})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement(l.a,null,s.a.createElement(i.a,{name:"Error"},s.a.createElement("h4",null,t("newSettings.notifications.silo.errors"),s.a.createElement("i",{className:"fas fa-exclamation-circle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.silo.minimum")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement(c.a,{name:"ExceededMinimum",component:p.a,label:"",id:"ExceededMinimum"}))))))}}E=Object(o.a)({form:"silo-notifications",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.Silo=e,a.setDtaModTime(),t(Object(h.c)(a))}else{let a=g.a.createSetting(f.a.NOTIFICATIONS,{Silo:e},s);delete a.FarmID,t(Object(h.a)(a))}}})(E),E=Object(m.connect)(e=>({notifications:e.settings.notifications,user:e.user.user}))(E);t.a=Object(b.a)()(E)},sYJm:function(e,t,a){"use strict";var n=a("J2iB"),s=a.n(n),r=a("lFKM"),i=a.n(r),c=a("q1tI"),o=a.n(c),l=a("/MKj"),m=a("2wEF"),d=a("Ty5D"),u=a("4qC0"),p=a.n(u),g=a("mwIZ"),f=a.n(g),h=a("BkRI"),b=a.n(h),E=a("3Z9Z"),S=a("JI6e"),v=a("d/v1"),D=a("wQmL"),y=a("3t43"),O=a("pJVQ"),N=a("tDQA"),w=a("VyNe"),C=a("y4iu"),I=a("26mJ"),j=a("XoCd"),T=a("uSQv"),A=a("wd/R"),F=a.n(A),x=a("Zayz"),P=a("P0Qa"),R=a("AF5L"),k=a("zDJl"),_=a("vzZS"),M=a("2UNB"),B=a("LCzB"),L=a("XzT5");function V(){return(V=Object.assign||function(e){for(var t=1;t{const{t:s}=this.props;let r=0;e.forEach((t,a)=>{r+=e.get(a).percent||0});let i=100-r;return i=i<0?0:i,o.a.createElement("div",null,o.a.createElement(_.a,{boxColor:100!==r?"warning":"success"},L.a.t("newSettings.feeding.plans.editDoses.usedXpercentOfDose",{amount:r})),e.map((t,a)=>{let n=e.get(a);return o.a.createElement(w.a,null,o.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center"},L.a.t("dosage",{count:a+1}),o.a.createElement(T.a,{onClick:()=>e.length>1&&e.remove(a),type:"button",buttonStyle:"round",className:"text",icon:o.a.createElement("i",{className:"fas fa-trash"})})),o.a.createElement(E.a,null,o.a.createElement(S.a,{xs:4},o.a.createElement(v.a,{name:"".concat(t,".start"),id:"".concat(t,".start"),label:s("newSettings.feeding.plans.editDoses.startTime"),type:"time",component:I.a})),o.a.createElement(S.a,{xs:4},o.a.createElement(v.a,{name:"".concat(t,".stop"),id:"".concat(t,".stop"),label:s("newSettings.feeding.plans.editDoses.stopTime"),type:"time",component:I.a})),o.a.createElement(S.a,{xs:4},o.a.createElement(v.a,{name:"".concat(t,".percent"),id:"".concat(t,".percent"),min:1,max:i+n.percent,valueFormatter:e=>e?"".concat(e," %"):"",label:s("dosage"),component:j.a}))))}),!!i&&e.length<6&&o.a.createElement(w.a,null,o.a.createElement("h5",{className:"flex-lg-row justify-content-between align-content-center",onClick:()=>e.push({start:"",stop:"",percent:5})},s("newSettings.feeding.plans.editDoses.addNextDose")," ",o.a.createElement("i",{className:"fas fa-plus"}))))};const{dispatch:t,defaultValue:a}=this.props;t(Object(D.c)(z,{doses:b()(f()(a,"SetData.Doses",[{Start:"00:15",Stop:"23:45",Percent:100}])).map(e=>({percent:+e.Percent,start:p()(e.Start)?e.Start:F()(e.Start).format("HH:mm"),stop:p()(e.Stop)?e.Stop:F()(e.Stop).format("HH:mm")})),planName:f()(a,"SetData.Name","")}))}render(){const{handleSubmit:e,t:t}=this.props;return o.a.createElement("div",{className:"".concat(z," overflow-hidden")},o.a.createElement(C.a,V({},this.props,{handleSubmit:e,icon:o.a.createElement("i",{className:"fas fa-arrow-right"})}),o.a.createElement(E.a,{className:"justify-content-center"},o.a.createElement(S.a,{md:12},o.a.createElement(w.a,{type:"col"},o.a.createElement(v.a,{name:"planName",id:"planName",label:t("planName"),type:"text",component:I.a}))),o.a.createElement(S.a,{md:12},o.a.createElement(y.a,{name:"doses",component:this.renderDoses,rerenderOnEveryChange:!0})))))}}U=Object(O.a)({form:z,onSubmit:function(e,t,a){console.log(e,a);let{doses:n,planName:s}=b()(e);const{defaultValue:r,gateways:i,index:c}=a;n.sort((e,t)=>Object(x.c)(e.start)-Object(x.c)(t.start)),n=n.map(e=>({Percent:+e.percent,Start:Object(x.c)(e.start),Stop:Object(x.c)(e.stop)}));let o=M.a.createSetting(P.a.FEEDING_SCHEDULE,{Name:s,Doses:n,Index:c});console.log(o),r&&(o.SetID=r.SetID,o.DtaModTime=+new Date);for(let l=0;l{const a={};if(s()(e.percent)&&(a.percent=i("required")),e.start||(a.start=i("required")),e.stop||(a.stop=i("required")),e.start&&e.stop){let s=!1;n.filter((e,a)=>e.start&&e.stop&&a!==t).forEach(t=>{Object(x.a)(Object(x.c)(e.start),Object(x.c)(e.stop),Object(x.c)(t.start),Object(x.c)(t.stop))&&(s=!0)}),s&&(a.start=i("errors.duplicate"),a.stop=i("errors.duplicate")),Object(x.c)(e.start)>Object(x.c)(e.stop)&&(a.start=i("errors.mustBeBelow")+i("newSettings.feeding.plans.editDoses.stopTime"),a.stop=i("errors.mustBeAbove")+i("newSettings.feeding.plans.editDoses.startTime"))}return a}):a.doses=i("required"),a.doses=c,a}})(U);const W=Object(N.a)(z);U=Object(l.connect)(e=>({stages:W(e,"stages"),gateways:e.farmDevices.devices.filter(e=>e.DevType===k.d.GATEWAY),farm:e.location.farm}))(U),U=Object(B.a)()(U);var q,H=Object(d.o)(U),G=a("qx5e"),J=a("s506"),Y=a("0gjr"),Z=a("84Ez"),Q=a("mr+a");let K=Object(l.connect)(e=>({farm:e.location.farm,license:Object(Z.a)(e,{licenseName:J.a.DISPENSER}),schedules:Object(Q.f)(e)}))(q=class extends o.a.Component{render(){const{match:{params:{index:e}},license:t,schedules:a}=this.props;let n=i()(+e)?+e:null;const r=a.find(e=>e.SetData.Index===n),c=t===J.b.EXTENDED?Y.a.FEEDING_SCHEDULE_EXTENDED:Y.a.FEEDING_SCHEDULE_BASIC;return s()(n)||n<0||n>=c?o.a.createElement(m.a,null):o.a.createElement(o.a.Fragment,null,o.a.createElement(H,{defaultValue:r,index:n}))}})||q;K=Object(d.o)(K);t.a=Object(G.a)({roles:[J.c._DEVICE_CONFIG],showComponent:!0})(K)},tG0a:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("pJVQ"),o=a("tDQA"),l=a("FPv+"),m=a("VfnB"),d=a("zDJl"),u=a("kCmh"),p=a("6uZD"),g=a("XzT5");var f=a("/MKj"),h=a("Ty5D"),b=a("qx5e"),E=a("s506");class S extends s.a.Component{render(){const{handleSubmit:e,address:t,device:a,edit:n,bridge:c}=this.props;return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,address:t,device:a,showAdditionalButton:!!a,disableBridge:n,bridge:c,showHelp:!n}))}}S=Object(c.a)({form:"dispenserNRFMulti",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,device:i,alias:c}=e;let o=i.clone();o.Address=Number(n),o.Name=r,o.Interface=+s,o.Alias=c,o.Protocol=d.g.NRF,o.VerHard="0.1",o.VerSoft="0.1",t(Object(p.e)(o,o.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))},validate:function(e,t){const a={};if(e.name||(a.name=g.a.t("required")),(!l.a.DEVICE_MANY_ADDR_DI_NRF_MULTI.test("".concat(e.address))||e.edit&&!l.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=g.a.t("addressError",{amount1:"0x1300",amount2:"0xFF00",amount3:"0x1500"})),e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(m.d)(e.address,d.d.DISPENSER_NRF_MULTI),s=[];for(let a of n){let n=u.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}console.log(s),s.length>0&&(a.address=g.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=g.a.t("required");return e.interf||(a.interf=g.a.t("required")),a}})(S),S=Object(b.a)(e=>({roles:[E.c._DEVICE_CONFIG],showComponent:!0}))(S);const v=Object(o.a)("dispenserNRFMulti");S=Object(f.connect)(e=>({address:v(e,"address"),device:v(e,"device"),edit:v(e,"edit"),bridge:v(e,"bridge"),user:e.user.user,farm:e.location.farm}))(S);t.a=Object(h.o)(S)},uD39:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("VyNe"),i=a("ROqK"),c=a("3t43"),o=a("pJVQ"),l=a("tDQA"),m=a("lFKM"),d=a.n(m),u=a("BkRI"),p=a.n(u),g=a("mwIZ"),f=a.n(g),h=a("zDJl"),b=a("pxzG"),E=a("q17X"),S=a("6uZD"),v=a("FPv+"),D=a("VfnB"),y=a("kCmh"),O=a("XzT5"),N=a("ztiR");var w=a("/MKj"),C=a("w2lk"),I=a("a+pQ"),j=a("Ty5D"),T=a("lAGl"),A=a("qx5e"),F=a("s506"),x=a("S8cm"),P=a("1Exf"),R=a("vzZS"),k=a("LCzB");function _(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function M(e){for(var t=1;t{const{farmLicense:t}=this.state;if(e){let e=this.props.siloses.map((e,a)=>M({},e,{Active:!t||t.DevSilosesLeft>a}));this.props.change("siloses",e)}else{let e=this.props.siloses.map(e=>M({},e,{Active:!1}));this.props.change("siloses",e)}},this.checkIfSelected=()=>{const{farmLicense:e}=this.state,{siloses:t}=this.props;let a=e?e.DevSilosesLeft>8?8:e.DevSilosesLeft:8;return t&&t.reduce((e,t)=>e+ +t.Active,0)===a},this.disableCheckbox=({value:e})=>{if(e)return!1;const{farmLicense:t}=this.state,{siloses:a}=this.props;return!(!t||!a)&&t.DevSilosesLeft<=a.reduce((e,t)=>e+ +t.Active,0)};const{user:{LicPackages:t},farm:a}=e;let n=null;t&&(n=t.find(e=>e.FarmID===a)),this.state={farmLicense:n},this.props.device||this.props.initialize({siloses:new Array(8).fill({}).map((e,t)=>({Active:!n||n.DevSilosesLeft>t,Adr:t,Capacity:0}))})}render(){const{handleSubmit:e,address:t,device:a,t:n,forages:o,bridge:l,edit:m}=this.props,{farmLicense:d}=this.state;let u=Object(E.getScaleUnit)(),p=this.checkIfSelected();const g=[{name:n("newSettings.devices.form.exit"),field:"Adr",fieldToGet:"Adr",valueFormatter:e=>e+1,dontShowInput:!0},{name:n("capacity"),component:T.a,field:"Capacity",unit:Object(b.l)("weight",u),type:"number"},{name:n("newSettings.devices.form.alias"),component:T.a,field:"Alias",type:"text"},{name:n("forage"),component:P.a,field:"Forage",options:o.map(e=>({name:e.SetData.Name,value:e.SetID}))},{name:n("newSettings.devices.form.number"),component:T.a,field:"Number",type:"text",normalize:e=>e?e.slice(0,3).toUpperCase():null},{name:n("newSettings.devices.form.active"),component:C.a,field:"Active",type:"number",disabled:this.disableCheckbox,headerComponent:s.a.createElement("span",null,n("newSettings.devices.form.active")," ",s.a.createElement(x.a,{label:"",checked:p,onChange:this.onAllSelectedChange}))}];return s.a.createElement(r.a,null,s.a.createElement(i.a,{handleSubmit:e,showInterfacePicker:!0,device:a,showAdditionalButton:!!a,address:t,bridge:l,showHelp:!m},d&&d.DevSilosesLeft<8&&s.a.createElement(R.a,{boxColor:"warning"},O.a.t("newSettings.devices.form.maxSilo",{license:d.DevSilosesLeft})),s.a.createElement(c.a,{name:"siloses",component:I.a,headers:g})))}}L=Object(o.a)({form:"weightWST",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,siloses:l,alias:m}=e;let u=Object(E.getScaleUnit)();if(!c){let e=[];for(let a=0;a<8;a++)e[a]={Adr:a,Active:!!f()(l,"[".concat(a,"].Active"),!1),Capacity:Object(b.i)(f()(l,+"[".concat(a,"].Capacity"),0),{fromUnit:u}),Alias:f()(l,"[".concat(a,"].Alias"),null),Forage:f()(l,"[".concat(a,"].Forage"),null),Number:f()(l,"[".concat(a,"].Number"),null)};const t=Object(D.d)(n,h.d.SCALE).map(t=>({DevType:h.d.SCALE,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:m,AdditionalData:{Siloses:e}}));return Object(N.a)(t).then(e=>{a.reset(),Object(N.c)(e)}).catch(e=>{Object(N.b)(e)})}{let e=o.clone();e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=m,e.Siloses=p()(l||new Array(8).fill(1)).map((e,t)=>{let a={Adr:t,Active:!!e.Active,Alias:e.Alias,Forage:e.Forage,Number:e.Number};return e.Capacity&&d()(+e.Capacity)&&(a.Capacity=Object(b.i)(+e.Capacity,{fromUnit:u})),a}),e.Protocol=h.g.WST,e.VerHard="0.1",e.VerSoft="0.1",t(Object(S.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),!v.a.DEVICE_MANY_ADDR_SC.test("".concat(e.address))||e.edit&&!v.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=O.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){let t=Object(D.d)(e.address,h.d.SCALE);if(e.siloses){let n=e.siloses.reduce((e,t)=>e+ +t.Active,0),s=Math.floor(r.DevSilosesLeft/n);t.length>s&&(a.address=O.a.t("errors.maxDevices",{amount:s}))}}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(D.d)(e.address,h.d.SCALE),s=[];for(let a of n){let n=y.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=O.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),e.siloses&&(a.siloses=e.siloses.map(e=>{let t={};return e.Number&&!e.Number.match(new RegExp("^[0-9]{1,2}[A-Z]?$","g"))&&(t.Number=O.a.t("errors.shouldBeInFormat",{type:"1, 11, 11A"})),t})),a}})(L),L=Object(A.a)(e=>({roles:[F.c._DEVICE_CONFIG],showComponent:!0}))(L);const V=Object(l.a)("weightWST");L=Object(w.connect)(e=>({address:V(e,"address"),device:V(e,"device"),siloses:V(e,"siloses"),bridge:V(e,"bridge"),edit:V(e,"edit"),user:e.user.user,forages:e.settings.forage,farm:e.location.farm}))(L),L=Object(k.a)()(L);t.a=Object(j.o)(L)},vAb9:function(e,t,a){"use strict";a.r(t);var n=a("q1tI"),s=a.n(n),r=a("/MKj"),i=a("ANjH"),c=a("f0zD"),o=a("IXwn"),l=a("uSQv"),m=a("VyNe"),d=a("BbMY"),u=a("erjJ"),p=a("gypA"),g=a("4tbe"),f=a("S403"),h=a("ZJCK"),b=a("JZab"),E=a("qx5e"),S=a("JFDi"),v=a("/U+v"),D=a("LCzB"),y=a("Ke8t"),O=a("wd/R"),N=a.n(O),w=a("Gr13"),C=a("lodY");function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function j(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class T extends s.a.Component{constructor(e){super(e),this.onCancel=()=>{Object(S.b)()},this.onSubscribe=async()=>{const{subList:e,dispatch:t,dropinInstance:a,userData:n,user:{ClientID:s}}=this.props,r=e.filter(e=>e.id.slice(0,-20)===s)>0,i={trialDurationUnit:"day",trialDuration:N()().add(1,"month").endOf("month").diff(N()(),"days")+1,trialPeriod:!r};await Object(C.a)("adminPlanYearlyPLN",a,"peeleny",void 0,n.sub,i,{},"0.00").then(e=>{Object(C.c)(e),this.onNextStep(),t(Object(w.c)())}).catch(e=>Object(C.b)(e))},this.onBackStep=()=>{this.setState(e=>({activeStep:e.activeStep-1}))},this.onNextStep=()=>{const{activeStep:e}=this.state;this.setState(e=>({activeStep:e.activeStep+1}))};const{dispatch:t,userData:{email:a,name:n,phone:s,sub:r},customer:i}=e;i||t(Object(b.a)(a,n,s,r)),this.state={activeStep:1}}componentDidMount(){this.props.dispatch({type:"HIDE_SIDE_NAVIGATION"})}render(){const{activeStep:e}=this.state,{t:t}=this.props;return s.a.createElement("div",null,s.a.createElement(m.a,null,s.a.createElement(d.a,{activeStep:e},s.a.createElement(s.a.Fragment,null,s.a.createElement(u.a,{label:this.props.t("subscriptions.steps.agreementConditions")}),s.a.createElement(u.a,{label:this.props.t("subscriptions.steps.payment")}),s.a.createElement(u.a,{label:this.props.t("subscriptions.steps.confirmation")}),s.a.createElement(u.a,{label:this.props.t("summary")}))),1===e&&s.a.createElement(g.a,{onCancel:this.onCancel,onNextStep:this.onNextStep,isFirstStep:!0}),2===e&&s.a.createElement(p.a,{onCancel:this.onCancel,onBackStep:this.onBackStep,onNextStep:this.onNextStep}),3===e&&s.a.createElement(f.a,{onCancel:this.onCancel,onBackStep:this.onBackStep,onSubscribe:this.onSubscribe}),4===e&&s.a.createElement(s.a.Fragment,null,s.a.createElement(h.a,{logout:!0}),s.a.createElement(o.a,{fixed:!0},s.a.createElement(l.a,{buttonColor:"error",buttonStyle:"round",icon:s.a.createElement("i",{className:"fas fa-times"}),onClick:this.onCancel})))),s.a.createElement(v.b,{handleHide:c.b,counter:10,action:S.b,title:t("modals.logoutModal.title"),text:"modals.logoutModal.text",confirmButtonText:t("logout")}))}}t.default=Object(i.d)(Object(D.a)(),Object(E.a)({roles:[y.BILLING]}),Object(r.connect)((function(e){return{userData:e.user.attributes,user:e.user.user,dropinInstance:e.braintree.dropinInstance,dropinLoaded:e.braintree.dropinLoaded,customer:e.braintree.customer,paymentMethodRequestable:e.braintree.paymentMethodRequestable,farm:e.location.farm,subList:e.braintree.subscriptionList}}),(function(e){return function(e){for(var t=1;te?e.slice(0,3).toUpperCase():null})))))}}t.a=Object(c.d)(Object(r.connect)((function(e){return{user:e.user.user}})),Object(m.a)(),Object(l.a)({form:"pigletScaleEdit",onSubmit:function(e,t,a){console.log(e);const{device:n,name:s,Number:r}=e,{user:i}=a;let c=n.clone();c.Name=s,c.Number=r,t(Object(u.e)(c,c.FarmID,i.ClientID,i.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))},validate:function(e,t){const a={};return e.name||(a.name=t.t("required")),e.Number&&!e.Number.match(new RegExp("^[0-9]{1,2}[A-Z]?$","g"))&&(a.Number=p.a.t("errors.shouldBeInFormat",{type:"1, 11, 11A"})),a}}))(b)},xEfi:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("3t43"),i=a("pJVQ"),c=a("tDQA"),o=a("ROqK"),l=a("VyNe"),m=a("/MKj"),d=a("BkRI"),u=a.n(d),p=a("mwIZ"),g=a.n(p),f=a("zDJl"),h=a("6uZD"),b=a("FPv+"),E=a("VfnB"),S=a("kCmh"),v=a("XzT5"),D=a("ztiR");var y=a("Ty5D"),O=a("a+pQ"),N=a("w2lk"),w=a("qx5e"),C=a("s506"),I=a("S8cm"),j=a("lAGl"),T=a("vzZS"),A=a("LCzB");function F(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function x(e){for(var t=1;t{const{farmLicense:t}=this.state;if(e){let e=this.props.dispensers.map((e,a)=>x({},e,{Connected:!t||t.DevDispensersWSTLeft>a}));this.props.change("dispensers",e)}else{let e=this.props.dispensers.map(e=>x({},e,{Connected:!1}));this.props.change("dispensers",e)}},this.checkIfSelected=()=>{const{dispensers:e}=this.props,{farmLicense:t}=this.state;let a=t?t.DevDispensersWSTLeft>20?20:t.DevDispensersWSTLeft:20;return e&&e.reduce((e,t)=>e+ +t.Connected,0)===a},this.disableCheckbox=({value:e})=>{if(e)return!1;const{farmLicense:t}=this.state,{dispensers:a}=this.props;return!(!t||!a)&&t.DevDispensersWSTLeft<=a.reduce((e,t)=>e+ +t.Connected,0)};const{user:{LicPackages:t},farm:a}=e;let n=null;t&&(n=t.find(e=>e.FarmID===a)),this.state={farmLicense:n},this.props.device||this.props.initialize({dispensers:new Array(20).fill({}).map((e,t)=>({Connected:!n||n.DevDispensersWSTLeft>t,Adr:t}))})}render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:i,edit:c}=this.props,{farmLicense:m}=this.state;let d=this.checkIfSelected();const u=[{name:n("newSettings.devices.form.exit"),field:"Adr",fieldToGet:"Adr",valueFormatter:e=>e+1,dontShowInput:!0},{name:n("newSettings.devices.form.alias"),component:j.a,field:"Alias",type:"text"},{name:n("newSettings.devices.form.active"),component:N.a,field:"Connected",type:"number",disabled:this.disableCheckbox,headerComponent:s.a.createElement("span",null,n("newSettings.devices.form.active")," ",s.a.createElement(I.a,{label:"",checked:d,onChange:this.onAllSelectedChange}))}];return s.a.createElement(l.a,null,s.a.createElement(o.a,{handleSubmit:e,showInterfacePicker:!0,address:t,showAdditionalButton:!!a,device:a,bridge:i,showHelp:!c},m&&m.DevDispensersWSTLeft<20&&s.a.createElement(T.a,{boxColor:"warning"},v.a.t("newSettings.devices.form.maxWST",{license:m.DevDispensersWSTLeft})),s.a.createElement(r.a,{name:"dispensers",component:O.a,headers:u})))}}R=Object(i.a)({form:"dispenserWST",onSubmit:function(e,t,a){const{address:n,interf:s,name:r,bridge:i,edit:c,device:o,dispensers:l,alias:m}=e;if(!c){let e=[];for(let a=0;a<20;a++)e[a]={Adr:a,Connected:!!g()(l,"[".concat(a,"].Connected"),!1),Alias:g()(l,"[".concat(a,"].Alias"),null)};const t=Object(E.d)(n,f.d.DISPENSER).map(t=>({DevType:f.d.DISPENSER,Name:r,Address:t,ParentID:i.DevID,Interface:+s,Alias:m,AdditionalData:{Dispensers:e}}));return Object(D.a)(t).then(e=>{a.reset(),Object(D.c)(e)}).catch(e=>{Object(D.b)(e)})}{let e=o.clone();e.Address=Number(n),e.Name=r,e.ParentID=i.DevID,e.Interface=+s,e.Alias=m,e.Dispensers=u()(l||new Array(20).fill(1)).map((e,t)=>({Adr:t,Connected:!!e.Connected,Alias:e.Alias})),e.Protocol=f.g.WST,e.VerHard="0.1",e.VerSoft="0.1",t(Object(h.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};if(e.name||(a.name=t.t("required")),!b.a.DEVICE_MANY_ADDR_DI.test("".concat(e.address))||e.edit&&!b.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))a.address=v.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"});else{const{user:{LicPackages:n=[]},farm:s}=t;let r=n.find(e=>e.FarmID===s);if(r){let t=Object(E.d)(e.address,f.d.DISPENSER);if(e.dispensers){let n=e.dispensers.reduce((e,t)=>e+ +t.Connected,0),s=Math.floor(r.DevDispensersWSTLeft/n);t.length>s&&(a.address=v.a.t("errors.maxDevices",{amount:s}))}}}if(e.bridge){if(e.address&&!a.address&&e.interf){let n=Object(E.d)(e.address,f.d.DISPENSER),s=[];for(let a of n){let n=S.a.getDevicesWithAddress(t.farm,a);n=n.filter(t=>t.ParentID===e.bridge.DevID&&t.Interface===e.interf),e.edit&&(n=n.filter(t=>e.device.DevID!==t.DevID)),n.length>0&&s.push(a)}s.length>0&&(a.address=v.a.t("errors.takenAddress",{type:s.join(", ")}))}}else a.bridge=t.t("required");return e.interf||(a.interf=t.t("required")),a}})(R),R=Object(w.a)(e=>({roles:[C.c._DEVICE_CONFIG],showComponent:!0}))(R);const k=Object(c.a)("dispenserWST");R=Object(m.connect)(e=>({address:k(e,"address"),device:k(e,"device"),dispensers:k(e,"dispensers"),bridge:k(e,"bridge"),edit:k(e,"edit"),user:e.user.user,farm:e.location.farm}))(R),R=Object(A.a)()(R);t.a=Object(y.o)(R)},yvpC:function(e,t,a){"use strict";var n=a("Y+p1"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("/MKj"),o=a("ANjH"),l=a("f0zD"),m=a("0ajJ"),d=a("VyNe"),u=a("qx5e"),p=a("s506"),g=a("mwIZ"),f=a.n(g),h=a("BkRI"),b=a.n(h),E=a("17x9"),S=a.n(E),v=a("IXwn"),D=a("uSQv"),y=a("55Ip"),O=a("zDJl"),N=a("9jj8"),w=a("AF5L"),C=a("gLBR"),I=a("pxzG"),j=a("LFUJ"),T=a("4ltZ"),A=a("eASP"),F=a("wd/R"),x=a.n(F),P=a("9Zq/"),R=a("JI6e"),k=a("3Z9Z"),_=a("vYJ8"),M=a("AAik"),B=a("kCVf"),L=a("LCzB");class V extends r.Component{constructor(e){super(e),this.onUpdateOnDevicesClick=e=>{e.stopPropagation();const{gateways:t,forage:a}=this.props;a instanceof j.a&&t.forEach(e=>{Object(w.q)(e,a)})},this.onReactivateClick=e=>{const{show:t,forage:a}=this.props;let n=b()(a);t(P.a,{forage:n})},this.onRemoveClick=e=>{e.stopPropagation();const{forage:t,t:a,show:n,dispatch:s,buildings:r}=this.props;let i=b()(t);i instanceof j.a&&(i.deleteSetting(),n("confirm-modal",{title:a("newSettings.feeding.forages.feedingForageItem.confirmInactive"),text:a("newSettings.feeding.forages.feedingForageItem.confirmInactiveLong"),confirmText:a("yes"),onConfirmed:e=>{this.setState({deleting:!0},()=>{const t=Object(B.n)(r,null,i.SetID);for(let e of t)s(Object(T.e)(e));s(Object(C.c)(i,()=>{e.handleHide(),this.setState({deleting:!1})},()=>{this.setState({deleting:!1})}))})}}))},this.handleToggleShow=()=>{this.setState(e=>({show:!e.show}))},this.state={deleting:!1,show:!1}}render(){const{forage:e,index:t,t:a,isHistorical:n,forageIngredients:s}=this.props,{deleting:r,show:c}=this.state;let o=f()(e,"SetData.Name","Pasza ".concat(t+1)),l=f()(e,"DtaDelTime",0),m=f()(e,"SetData.Color","#FFFFFF");const d=[{name:a("newSettings.feeding.forages.feedingForageItem.ingredient"),field:"",valueFormatter:e=>f()(s.find(t=>t.SetID&&t.SetID===e.IngredientID),"WData.Name",e.Name)},{name:a("newSettings.feeding.forages.feedingForageItem.content"),field:"Percentage",valueFormatter:e=>"".concat(e,"%")},{name:a("newSettings.feeding.forages.feedingForageItem.cost"),field:"Cost",valueFormatter:e=>"".concat(e,"PLN/").concat(Object(I.j)(1e6,{unit:A.a.BIG,fixed:1,showUnit:!0}))}];return i.a.createElement(i.a.Fragment,null,i.a.createElement(N.a,{lp:t+1,index:t,color:e?m:null,onClick:this.handleToggleShow,className:"overflow-hidden position-relative pt-2 pb-2 mh-5rem align-items-center"},i.a.createElement(R.a,{xs:12},i.a.createElement(k.a,null,i.a.createElement(R.a,{xs:2},!n&&i.a.createElement("h3",null,t+1),!!n&&i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"font-weight-bold"},x()(l).format("DD.MM.YY")),i.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.forages.feedingForageItem.deactivateDate")))),!!e&&i.a.createElement(i.a.Fragment,null,i.a.createElement(R.a,{xs:3},i.a.createElement("div",{className:"font-weight-bold"},o),i.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.forages.feedingForageItem.forageName"))),i.a.createElement(R.a,{xs:2},i.a.createElement("div",{className:"font-weight-bold"},e.getCost(),"PLN/",Object(I.j)(1e6,{unit:A.a.BIG,fixed:1,showUnit:!0})),i.a.createElement("div",{className:"opacity-75"},a("newSettings.feeding.forages.feedingForageItem.cost")))),!e&&i.a.createElement(R.a,{xs:7,className:"opacity-50"},i.a.createElement("h5",{className:"justify-content-center"},a("newSettings.feeding.forages.feedingForageItem.forageNotConfigured"))),i.a.createElement(R.a,{xs:3,className:"justify-content-end align-items-center d-flex"},i.a.createElement(v.a,{className:"m-0"},!!n&&i.a.createElement(D.a,{title:a("newSettings.feeding.forages.feedingForageItem.activate"),type:"button",isLoading:r,icon:i.a.createElement("i",{className:"fas fa-power-off"}),buttonStyle:"round",buttonColor:"success",onClick:this.onReactivateClick}),!n&&i.a.createElement(i.a.Fragment,null,i.a.createElement(y.Link,{to:"/".concat(this.props.farm,"/settings/feeding/forages/edit/").concat(t)},i.a.createElement(D.a,{title:a(e?"edit":"addNew"),type:"button",icon:e?i.a.createElement("i",{className:"fas fa-pen"}):i.a.createElement("i",{className:"fas fa-plus"}),buttonStyle:"round"})),!!e&&i.a.createElement(i.a.Fragment,null,i.a.createElement(D.a,{title:a("newSettings.feeding.forages.feedingForageItem.update"),type:"button",icon:i.a.createElement("i",{className:"fas fa-share"}),buttonStyle:"round",onClick:this.onUpdateOnDevicesClick}),i.a.createElement(D.a,{title:a("newSettings.feeding.forages.feedingForageItem.deactivate"),type:"button",isLoading:r,icon:i.a.createElement("i",{className:"fas fa-power-off"}),buttonStyle:"round",buttonColor:"error",onClick:this.onRemoveClick})))))))),i.a.createElement(_.a,{in:c&&!!e,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",{className:"d-flex w-100"},i.a.createElement(N.a,{className:"w-100 enable-overflow",style:{minHeight:"10rem"},disableHover:!0,index:2},i.a.createElement(R.a,{xs:12},i.a.createElement(M.a,{className:"w-100",data:e&&e.getRecipe()||[],headers:d}))))))}}V.propTypes={forage:S.a.object.isRequired},V=Object(c.connect)(e=>({forageIngredients:e.dictionary.forageIngredients,user:e.user.user,buildings:e.farms.buildings,gateways:e.farmDevices.devices.filter(e=>e.DevType===O.d.GATEWAY),farm:e.location.farm}))(V),V=Object(c.connect)(null,e=>Object(o.b)({show:l.d},e))(V);var z,U=Object(L.a)()(V),W=a("15cA"),q=a("8O+7"),H=a("mr+a"),G=a("84Ez"),J=a("0gjr"),Y=a("XzT5");function Z(){return(Z=Object.assign||function(e){for(var t=1;t({feedingForages:Object(H.d)(e),feedingForagesHistory:e.settings.forageHistory,buildings:e.farms.buildings,license:Object(G.a)(e,{licenseName:p.a.DISPENSER})}))(z=class extends r.Component{constructor(e){super(e),this.onShowHistoryClick=()=>{this.setState(e=>({showHistory:!e.showHistory}))},this.state={chambers:this.getChambers(this.props),showHistory:!1}}UNSAFE_componentWillReceiveProps(e,t){s()(e.buildings,this.props.buildings)||this.setState({chambers:this.getChambers(e)})}getChambers(e){const{buildings:t}=e;return Object(W.g)(t).map(e=>e.chamber)}render(){const{feedingForages:e,feedingForagesHistory:t=[],t:a,license:n}=this.props,{chambers:s,showHistory:r}=this.state;let c=[];for(let i=0;i<8;i++)c[i]={forage:e.find(e=>e.SetData.Index===i),index:i};return t.sort((e,t)=>t.DtaDelTime-e.DtaDelTime),i.a.createElement(i.a.Fragment,null,i.a.createElement(d.a,{className:"feeding-view-container"},i.a.createElement(k.a,null,i.a.createElement(R.a,{xs:12},i.a.createElement("h5",null,a("newSettings.feeding.forages.feedingForageItem.activeForages")))),i.a.createElement(k.a,null,i.a.createElement(m.a,{useFlexLayout:!1,striped:!0},i.a.createElement(q.a,{text:Y.a.t("newSettings.feeding.forages.feedingForageItem.compatibility",{type:"F1, F3, F5"}),key:"comp_WST"}),c.slice(0,J.a.FEEDING_FORAGE_BASIC).map((e,t)=>i.a.createElement(U,Z({key:"forage_".concat(e.index)},e,{chambers:s}))),n===p.b.EXTENDED&&i.a.createElement(i.a.Fragment,null,i.a.createElement(q.a,{text:Y.a.t("newSettings.feeding.forages.feedingForageItem.compatibility",{type:"F3, F5"}),key:"comp_NRF"}),c.slice(J.a.FEEDING_FORAGE_BASIC,J.a.FEEDING_FORAGE_EXTENDED).map((e,t)=>i.a.createElement(U,Z({key:"forage_".concat(e.index)},e,{chambers:s}))))))),!!t.length&&i.a.createElement(d.a,{className:"feeding-view-container"},i.a.createElement(k.a,{onClick:this.onShowHistoryClick},i.a.createElement(R.a,{xs:12},i.a.createElement("h5",{className:"justify-content-between align-items-center"},a("newSettings.feeding.forages.feedingForageItem.historicalForages"),i.a.createElement("i",{className:r?"fas fa-arrow-up":"fas fa-arrow-down"})))),i.a.createElement(_.a,{in:r},i.a.createElement(k.a,null,i.a.createElement(m.a,{useFlexLayout:!1,striped:!0},t.map((e,t)=>i.a.createElement(U,{key:e.SetID,forage:e,index:t,isHistorical:!0,chambers:s})))))),i.a.createElement(P.b,{foragesWithEmptySpaces:c}))}})||z;Q=Object(c.connect)(null,e=>Object(o.b)({show:l.d},e))(Q),Q=Object(L.a)()(Q);t.a=Object(u.a)({roles:[p.c._DEVICE_CONFIG],showComponent:!0})(Q)},yzW4:function(e,t,a){"use strict";var n=a("q1tI"),s=a.n(n),r=a("+oSd"),i=a("HIda"),c=a("d/v1"),o=a("pJVQ"),l=a("/MKj"),m=a("VyNe"),d=a("3Z9Z"),u=a("JI6e"),p=a("w2lk"),g=a("P0Qa"),f=a("gLBR"),h=a("2UNB");var b=a("LCzB");class E extends s.a.Component{constructor(e){super(e);const{notifications:t}=this.props;t&&t.SetData.Feeding?this.props.initialize(t.SetData.Feeding):this.props.initialize({Info:{AutoAdd:!0,Insemination:!0},Warning:{NoFeedingForHours:!0,AnimalWrongPlace:!0},Error:{AnimalNoCurve:!0,ScheduleNotAssigned:!0,ScheduleNotConfigured:!0,CurveNotAssigned:!0,CurveNotConfigured:!0,ForageNotConfigured:!0,SubaddressNoCommunication:!0,ManualAlarm:!0,RTC:!0,SingleDose:!0,TimeBetweenDoses:!0,Efficiency:!0,InitDose:!0,MotorErrors:!0,FeedingErrors:!0,ScheduleSetFail:!0,CurveSetFail:!0}})}render(){const{handleSubmit:e,t:t}=this.props;return s.a.createElement(r.a,{handleSubmit:e},s.a.createElement(m.a,null,s.a.createElement(i.a,{name:"Info"},s.a.createElement("h4",null,t("newSettings.notifications.feeding.info"),s.a.createElement("i",{className:"fas fa-info-circle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.autoAdd")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"AutoAdd",component:p.a,label:"",id:"AutoAdd"})))))),s.a.createElement(m.a,null,s.a.createElement(i.a,{name:"Warning"},s.a.createElement("h4",null,t("newSettings.notifications.feeding.warning"),s.a.createElement("i",{className:"fas fa-exclamation-triangle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.noFeeding")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"NoFeedingForHours",component:p.a,label:"",id:"NoFeedingForHours"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.wrongPlcmnt")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"AnimalWrongPlace",component:p.a,label:"",id:"AnimalWrongPlace"})))))),s.a.createElement(m.a,null,s.a.createElement(i.a,{name:"Error"},s.a.createElement("h4",null,t("newSettings.notifications.feeding.errors"),s.a.createElement("i",{className:"fas fa-exclamation-circle"})),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.scheduleNotAssigned")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ScheduleNotAssigned",component:p.a,label:"",id:"ScheduleNotAssigned"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.scheduleNotConfigured")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ScheduleNotConfigured",component:p.a,label:"",id:"ScheduleNotConfigured"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.curveNotAssigned")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"CurveNotAssigned",component:p.a,label:"",id:"CurveNotAssigned"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.curveNotConfigured")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"CurveNotConfigured",component:p.a,label:"",id:"CurveNotConfigured"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.manual")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ManualAlarm",component:p.a,label:"",id:"ManualAlarm"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.configurationErrors")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"RTC",component:p.a,label:t("newSettings.notifications.feeding.rtc"),id:"RTC"}),s.a.createElement(c.a,{name:"SingleDose",component:p.a,label:t("newSettings.notifications.feeding.singleDose"),id:"SingleDose"}),s.a.createElement(c.a,{name:"TimeBetweenDoses",component:p.a,label:t("newSettings.notifications.feeding.timeBetweenDoses"),id:"TimeBetweenDoses"}),s.a.createElement(c.a,{name:"Efficiency",component:p.a,label:t("newSettings.notifications.feeding.efficiency"),id:"Efficiency"}),s.a.createElement(c.a,{name:"InitDose",component:p.a,label:t("newSettings.notifications.feeding.initDose"),id:"InitDose"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("motorErrors")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"MotorErrors",component:p.a,label:"",id:"MotorErrors"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("feedingErrors")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"FeedingErrors",component:p.a,label:"",id:"FeedingErrors"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.setSchedule")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"ScheduleSetFail",component:p.a,label:"",id:"ScheduleSetFail"})))),s.a.createElement(d.a,null,s.a.createElement(u.a,{lg:4},t("newSettings.notifications.feeding.setCurve")),s.a.createElement(u.a,{lg:8,className:"notification-settings-right"},s.a.createElement("div",{className:"notification-settings-input"},s.a.createElement(c.a,{name:"CurveSetFail",component:p.a,label:"",id:"CurveSetFail"})))))))}}E=Object(o.a)({form:"feeding-notifications",onSubmit:function(e,t,a){const{notifications:n,user:{LocalUserID:s}}=a;if(n){let a=n.clone();a.SetData.Feeding=e,a.setDtaModTime(),t(Object(f.c)(a))}else{let a=h.a.createSetting(g.a.NOTIFICATIONS,{Feeding:e},s);delete a.FarmID,t(Object(f.a)(a))}}})(E),E=Object(l.connect)(e=>({notifications:e.settings.notifications,user:e.user.user}))(E);t.a=Object(b.a)()(E)},zDeS:function(e,t,a){"use strict";var n=a("lFKM"),s=a.n(n),r=a("q1tI"),i=a.n(r),c=a("VyNe"),o=a("ROqK"),l=a("d/v1"),m=a("pJVQ"),d=a("tDQA"),u=a("/MKj"),p=a("zDJl"),g=a("6uZD"),f=a("FPv+"),h=a("VfnB"),b=a("XzT5"),E=a("ztiR");var S=a("Ty5D"),v=a("qx5e"),D=a("s506"),y=a("26mJ"),O=a("3Z9Z"),N=a("JI6e"),w=a("LCzB");class C extends i.a.Component{render(){const{handleSubmit:e,address:t,device:a,t:n,bridge:r,edit:m}=this.props;return i.a.createElement(c.a,null,i.a.createElement(o.a,{handleSubmit:e,showInterfacePicker:!1,device:a,address:t,showHelp:!m,showAdditionalButton:a,bridge:r},i.a.createElement(O.a,{className:"justify-content-center"},i.a.createElement(N.a,{lg:6},i.a.createElement(l.a,{name:"number",id:"number",component:y.a,label:n("newSettings.devices.form.number"),type:"text",normalize:e=>e?e.slice(0,3).toUpperCase():null}),i.a.createElement(l.a,{name:"serial",id:"serial",component:y.a,label:n("newSettings.devices.form.serial"),type:"number",format:e=>s()(e)?"".concat(e):e||"",parse:e=>s()(parseInt(e))?parseInt(e):e})))))}}C=Object(m.a)({form:"waterMeter",onSubmit:function(e,t,a){const{address:n,serial:r,name:i,number:c,bridge:o,edit:l,device:m,alias:d}=e;if(!l){const e={};s()(r)&&(e.Serial=r),c&&(e.Number=c);const t=Object(h.d)(n,p.d.WATER_FLOW_METER).map(t=>({DevType:p.d.WATER_FLOW_METER,Name:i,Address:t,ParentID:o.DevID,Interface:p.h.BRIDGE_MBUS,Alias:d,AdditionalData:e}));return Object(E.a)(t).then(e=>{a.reset(),Object(E.c)(e)}).catch(e=>{Object(E.b)(e)})}{let e=m.clone();e.Address=Number(n),e.Name=i,e.ParentID=o.DevID,e.Serial=+r,d?e.Alias=d:delete e.Alias,c?e.Number=c:delete e.Number,e.Protocol=p.g.MODBUS,e.VerHard="0.1",e.VerSoft="0.1",t(Object(g.e)(e,e.FarmID,a.user.ClientID,a.user.LocalUserID,null,()=>{a.history.push("/".concat(a.farm,"/settings/devices/manage"))}))}},validate:function(e,t){const a={};return e.name||(a.name=t.t("required")),(!f.a.DEVICE_MANY_ADDR_TE.test("".concat(e.address))||e.edit&&!f.a.NUMBER_DEC_OR_HEX.test("".concat(e.address)))&&(a.address=b.a.t("errors.addressError",{amount1:"".concat(1," (0x1)"),amount2:"127 (0x".concat(15..toString(16).toUpperCase(),")"),amount3:"14"})),e.bridge||(a.bridge=t.t("required")),s()(e.serial)||(a.serial=t.t("required")),a}})(C),C=Object(v.a)(e=>({roles:[D.c._DEVICE_CONFIG],showComponent:!0}))(C);const I=Object(d.a)("waterMeter");C=Object(u.connect)(e=>({address:I(e,"address"),device:I(e,"device"),bridge:I(e,"bridge"),edit:I(e,"edit"),user:e.user.user,farm:e.location.farm}))(C),C=Object(w.a)()(C);t.a=Object(S.o)(C)}}]); //# sourceMappingURL=main~86e8a818.d0ed6f02.chunk.js.map