(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[92],{"/V44":function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("VyNe"),o=a("AAik"),s=a("zDJl"),c=a("IXwn"),l=a("uSQv"),m=a("/MKj"),u=a("qx5e"),g=a("s506"),d=a("BvFm"),p=a("VfnB"),h=a("55Ip"),b=a("LCzB"),f=a("yjtO");class E extends i.a.Component{constructor(e){super(e),this.onSelectionChange=e=>{this.setState({selectedClimates:e})},this.state={selectedClimates:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(p.t)(t),{selectedClimates:m}=this.state;return Object(d.a)()?i.a.createElement(r.a,null,i.a.createElement(o.a,{data:e.filter(e=>e.DevType===s.d.CLIMATE),headers:n,shouldIndex:!0,mobileRow:i.a.createElement(f.a,null),selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageClimates"}),i.a.createElement(c.a,{fixed:!0,renderInPortal:!1},i.a.createElement(h.Link,{to:{pathname:"/".concat(a,"/settings/climate/manage/configuration"),state:{selectedClimates:m}},disabled:0===m.length},i.a.createElement(l.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===m.length})))):null}}let v=Object(m.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(E);v=Object(u.a)({roles:[g.c._DEVICE_CLIMATE,g.c._DEVICE_CONFIG],showComponent:!0})(v),t.a=Object(b.a)()(v)},"/vMg":function(e,t,a){},"00Nw":function(e,t,a){"use strict";var n=a("mwIZ"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("/MKj"),c=a("/kok"),l=a("lSCD"),m=a.n(l),u=a("tDQA"),g=a("d/v1"),d=a("XoCd"),p=a("uSQv"),h=a("JI6e"),b=a("3Z9Z");class f extends r.Component{constructor(...e){super(...e),this.onClick=()=>{const{device:e,value:t,submit:a,id:n,submitKey:i}=this.props;m()(a)&&a(e,{[i||n]:t})}}render(){const{name:e,id:t,formatter:a,max:n,min:i,step:r,submit:s}=this.props;return o.a.createElement(b.a,null,o.a.createElement(h.a,{xs:3,sm:2,lg:1,className:"d-flex justify-content-center align-items-center"},o.a.createElement(p.a,{disabled:!m()(s),onClick:this.onClick,type:"button",buttonStyle:"bordered",icon:o.a.createElement("i",{className:"fas fa-paper-plane"})})),o.a.createElement(h.a,{xs:9,sm:10,lg:11},o.a.createElement(g.a,{label:e,name:t,id:t,valueFormatter:a,component:d.a,min:i,max:n,step:r})))}}var E=Object(s.connect)((function(e,t){const{formName:a,id:n}=t,i=Object(u.a)(a);return function(e){return{value:i(e,n)}}}))(f),v=a("1smR"),S=a("PbGg"),O=a("pJVQ"),y=a("LCzB"),C=a("thTS"),D=a("uw8+");function j(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 w(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 r.Component{constructor(...e){super(...e),this.initialize=()=>{const{initialize:e,shadow:t,model:a}=this.props;Object(D.a)({model:a,initialize:e,shadow:t})}}componentDidMount(){this.initialize()}componentDidUpdate(e,t,a){const{fetched:n,dirty:i}=this.props,{fetched:r}=e;n&&n!==r&&(i||this.initialize())}render(){const{submit:e,initialized:t,climates:a,name:n,model:i,form:r}=this.props;return o.a.createElement(v.b,{disabled:!t,title:n,onButtonClick:e},t&&i.map(e=>o.a.createElement(E,{device:a,formName:r,name:e.name,key:e.key,id:e.key,min:e.min,max:e.max,step:e.step,formatter:e.formatter,submit:e.submit,submitKey:e.submitKey||e.key})))}}T=Object(s.connect)((function(e,t){const a=Object(C.a)(),{climates:n}=t,i={DevID:n[0].DevID};return function(e){return function(e){for(var t=1;t{const{t:e}=this.props;return[{name:e("settings.minTempAlarmDeviation"),key:"minimumTemperatureAlarmDeviation",shadowKey:"configuration.alarms.minimumTemperatureAlarmDeviation",min:.2,max:20,step:.2,defaultValue:4,formatter:D.f,submit:I.C},{name:e("settings.maxTempAlarmDeviation"),key:"maximumTemperatureAlarmDeviation",shadowKey:"configuration.alarms.maximumTemperatureAlarmDeviation",min:2,max:20,step:.2,defaultValue:10,formatter:D.f,submit:I.A},{name:e("settings.absoluteAlarm"),key:"absoluteAlarm",shadowKey:"configuration.alarms.absoluteAlarm",min:20,max:55,step:1,defaultValue:35,formatter:D.f,submit:I.a}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"AlarmsMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.d)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("deviceRows.waterFlowMeter.waterTab.alarms"),model:e,onSubmit:this.submit,form:"climate-sk3-alarms-menu"}))}}var A=Object(y.a)()(P);class k extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("settings.heatingDeviation"),key:"heatingDeviation",shadowKey:"configuration.heatingDeviation",min:.2,max:4,step:.2,defaultValue:1.6,formatter:D.f,submit:I.w},{name:e("settings.heaterOpTime"),key:"heatingWorkTime",shadowKey:"service.service",min:1e4,max:6e5,step:1e4,defaultValue:12e4,formatter:D.e,submit:I.x},{name:e("settings.heaterBreakTime"),key:"heatingBreakTime",shadowKey:"service.heatingBreakTime",min:1e4,max:6e5,step:1e4,defaultValue:12e4,formatter:D.e,submit:I.v}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"HeaterMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.g)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("farmView.climate.heatersSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-heater-menu"}))}}var M=Object(y.a)()(k);class R extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("settings.switchOnTemp"),key:"coolingEnableTemperature",shadowKey:"configuration.coolingConfiguration.coolingEnableTemperature",min:2,max:50.6,step:.2,defaultValue:26,formatter:D.f,submit:I.q},{name:e("workTime"),key:"coolingWorkTime",shadowKey:"configuration.coolingConfiguration.coolingWorkTime",min:1e4,max:6e5,step:1e4,defaultValue:12e4,formatter:D.e,submit:I.u},{name:e("stopTime"),key:"coolingBreakTime",shadowKey:"configuration.coolingConfiguration.coolingBreakTime",min:1e4,max:6e5,step:1e4,defaultValue:12e4,formatter:D.e,submit:I.p},{name:e("settings.maxHumidity"),key:"coolingMaximumHumidity",shadowKey:"configuration.coolingConfiguration.coolingMaximumHumidity",min:20,max:100,step:1,defaultValue:90,formatter:D.c,submit:I.r},{name:e("settings.minPressure"),key:"coolingMinimumPressure",shadowKey:"configuration.coolingConfiguration.coolingMinimumPressure",min:0,max:60,step:1,defaultValue:20,formatter:D.d,submit:I.t},{name:e("settings.maxPressuer"),key:"coolingMaximumPressure",shadowKey:"configuration.coolingConfiguration.coolingMaximumPressure",min:30,max:121,step:1,defaultValue:60,formatter:D.d,submit:I.s}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"CoolerMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.e)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("settings.coolingSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-cooler-menu"}))}}var B=Object(y.a)()(R);class V extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("settings.ventilationIntensity"),key:"ventilationIntensity",shadowKey:"service.ventilationIntensity",min:0,max:50,step:.2,defaultValue:10,formatter:D.f,submit:I.N},{name:e("settings.ventilationCycleTime"),key:"ventilationCycleTime",shadowKey:"service.ventilationCycleTime",min:6e4,max:24e4,step:1e4,defaultValue:12e4,formatter:D.e,submit:I.L},{name:e("settings.minRotations"),key:"minimumRotation",shadowKey:"service.minimumRotation",min:10,max:70,step:1,defaultValue:15,formatter:D.c,submit:I.B},{name:e("settings.ventilationDelay"),key:"ventilationDelay",shadowKey:"service.ventilationDelay",min:6e4,max:24e4,step:1e3,defaultValue:12e4,formatter:D.e,submit:I.M},{name:e("settings.mastersAmount"),key:"mastersCount",shadowKey:"service.mastersCount",min:0,max:3,step:1,defaultValue:1,submit:I.y},{name:e("settings.chimneyFansAmount"),key:"chimneyVentilatorsCount",shadowKey:"service.chimneyVentilatorsCount",min:0,max:2,step:1,defaultValue:1,submit:I.c},{name:e("settings.objectDynamics"),key:"objectDynamics",shadowKey:"service.objectDynamics",min:3e4,max:12e5,step:3e4,defaultValue:6e5,formatter:D.b,submit:I.D},{name:e("settings.bandwithVenting"),key:"bandwidth",shadowKey:"configuration.bandwidth",min:0,max:10,step:.2,defaultValue:4,formatter:D.f,submit:I.b}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"VentilationMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.k)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("settings.ventilationSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-ventilation-menu"}))}}var _=Object(y.a)()(V);class L extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("settings.voltageForNumber",{number:"0%"}),key:"flapsVoltage0",shadowKey:"service.flapsVoltage0",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"2%"}),key:"flapsVoltage2",shadowKey:"service.flapsVoltage2",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"5%"}),key:"flapsVoltage5",shadowKey:"service.flapsVoltage5",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"10%"}),key:"flapsVoltage10",shadowKey:"service.flapsVoltage10",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"15%"}),key:"flapsVoltage15",shadowKey:"service.flapsVoltage15",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"20%"}),key:"flapsVoltage20",shadowKey:"service.flapsVoltage20",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"25%"}),key:"flapsVoltage25",shadowKey:"service.flapsVoltage25",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"35%"}),key:"flapsVoltage35",shadowKey:"service.flapsVoltage35",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"45%"}),key:"flapsVoltage45",shadowKey:"service.flapsVoltage45",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"70%"}),key:"flapsVoltage70",shadowKey:"service.flapsVoltage70",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"100%"}),key:"flapsVoltage100",shadowKey:"service.flapsVoltage100",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"100%+1M"}),key:"flapsVoltage100M1",shadowKey:"service.flapsVoltage100M1",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"100%+2M"}),key:"flapsVoltage100M2",shadowKey:"service.flapsVoltage100M2",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g},{name:e("settings.voltageForNumber",{number:"100%+3M"}),key:"flapsVoltage100M3",shadowKey:"service.flapsVoltage100M3",min:0,max:1e4,step:100,defaultValue:4e3,formatter:D.g}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"FlapsMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.f)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("settings.flapsSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-flaps-menu"}))}}var W=Object(y.a)()(L);class K extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("settings.throttleVoltageMin"),key:"throttleVoltageMin",shadowKey:"service.throttleVoltageMin",min:0,max:5e3,step:100,defaultValue:1e3,formatter:D.g,submit:I.K},{name:e("settings.throttleVoltageMax"),key:"throttleVoltageMax",shadowKey:"service.throttleVoltageMax",min:5100,max:1e4,step:100,defaultValue:8e3,formatter:D.g,submit:I.J}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"ThrottleMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.j)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("settings.thorttleSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-throttle-menu"}))}}var z=Object(y.a)()(K);class U extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return[{name:e("deviceRows.chainFeeding.chainFeedingRow.sensor",{number:1}),key:"temperatureSensorsCalibration[0]",shadowKey:"service.temperatureSensorsCalibration[0]",submitKey:"temperatureSensorsCalibration",min:75,max:125,step:1,defaultValue:100,formatter:D.c,submit:I.E},{name:e("deviceRows.chainFeeding.chainFeedingRow.sensor",{number:2}),key:"temperatureSensorsCalibration[1]",shadowKey:"service.temperatureSensorsCalibration[1]",submitKey:"temperatureSensorsCalibration",min:75,max:125,step:1,defaultValue:100,formatter:D.c,submit:I.F},{name:e("deviceRows.chainFeeding.chainFeedingRow.sensor",{number:3}),key:"temperatureSensorsCalibration[2]",submitKey:"temperatureSensorsCalibration",shadowKey:"service.temperatureSensorsCalibration[2]",min:75,max:125,step:1,defaultValue:100,formatter:D.c,submit:I.G},{name:e("deviceRows.chainFeeding.chainFeedingRow.sensor",{number:4}),key:"temperatureSensorsCalibration[3]",submitKey:"temperatureSensorsCalibration",shadowKey:"service.temperatureSensorsCalibration[3]",min:75,max:125,step:1,defaultValue:100,formatter:D.c,submit:I.H},{name:e("deviceRows.chainFeeding.chainFeedingRow.sensor",{number:5}),key:"temperatureSensorsCalibration[4]",submitKey:"temperatureSensorsCalibration",shadowKey:"service.temperatureSensorsCalibration[4]",min:75,max:125,step:1,defaultValue:100,formatter:D.c,submit:I.I}]},this.submit=e=>{const{climates:t}=this.props;console.log(e,"SensorsMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.h)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("newSettings.chainFeeding.sensorWorkType.title"),model:e,onSubmit:this.submit,form:"climate-sk3-sensors-menu"}))}}var q=Object(y.a)()(U),H=a("TYy9"),Y=a.n(H);class G extends r.Component{constructor(...e){super(...e),this.getModel=()=>{const{t:e}=this.props;return Y()(new Array(8).fill(0).map((t,a)=>[{name:e("settings.matDayX",{number:a+1}),key:"mats[".concat(a,"].day"),shadowKey:"mats[".concat(a,"].day"),min:0,max:99,step:1,defaultValue:4},{name:e("settings.matDeviationX",{number:a+1}),key:"mats[".concat(a,"].deviation"),shadowKey:"mats[".concat(a,"].deviation"),min:-99,max:99,step:1,defaultValue:0,formatter:D.c}]))},this.submit=e=>{const{climates:t}=this.props;console.log(e,"MatsMenu submit");const a=Object(F.r)(t);if(a)for(let n of a.values())Object(I.z)(n[N.d.CLIMATE_SK3],e);else console.error("devices not found")}}render(){const e=this.getModel(),{climates:t,t:a}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(x,{climates:t,name:a("farmView.climate.matSettings"),model:e,onSubmit:this.submit,form:"climate-sk3-mats-menu"}))}}var J=Object(y.a)()(G);class Q extends o.a.Component{constructor(e){super(e),this.getClimates=()=>{const{location:e}=this.props;return i()(e,"state.selectedClimates",[])};const{farm:t}=this.props;0===this.getClimates().length&&this.props.history.push("/".concat(t,"/settings/climate-sk3/manage")),c.a.startSendingDeviceState(this.getClimates())}render(){const e=this.getClimates();return 0===e.length?null:o.a.createElement("div",{style:{position:"relative"}},o.a.createElement(A,{climates:e}),o.a.createElement(M,{climates:e}),o.a.createElement(B,{climates:e}),o.a.createElement(_,{climates:e}),o.a.createElement(W,{climates:e}),o.a.createElement(z,{climates:e}),o.a.createElement(q,{climates:e}),o.a.createElement(J,{climates:e}))}}Q=Object(s.connect)(e=>({farm:e.location.farm}))(Q);t.a=Q},"49aN":function(e,t,a){"use strict";var n=a("BkRI"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("VyNe"),c=a("n7pt"),l=a("/MKj"),m=a("3t43"),u=a("pJVQ"),g=a("tDQA"),d=a("IXwn"),p=a("uSQv"),h=a("a+pQ"),b=a("lAGl"),f=a("kCmh"),E=a("zDJl"),v=a("AF5L"),S=a("2UNB"),O=a("P0Qa"),y=a("gLBR");var C=a("i8MS"),D=a("LCzB");function j(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 w(e){for(var t=1;t{const{chambers:e}=this.props;let t=e.slice(0);this.props.change("SetData.Plcmnts",t.map((e,t)=>w({},e,{ID:t+1})))},this.locationValueFormatter=e=>{let t=C.a.getAnimalLocationsByPlcmntID(e);if(t.length>0)return t[0].name};let{deviceSetting:t}=e,a=c.a.getAllChambers(e.farm).filter(e=>!e.IndividualFeeding);t?t.SetData.Plcmnts=a.map(e=>{let a=t.SetData.Plcmnts.find(t=>t.PlcmntID===e.CID);return a?w({},a):{PlcmntID:e.CID}}):t={SetData:{Plcmnts:a.map(e=>({PlcmntID:e.CID}))}},this.props.initialize(i()(t))}render(){const{handleSubmit:e,t:t}=this.props,a=[{name:t("newSettings.buildings.assignChambers.chamber"),field:"PlcmntID",dontShowInput:!0,valueFormatter:this.locationValueFormatter},{name:t("number"),field:"ID",component:b.a,type:"number",parse:e=>null===e?null:+e}];return o.a.createElement(s.a,null,o.a.createElement(p.a,{onClick:this.onAutoClick},t("newSettings.buildings.assignChambers.auto")),o.a.createElement("form",{onSubmit:e},o.a.createElement(m.a,{name:"SetData.Plcmnts",component:h.a,headers:a}),o.a.createElement(d.a,{fixed:!0,renderInPortal:!1},o.a.createElement(p.a,{buttonStyle:"round",buttonColor:"success",icon:o.a.createElement("i",{className:"fas fa-save"})}))))}}x=Object(u.a)({form:"assignChambers",onSubmit:function(e,t,a){let n=f.a.getDevices(a.farm).filter(e=>e.DevType===E.d.GATEWAY),i=e;i.SetID?t(Object(y.c)(i)):(i=S.a.createSetting(O.a.DEVICE_SETTINGS,e.SetData),t(Object(y.a)(i)));for(let r of n)Object(v.t)(r,i.SetData.Plcmnts)}})(x);const I=Object(g.a)("assignChambers");x=Object(l.connect)(e=>({farm:e.location.farm,chambers:I(e,"SetData.Plcmnts"),deviceSetting:e.settings.deviceSetting}))(x);t.a=Object(D.a)()(x)},A6ap:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("VyNe"),o=a("IXwn"),s=a("uSQv"),c=a("/MKj"),l=a("SlBD"),m=a("qx5e"),u=a("s506"),g=a("LCzB"),d=a("re1K"),p=a("d/v1"),h=a("3t43"),b=a("pJVQ"),f=a("tDQA"),E=a("26mJ"),v=a("3Z9Z"),S=a("JI6e"),O=a("XoCd"),y=a("2UNB"),C=a("P0Qa"),D=a("+PoS"),j=a("gLBR"),w=a("pxzG"),T=a("eASP");const x={days:{min:[0,0,0,0,0,10,10,10],max:[0,10,20,30,40,40,43,50]},requestedTemperature:{min:[12,16,16,16,16,16,16,16],max:[40,36,32,30,30,30,30,30]},minimumVentilation:{min:[0,0,0,0,5,5,5,0],max:[25,25,35,40,50,50,50,50]},floor:{min:[0,0,0,0,0,0,0,0],max:[100,100,100,100,100,100,100,100]}};class I extends i.a.Component{constructor(e){super(e),this.temperatureFormatter=e=>Object(w.f)(e,{unit:T.a.SMALL,fixed:1,showUnit:!0}),this.ventilationFormatter=e=>"".concat(e.toFixed(1),"%"),this.renderStages=({fields:e})=>{const{t:t}=this.props;return i.a.createElement(i.a.Fragment,null,e.map((e,a)=>i.a.createElement(r.a,{key:a},i.a.createElement("h5",null,a<1?t("newSettings.climate.curve.start"):"".concat(t("newSettings.climate.curve.stage")," ").concat(a)),i.a.createElement(v.a,null,i.a.createElement(S.a,{md:6},i.a.createElement(p.a,{name:"".concat(e,".days"),id:"".concat(e,".days"),label:t("numberOfDays"),component:O.a,min:x.days.min[a],max:x.days.max[a],step:1,disabled:!a})),i.a.createElement(S.a,{md:6},i.a.createElement(p.a,{name:"".concat(e,".requestedTemperature"),id:"".concat(e,".requestedTemperature"),label:t("requestedTemperature"),component:O.a,min:x.requestedTemperature.min[a],max:x.requestedTemperature.max[a],valueFormatter:this.temperatureFormatter,step:.2})),i.a.createElement(S.a,{md:6},i.a.createElement(p.a,{name:"".concat(e,".minimumVentilation"),id:"".concat(e,".minimumVentilation"),label:t("minimumVentilation"),component:O.a,min:x.minimumVentilation.min[a],max:x.minimumVentilation.max[a],valueFormatter:this.ventilationFormatter,step:.2})),i.a.createElement(S.a,{md:6},i.a.createElement(p.a,{name:"".concat(e,".floor"),id:"".concat(e,".floor"),label:t("settings.floor"),component:O.a,min:x.floor.min[a],max:x.floor.max[a],valueFormatter:this.ventilationFormatter,step:1}))))))};const{initialize:t,farm:a,dispatch:n}=this.props;let o=[],s="",c="";try{c=e.match.params.id;const t=e.climateCurves.find(e=>e.SetID===c),i="/".concat(a,"/settings/climate-sk3/curves");!t&&c&&n(Object(D.a)(i)),t.SetData.Stages.forEach((e,t)=>{o[t]={days:e.Days,requestedTemperature:e.RequestedTemperature,minimumVentilation:e.MinimumVentilation,floor:e.Floor}}),s=t.SetData.Name}catch(l){console.error(l),o=new Array(8).fill(0).map((e,t)=>{const a={};return Object.keys(x).forEach(e=>{a[e]=x[e].max[t]}),a})}t({stages:o,name:s,id:c})}render(){const{t:e,handleSubmit:t,stages:a,initialized:n,submitting:c}=this.props;return i.a.createElement("form",{onSubmit:t},n&&i.a.createElement(i.a.Fragment,null,i.a.createElement(r.a,null,i.a.createElement(p.a,{name:"name",id:"name",label:e("designation"),component:E.a})),i.a.createElement(r.a,null,i.a.createElement(l.a,{stages:a})),i.a.createElement(h.a,{name:"stages",component:this.renderStages}),i.a.createElement(o.a,{fixed:!0,renderInPortal:!1},i.a.createElement(s.a,{isLoading:c,buttonStyle:"round",buttonColor:"success",icon:i.a.createElement("i",{className:"fas fa-save"})}))))}}I=Object(b.a)({form:"add-climate-sk3-curve",onSubmit:(e,t,a)=>{console.log(e,a);const{id:n,name:i,stages:r}=e,{climateCurves:o,farm:s}=a,c=n?o.find(e=>e.SetID===n):y.a.createSetting(C.a.CLIMATE_SK3_CURVE,{Stages:[]}).clone();r.forEach((e,t)=>{Object.keys(e).forEach(a=>{const n=a.slice(0,1).toUpperCase()+a.slice(1);c.SetData.Stages[t]||(c.SetData.Stages[t]={}),c.SetData.Stages[t][n]=e[a]})}),c.SetData.Name=i||"",console.log(c,"DLDLD");const l=e=>{e(),t(Object(D.a)("/".concat(s,"/settings/climate-sk3/curves")))};return new Promise((e,a)=>{n?(c.setDtaModTime(),t(Object(j.c)(c.prepareBeanToSave(),()=>l(e),a))):t(Object(j.a)(c.prepareBeanToSave(),()=>l(e),a))})}})(I);const F=Object(f.a)("add-climate-sk3-curve");I=Object(c.connect)(e=>({user:e.user.user,climateCurves:Object(d.a)(e),stages:F(e,"stages"),farm:e.location.farm}))(I),I=Object(m.a)({roles:[u.c._DEVICE_CLIMATE,u.c._DEVICE_CONFIG],showComponent:!0})(I),t.a=Object(g.a)()(I)},CYYY:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("KYPV"),l=a("Vv3o"),m=a("VyNe"),u=a("y4iu"),g=a("3Z9Z"),d=a("JI6e"),p=a("BkRI"),h=a.n(p),b=a("ZRKa"),f=a("gLBR"),E=a("2UNB"),v=a("P0Qa");function S(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 O(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var y=a("q17X");class C extends n.Component{constructor(...e){super(...e),this.onChangeMin=e=>{const{setFieldValue:t}=this.props;t("FeedingMinimumLevel",e)},this.onChangeMax=e=>{const{setFieldValue:t}=this.props;t("FeedingMaximumLevel",e)},this.valueFormatter=e=>(100*e).toFixed(0)+"%"}render(){const{t:e,values:t,handleSubmit:a}=this.props;return i.a.createElement(m.a,null,i.a.createElement(u.a,{handleSubmit:a},i.a.createElement(g.a,{className:"justify-content-center"},i.a.createElement(d.a,{lg:6},i.a.createElement(l.a,{label:e("newSettings.breeding.feedingLevels.minimum"),value:t.FeedingMinimumLevel,step:.01,min:.1,max:t.FeedingMaximumLevel,onChange:this.onChangeMin,valueFormatter:this.valueFormatter}),i.a.createElement(l.a,{label:e("newSettings.breeding.feedingLevels.maximum"),value:t.FeedingMaximumLevel,step:.01,min:t.FeedingMinimumLevel,max:1,onChange:this.onChangeMax,valueFormatter:this.valueFormatter})))))}}t.a=Object(s.d)(Object(o.a)(),Object(r.connect)((function(e){return{farm:e.location.farm,ClientID:e.user.user.ClientID}})),Object(c.c)({displayName:"feedingLevels",mapPropsToValues:()=>Object(y.getFeedingLevels)(),handleSubmit:function(e,t){const{ClientID:a,dispatch:n}=t.props;let i=b.a.getSettingByID(a);if(console.log(i),i){let t=h()(i);t.SetData?t.SetData.Settings||(t.SetData.Settings={}):t.SetData={Settings:{}},t.SetData.Settings.FeedingLevels=function(e){for(var t=1;ti.a.createElement(i.a.Fragment,null,e.map((a,n)=>i.a.createElement(u.a,{in:!!a,appear:!0,mountOnEnter:!0,unmountOnExit:!0,key:n},i.a.createElement("div",null,i.a.createElement(r.a,null,i.a.createElement("h5",{className:"justify-content-between align-items-center"},this.props.t("grafting")," ",n+1,i.a.createElement(E.a,{buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-trash"}),className:"text",disabled:1===e.length,onClick:()=>e.remove(n)})),i.a.createElement(g.a,null,i.a.createElement(d.a,{md:6},i.a.createElement(o.a,{name:"".concat(a,".Age"),component:v.a,min:1,max:250,label:t===b.a.SOW?this.props.t("newSettings.breeding.graftingProgram.dayAfterInsemination"):this.props.t("newSettings.breeding.graftingProgram.animalAge"),valueFormatter:e=>"".concat(e," ").concat(1===e?this.props.t("day"):this.props.t("days")," ")})),i.a.createElement(d.a,{md:6},i.a.createElement(o.a,{name:"".concat(a,".Medicine"),component:h.b,label:this.props.t("medicine"),options:this.props.medicines.filter(e=>e.WData.Type===D.b.VACCINE).map(e=>({name:e.WData.Name,value:e.WordID})),clearButton:!1}))))))),i.a.createElement(r.a,{className:"pointer",onClick:()=>e.push({Age:1})},i.a.createElement("h5",{className:"justify-content-between align-items-center"},this.props.t("newSettings.breeding.graftingProgram.addNext"),i.a.createElement("i",{className:"fas fa-plus"}))));const{edit:t,match:{params:{programID:a,animalKind:n}},graftingPrograms:s}=e;if(t){let e=s.find(e=>e.WordID===a);this.props.initialize(e)}else this.props.initialize({WData:{MedicineList:[{Age:1}],AnimalKind:+n}})}render(){const{animalKind:e,handleSubmit:t,t:a}=this.props;return i.a.createElement("form",{onSubmit:t},i.a.createElement(s.a,{name:"WData"},i.a.createElement(r.a,null,i.a.createElement(g.a,{className:"justify-content-center"},i.a.createElement(d.a,{xl:6},i.a.createElement(o.a,{component:p.a,name:"Name",label:a("designation"),type:"text"})))),i.a.createElement(c.a,{component:this.renderMedicineList,name:"MedicineList",animalKind:e})),i.a.createElement(S.a,{fixed:!0,renderInPortal:!1},i.a.createElement(E.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-save"})})))}}j=Object(l.a)({form:"addGraftingProgram",onSubmit:function(e,t,a){const{user:n,farm:i,edit:r}=a;if(r){let a=new O.a(e).prepareBeanToSave();a.sortMedicines(),a.setDtaModTime(),t(Object(y.d)(a,n.ClientID,n.LocalUserID))}else{const{WData:{Name:a,AnimalKind:i,MedicineList:r}}=e;let o=O.a.createGraftingProgram(a,i,r);t(Object(y.a)(o,n.ClientID,n.LocalUserID))}a.history.push("/".concat(i,"/settings/breeding/graftingProgram"))},validate:function(e,t){const a={WData:{}},{t:n}=t;return e.WData&&(e.WData.Name||(a.WData.Name=n("required")),e.WData.MedicineList&&(a.WData.MedicineList=e.WData.MedicineList.map(e=>{const t={};return e.Medicine||(t.Medicine=n("required")),t}))),a}})(j);const w=Object(m.a)("addGraftingProgram");j=Object(f.connect)(e=>({medicines:e.dictionary.medicine,animalKind:w(e,"WData.AnimalKind"),user:e.user.user,farm:e.location.farm,graftingPrograms:e.dictionary.graftingPrograms}))(j);t.a=Object(C.a)()(j)},HYy3:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("VyNe"),o=a("d/v1"),s=a("pJVQ"),c=a("3Z9Z"),l=a("JI6e"),m=a("y4iu"),u=a("4huo"),g=a("BkRI"),d=a.n(g),p=a("ZRKa"),h=a("2UNB"),b=a("P0Qa"),f=a("gLBR");function E(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 v(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var S=a("/MKj"),O=a("q17X");class y extends i.a.Component{constructor(e){super(e),this.props.initialize({passage:Object(O.getPassageAccuracy)()})}render(){const{handleSubmit:e}=this.props;return i.a.createElement(r.a,null,i.a.createElement(m.a,{handleSubmit:e},i.a.createElement(c.a,{className:"justify-content-center"},i.a.createElement(l.a,{lg:6},i.a.createElement(o.a,{id:"passage",name:"passage",component:u.b,label:"Dok\u0142adno\u015b\u0107 wykresu przej\u015b\u0107 w wadz\u0119",options:[{name:"0.5 kg",value:.5},{name:"1 kg",value:1}]})))))}}y=Object(s.a)({form:"displaying-cage",onSubmit:function(e,t,a){console.log(e);const{passage:n}=e,{user:{ClientID:i}}=a;let r=p.a.getSettingByID(i),o={Passage:n};if(r){let e=d()(r);e.SetData?e.SetData.Settings||(e.SetData=function(e){for(var t=1;t",e),t(Object(f.c)(e))}else{let e=h.a.createSetting(b.a.GENERAL,{Settings:{Cage:o}});console.log("create - >",e),t(Object(f.a)(e))}}})(y),y=Object(S.connect)(e=>({user:e.user.user}))(y);t.a=y},J9rs:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("IXwn"),o=a("uSQv"),s=a("VyNe"),c=a("AAik"),l=a("/MKj"),m=a("zDJl"),u=a("qx5e"),g=a("s506"),d=a("BvFm"),p=a("VfnB"),h=a("55Ip"),b=a("LCzB");class f extends i.a.Component{constructor(e){super(e),this.onSelectionChange=e=>{this.setState({selectedCages:e})},this.state={selectedCages:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(p.t)(t),{selectedCages:l}=this.state;return Object(d.a)()?i.a.createElement(s.a,null,i.a.createElement(c.a,{data:e.filter(e=>e.DevType===m.d.CAGE),headers:n,shouldIndex:!0,selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageCage"}),i.a.createElement(r.a,{fixed:!0,renderInPortal:!1},i.a.createElement(h.Link,{to:{pathname:"/".concat(a,"/settings/cage/manage/configuration"),state:{selectedCages:l}},disabled:0===l.length},i.a.createElement(o.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===l.length})))):null}}f=Object(l.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(f),f=Object(u.a)({roles:[g.c._DEVICE_CAGE,g.c._DEVICE_CONFIG],showComponent:!0})(f),f=Object(b.a)()(f),t.a=f},OcbF:function(e,t,a){},QIPU:function(e,t,a){"use strict";var n=a("GoyQ"),i=a.n(n),r=a("BkRI"),o=a.n(r),s=a("J2iB"),c=a.n(s),l=a("mwIZ"),m=a.n(l),u=a("q1tI"),g=a.n(u),d=a("zTlQ"),p=a("dmgJ"),h=a("lijG"),b=a("Ty5D"),f=a("RFJ0"),E=a("d/v1"),v=a("pJVQ"),S=a("tDQA"),O=a("/MKj"),y=a("OwcS"),C=a("dpQJ"),D=a("uSQv"),j=a("IXwn"),w=a("kCVf"),T=a("kCmh"),x=a("n7pt"),I=a("zDJl"),F=a("P0Qa"),N=a("2UNB"),P=a("gLBR"),A=a("3Z9Z"),k=a("JI6e"),M=a("VfnB"),R=a("qx5e"),B=a("s506"),V=a("ZRKa"),_=a("26mJ"),L=a("VyNe"),W=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 z(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const U="settings-buildings-map-manage";class q extends g.a.Component{constructor(e){super(e),this.readFile=e=>{let t=e.target.files;if(t)for(let a of t){let e=new FileReader;e.onload=(e=>e=>{let t=o()(e.target.result);this.props.change("farmMap",null),this.props.change("farmMap",Object(p.a)(t))})(),e.readAsText(a)}},this.renderUpload=()=>{const{t:e}=this.props;return g.a.createElement(d.a,{id:"upload-input",onChange:this.readFile,optionalProps:{multiple:!1,accept:".svg"},label:e("newSettings.buildings.farmMap.uploadMap"),frName:e("newSettings.buildings.farmMap.fileReaderButtonName"),type:"file"})},this.handleItemClick=({type:e,id:t,level:a})=>{const{change:n}=this.props;n("selectedID",t),n("selectedType",e)},this.onIDChange=(e=Object(y.a)())=>{const{farmMap:t,change:a,selectedID:n}=this.props;let i=t.cloneNode(!0);console.log(i);try{i.getElementById(n).id=e,a("farmMap",i),a("selectedID",e)}catch(r){console.error(r)}},this.onShowFilterChange=e=>{const{change:t}=this.props;t("showOnly",e),t("selectedID",null)};const{farm:t}=this.props;this.props.initialize({farmMap:Object(p.a)(m()(V.a.getSettingByID("farm_map_".concat(t)),"SetData.Levels[0]")),level:0,selectedID:null,showOnly:"all"});let a=Object(w.i)({Buildings:x.a.getAllBuildingsForFarm(t)||[]}),n=[],i=[],r=[];a.forEach(e=>{let t={name:Object(w.k)(e),value:Object(w.j)(e)};e.BgID?i.push(t):e.CID?r.push(t):e.SID&&n.push(t)}),this.state={options:{devices:Object(M.m)(T.a.getDevicesInPlcmnt({Buildings:x.a.getAllBuildingsForFarm(t)||[]}).filter(e=>e.DevType===I.d.SCALE)).map(e=>({name:e.device.Name,value:c()(e.index)?e.device.DevID:"".concat(e.device.DevID,"_").concat(e.index)})),sectors:n,buildings:i,chambers:r}}}UNSAFE_componentWillReceiveProps(e,t){const{level:a,farm:n}=this.props;a!==e.level&&(e.change("farmMap",Object(p.a)(m()(V.a.getSettingByID("farm_map_".concat(n)),"SetData.Levels[".concat(e.level,"]")))),document.getElementById("upload-input").value="")}render(){const{farmMap:e,selectedID:t,selectedType:a,handleSubmit:n,showOnly:i,t:r}=this.props,{options:o}=this.state;return g.a.createElement(L.a,null,g.a.createElement("form",{onSubmit:n},g.a.createElement(E.a,{id:"level",name:"level",component:_.a,type:"number",label:r("level")}),this.renderUpload(),e&&g.a.createElement(h.a,{showOnly:"all"===i?null:i,farmMap:e,onElementClick:this.handleItemClick,dataProvider:C.a},g.a.createElement(A.a,null,g.a.createElement(k.a,{md:6},g.a.createElement(f.a,{options:[{name:r("newSettings.buildings.farmMap.showAll"),value:"all"},{name:r("newSettings.buildings.farmMap.showChambers"),value:"chambers"},{name:r("newSettings.buildings.farmMap.showSectors"),value:"sectors"},{name:r("newSettings.buildings.farmMap.showBuildings"),value:"buildings"},{name:r("newSettings.buildings.farmMap.showDevices"),value:"devices"}],onChange:this.onShowFilterChange,label:r("newSettings.buildings.farmMap.show"),value:i})),g.a.createElement(k.a,{md:6},g.a.createElement(f.a,{options:o[a]||[],readOnly:!t,onChange:e=>this.onIDChange(e),label:r("devices"===a?"newSettings.buildings.farmMap.assignedDevice":"newSettings.buildings.farmMap.assignedLocation"),value:t||null})))),g.a.createElement(j.a,{fixed:!0,renderInPortal:!1},g.a.createElement(D.a,{icon:g.a.createElement("i",{className:"fas fa-save"}),buttonStyle:"round",buttonColor:"success",disabled:!e}))))}}q=Object(v.a)({form:U,onSubmit:function(e,t,a){const{farmMap:n,level:r}=e,{farm:o}=a;if(console.log(n),n){let e=V.a.getSettingByID("farm_map_".concat(o));e=m()(e,"SetData.Levels",{}),i()(e)||(e={0:e}),e=function(e){for(var t=1;t{a.history.push("/")}))}}})(q);const H=Object(S.a)(U);q=Object(O.connect)(e=>({farmMap:H(e,"farmMap"),level:H(e,"level"),selectedID:H(e,"selectedID"),showOnly:H(e,"showOnly"),selectedType:H(e,"selectedType"),farm:e.location.farm}))(q);q=Object(W.a)()(q),q=Object(b.o)(q),t.a=Object(R.a)({roles:[B.c._DEVICE_CONFIG],showComponent:!0})(q)},Th0Y:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("IXwn"),o=a("uSQv"),s=a("Ty5D"),c=a("/MKj"),l=a("VyNe"),m=a("0ajJ"),u=a("9jj8"),g=a("ANjH"),d=a("f0zD"),p=a("42VQ"),h=a("gLBR"),b=a("LCzB");class f extends i.a.Component{constructor(...e){super(...e),this.onDeleteConfirm=e=>{this.props.curve.deleteSetting(),this.props.dispatch(Object(h.c)(this.props.curve.prepareBeanToSave())),e.handleHide()},this.onDeleteClick=()=>{this.props.show(p.a,{text:"".concat(this.props.t("newSettings.climate.curveItem.deleteText")," ").concat(this.props.curve.SetData.Name,"?"),title:this.props.t("newSettings.climate.curveItem.deleteTitle"),confirmText:this.props.t("yes"),onConfirmed:this.onDeleteConfirm})},this.onEditClick=()=>{this.props.history.push("/".concat(this.props.farm,"/settings/climate/curves/edit/").concat(this.props.curve.SetID))}}render(){const{curve:{SetData:{Name:e}},t:t}=this.props;return i.a.createElement(u.a,null,i.a.createElement("span",null,i.a.createElement("strong",null,e),i.a.createElement("div",{className:"hide-on-small-device sm"},i.a.createElement("small",null,t("designation")))),i.a.createElement("span",null,i.a.createElement("strong",null,this.props.curve.getLength()),i.a.createElement("div",{className:"hide-on-small-device sm"},i.a.createElement("small",null,t("numberOfDays")))),i.a.createElement(r.a,null,i.a.createElement(o.a,{type:"button",icon:i.a.createElement("i",{className:"fas fa-pen"}),buttonStyle:"round",onClick:this.onEditClick}),i.a.createElement(o.a,{type:"button",icon:i.a.createElement("i",{className:"fas fa-trash"}),buttonStyle:"round",onClick:this.onDeleteClick,buttonColor:"error"})))}}f=Object(c.connect)(null,e=>Object(g.b)({show:d.d},e))(f),f=Object(c.connect)(e=>({farm:e.location.farm}))(f),f=Object(b.a)()(f);var E=f=Object(s.o)(f),v=a("vzZS"),S=a("qx5e"),O=a("s506");class y extends i.a.Component{constructor(...e){super(...e),this.onAddClick=()=>{this.props.history.push("/".concat(this.props.farm,"/settings/climate/curves/add"))}}render(){const{climateCurves:e}=this.props;return i.a.createElement(l.a,{type:"container"},i.a.createElement(m.a,null,e.map((e,t)=>i.a.createElement(E,{curve:e,key:t})),0===e.length&&i.a.createElement(v.a,{boxColor:"error"},this.props.t("newSettings.climate.curve.noCurves"))),i.a.createElement(r.a,{fixed:!0,renderInPortal:!1},i.a.createElement(o.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-plus"}),onClick:this.onAddClick})))}}let C=Object(c.connect)(e=>({climateCurves:e.settings.climateCurves,farm:e.location.farm}))(y);y=Object(s.o)(C),y=Object(S.a)({roles:[O.c._DEVICE_CLIMATE,O.c._DEVICE_CONFIG],showComponent:!0})(y),y=Object(b.a)()(y);t.a=y},XmJO:function(e,t,a){},a1wW:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("IXwn"),o=a("uSQv"),s=a("Ty5D"),c=a("/MKj"),l=a("VyNe"),m=a("0ajJ"),u=a("9jj8"),g=a("ANjH"),d=a("f0zD"),p=a("42VQ"),h=a("gLBR"),b=a("LCzB"),f=a("JI6e"),E=a("3Z9Z");class v extends i.a.Component{constructor(...e){super(...e),this.onDeleteConfirm=e=>{this.props.curve.deleteSetting(),this.props.dispatch(Object(h.c)(this.props.curve.prepareBeanToSave())),e.handleHide()},this.onDeleteClick=()=>{this.props.show(p.a,{text:"".concat(this.props.t("newSettings.climate.curveItem.deleteText")," ").concat(this.props.curve.SetData.Name,"?"),title:this.props.t("newSettings.climate.curveItem.deleteTitle"),confirmText:this.props.t("yes"),onConfirmed:this.onDeleteConfirm})},this.onEditClick=()=>{this.props.history.push("/".concat(this.props.farm,"/settings/climate-sk3/curves/edit/").concat(this.props.curve.SetID))}}render(){const{curve:{SetData:{Name:e}},t:t}=this.props;return i.a.createElement(u.a,null,i.a.createElement(f.a,{xs:12,className:"justify-content-center align-item-center"},i.a.createElement(E.a,null,i.a.createElement(f.a,{xs:6},i.a.createElement("h5",null,e),i.a.createElement("small",null,t("designation"))),i.a.createElement(f.a,{xs:3},i.a.createElement("strong",null,this.props.curve.getLength()),i.a.createElement("div",{className:"hide-on-small-device sm"},i.a.createElement("small",null,t("numberOfDays")))),i.a.createElement(f.a,{className:"col-auto m-auto"},i.a.createElement(r.a,{className:"m-0"},i.a.createElement(o.a,{type:"button",icon:i.a.createElement("i",{className:"fas fa-pen"}),buttonStyle:"round",onClick:this.onEditClick}),i.a.createElement(o.a,{type:"button",icon:i.a.createElement("i",{className:"fas fa-trash"}),buttonStyle:"round",onClick:this.onDeleteClick,buttonColor:"error"}))))))}}v=Object(c.connect)(null,e=>Object(g.b)({show:d.d},e))(v),v=Object(c.connect)(e=>({farm:e.location.farm}))(v),v=Object(b.a)()(v);var S=v=Object(s.o)(v),O=a("vzZS"),y=a("qx5e"),C=a("s506"),D=a("re1K");class j extends i.a.Component{constructor(...e){super(...e),this.onAddClick=()=>{this.props.history.push("/".concat(this.props.farm,"/settings/climate-sk3/curves/add"))}}render(){const{climateCurves:e}=this.props;return i.a.createElement(l.a,{type:"container"},i.a.createElement(m.a,{useFlexLayout:!1},e.map((e,t)=>i.a.createElement(S,{curve:e,key:t})),0===e.length&&i.a.createElement(O.a,{boxColor:"error"},this.props.t("newSettings.climate.curve.noCurves"))),i.a.createElement(r.a,{fixed:!0,renderInPortal:!1},i.a.createElement(o.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-plus"}),onClick:this.onAddClick})))}}let w=Object(c.connect)(e=>({climateCurves:Object(D.a)(e),farm:e.location.farm}))(j);j=Object(s.o)(w),j=Object(y.a)({roles:[C.c._DEVICE_CLIMATE,C.c._DEVICE_CONFIG],showComponent:!0})(j),j=Object(b.a)()(j);t.a=j},bweh:function(e,t,a){"use strict";var n=a("Y+p1"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("3Z9Z"),c=a("JI6e"),l=a("n7pt"),m=a("txkB"),u=a("wQmL"),g=a("d/v1"),d=a("pJVQ"),p=a("tDQA"),h=a("/MKj"),b=a("BkRI"),f=a.n(b),E=a("4ltZ");var v=a("y4iu"),S=a("26mJ"),O=a("AAik"),y=a("P5Co"),C=a("vzZS"),D=a("ANjH"),j=a("f0zD"),w=a("uSQv"),T=a("i7k/"),x=a("LCzB"),I=a("XzT5"),F=(a("xz4w"),a("tbNj")),N=a("wLAK"),P=a("kCVf"),A=a("CuyV");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 M(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const R=o.a.memo(Object(x.a)()(({t:e,onClick:t,color:a,allowDelete:n})=>o.a.createElement(A.a,{tooltipContent:o.a.createElement("div",null,!n&&o.a.createElement("div",null,o.a.createElement("i",{className:"fas fa-fw fa-plug"}),o.a.createElement("b",null,e("deleteLocationIconComponent.deletionNotAllowed"))),n&&o.a.createElement("div",null,o.a.createElement("b",null,e("deleteLocationIconComponent.deleteLocation")))),placement:"auto",type:a},o.a.createElement("i",{onClick:n?t:void 0,className:"fas fa-fw fa-trash ".concat(n?"":"disabled")}))));class B extends o.a.Component{render(){const{allowDelete:e,onClick:t}=this.props;return o.a.createElement(o.a.Fragment,null,o.a.createElement(R,{onClick:t,color:e?"":"error",allowDelete:e}))}}var V,_=Object(D.d)(Object(h.connect)((function(e,t){const{value:a}=t,n=a.BgID||a.SID||a.CID||a.BID,i=Object(P.h)(n),r=Object(F.d)(),o={PlcmntID:i,DevType:Object.keys(N).map(e=>N[e])};return function(e){return{allowDelete:!r(e,o).length}}}),(function(e){return function(e){for(var t=1;t({farm:e.location.farm,updating:e.farms.updating}))(V=class extends o.a.Component{constructor(e){super(e),this.sectorTypeFormatter=e=>{const{STypes:t}=this.state;return t[e-1]||e},this.onDeleteChildrenClick=e=>{const{value:t}=e,{show:a,dispatch:n,t:i}=this.props;a("confirm-modal",{title:i("newSettings.buildings.manage.building.deleteSector"),text:I.a.t("newSettings.buildings.manage.building.deleteSectorLong",{type:t.SName}),confirmText:i("yes"),onConfirmed:e=>n(Object(E.b)(t,()=>e.handleHide()))})},this.onAddChildrenClick=()=>{const{building:e,show:t}=this.props;t("settings-buildings-add-location-modal",{parent:e})},this.initializeForm(this.props),this.state={STypes:I.a.t("SType",{returnObjects:!0})}}componentDidUpdate(e,t,a){e!==this.props&&this.setState({STypes:I.a.t("SType",{returnObjects:!0})});const{building:n}=this.props;i()(n,e.building)||(console.log("Buildinzzzzg:",n),this.initializeForm(this.props))}initializeForm(e){const{dispatch:t,building:a}=e;t(Object(u.c)(W,{buildingName:a.BName,sectors:a.Sectors}))}render(){const{handleSubmit:e,sectors:t,building:{Sectors:a},updating:n,t:r}=this.props,l=[{name:r("newSettings.buildings.manage.building.sectorName"),field:"SName",filterType:y.a.STRING,customSort:T.b},{name:r("sectorType"),field:"SType",filterType:y.a.STRING,valueFormatter:this.sectorTypeFormatter},{name:" ",filterType:y.a.STRING,component:e=>o.a.createElement(_,L({onClick:this.onDeleteChildrenClick.bind(this,e)},e))}];return o.a.createElement(v.a,{handleSubmit:e,submitting:n},o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement(g.a,{name:"buildingName",id:"buildingName",required:!0,type:"text",component:S.a,label:r("newSettings.buildings.manage.building.buildingName")}),o.a.createElement("hr",null),!i()(a,t)&&o.a.createElement(C.a,{boxColor:"warning"},r("newSettings.buildings.manage.building.deleteSectorWarning")),o.a.createElement("label",null,r("newSettings.buildings.manage.building.availableSectors")," ",o.a.createElement(w.a,{type:"button",buttonStyle:"round",onClick:()=>this.onAddChildrenClick(),icon:o.a.createElement("i",{className:"fas fa-plus"})})),o.a.createElement(O.a,{data:t||[],headers:l}))))}})||V;K=Object(d.a)({form:W,onSubmit:function({buildingName:e},t,a){console.log("UpdateBuilding",a);const n=f()(a.building);return n.BName=e,t(Object(E.e)(n))},validate:function(e,t){const a={},{buildingName:n}=e,{t:i}=t;return n||(a.buildingName=i("required")),a}})(K);const z=Object(p.a)(W);K=Object(h.connect)(e=>({sectors:z(e,"sectors")}))(K),K=Object(h.connect)(null,e=>Object(D.b)({show:j.d},e))(K);var U=Object(x.a)()(K);var q=a("4huo");function H(){return(H=Object.assign||function(e){for(var t=1;t{const{value:t}=e,{show:a,dispatch:n,t:i}=this.props;a("confirm-modal",{title:i("newSettings.buildings.manage.sector.confirmDelete"),text:I.a.t("newSettings.buildings.manage.sector.confirmDeleteLong",{type:t.CName}),confirmText:i("yes"),onConfirmed:e=>n(Object(E.b)(t,()=>e.handleHide()))})},this.onAddChildrenClick=()=>{const{sector:e,show:t}=this.props;t("settings-buildings-add-location-modal",{parent:e})},this.feedingTypeFormatter=e=>{const{t:t}=this.props;return t(e?"newSettings.buildings.manage.sector.individual":"newSettings.buildings.manage.sector.group")},this.chamberSizeFormatter=e=>e.IndividualFeeding?e.Boxes.length:e.CSize,this.state={STypes:I.a.t("SType",{returnObjects:!0})}}componentDidMount(){this.initializeForm(this.props)}UNSAFE_componentWillReceiveProps(e,t){const{sector:a}=this.props;i()(a,e.sector)||this.initializeForm(e)}componentDidUpdate(e,t,a){e!==this.props&&this.setState({STypes:I.a.t("SType",{returnObjects:!0})})}initializeForm(e){const{dispatch:t,sector:a}=e;t(Object(u.c)(Y,{sectorName:a.SName,sectorType:+a.SType,chambers:a.Chambers}))}render(){const{handleSubmit:e,sector:{Chambers:t},t:a}=this.props;let{STypes:n}=this.state;const i=[];n.forEach((e,t)=>{i.push({name:e,value:t+1})});const r=[{name:a("newSettings.buildings.manage.sector.chamberName"),field:"CName",filterType:y.a.STRING,customSort:T.b},{name:a("feeding"),field:"IndividualFeeding",filterType:y.a.STRING,valueFormatter:this.feedingTypeFormatter},{name:a("newSettings.buildings.manage.sector.chamberSize"),filterType:y.a.STRING,valueFormatter:this.chamberSizeFormatter},{name:" ",filterType:y.a.STRING,component:e=>o.a.createElement(_,H({onClick:this.onDeleteChildrenClick.bind(this,e)},e))}];return o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement(v.a,{handleSubmit:e},o.a.createElement(g.a,{name:"sectorName",id:"sectorName",required:!0,type:"text",component:S.a,label:a("newSettings.buildings.manage.sector.sectorName")}),o.a.createElement(g.a,{name:"sectorType",id:"sectorType",required:!0,component:q.b,options:i,label:a("sectorType")}),o.a.createElement("label",null,a("newSettings.buildings.manage.sector.availableChambers")," ",o.a.createElement(w.a,{type:"button",buttonStyle:"round",onClick:()=>this.onAddChildrenClick(),icon:o.a.createElement("i",{className:"fas fa-plus"})})),o.a.createElement(O.a,{data:t||[],headers:r}))))}}G=Object(d.a)({form:Y,onSubmit:function({sectorName:e,sectorType:t},a,n){console.log(n);const i=f()(n.sector);return i.SName=e,i.SType=+t,a(Object(E.e)(i))},validate:function(e,t){const a={},{sectorName:n,sectorType:i}=e,{t:r}=t;return n||(a.sectorName=r("required")),(!i||+i<=0)&&(a.sectorType=r("required")),a}})(G),G=Object(h.connect)(e=>({farm:e.location.farm}))(G);const J=Object(p.a)(Y);G=Object(h.connect)(e=>({chambers:J(e,"chambers")}))(G),G=Object(h.connect)(null,e=>Object(D.b)({show:j.d},e))(G);var Q=Object(x.a)()(G),Z=a("mwIZ"),X=a.n(Z),$=a("lFKM"),ee=a.n($);var te=a("XM6k"),ae=a("a4gc"),ne=a("Jxr4"),ie=a("KVmA"),re=a("nPqS"),oe=a("unVT"),se=a("HuqI"),ce=a("feJH"),le=a("ZVDl"),me=a("pEX4");function ue(){return(ue=Object.assign||function(e){for(var t=1;t{const{value:t}=e,{show:a,dispatch:n,t:i}=this.props;a("confirm-modal",{title:i("newSettings.buildings.manage.chamber.confirmDelete"),text:I.a.t("newSettings.buildings.manage.chamber.confirmDeleteSingleBox",{type:t.BoxesName}),confirmText:i("yes"),onConfirmed:e=>n(Object(E.b)(t,()=>e.handleHide()))})},this.onAddChildrenClick=()=>{const{chamber:e,show:t}=this.props;t("settings-buildings-add-location-modal",{parent:e})}}componentDidMount(){be.initializeForm(this.props)}componentDidUpdate(e,t,a){const{chamber:n}=this.props;i()(e.chamber,n)||be.initializeForm(this.props)}static initializeForm(e){const{dispatch:t,chamber:a}=e;t(Object(u.c)(pe,{chamberName:a.CName,chamberSize:a.CSize,individualFeeding:!!a.IndividualFeeding,standsInRow:a.StandsInRow,standsOrder:void 0!==a.StandsOrder?+a.StandsOrder:1,boxes:a.Boxes}))}onDeleteAllBoxesClick(){const{show:e,dispatch:t,t:a}=this.props,n=f()(this.props.chamber);n.Boxes=[],e("confirm-modal",{title:a("newSettings.buildings.manage.chamber.confirmDelete"),text:I.a.t("newSettings.buildings.manage.chamber.confirmDeleteAllBoxes",{type:n.CName}),confirmText:a("yes"),onConfirmed:e=>t(Object(E.e)(n,()=>e.handleHide()))})}render(){const{handleSubmit:e,individualFeeding:t,boxes:a,chamber:{IndividualFeeding:n},t:r,allowDelete:l}=this.props,m=[{name:r("newSettings.buildings.manage.chamber.boxesName"),field:"BoxesName",filterType:y.a.STRING,customSort:T.b},{name:r("rfid"),field:"RFID",filterType:y.a.STRING},{name:" ",filterType:y.a.STRING,component:e=>o.a.createElement(_,ue({onClick:this.onDeleteChildrenClick.bind(this,e)},e))}];return o.a.createElement(v.a,{handleSubmit:e},o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement(g.a,{name:"chamberName",id:"chamberName",required:!0,type:"text",component:S.a,label:r("newSettings.buildings.manage.chamber.chamberName")}),o.a.createElement(g.a,{name:"individualFeeding",id:"individualFeeding",component:te.a,label:o.a.createElement(o.a.Fragment,null,r("newSettings.buildings.manage.chamber.individualFeeding"),!l&&n&&o.a.createElement(A.a,{placement:"auto",tooltipContent:r("newSettings.buildings.manage.chamber.individualFeedingFailureMessage")},o.a.createElement("i",{className:"fas fa-fw fa-info-circle ml-1"}))),disabled:!l&&n}),!t&&o.a.createElement(o.a.Fragment,null,o.a.createElement(g.a,{name:"chamberSize",id:"chamberSize",required:!0,type:"number",component:S.a,label:r("newSettings.buildings.manage.chamber.chamberSize")}),!i()(n,t)&&o.a.createElement(C.a,{boxColor:"warning"},r("newSettings.buildings.manage.chamber.changingFeedingTypeDeletesStandings"))),t&&o.a.createElement(o.a.Fragment,null,o.a.createElement(g.a,{name:"standsInRow",id:"standsInRow",required:!0,type:"number",component:S.a,label:r("standingsInRow")}),o.a.createElement(g.a,{name:"standsOrder",id:"standsOrder",component:ae.a,showLabels:!0,required:!0,itemsInRow:4,options:[{value:0,svgPath:ne.a,label:"A1"},{value:1,svgPath:ie.a,label:"A2"},{value:2,svgPath:re.a,label:"A3"},{value:3,svgPath:oe.a,label:"A4"},{value:4,svgPath:se.a,label:"B1"},{value:5,svgPath:ce.a,label:"B2"},{value:6,svgPath:le.a,label:"B3"},{value:7,svgPath:me.a,label:"B4"}],label:r("newSettings.buildings.manage.chamber.standsOrder")}),o.a.createElement("label",null,r("newSettings.buildings.manage.chamber.availableStandings")," ",n&&o.a.createElement(w.a,{type:"button",buttonStyle:"round",onClick:()=>this.onAddChildrenClick(),icon:o.a.createElement("i",{className:"fas fa-plus"})})),o.a.createElement(O.a,{data:a||[],headers:m})))))}}var fe,Ee=Object(D.d)(Object(x.a)(),Object(h.connect)((function(e,t){const{chamber:a}=t,n=Object(F.d)(),i={PlcmntID:Object(P.h)(a.CID),DevType:Object.keys(N).map(e=>N[e])};return function(e){const t=n(e,i);return{farm:e.location.farm,individualFeeding:he(e,"individualFeeding"),boxes:he(e,"boxes"),allowDelete:!t.length}}}),(function(e){return function(e){for(var t=1;t({farm:e.location.farm}))(fe=class extends o.a.Component{componentDidMount(){this.initializeForm(this.props)}UNSAFE_componentWillReceiveProps(e,t){const{sector:a}=this.props;i()(a,e.sector)||this.initializeForm(e)}initializeForm(e){const{dispatch:t,box:a}=e;t(Object(u.c)("settings-buildings-manage-box",{boxName:a.BoxesName,boxRFID:a.RFID}))}render(){const{handleSubmit:e,t:t}=this.props;return o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement(v.a,{handleSubmit:e},o.a.createElement(g.a,{name:"boxName",id:"boxName",type:"text",required:!0,component:S.a,label:t("newSettings.buildings.manage.box.boxName")}),o.a.createElement(g.a,{name:"boxRFID",id:"boxRFID",type:"text",component:S.a,label:t("newSettings.buildings.manage.box.boxRFID")}))))}})||fe;Se=Object(d.a)({form:"settings-buildings-manage-box",onSubmit:function({boxName:e,boxRFID:t},a,n){console.log(n);const i=f()(n.box);return i.BoxesName=e,t?i.RFID=Object(ve.a)(t):delete i.RFID,console.log("update this box",i),a(Object(E.e)(i))},validate:function(e,t){const a={},{t:n}=t,{boxName:i,boxRFID:r}=e;return i||(a.boxName=n("required")),r&&r.length>16&&(a.boxRFID=n("required")),a}})(Se),Se=Object(h.connect)(e=>({}))(Se);var Oe=Object(x.a)()(Se),ye=a("9GTB");function Ce(){return(Ce=Object.assign||function(e){for(var t=1;t{const{value:t}=e,{show:a,dispatch:n,t:i}=this.props;a("confirm-modal",{title:i("newSettings.buildings.manage.farm.confirmDelete"),text:I.a.t("newSettings.buildings.manage.farm.confirmDeleteLong",{type:t.BName}),confirmText:i("yes"),onConfirmed:e=>n(Object(E.b)(t,()=>e.handleHide()))})},this.onAddChildrenClick=()=>{const{farm:e,show:t}=this.props;t("settings-buildings-add-location-modal",{parent:e})}}render(){const{buildings:e,t:t}=this.props,a=[{name:t("newSettings.buildings.manage.farm.buildingName"),field:"BName",filterType:y.a.STRING},{name:" ",filterType:y.a.STRING,component:e=>o.a.createElement(_,Ce({onClick:this.onDeleteChildrenClick.bind(this,e)},e))}];return o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement("label",null,t("newSettings.buildings.manage.farm.availableBuildings"),o.a.createElement(w.a,{type:"button",buttonStyle:"round",onClick:this.onAddChildrenClick,icon:o.a.createElement("i",{className:"fas fa-plus"})})),o.a.createElement(O.a,{data:e||[],headers:a})))}}var Te=Object(D.d)(Object(x.a)(),Object(h.connect)((function(e,t){return{farm:Object(ye.a)(e)}}),(function(e){return function(e){for(var t=1;t{const{history:e}=this.props;e.go(-2),window.removeEventListener("popstate",this.goBack)},this.onBuildingsUpdate=e=>{const{selectedPlacement:t}=this.state;this.setState({treeOptions:l.a.getObjectForTreeSelect(e.farm,!0),buildings:l.a.getAllBuildingsForFarm(e.farm),selectedPlacement:t?l.a.getLocationByID(t.BID||t.CID||t.SID||t.BgID||t.FarmID):void 0})},this.onTreeValueChange=e=>{this.setState({selectedPlacement:e||null})},this.state={treeOptions:l.a.getObjectForTreeSelect(e.farm,!0),buildings:l.a.getAllBuildingsForFarm(e.farm),selectedPlacement:void 0}}componentDidUpdate(e,t,a){const{buildings:n}=this.props;i()(e.buildings,n)||this.onBuildingsUpdate(this.props)}componentDidMount(){const{history:e}=this.props;e&&e.location&&e.location.state&&e.location.state.fromPage&&e.location.state.fromPage.pathname&&"eventChooser"===e.location.state.fromPage.pathname.split("/")[2]&&"events"!==e.location.state.fromPage.pathname.split("/")[3]&&window.addEventListener("popstate",this.goBack)}render(){const{treeOptions:e,selectedPlacement:t,buildings:a}=this.state,{t:n}=this.props;return o.a.createElement(Fe.a,{className:"manage-buildings-view"},o.a.createElement(s.a,{className:"justify-content-center"},o.a.createElement(c.a,{lg:6},o.a.createElement("label",null,n("newSettings.buildings.manageBuildingsView.choosenLocation")),o.a.createElement(m.a,{options:e,expanded:!0,onChange:this.onTreeValueChange,value:t,clearButton:!0}))),t&&o.a.createElement(o.a.Fragment,null,t.object.BgID&&o.a.createElement(U,{building:t.object}),t.object.SID&&o.a.createElement(Q,{sector:t.object}),t.object.CID&&o.a.createElement(Ee,{chamber:t.object}),t.object.BID&&o.a.createElement(Oe,{box:t.object})),!t&&o.a.createElement(Te,{buildings:a}),o.a.createElement(xe.b,null),o.a.createElement(Ie.a,null))}}t.a=Object(D.d)(Object(Ne.a)({roles:[Pe.BUILDING],showComponent:!0}),Ae.o,Object(x.a)(),Object(h.connect)((function(e){return{farm:e.location.farm,buildings:e.farms.buildings}})))(ke)},dZA5:function(e,t,a){"use strict";var n=a("BkRI"),i=a.n(n),r=a("mwIZ"),o=a.n(r),s=a("Y+p1"),c=a.n(s),l=a("q1tI"),m=a.n(l),u=a("3Z9Z"),g=a("JI6e"),d=a("/MKj"),p=a("44Ds"),h=a.n(p),b=a("kCVf"),f=a("zDJl"),E=a("9jj8"),v=a("VfnB"),S=a("pJDg"),O=a("vYJ8"),y=a("0ajJ"),C=a("J2iB"),D=a.n(C),j=a("lFKM"),w=a.n(j),T=a("uSQv"),x=a("IXwn"),I=a("f0zD"),F=a("ANjH"),N=a("42VQ"),P=a("6uZD"),A=a("LCzB"),k=a("XzT5");class M extends m.a.Component{constructor(...e){super(...e),this.onButtonClick=()=>{console.log(this.props);const{device:e,location:t,t:a,show:n,user:i,index:r}=this.props;let o=t.BgID||t.SID||t.CID||t.BID,s=e.clone();this.checkIfSelected()?(s.removeLocation(o,void 0!==r?r:null),n(N.a,{title:a("newSettings.buildings.pair.pairLocationView.confirmUnlink"),text:a("newSettings.buildings.pair.pairLocationView.confirmUnlinkLong"),confirmText:a("yes"),onConfirmed:e=>{this.props.dispatch(Object(P.e)(s.prepareBeanToSave(),s.FarmID,i.ClientID,i.LocalUserID)),Object(b.o)(t),e.handleHide()}})):(s.addLocation(o,void 0!==r?r:null),s.getLocation(void 0!==r?r:null).length>1?n(N.a,{title:a("newSettings.buildings.pair.pairLocationView.confirmLink"),text:k.a.t("newSettings.buildings.pair.pairLocationView.deviceExistsInAnotherLoc",{location:e.getLocation(void 0!==r?r:null).map(e=>Object(b.k)(e)).join(", ")}),confirmText:a("yes"),onConfirmed:e=>{this.props.dispatch(Object(P.e)(s.prepareBeanToSave(),s.FarmID,i.ClientID,i.LocalUserID)),Object(b.o)(t),e.handleHide()}}):(this.props.dispatch(Object(P.e)(s.prepareBeanToSave(),s.FarmID,i.ClientID,i.LocalUserID)),Object(b.o)(t)))}}checkIfSelected(){try{const{location:e,device:t,index:a}=this.props;let n=e.BgID||e.SID||e.CID||e.BID;return void 0!==a?t.PlcmntID.filter(e=>e.PlcmntID===n&&e.Adr===a).length>0:t.PlcmntID.filter(e=>e.PlcmntID===n).length>0}catch(e){return!1}}shouldComponentUpdate(e,t,a){return!c()(this.props,e)}render(){const{device:e,location:t,index:a,updating:n,fetching:i,t:r,lp:o}=this.props,s=this.checkIfSelected();return m.a.createElement(E.a,{index:o,color:"#00afff",className:"pair-device-item"},m.a.createElement(x.a,null,m.a.createElement(T.a,{disabled:!t,isLoading:n||i,type:"button",className:"round",onClick:this.onButtonClick,buttonStyle:"text",icon:m.a.createElement("i",{className:s?"fas fa-link fa-fw":"fas fa-unlink fa-fw"}),buttonColor:s?"success":null})),m.a.createElement("span",null,m.a.createElement("div",null,m.a.createElement("strong",null,e.Name)," "),m.a.createElement("div",null,m.a.createElement("small",null,k.a.t("newSettings.buildings.pair.deviceItem.devAdrIndexAndSN",{address:w()(e.Address)?"".concat(e.Address,"/0x").concat(e.Address.toString(16)):"-",index:D()(a)?"-":a,device:e.DevID})))),m.a.createElement("span",{className:"hide-on-small-device md"},m.a.createElement("div",null,e.getLocation(void 0!==a?a:null).map(e=>Object(b.k)(e)).join(", ")||"-"),m.a.createElement("div",null,m.a.createElement("small",null,r("placement")))))}}M=Object(d.connect)(e=>({farm:e.location.farm,fetching:e.farmDevices.fetching,user:e.user.user}))(M),M=Object(d.connect)(null,e=>Object(F.b)({show:I.d},e))(M);var R=Object(A.a)()(M),B=a("8TgK"),V=a("kCmh");class _ extends m.a.Component{constructor(e){super(e),this.getDevicesSize=h()((e,t)=>{let a=0,n=0,i=0,r=[],o=0;e.forEach(e=>{switch(e.DevType){case f.d.CAGE:a+=1;break;case f.d.CLIMATE:n+=1;break;case f.d.DISPENSER_NRF:case f.d.DISPENSER:i+=1;break;case f.d.ANTENNA_RFID:o+=1;break;case f.d.SCALE:r.push(e)}});let s=Object(v.q)(r,t);return{climates:n,cages:a,dispensers:i,scales:s,antennas:o}},(...e)=>JSON.stringify(e)),this.onItemClick=()=>{this.setState(e=>({collapse:!e.collapse}))},this.renderDispensersAdd=()=>{const{location:e,t:t}=this.props;if(e&&e.CID&&e.IndividualFeeding){let a=[];for(let t of e.Boxes){let e=V.a.getDevicesInPlcmnt(t);e.length>0&&a.push(e[0])}return m.a.createElement("div",null,m.a.createElement(E.a,{className:"pair-device-item",fixedWidth:!0},m.a.createElement(S.a,null,m.a.createElement(T.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-list-ol"}),onClick:()=>{const{show:t}=this.props;t(B.a,{chamber:e})}})),m.a.createElement("span",null,m.a.createElement("div",null,m.a.createElement("strong",null,t("newSettings.buildings.pair.locationItem.manageDispensers"))),m.a.createElement("div",null,m.a.createElement("small",null,k.a.t("newSettings.buildings.pair.locationItem.linkedBoxes",{amount1:a.length,amount2:e.Boxes.length}))))))}return null},this.state={collapse:!1}}render(){const{location:e,selectedLocation:t,t:a,handleOnClick:n,devices:i,devicesMap:r=new Map}=this.props,{collapse:o}=this.state,s=r.get(Object(b.j)(e))||[],{climates:l,scales:u,cages:g,antennas:d,dispensers:p}=this.getDevicesSize(s,e);return m.a.createElement("div",null,m.a.createElement(E.a,{selected:Object(b.j)(e)===Object(b.j)(t),onClick:()=>{n(e),this.onItemClick()}},m.a.createElement("div",null,m.a.createElement("span",null,m.a.createElement("div",null,m.a.createElement("strong",null,Object(b.k)(e))),m.a.createElement("small",null,a("newSettings.buildings.pair.locationItem.cages",{number:g}),", ",a("newSettings.buildings.pair.locationItem.climates",{number:l}),", ",a("newSettings.buildings.pair.locationItem.dispensers",{number:p}),", ",a("newSettings.buildings.pair.locationItem.scales",{number:u}),", ",a("newSettings.buildings.pair.locationItem.antennas",{number:d})))),m.a.createElement("i",{className:"fas fa-arrow-".concat(o&&i.length?"up":"down")})),c()(e,t)&&m.a.createElement(O.a,{in:o,mountOnEnter:!0,unmountOnExit:!0},m.a.createElement("div",null,m.a.createElement(y.a,{striped:!0},o&&this.renderDispensersAdd(),i.map((t,a)=>m.a.createElement(R,{lp:a,key:a,device:t.device,index:t.index,location:e}))))))}}_=Object(d.connect)(null,e=>Object(F.b)({show:I.d},e))(_),_=Object(A.a)()(_);var L=a("0MVo"),W=a("VyNe"),K=a("qx5e"),z=a("s506"),U=(a("XmJO"),a("2dKy"));class q extends m.a.Component{constructor(e){super(e),this.prepareData=this.prepareData.bind(this),this.filterBuildings=this.filterBuildings.bind(this),this.filterDevices=this.filterDevices.bind(this),this.changeLocation=this.changeLocation.bind(this),this.renderDispensersAdd=this.renderDispensersAdd.bind(this),this.state={filterLocation:"",filterDevices:"",devices:[],buildings:[]}}componentDidMount(){this.prepareData(this.props)}prepareData(e=this.props){this.setState({devices:Object(v.m)(e.devices),buildings:Object(b.i)({Buildings:e.buildings}),placementDevicesMap:Object(v.w)()})}UNSAFE_componentWillReceiveProps(e,t){const{devices:a,buildings:n}=this.props;c()(a,e.devices)&&c()(n,e.buildings)||this.prepareData(e)}checkFilter(e="",t=""){return"".concat(e).replace(/\s/g,"").toLowerCase().includes(t.replace(/\s/g,"").toLowerCase())}filterBuildings(e=[]){let t=i()(e);const{filterLocation:a}=this.state;return t=t.filter(e=>e.CID||e.SID||e.BgID),a?t.filter(e=>this.checkFilter(Object(b.k)(e),a)):t}filterDevices(e=[]){let t=i()(e);const{filterDevices:a}=this.state,{location:n}=this.state;let r=[];return n&&(n.CID&&(r=[f.d.CLIMATE,f.d.SCALE,f.d.CAGE,f.d.ANTENNA_RFID,f.d.WATER_FLOW_METER,f.d.ELECTRICITY_FLOW_METER,f.d.SMALL_CAGE,f.d.CHAIN_FEEDING],n.IndividualFeeding||r.push(f.d.DISPENSER_NRF)),n.BgID&&(r=[f.d.CLIMATE,f.d.SCALE,f.d.WATER_FLOW_METER,f.d.ELECTRICITY_FLOW_METER])),t=t.filter(e=>r.includes(o()(e,"device.DevType"))),t.sort((e,t)=>Object(L.b)(o()(e,"device.Name"),o()(t,"device.Name"),{numeric:!0})||Object(L.b)(o()(e,"device.Address"),o()(t,"device.Address"),{numeric:!0})),a?t.filter(e=>this.checkFilter(o()(e,"device.Name",""),a)||this.checkFilter("0x".concat(o()(e,"device.Address",0).toString(16)),a)||this.checkFilter(o()(e,"device.Address",""),a)):t}changeLocation(e){this.setState({location:e})}renderDispensersAdd(){const{location:e}=this.state,{t:t}=this.props;if(e&&e.CID&&e.IndividualFeeding){let a=[];for(let t of e.Boxes){let e=V.a.getDevicesInPlcmnt(t);e.length>0&&a.push(e[0])}return m.a.createElement(E.a,{className:"pair-device-item",fixedWidth:!0},m.a.createElement(x.a,null,m.a.createElement(T.a,{buttonStyle:"text",className:"round",icon:m.a.createElement("i",{className:"fas fa-list-ol"}),onClick:()=>{const{show:t}=this.props;t(B.a,{chamber:e})}})),m.a.createElement("span",null,m.a.createElement("div",null,m.a.createElement("strong",null,t("newSettings.buildings.pair.pairLocationView.manageDispensers"))),m.a.createElement("div",null,m.a.createElement("small",null,k.a.t("newSettings.buildings.pair.pairLocationView.linkedBoxes",{linked:a.length,location:e.Boxes.length})))))}return null}render(){const{location:e,placementDevicesMap:t,filterLocation:a,filterDevices:n}=this.state,{t:i}=this.props,r=this.filterDevices(this.state.devices),o=this.filterBuildings(this.state.buildings);return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"headers"},m.a.createElement(u.a,{className:"justify-content-center fixed-width"},m.a.createElement(g.a,{md:4},m.a.createElement(U.a,{placeholder:i("newSettings.buildings.pair.pairLocationView.locationFiltering"),type:"text",value:a,onChange:e=>this.setState({filterLocation:e})})),m.a.createElement(g.a,{md:8},m.a.createElement(U.a,{placeholder:i("newSettings.buildings.pair.pairLocationView.deviceFiltering"),type:"text",value:n,onChange:e=>this.setState({filterDevices:e})})))),m.a.createElement("div",{className:"settings-profile-general overflow-hidden"},m.a.createElement(u.a,{className:"justify-content-center"},m.a.createElement(W.a,{type:"container",style:{width:"98%"}},m.a.createElement(y.a,null,o.map((a,n)=>m.a.createElement(_,{devicesMap:t,key:n,location:a,devices:r,selectedLocation:e,handleOnClick:this.changeLocation}))))),m.a.createElement(B.b,null)))}}q=Object(d.connect)(e=>({devices:e.farmDevices.devices,buildings:e.farms.buildings}))(q),q=Object(d.connect)(null,e=>Object(F.b)({show:I.d},e))(q),q=Object(A.a)()(q);t.a=Object(K.a)({roles:[z.c._DEVICE_CONFIG],showComponent:!0})(q)},f13W:function(e,t,a){"use strict";var n=a("44Ds"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("IXwn"),c=a("uSQv"),l=a("VyNe"),m=a("AAik"),u=a("/MKj"),g=a("zDJl"),d=a("qx5e"),p=a("s506"),h=a("BvFm"),b=a("VfnB"),f=a("55Ip"),E=a("LCzB"),v=a("yjtO");class S extends o.a.Component{constructor(e){super(e),this.getChainFeeding=i()((e=[])=>e.filter(e=>e.DevType===g.d.CHAIN_FEEDING)),this.onSelectionChange=e=>{this.setState({selectedDevices:e})},this.state={selectedDevices:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(b.t)(t),{selectedDevices:i}=this.state;return Object(h.a)()?o.a.createElement(l.a,null,o.a.createElement(m.a,{data:this.getChainFeeding(e),headers:n,shouldIndex:!0,mobileRow:o.a.createElement(v.a,null),selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageChainFeeding"}),o.a.createElement(s.a,{fixed:!0,renderInPortal:!1},o.a.createElement(f.Link,{to:{pathname:"/".concat(a,"/settings/chainFeeding/manage/configuration"),state:{selectedDevices:i}},disabled:0===i.length},o.a.createElement(c.a,{buttonColor:"success",buttonStyle:"round",icon:o.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===i.length})))):null}}S=Object(u.connect)(e=>({devices:e.farmDevices.devices,farm:e.location.farm}))(S),S=Object(d.a)({roles:[p.c._DEVICE_CHAIN,p.c._DEVICE_CONFIG],showComponent:!0})(S),S=Object(E.a)()(S),t.a=S},iwqF:function(e,t,a){"use strict";var n=a("BkRI"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("3Z9Z"),c=a("JI6e"),l=a("wQmL"),m=a("d/v1"),u=a("pJVQ"),g=a("/MKj"),d=a("VyNe"),p=a("y4iu"),h=a("q17X"),b=a("XoCd"),f=a("ZRKa"),E=a("P0Qa"),v=a("2UNB"),S=a("gLBR"),O=a("qx5e"),y=a("s506"),C=a("pxzG"),D=a("eASP"),j=a("26mJ"),w=a("wd/R"),T=a.n(w),x=a("LCzB"),I=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 N(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;tt("newSettings.breeding.manage.cycle.weeks",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.numberOfWeeksInCycle")}),o.a.createElement(m.a,{name:"technologyGroupSize",id:"technologyGroupSize",required:!0,min:1,max:500,component:b.a,valueFormatter:e=>t("pcs",{count:e}),label:t("newSettings.breeding.manage.cycle.technologyGroupSize")}),o.a.createElement(m.a,{name:"timeFromInseminationToPregnancy",id:"timeFromInseminationToPregnancy",required:!0,min:20,max:40,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeFromInseminationToPregnancy")}),o.a.createElement(m.a,{name:"timeFromInseminationToPartuition",id:"timeFromInseminationToPartuition",required:!0,min:90,max:130,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeFromInseminationToPartuition")}),o.a.createElement(m.a,{name:"timeBetweenInseminations",id:"timeBetweenInseminations",required:!0,min:1,max:15,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeBetweenInseminations")}),o.a.createElement(m.a,{name:"timeOnBirthRoom",id:"timeOnBirthRoom",required:!0,min:20,max:50,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeOnBirthRoom")}),o.a.createElement(m.a,{name:"timeOnBirthRoomMommy",id:"timeOnBirthRoomMommy",required:!0,min:20,max:50,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeOnBirthRoomMommy")}),o.a.createElement(m.a,{name:"timeOnMatingRoom",id:"timeOnMatingRoom",required:!0,min:1,max:30,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeOnMatingRoom")}),o.a.createElement(m.a,{name:"timeOnSowsRoom",id:"timeOnSowsRoom",required:!0,min:70,max:120,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.timeOnSowsRoom")}),o.a.createElement(m.a,{name:"maxPartuitionDelay",id:"maxPartuitionDelay",required:!0,min:1,max:15,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.maxPartuitionDelay")}),o.a.createElement(m.a,{name:"matingPreparationPeriod",id:"matingPreparationPeriod",required:!0,min:1,max:15,valueFormatter:e=>t("newSettings.breeding.manage.cycle.weeks",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.matingPreparationPeriod")}),o.a.createElement(m.a,{name:"firstMatingMinWeight",id:"firstMatingMinWeight",required:!0,min:1e3,max:17e4,step:1e3,valueFormatter:e=>Object(C.j)(e,{showUnit:!0,unit:D.a.MEDIUM,fixed:0}),component:b.a,label:t("newSettings.breeding.manage.cycle.firstMatingMinWeight")}),o.a.createElement(m.a,{name:"firstMatingMinAge",id:"firstMatingMinAge",required:!0,min:30,max:300,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.firstMatingMinAge")}),o.a.createElement(m.a,{name:"numberOfDaysToSale",id:"numberOfDaysToSale",required:!0,min:50,max:130,valueFormatter:e=>t("newSettings.breeding.manage.cycle.days",{count:e}),component:b.a,label:t("newSettings.breeding.manage.cycle.numberOfDaysToSale")})))))}}k=Object(u.a)({form:A,onSubmit:function(e,t,a){const{user:{ClientID:n}}=a;let r=f.a.getSettingByID(n),o={NumberOfWeeksInCycle:+e.numberOfWeeksInCycle,TimeFromInseminationToPregnancy:+e.timeFromInseminationToPregnancy,TimeFromInseminationToPartuition:+e.timeFromInseminationToPartuition,TimeBetweenInseminations:+e.timeBetweenInseminations,TimeOnBirthRoom:+e.timeOnBirthRoom,TimeOnBirthRoomMommy:+e.timeOnBirthRoomMommy,TimeOnMatingRoom:+e.timeOnMatingRoom,TimeOnSowsRoom:+e.timeOnSowsRoom,MaxPartuitionDelay:+e.maxPartuitionDelay,MatingPreparationPeriod:+e.matingPreparationPeriod,FirstMatingMinWeight:+e.firstMatingMinWeight,FirstMatingMinAge:+e.firstMatingMinAge,NumberOfDaysToSale:+e.numberOfDaysToSale,TechnologyGroupSize:+e.technologyGroupSize,FirstTechnologyGroup:T()(e.firstTechnologyGroup).toDate().getTime()};if(r){let e=i()(r);e.SetData?e.SetData.Settings||(e.SetData=function(e){for(var t=1;t({farm:e.location.farm,user:e.user.user}))(k);M=Object(O.a)({roles:[y.c._BREEDING],showComponent:!0})(M),t.a=Object(x.a)()(M)},jGzQ:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("udB/"),o=a("3Z9Z"),s=a("JI6e"),c=a("/MKj"),l=a("/kok"),m=a("mwIZ"),u=a.n(m),g=a("Y+p1"),d=a.n(g),p=a("1smR"),h=a("zTlQ"),b=a("17x9"),f=a.n(b),E=a("sZ7W"),v=a("IBmF"),S=a("zDJl"),O=a("vzZS"),y=a("wd/R"),C=a.n(y),D=a("LCzB"),j=a("XzT5");function w(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 T(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class x extends i.a.Component{constructor(e){super(e),this.onAttemptsNumberChange=e=>{this.setState({attemptsNumber:e,changed:!0})},this.onClick=()=>{this.state.attemptsNumber&&Object(E.e)(this.props.cages,+this.state.attemptsNumber)},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(x);var I=Object(D.a)()(x);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 N(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 i.a.Component{constructor(e){super(e),this.onExitTimeChange=e=>{this.setState({exitTime:e,changed:!0})},this.onClick=()=>{this.state.exitTime&&Object(E.h)(this.props.cages,+this.state.exitTime)},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(P);var A=Object(D.a)()(P),k=a("pxzG");function M(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,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class B extends i.a.Component{constructor(e){super(e),this.onAverageWeightChange=e=>{this.setState({averageWeight:e,changed:!0})},this.onClick=()=>{this.state.averageWeight&&Object(E.f)(this.props.cages,Object(k.i)(+this.state.averageWeight))},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(B);var V=Object(D.a)()(B),_=a("RFJ0");function L(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 W(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class K extends i.a.Component{constructor(e){super(e),this.onDefaultExitChange=e=>{this.setState({defaultExit:e,changed:!0})},this.onClick=()=>{Object(E.g)(this.props.cages,this.state.defaultExit)},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(K);var z=Object(D.a)()(K),U=a("B/gD");function q(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 H(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 i.a.Component{constructor(e){super(e),this.onTareStatusChange=e=>{this.setState({tareStatus:e,changed:!0})},this.onClick=()=>{Object(E.u)(this.props.cages,this.state.tareStatus)},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(Y);var G=Object(D.a)()(Y);function J(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 Q(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Z extends i.a.Component{constructor(e){super(e),this.onReturnToDefaultExitChange=e=>{this.setState({returnToDefaultExit:e,changed:!0})},this.onClick=()=>{Object(E.o)(this.props.cages,this.state.returnToDefaultExit)},this.state=function(e){for(var t=1;t({shadows:e.shadows.shadows}))(Z);var X=Object(D.a)()(Z);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 ee(e){for(var t=1;t{this.setState({training1:e,changed:!0})},this.onTraining2Change=e=>{this.setState({training2:e,changed:!0})},this.onTraining3Change=e=>{this.setState({training3:e,changed:!0})},this.onSeparationChange=e=>{this.setState({separation:e,changed:!0})},this.onExpeditionChange=e=>{this.setState({expedition:e,changed:!0})},this.onClick=()=>{this.state.training1&&this.state.training2&&this.state.training3&&this.state.separation&&this.state.expedition&&Object(E.x)(this.props.cages,{training1:+this.state.training1,training2:+this.state.training2,training3:+this.state.training3,separation:+this.state.separation,expedition:+this.state.expedition})},this.state=ee({},this.getWorkTypeDuration(),{changed:!1})}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(ee({},this.getWorkTypeDuration(e)))}shouldComponentUpdate(e,t,a){return!d()(this.state,t)}getWorkTypeDuration(e=this.props){let t=e.cages[0];try{let a=e.shadows.get(t.DevID);return ee({},a.configuration.workTypeDuration,{loadedDataFrom:S.i.SHADOW,SetTime:a.metadata.configuration,device:t})}catch(a){return ee({},u()(t,"Settings.Configuration.".concat(v.n.SET_WORK_TYPE_DURATION),{training1:6,training2:6,training3:6,separation:20,expedition:20}),{SetTime:u()(t,"Settings.Configuration.".concat(v.n.SET_WORK_TYPE_DURATION,".SetTime"),0),loadedDataFrom:t&&t.Settings&&t.Settings.Configuration&&t.Settings.Configuration[v.n.SET_WORK_TYPE_DURATION]?S.i.DYNAMO:S.i.NO_DATA,device:t})}}render(){const{t:e}=this.props,{training1:t,training2:a,training3:n,separation:r,expedition:o,loadedDataFrom:s,SetTime:c,device:l}=this.state;return i.a.createElement(p.b,{title:this.props.t("newSettings.cage.manage.workTypeDurations.title"),onButtonClick:this.onClick},s!==S.i.SHADOW&&i.a.createElement(i.a.Fragment,null,s===S.i.DYNAMO&&!l.Settings.Configuration[v.n.SET_WORK_TYPE_DURATION].isSet&&i.a.createElement(O.a,{boxColor:"warning"},j.a.t("newSettings.devices.settingsInfo.dynamo",{date:C()(c).format("DD.MM.YYYY HH:mm")})),s===S.i.NO_DATA&&i.a.createElement(O.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.workTypeDurations.training1"),type:"number",value:t,onChange:this.onTraining1Change}),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.workTypeDurations.training2"),type:"number",value:a,onChange:this.onTraining2Change}),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.workTypeDurations.training3"),type:"number",value:n,onChange:this.onTraining3Change}),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.workTypeDurations.separation"),type:"number",value:r,onChange:this.onSeparationChange}),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.workTypeDurations.expedition"),type:"number",value:o,onChange:this.onExpeditionChange}))}}ae.propTypes={cages:f.a.array.isRequired},ae=Object(c.connect)(e=>({shadows:e.shadows.shadows}))(ae);var ne=Object(D.a)()(ae),ie=a("uSQv"),re=a("iPVS"),oe=a("ANjH"),se=a("f0zD");function ce(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 le(e){for(var t=1;t{this.setState({SW:+e,changed:!0})},this.onSDChange=e=>{this.setState({SD:+e,changed:!0})},this.onConfigurationButtonClick=()=>{this.props.show(re.a,{})},this.onClick=()=>{this.state.SW&&this.state.SD&&Object(E.q)(this.props.cages,+this.state.SW,+this.state.SD)},this.state=le({},this.getWeightSettings(),{changed:!1})}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(le({},this.getWeightSettings(e)))}shouldComponentUpdate(e,t,a){return!d()(this.state,t)}getWeightSettings(e=this.props){let t=e.cages[0];try{let a=e.shadows.get(t.DevID);return{SD:a.configuration.scale.SD||0,SW:a.configuration.scale.SW||0}}catch(a){return le({},u()(t,"Settings.Configuration.".concat(v.n.SET_SCALE_FACTOR),{SD:0,SW:0}),{SetTime:u()(t,"Settings.Configuration.".concat(v.n.SET_SCALE_FACTOR,".SetTime"),0),loadedDataFrom:t&&t.Settings&&t.Settings.Configuration&&t.Settings.Configuration[v.n.SET_SCALE_FACTOR]?S.i.DYNAMO:S.i.NO_DATA,device:t})}}render(){const{t:e}=this.props,{SW:t,SD:a,loadedDataFrom:n,SetTime:r,device:o}=this.state;return i.a.createElement(p.b,{title:this.props.t("weightSettings"),onButtonClick:this.onClick},n!==S.i.SHADOW&&i.a.createElement(i.a.Fragment,null,n===S.i.DYNAMO&&!o.Settings.Configuration[v.n.SET_SCALE_FACTOR].isSet&&i.a.createElement(O.a,{boxColor:"warning"},j.a.t("newSettings.devices.settingsInfo.dynamo",{date:C()(r).format("DD.MM.YYYY HH:mm")})),n===S.i.NO_DATA&&i.a.createElement(O.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.weight.sw"),type:"number",value:t,onChange:this.onSWChange}),i.a.createElement(h.a,{label:this.props.t("newSettings.cage.manage.weight.sd"),type:"number",value:a,onChange:this.onSDChange}),i.a.createElement(ie.a,{onClick:this.onConfigurationButtonClick},this.props.t("newSettings.cage.manage.weight.configurator")),i.a.createElement(re.b,null))}}ue.propTypes={cages:f.a.array.isRequired},ue=Object(c.connect)(null,e=>Object(oe.b)({show:se.d},e))(ue),ue=Object(c.connect)(e=>({shadows:e.shadows.shadows}))(ue);var ge=Object(D.a)()(ue),de=a("Vv3o");function pe(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 he(e){for(var t=1;t{this.setState({bigger:e,changed:!0})},this.onAnimalsNumberChange=e=>{this.setState({animalsNumber:e,changed:!0})},this.onToSideChange=e=>{this.setState({toSide:e,changed:!0})},this.sliderTextFormatter=e=>{const{bigger:t,animalsNumber:a}=this.state;let n=1===t?this.props.t("left"):this.props.t("right"),i=1===t?this.props.t("right"):this.props.t("left");return"".concat(n,": ").concat(Math.ceil(+a/2)+e," ").concat(i,": ").concat(Math.floor(+a/2)-e)},this.onClick=()=>{const{bigger:e,animalsNumber:t,toSide:a}=this.state;let n=Math.ceil(+t/2)+a,i=Math.floor(+t/2)-a,r=1===e?{exit1:n,exit3:i}:{exit1:i,exit3:n};Object(E.n)(this.props.cages,r)},this.state=he({},this.getNumbersToExit(),{changed:!1})}UNSAFE_componentWillReceiveProps(e,t){this.state.changed||this.setState(he({},this.getNumbersToExit(e)))}shouldComponentUpdate(e,t,a){return!d()(this.state,t)}getNumbersToExit(e=this.props){let t=e.cages[0];try{let a=e.shadows.get(t.DevID).expeditionData,n=a.exit1+a.exit3,i=a.exit3>a.exit1?3:1;return{animalsNumber:n,bigger:i,toSide:Math.floor((n-i===1?a.exit1:a.exit3)/2-1)}}catch(a){try{let a=e.cages[0].Settings.Configuration[v.n.SET_NUMBERS_SEND_TO_EXITS],n=a.exit1+a.exit3,i=a.exit3>a.exit1?3:1;return{animalsNumber:n,bigger:i,toSide:Math.floor((n-i===1?a.exit1:a.exit3)/2-1),SetTime:u()(t,"Settings.Configuration.".concat(v.n.SET_NUMBERS_SEND_TO_EXITS,".SetTime"),0),loadedDataFrom:S.i.DYNAMO,device:t}}catch(a){return{bigger:1,animalsNumber:10,toSide:0,SetTime:0,loadedDataFrom:S.i.NO_DATA,device:t}}}}render(){let e=[{name:this.props.t("left"),value:1},{name:this.props.t("right"),value:3}];const{t:t}=this.props,{bigger:a,animalsNumber:n,toSide:r,loadedDataFrom:o,SetTime:s,device:c}=this.state;return i.a.createElement(p.b,{title:this.props.t("amountAnimalsToExit"),onButtonClick:this.onClick},o!==S.i.SHADOW&&i.a.createElement(i.a.Fragment,null,o===S.i.DYNAMO&&!c.Settings.Configuration[v.n.SET_EXIT_TIME].isSet&&i.a.createElement(O.a,{boxColor:"warning"},j.a.t("newSettings.devices.settingsInfo.dynamo",{date:C()(s).format("DD.MM.YYYY HH:mm")})),o===S.i.NO_DATA&&i.a.createElement(O.a,{boxColor:"error"},t("newSettings.devices.settingsInfo.noData"))),i.a.createElement(_.a,{label:this.props.t("newSettings.cage.manage.animalsNumber.bigger"),options:e,value:a,onChange:this.onBiggerChange}),i.a.createElement(h.a,{label:this.props.t("animalCount"),type:"number",value:n,onChange:this.onAnimalsNumberChange}),i.a.createElement(de.a,{label:this.props.t("newSettings.cage.manage.animalsNumber.proportion"),value:r,max:Math.floor(n/2)-1,onChange:this.onToSideChange,valueFormatter:this.sliderTextFormatter}))}}fe.propTypes={cages:f.a.array.isRequired},fe=Object(c.connect)(e=>({shadows:e.shadows.shadows}))(fe);var Ee=Object(D.a)()(fe);class ve extends i.a.Component{constructor(e){super(e),this.state={selectedCages:this.props.location.state?this.props.location.state.selectedCages:[],loading:!0},this.setLoading=()=>{this.setState({loading:!1})},0===this.state.selectedCages.length&&this.props.history.push("/".concat(this.props.farm,"/settings/cage/manage")),l.a.startSendingDeviceState(this.state.selectedCages,this.setLoading,this.setLoading)}render(){const{selectedCages:e,loading:t}=this.state;return 0===e.length?null:i.a.createElement("div",{className:"overflow-hidden",style:{position:"relative"}},i.a.createElement(r.a,{isLoading:t}),i.a.createElement(o.a,null,i.a.createElement(s.a,{xl:4},i.a.createElement(I,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(A,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(V,{cages:e}))),i.a.createElement(o.a,null,i.a.createElement(s.a,{xl:4},i.a.createElement(z,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(G,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(X,{cages:e}))),i.a.createElement(o.a,null,i.a.createElement(s.a,{xl:4},i.a.createElement(ne,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(ge,{cages:e})),i.a.createElement(s.a,{xl:4},i.a.createElement(Ee,{cages:e}))))}}ve=Object(c.connect)(e=>({farm:e.location.farm}))(ve);t.a=ve},jda2:function(e,t,a){},mndY:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("VyNe"),o=a("/MKj"),s=a("ANjH"),c=a("f0zD"),l=a("0ajJ"),m=a("Y+p1"),u=a.n(m),g=a("17x9"),d=a.n(g),p=a("9jj8"),h=a("OKc2"),b=a("IXwn"),f=a("uSQv"),E=a("55Ip"),v=a("42VQ"),S=a("lM7y"),O=a("LCzB"),y=a("XzT5"),C=a("JI6e"),D=a("3Z9Z");function j(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 w(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 i.a.Component{constructor(...e){super(...e),this.state={graftingProgram:this.props.graftingPrograms.find(e=>e.WData.AnimalKind===this.props.animalKindIndex),graftingPrograms:this.props.graftingPrograms},this.onRemoveClick=()=>{const{t:e}=this.props,{graftingProgram:t}=this.state;this.props.show(v.a,{title:e("newSettings.breeding.graftingProgram.removeTitle"),text:y.a.t("newSettings.breeding.graftingProgram.removeText",{type:t.WData.Name}),confirmText:e("yes"),onConfirmed:e=>{const{user:a}=this.props;t.remove(),this.props.dispatch(Object(S.d)(t.prepareBeanToSave(),a.ClientID,a.LocalUserID)),e.handleHide()}})}}static getDerivedStateFromProps(e,t){const{graftingPrograms:a,animalKindIndex:n}=e;if(!u()(a,t.graftingPrograms)){return{graftingProgram:a.find(e=>e.WData.AnimalKind===n),graftingPrograms:a}}return null}render(){const{animalKindText:e,farm:t,animalKindIndex:a,t:n}=this.props,{graftingProgram:r}=this.state;return i.a.createElement(p.a,{className:"mh-5rem d-flex align-items-center mh-5rem overflow-hidden position-relative pt-3 pb-3"},i.a.createElement(C.a,{xs:12},i.a.createElement(D.a,null,i.a.createElement(C.a,{xs:12,sm:r?3:9,xl:r?6:10},i.a.createElement("div",{className:"font-weight-bold"},e),i.a.createElement("div",{className:"opacity-75"},n("animalType"))),!!r&&i.a.createElement(i.a.Fragment,null,i.a.createElement(C.a,{xs:6,sm:3,xl:2,className:"d-none d-sm-block"},i.a.createElement("div",{className:"font-weight-bold"},r.WData.Name),i.a.createElement("div",{className:"opacity-75"},n("designation"))),i.a.createElement(C.a,{xs:6,sm:3,xl:2,className:"d-none d-sm-block"},i.a.createElement("div",{className:"font-weight-bold"},r.WData.MedicineList.length),i.a.createElement("div",{className:"opacity-75"},n("newSettings.breeding.graftingProgram.medicineAmount")))),i.a.createElement(C.a,{xs:12,sm:3,xl:2,className:"justify-content-end align-items-center d-flex"},i.a.createElement(b.a,{className:"m-0"},!!r&&i.a.createElement(i.a.Fragment,null,i.a.createElement(E.Link,{to:"/".concat(t,"/settings/breeding/graftingProgram/edit/").concat(r.WordID)},i.a.createElement(f.a,{buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-pen"})})),i.a.createElement(f.a,{buttonStyle:"round",buttonColor:"error",icon:i.a.createElement("i",{className:"fas fa-trash"}),onClick:this.onRemoveClick})),!r&&i.a.createElement(i.a.Fragment,null,i.a.createElement(E.Link,{to:"/".concat(t,"/settings/breeding/graftingProgram/add/").concat(a)},i.a.createElement(f.a,{buttonStyle:"round",buttonColor:"primary",icon:i.a.createElement("i",{className:"fas fa-plus"})}))))))))}}T.propTypes={animalKindIndex:d.a.number.isRequired,animalKindText:d.a.string.isRequired,graftingPrograms:d.a.arrayOf(d.a.instanceOf(h.a)),farm:d.a.string},T=Object(o.connect)(e=>({graftingPrograms:e.dictionary.graftingPrograms,farm:e.location.farm,user:e.user.user}),e=>function(e){for(var t=1;ti.a.createElement(x,{animalKindText:e,animalKindIndex:t,key:t}))))}}N=Object(o.connect)(e=>({farm:e.location.farm,graftingPrograms:e.dictionary.graftingPrograms,user:e.user.user}),e=>function(e){for(var t=1;t{const{search:e}=this.state;if(e){let t=null;const{values:{chambers:a}}=this.props;let n=a.find(t=>t.CName.includes(e)||t.RFID&&(t.RFID+"").includes(e));n&&(t=document.getElementById(n.CID));for(let i of a)if(i.Boxes){let a=i.Boxes.find(t=>t.BoxesName.includes(e)||t.RFID&&(t.RFID+"").includes(e));if(a){t=document.getElementById(a.BID);break}}if(t){let e=t.getBoundingClientRect();window.scrollTo({top:e.top-this.searchbox.current.clientHeight+window.scrollY,behavior:"smooth"})}}else window.scrollTo({top:0,behavior:"smooth"})},300),this.onSearchChange=e=>{this.setState({search:e},()=>{this.search()})}}findNextEmpty(e=this.props.values.chambers,t="chambers"){for(let a=0;ao.a.createElement("div",{key:t,id:e.CID},o.a.createElement("h4",null,e.CName),e.Boxes&&this.renderBoxes(e.Boxes,t),!e.Boxes&&o.a.createElement(h.a,{label:"RFID",type:"number",onChange:a,value:e.RFID,name:"chambers[".concat(t,"].RFID"),onBlur:i,onChangeWithEvent:!0,error:Object(d.b)(c,"chambers[".concat(t,"].RFID"))&&Object(d.b)(r,"chambers[".concat(t,"].RFID")),id:"chambers[".concat(t,"].RFID")}))),o.a.createElement(l.a,{fixed:!0,renderInPortal:!1},o.a.createElement(m.a,{icon:o.a.createElement("i",{className:"fas fa-save"}),buttonStyle:"round",buttonColor:"success"}))))}}T=Object(c.connect)(e=>({farm:e.location.farm}))(T),T=Object(d.c)({mapPropsToValues:e=>({chambers:p.a.getAllChambers(e.farm)}),displayName:"assignRFID",validate:function(e,t){const a={},{t:n,farm:i}=t;function r(t){let a=0;for(let n of e.chambers)if(n.Boxes)for(let e of n.Boxes)e.RFID===t&&a++;else n.RFID===t&&a++;return a>1}if(e.chambers){let t=!1;a.chambers=e.chambers.map(e=>{const a={};return e.Boxes?a.Boxes=e.Boxes.map(e=>{let a={};return e.RFID&&(r(e.RFID)||S.a.checkIfHaveRFID(e.RFID,i))&&(a.RFID=n("errors.duplicate"),t=!0),a}):e.RFID&&(r(e.RFID)||S.a.checkIfHaveRFID(e.RFID,i))&&(a.RFID=n("errors.duplicate"),t=!0),a}),t||delete a.chambers}return a},handleSubmit:function(e,t){const{chambers:a}=e,{farm:n,dispatch:i}=t.props;let r=p.a.getAllChambers(n);for(let o=0;oe.RFID?D({},e,{RFID:Object(O.a)(e.RFID+"")}):e):e.RFID?e.RFID=Object(O.a)(e.RFID+""):e.RFID=void 0,i(Object(y.e)(e)))}}})(T),T=Object(u.a)()(T);t.a=Object(g.a)()(T)},pCty:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("udB/"),o=a("3Z9Z"),s=a("JI6e"),c=a("/MKj"),l=a("/kok"),m=a("J2iB"),u=a.n(m),g=a("Y+p1"),d=a.n(g),p=a("Z0cm"),h=a.n(p),b=a("mwIZ"),f=a.n(b),E=a("1smR"),v=a("d/v1"),S=a("3t43"),O=a("pJVQ"),y=a("tDQA"),C=a("PbGg"),D=a("XM6k"),j=a("LCzB"),w=a("Y/op"),T=a("uSQv"),x=a("pxzG"),I=a("eASP"),F=a("w2lk"),N=a("IBmF"),P=a("zDJl"),A=a("vzZS"),k=a("0MVo"),M=a("wd/R"),R=a.n(M),B=a("lwfn"),V=a("4huo"),_=a("XoCd");class L extends n.Component{constructor(e){super(e),this.getState=(e=this.props)=>{const t={sensors:[],outputs:[],inputs:[]},{devices:a,shadows:n}=e,i=a[0],r=!!f()(i,"Settings.UseVoltage"),o=i?n.get(i.DevID):null;for(let c=0;c<8;c++)t.inputs[c]=!!f()(o,"workType.inputNegation[".concat(c,"]"),f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].inputNegation[").concat(c,"]"),0)),t.outputs[c]=!!f()(o,"workType.outputNegation[".concat(c,"]"),f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].outputNegation[").concat(c,"]"),0));t.sensorID=f()(o,"workType.sensorID",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].sensorID"),0)),t.actuatorPositioningTimeMax=f()(o,"workType.actuatorPositioningTimeMax",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].actuatorPositioningTimeMax"),0)),t.actuatorPositioningTime=f()(o,"workType.actuatorPositioningTime",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].actuatorPositioningTime"),0)),t.outputCurrentRangeReversal=!!f()(o,"workType.outputCurrentRangeReversal",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].outputCurrentRangeReversal"),0)),t.outputCurrent=[f()(o,"workType.outputMinCurrent",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].outputMinCurrent"),0)),f()(o,"workType.outputMaxCurrent",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].outputMaxCurrent"),0))],t.inputCurrent=[f()(o,"workType.inputMinCurrent",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].inputMinCurrent"),0)),f()(o,"workType.inputMaxCurrent",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].inputMaxCurrent"),0))];const s=r?this.voltageOptions:this.currentOptions;return s.find(e=>d()(e.value,t.inputCurrent))||(t.inputCurrent=null),s.find(e=>d()(e.value,t.outputCurrent))||(t.outputCurrent=null),t.SetTime=f()(o,"metaData.workType",f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"].SetTime"),0)),t.loadedDataFrom=u()(f()(o,"workType.outputMinCurrent"))?f()(i,"Settings.Configuration[".concat(N.b.SET_SENSOR_WORK_TYPE,"]"))?P.i.DYNAMO:P.i.NO_DATA:P.i.SHADOW,t},this.currentFormatter=e=>Array.isArray(e)?"".concat(Object(x.a)(e[0],{showUnit:!1,unit:I.a.SMALL,fixed:0}),"-").concat(Object(x.a)(e[1],{showUnit:!0,unit:I.a.SMALL,fixed:0})):Object(x.a)(e,{showUnit:!0,unit:I.a.SMALL,fixed:0}),this.voltageFormatter=e=>Array.isArray(e)?"".concat(Object(x.g)(e[0],{showUnit:!1,unit:I.a.SMALL,fixed:0}),"-").concat(Object(x.g)(e[1],{showUnit:!0,unit:I.a.SMALL,fixed:0})):Object(x.g)(e,{showUnit:!0,unit:I.a.SMALL,fixed:0}),this.renderInputs=({fields:e})=>{const{t:t}=this.props;return i.a.createElement(i.a.Fragment,null,i.a.createElement("label",null,t("newSettings.chainFeeding.sensorWorkType.inputNegation")),e.map((e,a)=>i.a.createElement("div",null,i.a.createElement(v.a,{name:"".concat(e),id:"".concat(e),component:F.a,label:t("newSettings.chainFeeding.sensorWorkType.input",{number:a+1})}))))},this.renderOutputs=({fields:e})=>{const{t:t}=this.props;return i.a.createElement(i.a.Fragment,null,i.a.createElement("label",null,t("newSettings.chainFeeding.sensorWorkType.outputNegation")),e.map((e,a)=>i.a.createElement("div",null,i.a.createElement(v.a,{name:"".concat(e),id:"".concat(e),component:F.a,label:t("newSettings.chainFeeding.sensorWorkType.output",{number:a+1})}))))},this.voltageOptions=[{name:this.voltageFormatter([0,1e4]),value:[0,1e4]},{name:this.voltageFormatter([2e3,1e4]),value:[2e3,1e4]}],this.currentOptions=[{name:this.currentFormatter([4,20]),value:[4,20]},{name:this.currentFormatter([5,20]),value:[5,20]}],e.initialize(this.getState())}UNSAFE_componentWillReceiveProps(e){const{devices:t,shadows:a}=e,n=t[0];(n?a.get(n.DevID):null)&&!e.dirty&&e.initialize(this.getState(e))}render(){const{t:e,submit:t,loadedDataFrom:a,SetTime:n,devices:r}=this.props,o=r[0],s=!!f()(o,"Settings.UseVoltage");return i.a.createElement(E.a,{title:e("newSettings.chainFeeding.sensorWorkType.title"),onButtonClick:t},a!==P.i.SHADOW&&i.a.createElement(i.a.Fragment,null,a===P.i.DYNAMO&&!o.Settings.Configuration[N.b.SET_SENSOR_WORK_TYPE].isSet&&i.a.createElement(A.a,{boxColor:"warning"},Object(k.d)(e("newSettings.devices.settingsInfo.dynamo"),R()(n).format("DD.MM.YYYY HH:mm"))),a===P.i.NO_DATA&&i.a.createElement(A.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),i.a.createElement(S.a,{name:"inputs",component:this.renderInputs}),i.a.createElement(S.a,{name:"outputs",component:this.renderOutputs}),i.a.createElement("label",null,e("newSettings.chainFeeding.sensorWorkType.chooseSensor")),i.a.createElement(v.a,{name:"sensorID",component:w.a},new Array(4).fill(1).map((t,a)=>i.a.createElement(T.a,{buttonStyle:"text",value:a},e("newSettings.chainFeeding.sensorWorkType.sensor",{number:a+1})))),i.a.createElement(v.a,{label:e("newSettings.chainFeeding.sensorWorkType.".concat(s?"inputVoltage":"inputCurrent")),component:V.b,options:s?this.voltageOptions:this.currentOptions,name:"inputCurrent",id:"inputCurrent"}),i.a.createElement(v.a,{label:e("newSettings.chainFeeding.sensorWorkType.".concat(s?"outputVoltage":"outputCurrent")),component:V.b,options:s?this.voltageOptions:this.currentOptions,name:"outputCurrent",id:"outputCurrent"}),i.a.createElement(v.a,{label:e("newSettings.chainFeeding.sensorWorkType.outputCurrentRangeReversal"),component:D.a,name:"outputCurrentRangeReversal",id:"outputCurrentRangeReversal"}),i.a.createElement(v.a,{label:e("newSettings.chainFeeding.sensorWorkType.actuatorPositioningTime"),component:_.a,name:"actuatorPositioningTime",id:"actuatorPositioningTime",max:3e5,step:1e3,min:0,valueFormatter:e=>"".concat(e,"ms")}),i.a.createElement(v.a,{label:e("newSettings.chainFeeding.sensorWorkType.actuatorPositioningTimeMax"),component:_.a,name:"actuatorPositioningTimeMax",id:"actuatorPositioningTimeMax",max:3e5,step:1e3,min:0,valueFormatter:e=>"".concat(e,"ms")}))}}L=Object(O.a)({form:"sensorWorkType",onSubmit:(e,t,a)=>{const{devices:n}=a,i={inputNegation:[],outputNegation:[]};i.sensorID=e.sensorID,i.outputCurrentRangeReversal=!!e.outputCurrentRangeReversal,i.actuatorPositioningTime=e.actuatorPositioningTime,i.actuatorPositioningTimeMax=e.actuatorPositioningTimeMax,i.outputMinCurrent=e.outputCurrent[0],i.outputMaxCurrent=e.outputCurrent[1],i.inputMinCurrent=e.inputCurrent[0],i.inputMaxCurrent=e.inputCurrent[1];for(let r=0;r<8;r++)i.inputNegation[r]=!!e.inputs[r],i.outputNegation[r]=!!e.outputs[r];console.log(i,n),n.forEach(e=>{Object(B.c)(e,i)})},validate:(e,t)=>{const a={},{t:n}=t,{inputCurrent:i,outputCurrent:r}=e;return h()(i)||(a.inputCurrent=n("required")),h()(r)||(a.outputCurrent=n("required")),a},initialValues:{sensors:[!1,!1,!1,!1]}})(L);const W=Object(y.a)("sensorWorkType");L=Object(c.connect)(e=>({climateCurves:e.settings.climateCurves,SetTime:W(e,"SetTime"),loadedDataFrom:W(e,"loadedDataFrom"),dirty:Object(C.a)("sensorWorkType")(e),shadows:e.shadows.shadows}))(L);var K=Object(j.a)()(L),z=a("lFKM"),U=a.n(z),q=a("a+pQ"),H=a("lAGl"),Y=a("Zayz");class G extends n.Component{constructor(e){super(e),this.getState=(e=this.props)=>{const t={schedule:[]},{devices:a,shadows:n}=e,i=a[0],r=i?n.get(i.DevID):null;for(let o=0;o<8;o++){const e=r?"analogSchedule":"Settings.Configuration[".concat(N.b.SET_SCHEDULE_ANALOG,"]"),a=r||i;t.schedule[o]={start:f()(a,"".concat(e,"[").concat(o,"].start"))?R()(f()(a,"".concat(e,"[").concat(o,"].start"))).format("HH:mm"):"",stop:f()(a,"".concat(e,"[").concat(o,"].stop"))?R()(f()(a,"".concat(e,"[").concat(o,"].stop"))).format("HH:mm"):"",time:f()(a,"".concat(e,"[").concat(o,"].workTime"))?f()(a,"".concat(e,"[").concat(o,"].workTime"),0)/6e4:""}}return t.SetTime=f()(r,"metaData.analogSchedule",f()(i,"Settings.Configuration[".concat(N.b.SET_SCHEDULE_ANALOG,"].SetTime"),0)),t.loadedDataFrom=u()(f()(r,"analogSchedule"))?f()(i,"Settings.Configuration[".concat(N.b.SET_SCHEDULE_ANALOG,"]"))?P.i.DYNAMO:P.i.NO_DATA:P.i.SHADOW,t},e.initialize(this.getState())}UNSAFE_componentWillReceiveProps(e){const{devices:t,shadows:a}=e,n=t[0];(n?a.get(n.DevID):null)&&!e.dirty&&e.initialize(this.getState(e))}render(){const{t:e,submit:t,loadedDataFrom:a,SetTime:n,devices:r}=this.props,o=r[0],s=[{name:e("newSettings.chainFeeding.scheduleAnalog.start"),field:"start",type:"time",component:H.a},{name:e("newSettings.chainFeeding.scheduleAnalog.stop"),field:"stop",type:"time",component:H.a},{name:e("newSettings.chainFeeding.scheduleAnalog.time"),field:"time",type:"number",unit:"min",component:H.a}];return i.a.createElement(E.a,{title:e("newSettings.chainFeeding.scheduleAnalog.title"),onButtonClick:t},a!==P.i.SHADOW&&i.a.createElement(i.a.Fragment,null,a===P.i.DYNAMO&&!o.Settings.Configuration[N.b.SET_SENSOR_WORK_TYPE].isSet&&i.a.createElement(A.a,{boxColor:"warning"},Object(k.d)(e("newSettings.devices.settingsInfo.dynamo"),R()(n).format("DD.MM.YYYY HH:mm"))),a===P.i.NO_DATA&&i.a.createElement(A.a,{boxColor:"error"},e("newSettings.devices.settingsInfo.noData"))),i.a.createElement(S.a,{name:"schedule",component:q.a,headers:s}))}}G=Object(O.a)({form:"scheduleAnalog",onSubmit:(e,t,a)=>{const{devices:n}=a,{schedule:i}=e,r={schedule:[]};for(let o=0;o<8;o++){i[o].time&&i[o].start&&i[o].stop&&(r.schedule[o]={},r.schedule[o].start=+R()(i[o].start,"HH:mm"),r.schedule[o].stop=+R()(i[o].stop,"HH:mm"),r.schedule[o].workTime=6e4*+i[o].time)}r.schedule=r.schedule.filter(e=>!!e),r.schedule.sort((e,t)=>e.start-t.start),console.log(r,n),n.forEach(e=>{Object(B.b)(e,r)})},validate:(e,t)=>{const a={},{schedule:n}=e,{t:i}=t;if(n){const e=n.map((e,t)=>{const a={};if(e.start&&e.stop&&e.time&&(e.time&&U()(+e.time)&&0!==+e.time||(a.time=i("required")),e.start&&e.stop)){let r=!1;n.filter((e,a)=>e.start&&e.stop&&a!==t).forEach(t=>{Object(Y.a)(Object(Y.c)(e.start),Object(Y.c)(e.stop),Object(Y.c)(t.start),Object(Y.c)(t.stop))&&(r=!0)}),r&&(a.start=i("errors.duplicate"),a.stop=i("errors.duplicate")),Object(Y.c)(e.start)>Object(Y.c)(e.stop)&&(a.start=i("errors.mustBeBelow")+i("newSettings.chainFeeding.scheduleAnalog.stop"),a.stop=i("errors.mustBeAbove")+i("newSettings.chainFeeding.scheduleAnalog.start"))}return a});a.schedule=e}return a},initialValues:{schedule:[{},{},{},{},{},{},{},{}]}})(G);const J=Object(y.a)("scheduleAnalog");G=Object(c.connect)(e=>({climateCurves:e.settings.climateCurves,SetTime:J(e,"SetTime"),loadedDataFrom:J(e,"loadedDataFrom"),dirty:Object(C.a)("scheduleAnalog")(e),shadows:e.shadows.shadows}))(G);var Q=Object(j.a)()(G);class Z extends i.a.Component{constructor(e){super(e),this.state={selectedDevices:this.props.location.state?this.props.location.state.selectedDevices:[],loading:!0},this.setLoading=()=>{this.setState({loading:!1})},0===this.state.selectedDevices.length&&this.props.history.push("/".concat(this.props.farm,"/settings/chainFeeding/manage")),l.a.startSendingDeviceState(this.state.selectedDevices,this.setLoading,this.setLoading)}render(){const{selectedDevices:e,loading:t}=this.state;return 0===e.length?null:i.a.createElement("div",{className:"overflow-hidden",style:{position:"relative"}},i.a.createElement(r.a,{isLoading:t}),i.a.createElement(o.a,null,i.a.createElement(s.a,{xl:6},i.a.createElement(K,{devices:e})),i.a.createElement(s.a,{xl:6},i.a.createElement(Q,{devices:e}))))}}Z=Object(c.connect)(e=>({farm:e.location.farm}))(Z);t.a=Z},q1ki:function(e,t,a){"use strict";var n=a("Y+p1"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("17x9"),c=a.n(s),l=a("VyNe"),m=a("3Z9Z"),u=a("JI6e"),g=a("Vv3o"),d=a("VfnB"),p=a("LCzB"),h=a("/MKj");class b extends o.a.Component{constructor(e){super(e),this.onDaysChange=e=>{this.setState({Days:e},()=>{this.onChange()})},this.onExpectedTemperatureChange=e=>{this.setState({ExpectedTemperature:e},()=>{this.onChange()})},this.onVentilationChange=e=>{e[0]>180&&(e[0]=180),this.setState({Ventilation:e},()=>{this.onChange()})},this.daysValueFormatter=e=>e+" "+this.props.t("days"),this.temperatureValueFormatter=e=>e+"\xb0C",this.rangeVentilationValueFormatter=e=>"".concat(Object(d.c)(e).toFixed(1),"%"),this.ventilationValueFormatter=e=>e[1]>190&&e[1]<=205?"".concat(Object(d.c)(e[0]).toFixed(1),"% - ").concat(Object(d.c)(e[1]).toFixed(1),"%, 1 master"):e[1]>205&&e[1]<=220?"".concat(Object(d.c)(e[0]).toFixed(1),"% - ").concat(Object(d.c)(e[1]).toFixed(1),"%, 2 mastery"):e[1]>220&&e[1]<=249?"".concat(Object(d.c)(e[0]).toFixed(1),"% - ").concat(Object(d.c)(e[1]).toFixed(1),"%, 3 mastery"):e[1]>249?"".concat(Object(d.c)(e[0]).toFixed(1),"% - ").concat(Object(d.c)(e[1]).toFixed(1),"%, 4 mastery"):"".concat(Object(d.c)(e[0]).toFixed(1),"% - ").concat(Object(d.c)(e[1]).toFixed(1),"%"),this.state={Days:e.value?e.value.Days:0,ExpectedTemperature:e.value?e.value.ExpectedTemperature:10,Ventilation:e.value?e.value.Ventilation:[0,250]}}shouldComponentUpdate(e,t,a){return!i()(this.state,t)||!i()(this.props.lang,e.lang)}onChange(){this.props.onChange(this.state,this.props.index)}render(){const{title:e,disableDaysInput:t,t:a}=this.props,{Days:n,ExpectedTemperature:i,Ventilation:r}=this.state;return o.a.createElement(l.a,null,o.a.createElement("h5",null,e),o.a.createElement(m.a,null,o.a.createElement(u.a,{md:4},o.a.createElement(g.a,{label:a("numberOfDays"),value:n,onChange:this.onDaysChange,valueFormatter:this.daysValueFormatter,disabled:t})),o.a.createElement(u.a,{md:4},o.a.createElement(g.a,{label:a("newSettings.climate.curve.expectedTemperature"),value:i,onChange:this.onExpectedTemperatureChange,valueFormatter:this.temperatureValueFormatter,min:10,max:50,step:.2})),o.a.createElement(u.a,{md:4},o.a.createElement(g.a,{label:a("newSettings.climate.curve.ventilation"),value:r,onChange:this.onVentilationChange,tipFormatter:this.rangeVentilationValueFormatter,valueFormatter:this.ventilationValueFormatter,isRange:!0,min:0,max:250}))))}}b.propTypes={title:c.a.string.isRequired,value:c.a.shape({days:c.a.number.isRequired,expectedTemperature:c.a.number.isRequired,ventilation:c.a.arrayOf(c.a.number).isRequired}).isRequired,onChange:c.a.func.isRequired,index:c.a.number.isRequired,disableDaysInput:c.a.bool},b=Object(h.connect)(e=>({lang:e.language.lang.lang}))(b);var f=Object(p.a)()(b),E=a("IXwn"),v=a("uSQv"),S=a("2UNB"),O=a("P0Qa"),y=a("gLBR"),C=a("zTlQ"),D=a("ZiuD"),j=(a("/vMg"),a("qx5e")),w=a("s506");class T extends o.a.Component{constructor(e){let t;super(e),this.onChange=(e,t)=>{let a=this.state.stages.slice(0);a[t]=e,this.setState({stages:a})},this.saveClimateCurve=()=>{if(!this.state.nameError&&this.state.name){let t=this.state.stages;if(this.state.id)try{let e=this.props.climateCurves.find(e=>e.SetID===this.state.id);e.SetData.Stages=t,e.SetData.Name=this.state.name,e.setDtaModTime(),this.props.dispatch(Object(y.c)(e.prepareBeanToSave()))}catch(e){console.error(e)}else try{let e=S.a.createSetting(O.a.CLIMATE_CURVE,{Stages:t,Name:this.state.name});this.props.dispatch(Object(y.a)(e,this.props.user.ClientID))}catch(e){console.error(e)}this.props.history.push("/".concat(this.props.farm,"/settings/climate/curves"))}else this.setState({nameError:this.props.t("required")})},this.onNameChange=e=>{e?this.setState({nameError:"",name:e}):this.setState({nameError:this.props.t("required"),name:e})};let a="",n="";try{n=e.match.params.id;let i=e.climateCurves.find(e=>e.SetID===n);t=i.SetData.Stages,a=i.SetData.Name}catch(i){console.error(i),t=[{Days:1,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]},{Days:2,ExpectedTemperature:10,Ventilation:[0,190]}]}this.state={stages:t,name:a,nameError:"",id:n}}shouldComponentUpdate(e,t,a){const{lang:n}=this.props,{name:r}=this.state;return!i()(n,e.lang)||!i()(r,t.name)}render(){const{stages:e,name:t,nameError:a}=this.state,{t:n}=this.props;return console.log("Nazwa:",t),o.a.createElement("div",null,o.a.createElement(l.a,null,o.a.createElement(C.a,{label:n("designation"),type:"text",value:t,error:a,onChange:this.onNameChange})),o.a.createElement(l.a,null,o.a.createElement(D.a,{stages:e})),o.a.createElement(f,{title:n("newSettings.climate.curve.start"),value:e[0],onChange:this.onChange,index:0,disableDaysInput:!0}),o.a.createElement(f,{title:n("newSettings.climate.curve.before"),value:e[1],onChange:this.onChange,index:1}),o.a.createElement(f,{title:n("settlement"),value:e[2],onChange:this.onChange,index:2}),o.a.createElement(f,{title:"".concat(n("newSettings.climate.curve.stage")," 1"),value:e[3],onChange:this.onChange,index:3}),o.a.createElement(f,{title:"".concat(n("newSettings.climate.curve.stage")," 2"),value:e[4],onChange:this.onChange,index:4}),o.a.createElement(f,{title:"".concat(n("newSettings.climate.curve.stage")," 3"),value:e[5],onChange:this.onChange,index:5}),o.a.createElement(f,{title:"".concat(n("newSettings.climate.curve.stage")," 4"),value:e[6],onChange:this.onChange,index:6}),o.a.createElement(f,{title:"".concat(n("newSettings.climate.curve.stage")," 5"),value:e[7],onChange:this.onChange,index:7}),o.a.createElement(E.a,{fixed:!0,renderInPortal:!1},o.a.createElement(v.a,{buttonStyle:"round",buttonColor:"success",icon:o.a.createElement("i",{className:"fas fa-save"}),onClick:this.saveClimateCurve})))}}let x=Object(h.connect)(e=>({user:e.user.user,climateCurves:e.settings.climateCurves,farm:e.location.farm,lang:e.language.lang.lang}))(T);x=Object(j.a)({roles:[w.c._DEVICE_CLIMATE,w.c._DEVICE_CONFIG],showComponent:!0})(x);t.a=Object(p.a)()(x)},qJRs:function(e,t,a){"use strict";var n=a("q1tI"),i=a.n(n),r=a("VyNe"),o=a("AAik"),s=a("zDJl"),c=a("IXwn"),l=a("uSQv"),m=a("/MKj"),u=a("qx5e"),g=a("s506"),d=a("VfnB"),p=a("55Ip"),h=a("LCzB"),b=a("tbNj"),f=a("yjtO");const E={DevType:s.d.CLIMATE_SK3};class v extends i.a.Component{constructor(e){super(e),this.onSelectionChange=e=>{this.setState({selectedClimates:e})},this.state={selectedClimates:[]}}render(){const{devices:e,t:t,farm:a}=this.props,n=Object(d.t)(t),{selectedClimates:s}=this.state;return i.a.createElement(r.a,null,i.a.createElement(o.a,{data:e,headers:n,shouldIndex:!0,mobileRow:i.a.createElement(f.a,null),selectableRow:!0,onSelectedRowsChanged:this.onSelectionChange,name:"manageClimates"}),i.a.createElement(c.a,{fixed:!0,renderInPortal:!1},i.a.createElement(p.Link,{to:{pathname:"/".concat(a,"/settings/climate-sk3/manage/configuration"),state:{selectedClimates:s}},disabled:0===s.length},i.a.createElement(l.a,{buttonColor:"success",buttonStyle:"round",icon:i.a.createElement("i",{className:"fas fa-arrow-right"}),disabled:0===s.length}))))}}let S=Object(m.connect)((function(){const e=Object(b.c)();return function(t){return{farm:t.location.farm,devices:e(t,E)}}}))(v);S=Object(u.a)({roles:[g.c._SERVICE],showComponent:!0})(S),t.a=Object(h.a)()(S)},rZug:function(e,t,a){"use strict";var n=a("J2iB"),i=a.n(n),r=a("mwIZ"),o=a.n(r),s=a("q1tI"),c=a.n(s),l=a("d/v1"),m=a("pJVQ"),u=a("tDQA"),g=a("4huo"),d=a("/MKj"),p=a("zDJl"),h=a("VfnB"),b=a("rAw4"),f=a("VyNe"),E=a("BbMY"),v=a("erjJ"),S=a("y6dH"),O=a("j2z9"),y=a("IXwn"),C=a("uSQv"),D=a("XwVs"),j=(a("OcbF"),a("Y+p1")),w=a.n(j),T=a("vzZS"),x=a("MeEv"),I=a.n(x),F=a("y4iu");var N=a("qzmO"),P=a("r3a2"),A=a("pxzG"),k=a("26mJ"),M=a("eASP"),R=a("LCzB");class B extends c.a.Component{constructor(e){super(e),this.start=e=>{if(e){const{DevID:t,Adr:a}=e;i()(a)?Object(N.D)(t,{time:6e4},()=>this.setState({started:!0,message:""})):Object(P.k)(t,[{time:6e4,number:a+1}],()=>this.setState({started:!0,message:""}))}},this.stop=e=>{if(e){const{DevID:t,Adr:a}=e;i()(a)?Object(N.G)(t,()=>this.setState({started:!1,message:""})):Object(P.l)(t,[a+1],()=>this.setState({started:!1,message:""}))}},this.state={started:!1}}UNSAFE_componentWillReceiveProps(e,t){const{device:a}=this.props,{started:n}=this.state;w()(a,e.device)||n&&this.stop(a)}render(){const{started:e,message:t}=this.state,{device:a,handleSubmit:n,t:i}=this.props;return c.a.createElement("div",null,e&&c.a.createElement(T.a,{boxColor:"info"},c.a.createElement(I.a,{backward:!0,seconds:60,showHours:!1,showMinutes:!1,endLabel:"s",callback:()=>this.setState({started:!1,message:i("newSettings.feeding.forages.calibration.calibrationMessage")})})),!e&&!!t&&c.a.createElement(T.a,{boxColor:"success"},t),c.a.createElement(F.a,{handleSubmit:n,icon:c.a.createElement("i",{className:"fas fa-arrow-right"})},c.a.createElement(l.a,{label:i("newSettings.feeding.forages.calibration.firstForageWeight"),name:"firstWeight",id:"firstWeight",unit:Object(A.l)("weight",M.a.SMALL),type:"number",component:k.a}),c.a.createElement(l.a,{label:i("newSettings.feeding.forages.calibration.secondForageWeight"),name:"secondWeight",id:"secondWeight",unit:Object(A.l)("weight",M.a.SMALL),type:"number",component:k.a})),c.a.createElement("hr",null),c.a.createElement(C.a,{className:"w-100",type:"button",onClick:()=>e?this.stop(a):this.start(a)},e&&i("disableDispenser")," ",!e&&i("newSettings.feeding.forages.calibration.startDispenser")))}}B=Object(m.a)({form:"settings-feeding-dispenser-calibration",onSubmit:function(e,t,a){const{firstWeight:n,secondWeight:i}=e,r=(+n+ +i)/2;a.onNextClick({weights:e,efficiency:r})},validate:function(e,t){const a={},{t:n}=t,i=e=>e>2550||e<30;return e.firstWeight?i(+e.firstWeight)&&(a.firstWeight=n("errors.mustBeInRange",{start:30,end:2550})):a.firstWeight=n("required"),e.secondWeight?i(+e.firstWeight)&&(a.secondWeight=n("errors.mustBeInRange",{start:30,end:2550})):a.secondWeight=n("required"),a},destroyOnUnmount:!0,forceUnregisterOnUnmount:!0})(B);var V=Object(R.a)()(B),_=a("3Z9Z"),L=a("JI6e"),W=a("Ty5D"),K=a("e/I0"),z=a("kCVf"),U=a("lFKM"),q=a.n(U),H=a("I8zd"),Y=a("LDPH");const G="settings-feeding-calibration-destination",J=Object(u.a)(G);class Q extends s.Component{constructor(e){super(e),this.onChange=(e="device")=>{const{change:t}=this.props;t("type",e)};const{initialize:t}=this.props;t({type:"device",actions:Q.allowedActions(this.props)})}render(){const{device:e,type:t,actions:a={},handleSubmit:n,submitting:i,buildingsMap:r,t:o}=this.props;return c.a.createElement("form",{onSubmit:n},o("newSettings.feeding.forages.calibration.chooseDestination"),c.a.createElement(_.a,null,!!a.device&&c.a.createElement(L.a,{className:"pointer",md:6,onClick:()=>this.onChange("device")},c.a.createElement(f.a,{shadow:!1,className:"h-100",selected:"device"===t},c.a.createElement("h5",null," ",o("newSettings.feeding.forages.calibration.setOnDevice")),c.a.createElement("div",{className:"opacity-50 text-wrap"},e.name))),!!a.chamber&&c.a.createElement(L.a,{className:"pointer",md:6,onClick:()=>this.onChange("chamber")},c.a.createElement(f.a,{shadow:!1,className:"h-100",selected:"chamber"===t},c.a.createElement("h5",null," ",o("newSettings.feeding.forages.calibration.setOnChamber")),c.a.createElement("div",{className:"opacity-50 text-wrap"},Object(z.l)(r,a.chamber))))),c.a.createElement(y.a,{fixed:!0,renderInPortal:!1},c.a.createElement(C.a,{isLoading:i,buttonStyle:"round",buttonColor:"success",icon:c.a.createElement("i",{className:"fas fa-plus"})})))}}Q.allowedActions=e=>{const t={device:!1,chamber:!1,silo:!1},{devices:a,buildingsMap:n,device:i}=e;a.find(e=>e.DevID===i.DevID)&&(t.device=q()(i.Adr)?"".concat(i.DevID,"_").concat(i.Adr):"".concat(i.DevID)),t.silo=!1;let r=n.get(i.placementId);if(r)if(r.level===H.a.CHAMBER)t.chamber=i.placementId;else if(r.level===H.a.BOX){const e=r.parentId;r=n.get(e),r&&(t.chamber=e)}return t};Q=Object(m.a)({form:G,onSubmit:(e,t,a)=>{const{data:n,history:i,farm:r}=a,{type:o,actions:s}=e,c={Efficiency:+n.efficiency};return c[{device:"DevIDs",silo:"SiloIDs",chamber:"PlcmntIDs"}[o]]=[s[o]].filter(e=>!!e),Object(Y.a)(c).then(e=>{Object(Y.c)(e),i.push("/".concat(r,"/settings"))}).catch(e=>{Object(Y.b)(e)})},destroyOnUnmount:!0,forceUnregisterOnUnmount:!0})(Q),Q=Object(d.connect)((function(e){return{farm:e.location.farm,devices:e.farmDevices.devices,type:J(e,"type"),actions:J(e,"actions"),buildingsMap:Object(K.a)(e),siloses:[]}}))(Q),Q=Object(W.o)(Q);var Z=Object(R.a)()(Q);const X="settings-feeding-calibration-manage";class $ extends c.a.Component{constructor(e){super(e),this.getLocationSelect=e=>{const{devices:t,buildingsMap:a}=e,n=[];for(let r of Object(h.m)(t||[]))if([p.d.DISPENSER,p.d.DISPENSER_NRF].includes(r.device.DevType)){const e=o()(r,"index"),t=Object(z.m)({device:r.device,index:e});if(1!==t.length||!Object(z.l)(a,t[0]))continue;const s=o()(r,"device.Address"),c=i()(e)?s.toString(16):"".concat(s.toString(16)," {").concat(e,"}"),l="".concat(Object(z.l)(a,t[0])," | 0x").concat(c),m={name:l,value:{DevID:r.device.DevID,Adr:r.index,placementId:t[0],name:l}};n.push(m)}return n},this.onStepClick=e=>{6!==this.state.activeStep&&this.setState({activeStep:e})},this.onNext=()=>{const{activeStep:e}=this.state;this.setState({activeStep:e+1})},this.onBack=()=>{const{activeStep:e}=this.state;this.setState({activeStep:e-1})},this.onNextEfficiencyData=e=>{this.setState(t=>({activeStep:t.activeStep+1,efficiencyData:e}),()=>{this.props.history.push("/".concat(this.props.farm,"/settings/feeding/calibration/summary"))})},this.state={activeStep:1,locationOptions:[],efficiencyData:void 0}}componentDidMount(){this.setState({locationOptions:this.getLocationSelect(this.props)})}componentDidUpdate(e,t,a){const n=e.devices.length!==this.props.devices.length,i=e.buildingsMap.size!==this.props.buildingsMap.size;(n||i)&&this.setState({locationOptions:this.getLocationSelect(this.props)})}getLocationID(e){return e.CID||e.SID||e.BID||e.BgID||e.FarmID}render(){const{dispenser:e,gateways:t,t:a}=this.props,{locationOptions:n,activeStep:i}=this.state;return c.a.createElement("div",null,c.a.createElement(f.a,null,c.a.createElement(E.a,{activeStep:i,onClickStep:this.onStepClick},c.a.createElement(v.a,{label:a("newSettings.feeding.forages.calibration.firstStep")}),c.a.createElement(v.a,{label:a("newSettings.feeding.forages.calibration.secondStep")}),c.a.createElement(v.a,{label:a("newSettings.feeding.forages.calibration.thirdStep")}),c.a.createElement(v.a,{label:a("calibration")}),c.a.createElement(v.a,{label:a("summary")})),1===i&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"calibration"},c.a.createElement("div",{className:"calibration-container"},c.a.createElement(S.a,{src:O.a})),c.a.createElement("p",null,a("newSettings.feeding.forages.calibration.firstStepMessage")),c.a.createElement(y.a,{fixed:!0},c.a.createElement(C.a,{buttonColor:"success",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-right"}),onClick:this.onNext})))),2===i&&c.a.createElement(c.a.Fragment,null,c.a.createElement(_.a,{className:"justify-content-center"},c.a.createElement(L.a,{md:6},c.a.createElement(b.a,{device:e,onNextClick:this.onNext},c.a.createElement(l.a,{name:"dispenser",id:"dispenser",label:a("location"),options:n,component:g.b})),c.a.createElement("p",null,a("newSettings.feeding.forages.calibration.fiveSeconds")))),c.a.createElement(y.a,{fixed:!0},c.a.createElement(C.a,{buttonColor:"success",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-left"}),onClick:this.onBack}),c.a.createElement(C.a,{disabled:!e,buttonColor:"success",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-right"}),onClick:this.onNext}))),3===i&&c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:"calibration"},c.a.createElement("div",{className:"calibration-container"},c.a.createElement(S.a,{src:D.a})),c.a.createElement("p",null,a("newSettings.feeding.forages.calibration.thirdStepMessage")),c.a.createElement(y.a,{fixed:!0},c.a.createElement(C.a,{buttonColor:"success",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-left"}),onClick:this.onBack}),c.a.createElement(C.a,{buttonColor:"success",buttonStyle:"round",icon:c.a.createElement("i",{className:"fas fa-arrow-right"}),onClick:this.onNext})))),4===i&&c.a.createElement(c.a.Fragment,null,c.a.createElement(_.a,{className:"justify-content-center"},c.a.createElement(L.a,{md:6},c.a.createElement(V,{device:e,onNextClick:this.onNextEfficiencyData}),c.a.createElement("p",null,a("newSettings.feeding.forages.calibration.sixtySeconds"))))),this.state.efficiencyData&&5===i&&c.a.createElement(c.a.Fragment,null,c.a.createElement(W.d,{path:"/".concat(this.props.farm,"/settings/feeding/calibration/summary"),render:()=>c.a.createElement(Z,{device:e,gateways:t,data:this.state.efficiencyData})}))))}}$=Object(m.a)({form:X,destroyOnUnmount:!0,forceUnregisterOnUnmount:!0})($);const ee=Object(u.a)(X);$=Object(d.connect)(e=>({devices:e.farmDevices.devices,dispenser:ee(e,"dispenser"),forages:e.settings.forage,buildingsMap:Object(K.a)(e),farm:e.location.farm}))($),$=Object(W.o)($);t.a=Object(R.a)()($)},slNt:function(e,t,a){"use strict";var n=a("P/G1"),i=a.n(n),r=a("q1tI"),o=a.n(r),s=a("udB/"),c=a("/MKj"),l=a("/kok"),m=a("J2iB"),u=a.n(m),g=a("1smR"),d=a("d/v1"),p=a("HIda"),h=a("pJVQ"),b=a("XoCd"),f=a("VfnB"),E=a("3Z9Z"),v=a("JI6e"),S=a("BkRI"),O=a.n(S),y=a("Yh51");var C=a("LCzB"),D=a("pxzG"),j=a("eASP");class w extends o.a.Component{constructor(e){super(e),this.onClick=()=>{this.props.submit()},this.props.initialize({requestedAirTemperature:10,requestedTemperatureDeviation:0,bandWidth:1,ventilationConfiguration:{minimumVentilation:0,maximumVentilation:0,ventilationSuspension:0,minimumVentilationDeviation:0,maximumVentilationDeviation:0},floors:[0,0,0],maximumHoldFor20Percent:10,manual:0,alarms:{minimumTemperatureAlarmDeviation:.2,maximumTemperatureAlarmDeviation:2,outsideAlarmDeviation:.2,absoluteAlarm:10},additionalHeatingVentilation:10,heatingDeviation:10,heatingWorkTime:10,heatingBreakTime:10,coolingConfiguration:{coolingEnableTemperature:0,coolingWorkTime:30,coolingBreakTime:30,coolingMaximumHumidity:0,coolingMinimumPressure:0,coolingMaximumPressure:0}})}render(){const{t:e}=this.props,t=e=>Object(D.f)(e,{fixed:1,unit:j.a.SMALL,acceptNil:!0}),a=e=>u()(e)?"-%":"".concat(Object(f.c)(e).toFixed(1),"%");return o.a.createElement(g.b,{title:"Konfiguracja og\xf3lna",onButtonClick:this.onClick},o.a.createElement(E.a,null,o.a.createElement(v.a,{md:6},o.a.createElement("h5",null,"Temperatura"),o.a.createElement(d.a,{name:"requestedAirTemperature",component:b.a,label:e("settings.desiredTemp"),min:10,max:50,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"requestedTemperatureDeviation",component:b.a,label:e("settings.desiredTempDeviation"),min:-10,max:10,step:.2,valueFormatter:t}),o.a.createElement("hr",null),o.a.createElement("h5",null,"Wentylacja"),o.a.createElement(d.a,{name:"bandWidth",component:b.a,label:e("settings.bandwithVenting"),min:1,max:10,step:.2,valueFormatter:t}),o.a.createElement(p.a,{name:"ventilationConfiguration"},o.a.createElement(d.a,{name:"minimumVentilation",component:b.a,label:e("settings.minVenting"),min:0,max:180,valueFormatter:a}),o.a.createElement(d.a,{name:"maximumVentilation",component:b.a,label:e("settings.maxVenting"),min:0,max:190,valueFormatter:a}),o.a.createElement(d.a,{name:"ventilationSuspension",component:b.a,label:e("settings.stopVenting"),min:0,max:30,step:10,valueFormatter:e=>!u()(e)&&e?"".concat(e," s"):""}),o.a.createElement(d.a,{name:"minimumVentilationDeviation",component:b.a,label:e("settings.minVentingDeviation"),min:0,max:100,valueFormatter:e=>!u()(e)&&e?"".concat(Object(f.c)(e).toFixed(1),"%"):""}),o.a.createElement(d.a,{name:"maximumVentilationDeviation",component:b.a,label:e("settings.maxVentingDeviation"),min:0,max:100,valueFormatter:e=>!u()(e)&&e?"".concat(Object(f.c)(e).toFixed(1),"%"):""})),o.a.createElement("hr",null),o.a.createElement("h5",null,"Pod\u0142ogi"),o.a.createElement(d.a,{name:"floors[0]",component:b.a,label:e("settings.floor")+"1",min:0,max:50,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"floors[1]",component:b.a,label:e("settings.floor")+"2",min:0,max:50,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"floors[2]",component:b.a,label:e("settings.floor")+"3",min:0,max:50,step:.2,valueFormatter:t}),o.a.createElement("hr",null),o.a.createElement("h5",null,"Inne"),o.a.createElement(d.a,{name:"maximumHoldFor20Percent",component:b.a,label:e("settings.holdFor20Percent"),min:10,max:50,step:10,valueFormatter:t}),o.a.createElement(d.a,{name:"manual",component:b.a,label:e("settings.manualOperation"),min:0,max:100,step:.4,valueFormatter:e=>!u()(e)&&e?"".concat(e.toFixed(1),"%"):""})),o.a.createElement(v.a,{md:6},o.a.createElement(p.a,{name:"alarms"},o.a.createElement("h5",null,"Alarmy"),o.a.createElement(d.a,{name:"minimumTemperatureAlarmDeviation",component:b.a,label:e("settings.minTempAlarmDeviation"),min:.2,max:4,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"maximumTemperatureAlarmDeviation",component:b.a,label:e("settings.maxTempAlarmDeviation"),min:2,max:20,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"outsideAlarmDeviation",component:b.a,label:e("settings.alarmDeviationFromTemp"),min:.2,max:2,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"absoluteAlarm",component:b.a,label:e("settings.absoluteAlarm"),min:10,max:50,valueFormatter:t})),o.a.createElement("hr",null),o.a.createElement("h5",null,"Ogrzewanie"),o.a.createElement(d.a,{name:"additionalHeatingVentilation",component:b.a,label:"Wentylacja nagrzewnicy",min:10,max:50,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"heatingDeviation",component:b.a,label:e("settings.heatingDeviation"),min:.2,max:6,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"heatingWorkTime",component:b.a,label:e("settings.heaterOpTime"),min:10,max:50,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"heatingBreakTime",component:b.a,label:e("settings.heaterBreakTime"),min:10,max:50,step:.2,valueFormatter:t}),o.a.createElement(p.a,{name:"coolingConfiguration"},o.a.createElement("hr",null),o.a.createElement("h5",null,"Ch\u0142odzenie"),o.a.createElement(d.a,{name:"coolingEnableTemperature",component:b.a,label:e("settings.switchOnTemp"),min:0,max:50.6,step:.2,valueFormatter:t}),o.a.createElement(d.a,{name:"coolingWorkTime",component:b.a,label:e("settings.operatingTime"),min:30,max:600,step:10,valueFormatter:e=>!u()(e)&&e?"".concat(e," s"):""}),o.a.createElement(d.a,{name:"coolingBreakTime",component:b.a,label:e("settings.breakTime"),min:30,max:600,step:10,valueFormatter:e=>!u()(e)&&e?"".concat(e," s"):""}),o.a.createElement(d.a,{name:"coolingMaximumHumidity",component:b.a,label:e("settings.maxHumidity"),min:0,max:100,valueFormatter:e=>!u()(e)&&e?"".concat(e,"%"):""}),o.a.createElement(d.a,{name:"coolingMinimumPressure",component:b.a,label:e("settings.minPressure"),min:0,max:80,valueFormatter:e=>!u()(e)&&e?"".concat(e," atm"):""}),o.a.createElement(d.a,{name:"coolingMaximumPressure",component:b.a,label:e("settings.maxPressuer"),min:0,max:80,valueFormatter:e=>!u()(e)&&e?"".concat(e," atm"):""})))))}}w=Object(h.a)({form:"climateConfiguration",onSubmit:function(e,t,a){let n=O()(e);n.requestedTemperatureDeviation+=10,Object(y.c)(a.climates,n)}})(w);var T=w=Object(C.a)()(w),x=a("tDQA"),I=a("XM6k"),F=a("4huo"),N=a("26mJ"),P=a("wd/R"),A=a.n(P);var k=a("ZiuD");function M(){return(M=Object.assign||function(e){for(var t=1;t{this.props.submit()}}render(){const{curveActive:e,climateCurves:t,curve:a}=this.props;return o.a.createElement(g.b,{title:"Menu zegara",onButtonClick:this.onButtonClick},o.a.createElement(d.a,{name:"curveActive",component:I.a,label:this.props.t("modals.climateCurve.curveActive")}),e&&o.a.createElement(o.a.Fragment,null,o.a.createElement(d.a,{name:"curve",component:F.b,label:this.props.t("settings.curvesSettings"),options:t.map(e=>({name:e.SetData.Name,value:e}))}),a&&o.a.createElement(o.a.Fragment,null,o.a.createElement(k.a,{stages:a.SetData.Stages}),o.a.createElement(d.a,M({name:"currentCurveDay",component:b.a},a.getMinAndMax(),{label:this.props.t("curveDay"),valueFormatter:e=>void 0!==e?e:null})))),o.a.createElement(d.a,{name:"recorderEraseTime",component:N.a,type:"time",label:this.props.t("modals.climateCurve.recorderEraseHour")}))}}R=Object(h.a)({form:"clockMenu",onSubmit:function(e,t,a){const{curveActive:n,recorderEraseTime:i,currentCurveDay:r=1,curve:o}=e;let s=i.split(":")[0],c=i.split(":")[1],l=A()(0).hour(+s).minute(+c).startOf("minute").toDate().getTime();const{climates:m}=a;if(n){let e=r+Math.abs(o.getMinAndMax().min)+1,t=o.getBackendStages();Object(y.b)(m,{currentCurveDay:e,stages:t,recorderEraseTime:l})}else Object(y.b)(m,{currentCurveDay:0,recorderEraseTime:l})},validate:function(e,t){const a={},{t:n}=t;return e.recorderEraseTime||(a.recorderEraseTime=n("required")),e.curve||(a.curve=n("required")),a}})(R);const B=Object(x.a)("clockMenu");R=Object(c.connect)(e=>({climateCurves:e.settings.climateCurves,curveActive:B(e,"curveActive"),curve:B(e,"curve")}))(R);var V=Object(C.a)()(R);class _ extends o.a.Component{constructor(e){super(e),this.createAnalogCurve=()=>{const{t:e}=this.props;let t=[];const a=["0% 0M","2% 0M","5% 0M","10% 0M","15% 0M","20% 0M","25% 0M","35% 0M","45% 0M","70% 0M","100% 0M","100% 1M","100% 2M","100% 3M","100% 4M"];for(let n=0;n<15;n++)t.push(o.a.createElement(d.a,{name:"firstAnalogOutputCurve[".concat(n,"]"),component:b.a,label:e("settings.pointX",{number:"".concat(n+1," ").concat(a[n])}),min:0,max:12,step:.1,valueFormatter:e=>u()(e)?"":"".concat((+e).toFixed(1),"V")}));return t},this.onButtonClick=()=>{this.props.submit()},this.state={maxHeaters:0,maxMasters:0,maxCooling:!1,maxFloorHeating:0},this.props.initialize({chimneyVentilatorsCount:1,heatersCount:0,mastersCount:0,cooling:!1,floorHeating:0,language:0,ventilationIntensity:0,ventilationCycleTime:30,temperatureSensorsCalibration:[0,0,0,0,0],rotation55PercentCalibration:0,minimumRotation:1,objectDynamics:3,analogOutputs:{firstAnalogOutputCurve:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],additionalAnalogOutputs:[{analogOutputNumber:2,minimumVoltage:0,maximumVoltage:0},{analogOutputNumber:3,minimumVoltage:0,maximumVoltage:0},{analogOutputNumber:4,minimumVoltage:0,maximumVoltage:0},{analogOutputNumber:5,minimumVoltage:0,maximumVoltage:0},{analogOutputNumber:6,minimumVoltage:0,maximumVoltage:0}]},memoryLock:3,heatingType:2})}createTemperatureCalibration(){const{t:e}=this.props;let t=[];for(let a=0;a<5;a++)t.push(o.a.createElement(d.a,{name:"temperatureSensorsCalibration[".concat(a,"]"),component:b.a,label:"".concat(e("settings.tempSensor")," ").concat(a+1),min:-25,max:25,step:.2,valueFormatter:e=>u()(e)?"":"".concat((+e).toFixed(1),"%")}));return t}createAdditionalAnalogOutputs(){const{t:e}=this.props;let t=[];for(let a=0;a<5;a++)t.push(o.a.createElement(d.a,{name:"additionalAnalogOutputs[".concat(a,"].minimumVoltage"),component:b.a,label:"".concat(e("settings.minVoltage")," ").concat(a+2," ").concat(e("settings.analOut")),valueFormatter:e=>u()(e)?"":"".concat((+e).toFixed(1),"V")})),t.push(o.a.createElement(d.a,{name:"additionalAnalogOutputs[".concat(a,"].maximumVoltage"),component:b.a,label:"Max. napi\u0119cie ".concat(a+2," wyj\u015bcia analogowego"),valueFormatter:e=>u()(e)?"":"".concat((+e).toFixed(1),"V")}));return t}UNSAFE_componentWillReceiveProps(e,t){let a,n=e.chimneyVentilatorsCount-1,i=0;n=n>3?3:n,i=e.channelsExtensionsInstalled?12-n:4-n,a=i,i>3&&(i=3);let r=i;i=a-e.heatersCount,a=i,i>4&&(i=4);let o=i;i=a-e.mastersCount,a=i,i>1&&(i=1);let s=1===i;i=a-(e.cooling?1:0),i+=1,i>3&&(i=3);let c=i;this.setState({maxHeaters:r,maxMasters:o,maxCooling:s,maxFloorHeating:c}),s||e.cooling===s||this.props.change("cooling",!1)}render(){const{heatingType:e,t:t}=this.props,{maxHeaters:a,maxMasters:n,maxFloorHeating:i,maxCooling:r}=this.state;return o.a.createElement(g.b,{title:"Ustawienia serwisowe",onButtonClick:this.onButtonClick},o.a.createElement("h5",null,t("settings.generalInstalationSet")),o.a.createElement(d.a,{name:"language",component:F.b,label:t("settings.language"),options:[{name:"polski",value:0},{name:"\u0440\u0443\u0441\u0441\u043a\u0438\u0439",value:1}]}),o.a.createElement(d.a,{name:"chimneyVentilatorsCount",component:b.a,label:t("settings.chimneyFansAmount"),min:1,max:8,valueFormatter:e=>u()(e)?"":e}),o.a.createElement(d.a,{name:"heatersCount",component:b.a,label:t("settings.heatersAmount"),min:0,max:a,valueFormatter:e=>u()(e)?"":e}),o.a.createElement(d.a,{name:"mastersCount",component:b.a,label:t("settings.mastersAmount"),min:0,max:n,valueFormatter:e=>u()(e)?"":e}),o.a.createElement(d.a,{name:"cooling",id:"cooling",component:I.a,label:t("settings.cooling"),disabled:!r}),o.a.createElement(d.a,{name:"heatingType",component:F.b,label:t("settings.heatingType"),options:[{name:t("settings.floorType"),value:1},{name:t("settings.waterType"),value:2}]}),1===e&&o.a.createElement(d.a,{name:"floorHeating",component:b.a,label:t("settings.floorHeatingCircuitsAmount"),min:0,max:i,valueFormatter:e=>u()(e)?"":e}),o.a.createElement(d.a,{name:"objectDynamics",component:b.a,label:t("settings.objectDynamics"),min:3,max:60,step:.5,valueFormatter:e=>e?e+" min":""}),o.a.createElement("hr",null),o.a.createElement("h5",null,t("settings.venting")),o.a.createElement(d.a,{name:"ventilationIntensity",component:b.a,label:t("settings.ventilationIntensity"),min:0,max:100,valueFormatter:e=>u()(e)?"":"".concat(Object(f.c)(e),"%")}),o.a.createElement(d.a,{name:"ventilationCycleTime",component:b.a,label:t("settings.ventilationCycleTime"),min:30,max:600,valueFormatter:e=>e?e+" s":""}),o.a.createElement(d.a,{name:"minimumRotation",component:b.a,label:t("settings.minRotations"),min:1,max:100,valueFormatter:e=>e?e+"%":""}),o.a.createElement("hr",null),o.a.createElement("h5",null,t("calibration")),o.a.createElement(d.a,{name:"rotation55PercentCalibration",component:b.a,label:t("settings.calibration55"),min:-30,max:40,valueFormatter:e=>u()(e)?"":e+"%"}),this.createTemperatureCalibration(),o.a.createElement(p.a,{name:"analogOutputs"},o.a.createElement("hr",null),o.a.createElement("h5",null,t("settings.firstAnalOutCurve")),this.createAnalogCurve(),o.a.createElement("hr",null),o.a.createElement("h5",null,t("settings.analOuts")),this.createAdditionalAnalogOutputs()))}}_=Object(h.a)({form:"service",onSubmit:function(e,t,a){const{climates:n}=a;Object(y.d)(n,e)}})(_);const L=Object(x.a)("service"),W=Object(c.connect)(e=>({chimneyVentilatorsCount:L(e,"chimneyVentilatorsCount"),heatersCount:L(e,"heatersCount"),mastersCount:L(e,"mastersCount"),channelsExtensionsInstalled:L(e,"channelsExtensionsInstalled"),cooling:L(e,"cooling"),heatingType:L(e,"heatingType")}))(_);var K=_=Object(C.a)()(W),z=a("IBmF"),U=a("wQmL"),q=a("BvFm");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 Y(e){for(var t=1;t{let t=null;try{t=i()(e.CAnsw)[0],this.props.dispatch(Object(U.c)("climateConfiguration",Y({},t.configuration,{requestedTemperatureDeviation:t.configuration.requestedTemperatureDeviation-10}))),this.props.dispatch(Object(U.c)("clockMenu",Y({},t.climateCurve,{curveActive:0!==t.climateCurve.currentCurveDay,recorderEraseTime:A()(t.climateCurve.recorderEraseTime).format("HH:mm")}))),this.props.dispatch(Object(U.c)("service",Y({},t.service,{channelsExtensionsInstalled:t.ambientConditions.channelsExtensionsInstalled,heatingType:4===t.service.floorHeating?2:1})))}catch(a){console.error(a)}this.setState({loading:!1})},this.onFailure=()=>{let e=this.state.selectedClimates[0];try{if(e.Settings.Configuration&&e.Settings.Configuration[z.d.SET_CONFIGURATION]){let t=e.Settings.Configuration[z.d.SET_CONFIGURATION].requestedTemperatureDeviation;this.props.dispatch(Object(U.c)("climateConfiguration",Y({},e.Settings.Configuration[z.d.SET_CONFIGURATION],{requestedTemperatureDeviation:t?t-10:0})))}e.Settings.Configuration&&e.Settings.Configuration[z.d.SET_CLOCK_MENU]&&this.props.dispatch(Object(U.c)("clockMenu",Y({},e.Settings.Configuration[z.d.SET_CLOCK_MENU],{curveActive:0!==e.Settings.Configuration[z.d.SET_CLOCK_MENU].currentCurveDay,recorderEraseTime:A()(e.Settings.Configuration[z.d.SET_CLOCK_MENU].recorderEraseTime).format("HH:mm")}))),e.Settings.Configuration&&e.Settings.Configuration[z.d.SET_SERVICE_MENU]&&this.props.dispatch(Object(U.c)("service",Y({},e.Settings.Configuration[z.d.SET_SERVICE_MENU],{channelsExtensionsInstalled:e.Settings.Configuration[z.d.SET_SERVICE_MENU].channelsExtensionsInstalled,heatingType:4===e.Settings.Configuration[z.d.SET_SERVICE_MENU].floorHeating?2:1})))}catch(t){console.error(t)}this.setState({loading:!1})},0===this.state.selectedClimates.length&&this.props.history.push("/".concat(this.props.farm,"/settings/climate/manage")),l.a.startSendingDeviceState(this.state.selectedClimates,this.setLoading,this.onFailure)}render(){const{selectedClimates:e,loading:t}=this.state;if(0===e.length)return null;const a=Object(q.i)();return o.a.createElement("div",{style:{position:"relative"}},o.a.createElement(s.a,{isLoading:t}),o.a.createElement(T,{climates:e}),o.a.createElement(V,{climates:e}),a&&o.a.createElement(K,{climates:e}))}}J=Object(c.connect)(e=>({farm:e.location.farm}))(J);t.a=J},"uw8+":function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"f",(function(){return g})),a.d(t,"e",(function(){return d})),a.d(t,"b",(function(){return p})),a.d(t,"c",(function(){return h})),a.d(t,"d",(function(){return b})),a.d(t,"g",(function(){return f}));var n=a("D1y2"),i=a.n(n),r=a("J2iB"),o=a.n(r),s=a("mwIZ"),c=a.n(s),l=a("pxzG"),m=a("eASP");const u=({initialize:e,shadow:t,model:a})=>{const n={};a.forEach(e=>{var a;i()(n,e.key,(a=e,c()(t,a.shadowKey,o()(a.defaultValue)?a.min:a.defaultValue)))}),e(n)},g=e=>Object(l.f)(e,{showUnit:!0,unit:m.a.SMALL,fixed:1}),d=e=>"".concat(((e||0)/1e3).toFixed(1),"s"),p=e=>"".concat(((e||0)/6e4).toFixed(1),"min"),h=e=>"".concat(e,"%"),b=e=>Object(l.e)(e,{showUnit:!0,fixed:2}),f=e=>Object(l.g)(e,{showUnit:!0,fixed:1,unit:m.a.MEDIUM})},xz4w:function(e,t,a){}}]); //# sourceMappingURL=main~d356962d.48229e49.chunk.js.map