(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[68],{"+V8T":function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var n=a("J2iB"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("pJVQ"),c=a("/MKj"),l=a("lVFi"),m=a("zM5D"),d=a("UGc4"),u=a("0pzG"),p=a("gu+X"),h=a("f0zD"),g=a("17x9"),b=a.n(g),f=a("uSQv"),D=a("ANjH"),v=a("42VQ"),O=a("0b+E"),E=a("krkt"),y=a("LCzB");const j="feeding-set-alarm-modal";class w extends o.a.Component{constructor(...e){super(...e),this.onSetAlertButtonClick=()=>{const{showModal:e,receivers:t,t:a,clearSelection:n}=this.props;e(v.a,{title:a("modals.feedingSetAlarmModal.confirmAlarmSet"),text:a("modals.feedingSetAlarmModal.confirmAlarmSetLong"),confirmText:a("yes"),onConfirmed:e=>{const{handleHide:a}=e;Object(l.a)({alert:!0},{},{receivers:t,handleHide:this.props.handleHide,clearSelection:n}),a(),n&&n()}}),O.a.modalview(j)},this.errorsParser=e=>{const{t:t}=this.props;return t(["notificationsCenter.errorCodes.S".concat([e]),"notificationsCenter.errorCodes.".concat([e]),"".concat(e)])}}render(){const{show:e,handleHide:t,selectedNodes:a,t:n,handleSubmit:i}=this.props;return o.a.createElement(m.a,{onHide:t,show:e,size:"lg"},o.a.createElement("form",{onSubmit:i},o.a.createElement(d.b,{title:n("modals.feedingSetAlarmModal.alarmsManage"),onCloseClick:t}),o.a.createElement(u.a,{className:j},o.a.createElement("div",null,a.map(e=>o.a.createElement(E.a,{header:e.name,notFoundText:n("modals.feedingSetAlarmModal.alarmsNotFound"),list:e.errors?e.errors.map(t=>"".concat(this.errorsParser(t,e.name)," (").concat(n("notificationsCenter.code",{code:t}),")")):[]})),!!a.filter(e=>e.receiver&&r()(e.receiver.index)).length&&o.a.createElement(f.a,{onClick:this.onSetAlertButtonClick,className:"mt-2",type:"button",buttonStyle:"text",icon:o.a.createElement("i",{className:"fas fa-exclamation-triangle"}),buttonColor:"error"},n("modals.feedingSetAlarmModal.alert")))),o.a.createElement(p.a,{hasConfirmButton:!0,confirmText:n("clear"),onCloseClick:t,formName:j})))}}w.propTypes={selectedNodes:b.a.array.isRequired,receivers:b.a.array.isRequired},w=Object(s.a)({form:j,onSubmit:l.a,validate:l.b})(w),w=Object(c.connect)(null,e=>Object(D.b)({showModal:h.d},e))(w),w=Object(h.a)({name:j})(w),t.b=Object(y.a)()(w)},"+z6k":function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a("q1tI"),r=a.n(n),i=a("f0zD"),o=a("UGc4"),s=a("0pzG"),c=a("zM5D"),l=a("gu+X"),m=a("d/v1"),d=a("pJVQ"),u=a("26mJ"),p=a("wd/R"),h=a.n(p),g=a("pxzG"),b=a("eASP"),f=a("kCVf"),D=a("DWSH"),v=a("byFs"),O=a("AF5L");var E=a("/MKj"),y=a("0b+E"),j=a("LCzB"),w=a("w2lk");const C="create-insertion-moal";class S extends r.a.Component{constructor(e){super(e),this.state={hideDate:!1};const{settlements:t,cages:a}=e;let n=!0;for(let r of a){let e=r.getLocation(),a=Object(f.j)(e[0]);t.find(e=>e.PlcmntID===a&&!e.DtaEndTime)||(n=!1)}this.state.hideDate=n,this.props.initialize({date:h()().format("YYYY-MM-DD"),number:400,weight:Object(g.j)(4e4,{unit:b.a.MEDIUM,fixed:1,rawValue:!0})}),y.a.modalview(C)}render(){const{show:e,handleHide:t,handleSubmit:a}=this.props,{hideDate:n}=this.state;return r.a.createElement(c.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:a},r.a.createElement(o.b,{title:this.props.t("modals.createInsertionModal.title"),onCloseClick:t}),r.a.createElement(s.a,{className:C},!n&&r.a.createElement(m.a,{name:"date",component:u.a,label:this.props.t("startDate"),type:"date"}),r.a.createElement(m.a,{name:"sendToDevice",component:w.a,label:this.props.t("modals.createInsertionModal.sendToDevice")}),r.a.createElement(m.a,{name:"number",component:u.a,label:this.props.t("modals.createInsertionModal.animalNumber"),type:"number"}),r.a.createElement(m.a,{name:"weight",component:u.a,label:this.props.t("averageWeight"),type:"number",unit:Object(g.l)("weight",b.a.MEDIUM)})),r.a.createElement(l.a,{hasConfirmButton:!0,confirmText:this.props.t("save"),onCloseClick:t,formName:C})))}}S=Object(d.a)({form:C,onSubmit:function(e,t,a){console.log(e);const{cages:n,settlements:r}=a;let i=h.a.utc(e.date),o=Object(g.i)(e.weight,{fromUnit:b.a.MEDIUM}),s=[],c=[];for(let l of n){let t=l.getLocation(),a=Object(f.j)(t[0]||{});if(a){let t=r.find(e=>e.PlcmntID===a&&!e.DtaEndTime);if(t){let a=l.prepareBeanToSave();a.startInsertion(t.DtaStartTime,o,+e.number),s.push(a)}else c.push(Object(D.g)({DevID:l.DevID,time:i.toDate().getTime(),weight:o,amount:+e.number}))}e.sendToDevice&&Object(O.r)(l.GatewayID,{DevID:l.DevID,animalsNumber:+e.number,weight:o,workType:1})}return s.length>0&&c.push(Object(v.a)(s)),Promise.all(c).then(e=>{a.handleHide(),Object(D.i)(e)}).catch(e=>{Object(D.h)(e)})},validate:function(e,t){const a={},{t:n}=t;if(e.date){let r=h.a.utc(e.date);if(r.isAfter(h.a.utc(),"days"))a.date=n("errors.future");else for(let e of t.cages){let i=e.getLocation(),o=Object(f.j)(i[0]||{});if(o){let e=t.settlements.filter(e=>e.PlcmntID===o);for(let t of e){if(r.isBetween(t.DtaStartTime,t.DtaEndTime)){let e=Object(f.k)(i[0]);a.date=n("errors.hasSettlement",{name:e});break}if(r.isBefore(t.DtaStartTime)){let e=Object(f.k)(i[0]);a.date=n("errors.hasLaterSettlement",{name:e});break}}}}}else a.date=n("required");return e.number||(a.number=n("required")),e.endDate||(a.endDate=n("required")),a}})(S),S=Object(E.connect)(e=>({settlements:e.settlement.settlement}))(S),S=Object(i.a)({name:C})(S);t.b=Object(j.a)()(S)},"/KDD":function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),i=a("Z0cm"),o=a.n(i),s=a("mwIZ"),c=a.n(s),l=a("TYy9"),m=a.n(l),d=a("q1tI"),u=a.n(d),p=a("/MKj"),h=a("bU1z"),g=a("LCzB"),b=a("eWv+"),f=a("pDHb"),D=a("wd/R"),v=a.n(D),O=a("Csjg"),E=a("7tbW"),y=a.n(E),j=a("9WAK"),w=a.n(j),C=a("44Ds"),S=a.n(C),T=a("JI6e"),I=a("3Z9Z"),k=a("vYJ8"),x=a("8V3e"),M=a("MOzw");function N(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 A(e){for(var t=1;tw()(y()(e)).slice(0,5),e=>JSON.stringify(e).slice(0,25)),this.toggleAllExamples=e=>{const t=A({},this.state.expanded);t[e]&&(t[e]="showExamples"===t[e]||"showExamples",this.setState({expanded:t}))},this.toggleKey=e=>{const t=A({},this.state.expanded);t[e]=!t[e],this.setState({expanded:t})},this.renderField=(e,t,a,n,r=[],i=[])=>{const{expanded:o={}}=this.state,{t:s}=this.props,c=!!o[e],l="showExamples"===o[e];return u.a.createElement(T.a,{key:e,xs:12},u.a.createElement(I.a,null,u.a.createElement(T.a,{xs:12,onClick:()=>this.toggleKey(e),className:" opacity-75 mb-1 mt-1"},u.a.createElement("i",{className:"fas fa-fw pr-1 ".concat(c?"fa-chevron-down":"fa-chevron-right")}),u.a.createElement("i",{className:t}),u.a.createElement("strong",{className:"ml-1"},a)),u.a.createElement(k.a,{in:c},u.a.createElement("div",null,u.a.createElement(T.a,{xs:12,className:"ml-4 mb-2 mt-2"},u.a.createElement("p",null,n)),r.length&&u.a.createElement(T.a,{xs:12,className:"ml-4 text-break"},u.a.createElement("i",null,s("logsView.example")),u.a.createElement("div",null,u.a.createElement("code",null,r.join(", "))),!!i.length&&u.a.createElement(u.a.Fragment,null,u.a.createElement("i",{onClick:()=>this.toggleAllExamples(e),className:"pointer"},s("logsView.allExamples")),l&&u.a.createElement(M.a,{json:i})))))))},this.state={expanded:{}}}componentDidUpdate(e,t,a){this.state.opened&&e.run!==this.props.run&&this.props.run&&this.setState({opened:!1})}render(){const{names:e,t:t,opened:a,toggleOpen:n}=this.props,r=[{key:"animals",icon:"fas fa-pig fa-fw",header:t("userRolePicker.animals"),text:t("logsView.details.animalsDesc"),items:this.getItems(Object.values(e.animals))},{key:"devices",icon:"fas fa-microchip fa-fw",header:t("newSettings.users.changeRolesView.devices"),text:t("logsView.details.devicesDesc"),items:this.getItems(Object.values(e.devices))},{key:"settings",icon:"fas fa-cog fa-fw",header:t("settings.settings"),text:t("logsView.details.settingsDesc"),items:this.getItems(Object.values(e.settings))},{key:"dictionary",icon:"fas fa-book fa-fw",header:t("modals.authorization.dictionaries"),text:t("logsView.details.dictionaryDesc"),items:this.getItems(Object.values(e.dictionaries.NAMES.DICTIONARY))},{key:"medicine",icon:"fas fa-pills fa-fw",header:t("medicines"),text:t("logsView.details.medicineDesc"),items:this.getItems(Object.values(e.dictionaries.NAMES.MEDICINE))},{key:"controlList",icon:"fas fa-list-alt fa-fw",header:t("controlLists.mainView.header"),text:t("logsView.details.controlListDesc"),items:this.getItems(Object.values(e.dictionaries.NAMES.CONTROLLIST))},{key:"graftingPrograms",icon:"fas fa-syringe fa-fw",header:t("logsView.details.graftingPrograms"),text:t("logsView.details.graftingProgramsDesc"),items:this.getItems(Object.values(e.dictionaries.NAMES.GRAFTINGPROGRAM))},{key:"ingredients",icon:"fas fa-wheat fa-fw",header:t("logsView.details.ingredients"),text:t("logsView.details.ingredientsDesc"),items:this.getItems(y()(Object.values(e.dictionaries.NAMES.INGREDIENT)))},{key:"buildings",icon:"fas fa-farm fa-fw",header:t("buildings"),text:t("logsView.details.buildingsDesc"),items:this.getItems(y()(Object.values(e.buildings)))}],i=Object(D.utc)().startOf("day"),o=[{key:"date",icon:"fas fa-calendar-day fa-fw",header:t("lastScannedRFID.days"),text:t("logsView.details.dateDesc"),items:[i.format("DD.MM.YY"),i.clone().subtract(5,"days").format("DD.MM.YY")]}],s=[{key:"users",icon:"fas fa-user fa-fw",header:t("users"),text:t("logsView.details.usersDesc"),items:this.getItems(y()(Object.values(e.employees)))}],c=t(["logsView.shortNames","{}"],{returnObjects:!0}),l=[{key:"codes",icon:"fas fa-text fa-fw",header:t("logsView.details.codes"),text:t("logsView.details.codesDesc"),items:this.getItems(y()(c.filter(e=>!!e))),fullList:y()(c.filter(e=>!!e)).sort()}];return u.a.createElement(x.a,{icon:"fa-fw fas fa-question",iconId:"helper-icon",onToggle:n,header:t("help"),opened:a},u.a.createElement(I.a,null,u.a.createElement(T.a,{xs:12},t("logsView.description"),u.a.createElement("h4",null,t("logsView.details.objects")),u.a.createElement("i",{className:"opacity-75"},t("logsView.max1item")),r.map(e=>this.renderField(e.key,e.icon,e.header,e.text,e.items)),u.a.createElement("h4",null,t("logsView.details.time")),u.a.createElement("i",{className:"opacity-75"},t("logsView.max1item")),o.map(e=>this.renderField(e.key,e.icon,e.header,e.text,e.items)),u.a.createElement("h4",null,t("logsView.details.user")),u.a.createElement("i",{className:"opacity-75"},t("logsView.max1item")),s.map(e=>this.renderField(e.key,e.icon,e.header,e.text,e.items)),u.a.createElement("h4",null,t("logsView.details.codes")),u.a.createElement("i",{className:"opacity-75"},t("logsView.maxLogItem")),l.map(e=>this.renderField(e.key,e.icon,e.header,e.text,e.items,e.fullList)))))}}F=Object(p.connect)((function(e){return{names:Object(b.b)(e)}}))(F);var z=Object(g.a)()(F),B=a("2HEh"),R=a("dVhv");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 L(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const V={OBJ_ID:"objectId",USER_ID:"userId",SEARCH_CODE:"searchCode",START_FROM:"startFrom",TEXT:"text"};class q extends d.Component{constructor(e){super(e),this.toggleOpen=()=>{this.setState(e=>({opened:!e.opened}))},this.getCookie=()=>{const{cookies:e}=this.props,t={counters:{}},a=e.get("tutorial-logs");try{return function(e){for(var t=1;t{console.time("eeee");const t={counters:this.cookie.counters,tutorialsAvailable:e.length,tutorialsFinished:0};return e.forEach(({key:e})=>{t.counters[e]&&(t.tutorialsFinished+=1)}),console.timeEnd("eeee"),t},this.getData=()=>{const{names:e,t:t}=this.props,a=v.a.utc().endOf("day"),n=t(["logsView.shortNames","{}"],{returnObjects:!0});return[{object:Object.entries(e.animals)[0],key:"animal",translationPath:"logsView.tutorialAnimal",type:V.OBJ_ID},{object:Object.entries(e.devices)[0],key:"device",translationPath:"logsView.tutorialDevice",type:V.OBJ_ID},{object:Object.entries(e.settings)[0],key:"setting",translationPath:"logsView.tutorialSetting",type:V.OBJ_ID},{object:Object.entries(e.dictionaries.NAMES.DICTIONARY)[0],key:"dictionary",translationPath:"logsView.tutorialDictionary",type:V.OBJ_ID},{object:Object.entries(e.dictionaries.NAMES.MEDICINE)[0],key:"medicine",translationPath:"logsView.tutorialMedicine",type:V.OBJ_ID},{object:Object.entries(e.dictionaries.NAMES.CONTROLLIST)[0],key:"controlList",translationPath:"logsView.tutorialControlList",type:V.OBJ_ID},{object:Object.entries(e.dictionaries.NAMES.GRAFTINGPROGRAM)[0],key:"graftingProgram",translationPath:"logsView.tutorialGraftingProgram",type:V.OBJ_ID},{object:Object.entries(e.dictionaries.NAMES.INGREDIENT)[0],key:"ingredient",translationPath:"logsView.tutorialIngredient",type:V.OBJ_ID},{object:[+a,a.format("DD.MM.YY")],key:"date",translationPath:"logsView.tutorialDate",type:V.START_FROM},{object:Object.entries(e.employees).filter(([e,t])=>t&&"Service"!==t)[0],key:"user",translationPath:"logsView.tutorialUser",type:V.USER_ID},{object:Object.entries(n).filter(([e,t])=>e&&t)[0],key:"code",translationPath:"logsView.tutorialCode",type:V.SEARCH_CODE},{object:Object.entries(e.buildings)[0],key:"building",translationPath:"logsView.tutorialBuilding",type:V.OBJ_ID}].filter(e=>!!e.object).map(e=>({value:e.object[0],text:e.object[1],key:e.key,name:t(e.translationPath,{example:e.object[1]}),type:e.type}))},this.start=()=>{const e=this.getData().slice(0),t=e=>this.cookie.counters[e]||0;e.sort((e,a)=>t(e.key)-t(a.key));const a=e[0];this.lastAction="",this.key=a.key;const{t:n}=this.props;this.setState({run:!0,stepIndex:0,running:!0,opened:!1,steps:m()([{content:n("logsView.tutorialSearchBar"),placement:"bottom",target:"#log-search-input",disableBeacon:!0},{content:n(a.name,{example:a.text}),placement:"bottom",target:"#log-search-input",object:a.text,type:V.TEXT},{content:n("logsView.clickSuggestionToApplyFilter"),placement:"right",target:"#item-".concat(a.value),object:a.value},{content:n("logsView.clickToDeleteFilter"),placement:"right",target:"#selected-".concat(a.value),type:a.type,object:a.value},{content:n("logsView.clickIconToShowMoreInfo"),placement:"left",target:"#".concat("helper-icon"),type:a.type,object:null}])})},this.stop=()=>{this.setState({run:!1,stepIndex:0,running:!1})},this.onCompleted=()=>{console.log(this.key,"finished tutorial"),this.key&&(this.cookie.counters[this.key]=this.cookie.counters[this.key]?this.cookie.counters[this.key]+1:1)},this.callback=e=>{console.log(e,"CB");const{action:t,index:a,lifecycle:n,status:r,size:i}=e,{steps:o}=this.state,{dispatch:s}=this.props;if(this.lastAction=t,[h.c.FINISHED,h.c.SKIPPED].includes(r)||[h.a.CLOSE,h.a.RESET].includes(t))this.stop();else if([h.a.NEXT,h.a.PREV].includes(t)&&n===h.b.COMPLETE){const e=a+(t===h.a.NEXT?1:-1),n=o[e];if(!n)return e===i&&this.onCompleted(),void this.stop();this.setState({stepIndex:e,run:!n.object||![V.OBJ_ID,V.SEARCH_CODE,V.START_FROM,V.USER_ID].includes(n.type)});const r=c()(n,"object","");switch(n.type){case V.TEXT:s(Object(f.f)(r));break;case V.USER_ID:s(Object(f.h)(r||null));break;case V.START_FROM:s(Object(f.g)(r||null));break;case V.SEARCH_CODE:s(3===e?Object(f.c)(o[1].value):Object(f.d)(r||null));break;case V.OBJ_ID:s(Object(f.e)(r||null))}}},this.cookie=this.getCookie(),this.lastAction="",this.key="",this.state={steps:[],run:!1,stepIndex:0,opened:!1}}componentWillUnmount(){clearTimeout(this.timer);const{cookies:e}=this.props;e.set("tutorial-logs",this.cookie,{path:"/",expires:v()().add(1,"year").toDate()})}componentDidUpdate(e,t,a){const{running:n,stepIndex:i,steps:s,run:c}=this.state;if(n&&!c){const e=s[i];e.type!==V.Text&&e.type&&r()(o()(this.props[e.type])?[e.object]:e.object,this.props[e.type])&&this.setState({run:!0})}}render(){const{steps:e,run:t,stepIndex:a,opened:n}=this.state,{t:r}=this.props,i=this.getData(),{tutorialsFinished:o,tutorialsAvailable:s}=this.getCounters(i);return u.a.createElement("div",null,u.a.createElement(R.a,{expanded:o{const{dispatch:a}=this.props;a(Object(j.d)(t))};const{dispatch:t,employee:a}=this.props,n=e.farms.length>0?e.farms[0].FarmID:"";t(Object(j.d)(n)),t(Object(s.c)(C,{farm:n,localUserID:r()(a,"LocalUserID"),roles:r()(a,"roles",[])})),E.a.modalview(C)}render(){const{updatingAuthorizations:e,show:t,handleHide:a,t:n,farms:r,selectedFarm:i,handleSubmit:s,employee:{userType:l}}=this.props;return o.a.createElement(h.a,{onHide:a,show:t,size:"lg"},o.a.createElement("form",{onSubmit:s},o.a.createElement(g.b,{title:n("modals.userEditRoleModal.editRoles"),onCloseClick:a}),o.a.createElement(b.a,{className:C},o.a.createElement(c.a,{name:"farm",component:O.b,label:n("modals.userEditRoleModal.farm"),options:r.map(e=>({name:e.FarmName,value:e.FarmID})),onChange:this.onChange}),o.a.createElement(c.a,{name:"roles",id:"roles",required:!0,component:v.a,label:n("roles"),farm:i,selectedUserType:l})),o.a.createElement(f.a,{hasConfirmButton:!0,confirmText:n("save"),onCloseClick:a,formName:C,submitting:e})))}}S=Object(l.a)({form:C,onSubmit:function(e,t,a){console.log(e);const{user:{user:{ClientID:n,LocalUserID:r}}}=p.default.getState(),{localUserID:i,roles:o}=e;let s={LocalUserID:i,roles:o};t(Object(u.k)(s,n,r,()=>{a.handleHide()}))},validate:function(e,t){return{}}})(S);const T=Object(m.a)(C),I=Object(d.connect)(e=>({farm:e.location.farm,farms:Object(w.c)(e),updatingAuthorizations:e.user.updatingAuthorizations,chamberIndividualFeeding:!!T(e,"chamberIndividualFeeding"),selectedFarm:T(e,"farm")}))(S);t.b=Object(y.a)()(Object(D.a)({name:C})(I))},"/U+v":function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a("q1tI"),r=a.n(n),i=a("17x9"),o=a.n(i),s=a("zM5D"),c=a("f0zD"),l=a("gu+X"),m=a("0pzG"),d=a("0b+E"),u=a("XzT5");const p="delayed-action-modal";class h extends n.Component{constructor(e){super(e),this.state={counter:e.counter},d.a.modalview(p)}onButtonClick(){this.props.action(),this.props.handleHide()}componentDidMount(){this.interval=setInterval(()=>{this.state.counter<1?this.onButtonClick():this.setState({counter:this.state.counter-1})},1e3)}componentWillUnmount(){clearInterval(this.interval)}render(){const{show:e,counter:t,title:a,text:n,confirmButtonText:i}=this.props;return r.a.createElement(s.a,{onHide:()=>{},show:e,counter:t},r.a.createElement(s.a.Header,null,r.a.createElement("h4",null,a)),r.a.createElement(m.a,{className:p},r.a.createElement("p",null,u.a.t(n,{counter:this.state.counter}))),r.a.createElement(l.a,{hasConfirmButton:!0,hasCloseButton:!1,confirmText:i,onConfirmed:()=>this.onButtonClick()}))}}h.propTypes={handleHide:o.a.func.isRequired,counter:o.a.number.isRequired,action:o.a.func.isRequired,title:o.a.string.isRequired,text:o.a.string.isRequired,confirmButtonText:o.a.string.isRequired},h=Object(c.a)({name:p})(h),t.b=h},"0IDN":function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("UGc4"),l=a("0pzG"),m=a("zM5D"),d=a("gu+X"),u=a("f0zD"),p=a("dfNF"),h=a("uxC8");const g="task-add-modal";class b extends n.Component{render(){const{handleHide:e,show:t,task:a,t:n,submitting:i}=this.props;return r.a.createElement(m.a,{onHide:e,show:t,size:"lg"},r.a.createElement(c.b,{title:n(a?"editTask":"addTask"),onCloseClick:e}),r.a.createElement(l.a,{className:g},r.a.createElement(p.a,{task:a,hide:e})),r.a.createElement(d.a,{hasConfirmButton:!0,formName:g,onCloseClick:e,confirmText:n("save"),submitting:i}))}}t.b=Object(s.d)(Object(u.a)({name:g}),Object(o.a)(),Object(i.connect)((function(e){return{submitting:Object(h.a)(g)(e)}})))(b)},"0Lmq":function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a("q1tI"),r=a.n(n),i=a("wQmL"),o=a("pJVQ"),s=a("/MKj"),c=a("krHZ"),l=a("zM5D"),m=a("UGc4"),d=a("0pzG"),u=a("gu+X"),p=a("f0zD"),h=a("17x9"),g=a.n(h),b=a("krkt"),f=a("mr+a"),D=a("15cA"),v=a("LCzB"),O=a("XzT5");const E="feeding-report-insemination-modal";class y extends r.a.Component{constructor(e){super(e);const{selectedNodes:t,type:a,reportData:{WST:n,NRF:r}={},feedingCurves:o}=this.props,{nodesAlreadyReported:s,nodesMissingSettings:c}=Object(D.b)(t,a,n,r,o);!!s.length||!!c.length||this.props.dispatch(Object(i.e)(E))}render(){const{show:e,handleHide:t,t:a,handleSubmit:n,selectedNodes:i,type:o,reportData:{WST:s,NRF:c}={},feedingCurves:p}=this.props,{nodesEligible:h,nodesAlreadyReported:g,nodesMissingSettings:f}=Object(D.b)(i,o,s,c,p);return r.a.createElement(l.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:n},r.a.createElement(m.b,{title:a("deviceRows.feeding.dispenserButtons.confirmSetInsemination"),onCloseClick:t}),r.a.createElement(d.a,{className:E},!!h.length&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mb-1"},a("deviceRows.feeding.dispenserButtons.confirmSetInseminationText")),r.a.createElement(b.a,{list:h.map(e=>e.name),maxItems:10})),!!g.length&&r.a.createElement("div",null,O.a.t("deviceRows.feeding.dispenserButtons.confirmSetInseminationAlreadyReportedText",{type:g.map(e=>e.name).join(", ")})),!!f.length&&r.a.createElement("div",null,O.a.t("deviceRows.feeding.dispenserButtons.confirmSetInseminationMissingConfigurationText",{type:f.map(e=>e.name).join(", ")}))),r.a.createElement(u.a,{hasConfirmButton:!!h.length,confirmText:a("deviceRows.feeding.dispenserButtons.start"),onCloseClick:t,formName:E})))}}y.propTypes={selectedNodes:g.a.array.isRequired},y=Object(o.a)({form:E,onSubmit:c.a})(y);const j=Object(v.a)()(Object(s.connect)(e=>({buildings:e.farms.buildings,feedingCurves:e.settings.feedingCurves,reportData:Object(f.l)(e)}))(y));t.b=Object(p.a)({name:E})(j)},"0faN":function(e,t,a){"use strict";a.d(t,"a",(function(){return q}));var n=a("bt/X"),r=a.n(n),i=a("noZS"),o=a.n(i),s=a("mwIZ"),c=a.n(s),l=a("q1tI"),m=a.n(l),d=a("f0zD"),u=a("UGc4"),p=a("0pzG"),h=a("gu+X"),g=a("zM5D"),b=a("3Z9Z"),f=a("JI6e"),D=a("d/v1"),v=a("pJVQ"),O=a("tDQA"),E=a("uSQv"),y=(a("Rj/F"),a("Y/op")),j=a("17x9"),w=a.n(j),C=a("/MKj"),S=a("XM6k"),T=a("sZ7W"),I=a("6uZD");var k=a("4huo"),x=a("XoCd"),M=a("pxzG"),N=a("eASP"),A=a("0b+E"),P=a("i8MS"),F=a("10H7"),z=a("AAik"),B=a("wd/R"),R=a.n(B),W=a("LCzB");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 V(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const q="cage-set-work-type-modal";class H extends m.a.Component{constructor(e){super(e),this.saveMinAndMaxWeight=()=>{Object(T.k)(this.props.cages,this.props.expeditionMinWeight,this.props.expeditionMaxWeight,()=>{this.saveExpedition(null,+this.props.expeditionMinWeight,+this.props.expeditionMaxWeight,null,!1)})},this.saveAnimalAmount=()=>{Object(T.i)(this.props.cages,this.props.expeditionAnimalAmount,()=>{this.saveExpedition(+this.props.expeditionAnimalAmount,null,null,null,!1)})},this.saveExpeditionWorkType=()=>{Object(T.l)(this.props.cages,this.props.expeditionWorkType,()=>{this.saveExpedition(null,null,null,this.props.expeditionWorkType,!1)})},this.isGracePeriod=()=>{const{farm:e,cages:t,medicines:a}=this.props;let n,i=t.map(e=>e.PlcmntID.map(e=>e.PlcmntID)),s=P.a.getAllAnimals(e),c=[],l=[],m=[],d=[],u="",p=!1,h=void 0,g=[],b=[];if(i.map(e=>e.map(e=>c=s.filter(t=>t.PlcmntID===e))),c[0]&&c.map(e=>{if(n=e.events.filter(e=>e.EvCode===F.b.GRAFTING),n[0]){if(n.map(e=>{let t=0;e.EvData.Medicine&&a[0]&&(console.log(e.EvData.Medicine,a[0]),t=864e5*a[0].WData.GracePeriod,u=e.EvData.Medicine),e.EvData.EndTime+t>Date.now()&&(h=new Date(e.EvData.EndTime+t),g.push({medicine:u,time:h}),p=!0)}),g[0]){let e=Math.max(...g.map(e=>e.time));b=[...b,g.find(t=>t.time.getTime()===e)]}g=[]}}),b[0]){let e=o()(r()(b,"time")),t=0;for(let a in e)a&&(l=[...l,Object.values(e)[t]],t++);l.map(e=>{m=[...m,{amount:e.length,medicine:e[0].medicine,time:e[0].time.getTime()}]}),d=m.sort((e,t)=>t.time-e.time),m=[],d.map(e=>{m=[...m,{amount:e.amount,medicine:e.medicine,time:R()(e.time).format("DD.MM.YYYY")}]})}if(p&&m[0])return m},this.props.initialize(function(e){for(var t=1;t{let o=i.prepareBeanToSave(),s=i.getLastExpedition();return s?(null===e&&(e=s.AnimalAmount),null===t&&(t=s.MinWeight),null===a&&(a=s.MaxWeight),null===n&&(n=s.ExpeditionWorktype),o.addExpedition((new Date).getTime(),e,+t,+a,n,r),o):null});i.filter(e=>e),this.props.dispatch(Object(I.e)(i,this.props.farm,this.props.user.ClientID,this.props.user.LocalUserID))}render(){const{cages:e,show:t,handleHide:a,worktype:n,separationWithMiddle:r,startNewSeparation:i,expeditionMinWeight:o,t:s}=this.props;console.log(e);const c=[{name:s("modals.cageWorkMode.endGracePeriod"),field:"time"},{name:s("medicine"),field:"medicine"},{name:s("animalCount"),field:"amount"}];let l=1===e.length?this.props.shadows.get(e[0].DevID):null;return m.a.createElement(g.a,{onHide:a,show:t,size:"lg"},m.a.createElement(u.b,{title:this.props.t("modals.cageWorkMode.title"),onCloseClick:a}),m.a.createElement(p.a,{className:q},m.a.createElement("div",{className:"work-types"},m.a.createElement(D.a,{name:"worktype",component:y.a},m.a.createElement(E.a,{buttonStyle:"text",value:"manual"},this.props.t("modals.cageWorkMode.manual")),m.a.createElement(E.a,{buttonStyle:"text",value:"training"},this.props.t("modals.cageWorkMode.training")),m.a.createElement(E.a,{buttonStyle:"text",value:"separation"},this.props.t("modals.cageWorkMode.separation")),m.a.createElement(E.a,{buttonStyle:"text",value:"expedition"},this.props.t("modals.cageWorkMode.expedition"))),m.a.createElement("div",{className:"placeholder"},"PLACEHOLDER"),m.a.createElement("div",null,"training"===n&&m.a.createElement(m.a.Fragment,null,m.a.createElement("h4",null,"Typ treningu"),m.a.createElement(D.a,{name:"training",component:y.a},m.a.createElement(E.a,{buttonStyle:"text",value:1},this.props.t("modals.cageWorkMode.training")," 1"),m.a.createElement(E.a,{buttonStyle:"text",value:2},this.props.t("modals.cageWorkMode.training")," 2"),m.a.createElement(E.a,{buttonStyle:"text",value:3},this.props.t("modals.cageWorkMode.training")," 3"),m.a.createElement(E.a,{buttonStyle:"text",value:6},this.props.t("modals.cageWorkMode.training")," 4"))),"separation"===n&&m.a.createElement(m.a.Fragment,null,m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"separationWithMiddle",id:"separationWithMiddle",component:S.a,label:this.props.t("modals.cageWorkMode.separationWithMiddleExit")}))),r&&m.a.createElement(m.a.Fragment,null,m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"startNewSeparation",id:"startNewSeparation",component:S.a,label:this.props.t("modals.cageWorkMode.startNewSeparation")}))),i&&m.a.createElement(m.a.Fragment,null,m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"separationMinWeight",component:x.a,min:1e3,max:18e4,step:1e3,valueFormatter:e=>Object(M.j)(+e,{unit:N.a.MEDIUM,fixed:0,showUnit:!0}),label:this.props.t("modals.cageWorkMode.minWeight")}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"separationMaxWeight",component:x.a,min:1e3,max:18e4,step:1e3,valueFormatter:e=>Object(M.j)(+e,{unit:N.a.MEDIUM,fixed:0,showUnit:!0}),label:this.props.t("modals.cageWorkMode.maxWeight")}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"separationAnimalAmount",component:x.a,min:0,max:600,valueFormatter:e=>0===e?this.props.t("noLimit"):e+" "+this.props.t("pcs"),label:this.props.t("animalCount")})))),!i&&l&&l.separationData&&m.a.createElement(m.a.Fragment,null,m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},this.props.t("modals.cageWorkMode.minWeight"),": ",m.a.createElement("strong",null,Object(M.j)(l.separationData.minWeight,{unit:N.a.MEDIUM,showUnit:!0,fixed:0})))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},this.props.t("modals.cageWorkMode.maxWeight"),": ",m.a.createElement("strong",null,Object(M.j)(l.separationData.maxWeight,{unit:N.a.MEDIUM,showUnit:!0,fixed:0})))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},this.props.t("animalCount"),":",m.a.createElement("strong",null,0===l.separationData.animalsNumber?this.props.t("noLimit"):l.separationData.animalsNumber," ",0!==l.separationData.animalsNumber?this.props.t("pcs"):"")))))),"expedition"===n&&m.a.createElement(m.a.Fragment,null,this.isGracePeriod()&&m.a.createElement("div",null,m.a.createElement("p",{style:{textAlign:"center",fontWeight:"700"}},s("modals.cageWorkMode.findAnimals")),m.a.createElement(z.a,{data:this.isGracePeriod(),headers:c}),m.a.createElement("br",null)),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"startNewExpedition",id:"startNew",component:S.a,label:this.props.t("modals.cageWorkMode.startNewExpedition")}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"expeditionMinWeight",component:x.a,min:1e3,max:18e4,step:1e3,valueFormatter:e=>Object(M.j)(+e,{unit:N.a.MEDIUM,fixed:0,showUnit:!0}),label:this.props.t("modals.cageWorkMode.minWeight")})),m.a.createElement(f.a,{lg:1,className:"d-flex align-items-end"},m.a.createElement(E.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-save"}),type:"button",onClick:this.saveMinAndMaxWeight}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"expeditionMaxWeight",component:x.a,min:o,max:18e4,step:1e3,valueFormatter:e=>Object(M.j)(+e,{unit:N.a.MEDIUM,fixed:0,showUnit:!0}),label:this.props.t("modals.cageWorkMode.maxWeight")})),m.a.createElement(f.a,{lg:1,className:"d-flex align-items-end"},m.a.createElement(E.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-save"}),type:"button",onClick:this.saveMinAndMaxWeight}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"expeditionAnimalAmount",component:x.a,min:0,max:600,valueFormatter:e=>0===e?this.props.t("noLimit"):e+" "+this.props.t("pcs"),label:this.props.t("animalCount")})),m.a.createElement(f.a,{lg:1,className:"d-flex align-items-end"},m.a.createElement(E.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-save"}),type:"button",onClick:this.saveAnimalAmount}))),m.a.createElement(b.a,{className:"justify-content-center"},m.a.createElement(f.a,{lg:6},m.a.createElement(D.a,{name:"expeditionWorkType",component:k.b,label:this.props.t("modals.cageWorkMode.workMode"),options:[{name:this.props.t("modals.cageWorkMode.sepMode"),value:1},{name:this.props.t("left")+" "+this.props.t("modals.cageWorkMode.exitOpen"),value:2},{name:this.props.t("right")+" "+this.props.t("modals.cageWorkMode.exitOpen"),value:3},{name:this.props.t("modals.cageWorkMode.altOpen"),value:4}]})),m.a.createElement(f.a,{lg:1,className:"d-flex align-items-end"},m.a.createElement(E.a,{buttonStyle:"round",icon:m.a.createElement("i",{className:"fas fa-save"}),type:"button",onClick:this.saveExpeditionWorkType}))))))),m.a.createElement(h.a,{hasConfirmButton:!0,confirmText:this.props.t("save"),onCloseClick:a,formName:q}))}}H.propTypes={cages:w.a.array.isRequired},H=Object(v.a)({form:q,onSubmit:function(e,t,a){console.log(e,a);const{worktype:n,training:r,separationWithMiddle:i,separationMinWeight:o,separationMaxWeight:s,separationAnimalAmount:c,startNewSeparation:l,startNewExpedition:m,expeditionWorkType:d,expeditionMinWeight:u,expeditionMaxWeight:p,expeditionAnimalAmount:h}=e,{cages:g,user:b}=a;if("manual"===n)for(let f of g)Object(T.w)(f,0,()=>{f.endExpedition(),t(Object(I.e)(f.prepareBeanToSave(),f.FarmID,b.ClientID,b.LocalUserID))});if("training"===n){console.log("training",r);for(let e of g)Object(T.w)(e,r,()=>{e.endExpedition(),t(Object(I.e)(e.prepareBeanToSave(),e.FarmID,b.ClientID,b.LocalUserID))})}if("separation"===n)for(let f of g)i?l&&(Object(T.t)(f,+o,+s),Object(T.r)(f,+c)):Object(T.t)(f,0,0),Object(T.w)(f,4,()=>{f.endExpedition(),t(Object(I.e)(f.prepareBeanToSave(),f.FarmID,b.ClientID,b.LocalUserID))});if("expedition"===n)for(let f of g)Object(T.j)(f,+h,+u,+p,d,!m),Object(T.w)(f,5,e=>{console.log(e),f.addExpedition((new Date).getTime(),+h,+u,+p,d,m),t(Object(I.e)(f.prepareBeanToSave(),f.FarmID,b.ClientID,b.LocalUserID))});a.handleHide()}})(H);const U=Object(O.a)(q),G=Object(C.connect)(e=>({shadows:e.shadows.shadows,user:e.user.user,medicines:e.dictionary.medicine,worktype:U(e,"worktype"),separationWithMiddle:U(e,"separationWithMiddle"),startNewSeparation:U(e,"startNewSeparation"),startNewExpedition:U(e,"startNewExpedition"),expeditionMinWeight:U(e,"expeditionMinWeight"),expeditionMaxWeight:U(e,"expeditionMaxWeight"),expeditionAnimalAmount:U(e,"expeditionAnimalAmount"),expeditionWorkType:U(e,"expeditionWorkType"),farm:e.location.farm}))(H);H=Object(d.a)({name:q})(G);t.b=Object(W.a)()(H)},"0pzG":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("7xGa"),s=a("17x9"),c=a.n(s);class l extends n.Component{constructor(e){super(e),this.getFocus=()=>{this.timer=setTimeout(()=>{if(this.body.current){let e,t=this.body.current.getElementsByTagName("input");for(let a=0;ae.localeCompare(t)).filter(e=>!this.props.current.includes(e)).map(e=>({value:e,name:this.props.languages[e]}))}}render(){const{show:e,handleHide:t,handleSubmit:a,submitting:n,t:i}=this.props,{languages:s}=this.state;return r.a.createElement(c.a,{onHide:t,show:e,size:"xl"},r.a.createElement("form",{onSubmit:a},r.a.createElement(l.a,{title:i("modals.newTranslation.title"),onCloseClick:t}),r.a.createElement(m.a,null,r.a.createElement(o.a,{name:"code",component:u.b,label:i("language"),options:s,disableSort:!0,clearButton:!1})),r.a.createElement(d.a,{hasConfirmButton:!0,confirmText:i("save"),onCloseClick:t,formName:f,submitting:n})))}}D=Object(s.a)({form:f,onSubmit:function(e,t,a){const{code:n}=e;let r=g.b.map(e=>({lang:n,path:e,value:{}}));return Object(h.c)(r).then(e=>{Object(h.b)(e),t(Object(p.a)(n)),a.handleHide()}).catch(e=>{Object(h.a)(e)})},validate:function(e,t){const a={},{t:n}=t;return e.code||(a.code=n("required")),a}})(D),D=Object(i.a)({name:f})(D);t.b=Object(b.a)()(D)},"1aAG":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("mzFT"),l=a("VyNe"),m=a("dfNF"),d=a("uSQv"),u=(a("4ELl"),a("uxC8")),p=a("wQmL"),h=a("Imit"),g=a("0IDN");class b extends n.Component{constructor(...e){super(...e),this.onSubmitClick=()=>{this.props.dispatch(Object(p.e)("task-add-modal"))}}render(){const{show:e,t:t,onHide:a,task:n,submitting:i}=this.props;return r.a.createElement(c.a,{name:t(n?"editTask":"addTask"),show:e,className:"task-add-drawer",onHide:a},r.a.createElement(l.a,null,r.a.createElement(m.a,{task:n,hide:a})),r.a.createElement(d.a,{className:"task-add-drawer-submit",buttonColor:"success",onClick:this.onSubmitClick,isLoading:i},t("save")))}}t.a=Object(s.d)(Object(o.a)(),Object(i.connect)((function(e){return{task:Object(h.a)(e),submitting:Object(u.a)(g.a)(e)}})))(b)},"2JXq":function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=(a("ETy9"),a("0b+E")),d=a("LCzB");const u="help-colors-modal";class p extends r.a.Component{constructor(e){super(e),m.a.modalview(u)}render(){const{show:e,handleHide:t}=this.props;return r.a.createElement(i.a,{show:e,size:"lg",onHide:t},r.a.createElement(o.b,{title:this.props.t("helpView.legend"),onCloseClick:t}),r.a.createElement(s.a,null,r.a.createElement("p",null,this.props.t("helpView.primaryDescription")),r.a.createElement("div",{className:"colors-container"},r.a.createElement("p",null,r.a.createElement("i",{style:{color:"#33cc33"},className:"fas fa-square"}),this.props.t("helpView.successDescription")),r.a.createElement("p",null,r.a.createElement("i",{style:{color:"#fd3b60"},className:"fas fa-square"}),this.props.t("helpView.dangerDescription")),r.a.createElement("p",null,r.a.createElement("i",{style:{color:"#ffc007"},className:"fas fa-square"}),this.props.t("helpView.warningDescription")),r.a.createElement("p",null,r.a.createElement("i",{style:{color:"#aaaaaa"},className:"fas fa-square"}),this.props.t("helpView.disabledDescription")),r.a.createElement("p",null,r.a.createElement("i",{style:{color:"#00afff"},className:"fas fa-square"}),this.props.t("helpView.infoDescription")))),r.a.createElement(c.a,{onCloseClick:t}))}}p=Object(l.a)({name:u})(p),t.b=Object(d.a)()(p)},"40zH":function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a("q1tI"),r=a.n(n),i=a("wQmL"),o=a("pJVQ"),s=a("/MKj"),c=a("krHZ"),l=a("qzmO");var m=a("zM5D"),d=a("UGc4"),u=a("0pzG"),p=a("gu+X"),h=a("f0zD"),g=a("17x9"),b=a.n(g),f=a("krkt"),D=a("mr+a"),v=a("15cA"),O=a("LCzB"),E=a("XzT5");const y="feeding-report-parturition-modal";class j extends r.a.Component{constructor(e){super(e);const{selectedNodes:t,type:a,reportData:{WST:n,NRF:r}={},feedingCurves:o}=this.props,{nodesAlreadyReported:s,nodesMissingSettings:c,nodesEligible:l}=Object(v.b)(t,a,n,r,o);console.log(s,c,l),!!s.length||!!c.length||this.props.dispatch(Object(i.e)(y))}render(){const{show:e,handleHide:t,t:a,handleSubmit:n,selectedNodes:i,type:o,reportData:{WST:s,NRF:c}={},feedingCurves:l}=this.props,{nodesEligible:h,nodesAlreadyReported:g,nodesMissingSettings:b}=Object(v.b)(i,o,s,c,l);return r.a.createElement(m.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:n},r.a.createElement(d.b,{title:a("deviceRows.feeding.dispenserButtons.confirmSetParturition"),onCloseClick:t}),r.a.createElement(u.a,{className:y},!!h.length&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mb-1"},a("deviceRows.feeding.dispenserButtons.confirmSetParturitionText")),r.a.createElement(f.a,{list:h.map(e=>e.name),maxItems:10})),!!g.length&&r.a.createElement("div",null,E.a.t("deviceRows.feeding.dispenserButtons.confirmSetParturitionAlreadyReportedText",{type:g.map(e=>e.name).join(", ")})),!!b.length&&r.a.createElement("div",null,E.a.t("deviceRows.feeding.dispenserButtons.confirmSetParturitionMissingConfigurationText",{type:b.map(e=>e.name).join(", ")}))),r.a.createElement(p.a,{hasConfirmButton:!!h.length,confirmText:a("deviceRows.feeding.dispenserButtons.start"),onCloseClick:t,formName:y})))}}j.propTypes={selectedNodes:b.a.array.isRequired},j=Object(o.a)({form:y,onSubmit:function(e,t,a){Object(c.a)(e,t,a,l.n,"PAR")}})(j);const w=Object(O.a)()(Object(s.connect)(e=>({buildings:e.farms.buildings,reportData:Object(D.m)(e),feedingCurves:e.settings.feedingCurves}))(j));t.b=Object(h.a)({name:y})(w)},"42VQ":function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n,r,i,o=a("q1tI"),s=a.n(o),c=a("17x9"),l=a.n(c),m=a("zM5D"),d=a("f0zD"),u=a("UGc4"),p=a("/MKj"),h=a("gu+X"),g=a("0pzG"),b=a("0b+E");const f="confirm-modal";const D=Object(p.connect)(e=>({supportLanguages:e.language.supportedLanguages,language:e.language.locale,languageFetched:e.language.fetched,user:e.user.user,isLoading:e.user.fetching}))((i=r=class extends o.Component{constructor(e){super(e),b.a.modalview(f)}render(){const{show:e,text:t,confirmText:a,children:n,handleHide:r,onConfirmed:i,title:o,size:c,closeText:l,optionalButtons:d}=this.props;return s.a.createElement(m.a,{onHide:r,show:e,size:c},s.a.createElement(u.b,{title:o,onCloseClick:r}),s.a.createElement(g.a,{className:f},s.a.createElement("div",{className:"mb-1"},t),n),s.a.createElement(h.a,{hasConfirmButton:!0,confirmText:a,onCloseClick:r,onConfirmed:()=>i(this.props),closeText:l,optionalButtons:d}))}},r.propTypes={text:l.a.string.isRequired,title:l.a.string.isRequired,confirmText:l.a.string.isRequired,handleHide:l.a.func.isRequired,onConfirmed:l.a.func.isRequired,size:l.a.string,closeText:l.a.string},n=i))||n;t.b=Object(d.a)({name:f})(D)},"4ELl":function(e,t,a){},"4Q+z":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("wQmL"),o=a("d/v1"),s=a("pJVQ"),c=a("qzmO"),l=a("wd/R"),m=a.n(l);var d,u=a("zM5D"),p=a("UGc4"),h=a("0pzG"),g=a("gu+X"),b=a("f0zD"),f=a("17x9"),D=a.n(f),v=a("msTn"),O=a("26mJ"),E=a("IBmF"),y=a("a4gc"),j=a("5tiW"),w=a("hN/4"),C=a("M3Xf"),S=a("0b+E"),T=a("LCzB"),I=a("/MKj");const k="feeding-set-type-event-modal";let x=Object(I.connect)()(d=class extends r.a.Component{constructor(e){super(e);const{dispatch:t,sectorType:a}=this.props;t(Object(i.c)(k,{startDate:m()().format(m.a.HTML5_FMT.DATE),eventType:a===v.a.DELIVERY?E.h.PARTURITION:E.h.INSEMINATION})),S.a.modalview(k)}render(){const{show:e,handleHide:t,t:a,handleSubmit:n}=this.props;return r.a.createElement(u.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:n},r.a.createElement(p.b,{title:a("modals.feedingSetTypeEventModal.reportEvent"),onCloseClick:t}),r.a.createElement(h.a,{className:k},r.a.createElement("div",null,r.a.createElement(o.a,{name:"startDate",label:a("modals.feedingSetTypeEventModal.startDate"),id:"startDate",type:"date",component:O.a}),r.a.createElement(o.a,{name:"eventType",id:"eventType",type:"text",showLabels:!0,required:!0,component:y.a,options:[{value:E.h.NO_EVENT,svgPath:C.a,label:a("modals.feedingSetTypeEventModal.noevent")},{value:E.h.INSEMINATION,svgPath:j.default,label:a("insemination")},{value:E.h.PARTURITION,svgPath:w.default,label:a("birth")}],label:a("modals.feedingSetTypeEventModal.eventType")}))),r.a.createElement(g.a,{hasConfirmButton:!0,confirmText:a("modals.feedingSetTypeEventModal.report"),onCloseClick:t,formName:k})))}})||d;x.propTypes={selectedNodes:D.a.array.isRequired,receivers:D.a.array.isRequired,sectorType:D.a.oneOf([v.a.DELIVERY,v.a.MATING]).isRequired},x=Object(s.a)({form:k,onSubmit:function(e,t,a){const{receivers:n,handleHide:r,clearSelection:i}=a,{startDate:o,eventType:s}=e;let l={type:+s,time:+m()(o,"YYYY-MM-DD").startOf("day")};for(let m of n.values())m.individualNRF.devices.length>0&&Object(c.A)(m.individualNRF.devices,l);r(),i()},validate:function(e,t){const a={},{startDate:n}=e,{t:r}=t;return n||(a.startDate=r("required")),a}})(x);t.a=x=Object(T.a)()(Object(b.a)({name:k})(x))},"4qqJ":function(e,t,a){"use strict";a.d(t,"a",(function(){return D}));var n=a("Y+p1"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("3Z9Z"),l=a("JI6e"),m=a("UGc4"),d=a("0pzG"),u=a("gu+X"),p=a("f0zD"),h=a("/MKj"),g=a("RFJ0"),b=a("/kok"),f=a("AAik");const D="ascii-climate-current-values";class v extends o.a.Component{constructor(e){super(e),this.state={climate:this.props.asciiClimates.length>0?this.props.asciiClimates[0]:null,shadow:null,data1:[],data2:[]},this.onChangeClimate=e=>{this.setState({value:e}),b.a.startSendingDeviceState(e)},this.state.climate&&b.a.startSendingDeviceState(this.state.climate)}shouldComponentUpdate(e,t,a){return!r()(this.state,t)}static getDerivedStateFromProps(e,t){let a=e.shadows.get(t.climate.DevID);if(a&&!r()(a,t.shadow)){let e=Object.keys(a).filter(e=>"metadata"!==e),t=Math.ceil(e.length/2),n=e.slice(0,t),r=e.slice(t,e.length),i=n.map(e=>({key:e,value:a[e]})),o=r.map(e=>({key:e,value:a[e]}));return{shadow:a,data1:i,data2:o}}return null}render(){const{show:e,handleHide:t,asciiClimates:a}=this.props,{climate:n,data1:r,data2:i}=this.state,p=[{name:"Klucz",field:"key"},{name:"Warto\u015b\u0107",field:"value",headerClassName:"index",itemClassName:"index"}];return o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement(m.b,{title:"Aktualne warto\u015bci klimatu",onCloseClick:t}),o.a.createElement(d.a,{className:D},o.a.createElement(g.a,{label:"Klimat",options:a.map(e=>({name:e.Name,value:e})),value:n,onChange:this.onChangeClimate,clearButton:!1}),o.a.createElement(c.a,null,o.a.createElement(l.a,{lg:6},o.a.createElement(f.a,{data:r,headers:p})),o.a.createElement(l.a,{lg:6},o.a.createElement(f.a,{data:i,headers:p})))),o.a.createElement(u.a,{onCloseClick:t}))}}v=Object(h.connect)(e=>({asciiClimates:e.farmDevices.devices.filter(e=>"CL_ASCII"===e.DevType),shadows:e.shadows.shadows}))(v),v=Object(p.a)({name:D})(v),t.b=v},"78Kh":function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("d/v1"),s=a("pJVQ"),c=a("f0zD"),l=a("UGc4"),m=a("gu+X"),d=a("/MKj"),u=a("lM7y"),p=a("BXH4"),h=a("OwcS"),g=a("ba6h"),b=a("hPO2");function f(e,t,a){let n=Object(h.a)();a.supportedLanguages.map(r=>{switch(e.WData[r.lang]||(e.WData[r.lang]=[]),a.type){case g.a.fallReasons:e.WData[r.lang].push({ID:n,Value:t.newValue,Short:t.abbreviation.trim()});break;case g.a.suppliers:e.WData[r.lang].push({ID:n,Value:t.newValue,Phone:t.phone,Address:t.address,NIP:t.nip,Website:t.website,HerdNumber:t.herdNumber});break;default:e.WData[r.lang].push({ID:n,Value:t.newValue})}e.WData[r.lang].map(e=>{delete e.isShowing})})}a("jVdC");var D=a("0pzG"),v=a("26mJ"),O=a("0b+E"),E=a("LCzB");const y="dictionary-modal";class j extends n.Component{constructor(e){super(e),O.a.modalview(y)}render(){const{show:e,handleHide:t,handleSubmit:a}=this.props;return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:a},r.a.createElement(l.b,{title:this.props.title,onCloseClick:t}),r.a.createElement(D.a,{className:"dictionary-modal"},r.a.createElement(o.a,{name:"newValue",id:"newValue",type:"text",label:this.props.t("dictionariesView.newValue"),required:!0,component:v.a}),[g.a.fallReasons].includes(this.props.type)&&r.a.createElement(o.a,{name:"abbreviation",id:"abbreviation",type:"text",label:this.props.t("dictionariesView.abbreviation"),required:!0,component:v.a}),g.a.suppliers===this.props.type&&r.a.createElement("div",null,r.a.createElement(o.a,{name:"phone",id:"phone",type:"text",label:this.props.t("phoneNumber"),required:!0,component:v.a}),r.a.createElement(o.a,{name:"address",id:"address",type:"text",label:this.props.t("address"),required:!0,component:v.a}),r.a.createElement(o.a,{name:"nip",id:"nip",type:"text",label:"NIP",required:!0,component:v.a,normalize:b.b}),r.a.createElement(o.a,{name:"website",id:"website",type:"text",label:"WWW",required:!0,component:v.a}),r.a.createElement(o.a,{name:"herdNumber",id:"herdNumber",type:"text",label:this.props.t("dictionariesView.herdNumber"),component:v.a}))),r.a.createElement(m.a,{hasConfirmButton:!0,confirmText:this.props.t("add"),onCloseClick:t,formName:y})))}}let w=Object(s.a)({form:y,onSubmit:function(e,t,a){let n=p.a.findDictionary(a.type);if(n.length>0){let r=Object.assign({},n[0]);f(r,e,a),r.DtaModTime=(new Date).getTime(),delete r.$loki,delete r.meta,t(Object(u.d)(r,a.user.ClientID,a.user.LocalUserID))}else{let n={ClientID:a.user.ClientID,DtaModTime:(new Date).getTime(),Type:a.type,WordID:Object(h.a)(),WData:{}};f(n,e,a),t(Object(u.a)(n,a.user.ClientID,a.user.LocalUserID))}a.handleHide()},validate:(e,t)=>{const a={},{t:n}=t;return e.newValue||(a.newValue=n("required")),e.abbreviation?1!==e.abbreviation.trim().length&&(a.abbreviation=n("errors.mustBe1Char")):a.abbreviation=n("required"),e.phone||(a.phone=n("required")),e.address||(a.address=n("required")),e.nip||(a.nip=n("required")),e.website||(a.website=n("required")),e.herdNumber||(a.herdNumber=n("required")),e.nip&&13!==e.nip.length&&(a.nip=n("errors.nipLength")),e.nip&&13===e.nip.length&&!Object(b.a)(e.nip)&&(a.nip=n("errors.nipError")),e.unit||(a.unit=n("required")),e.amountFor100||(a.amountFor100=n("required")),a}})(j);w=Object(c.a)({name:y})(w),w=Object(d.connect)((e,t)=>({user:e.user.user,dictionary:e.dictionary,lang:e.language.lang.lang,userAttr:e.user.attributes,supportedLanguages:e.language.supportedLanguages,supportLanguages:e.language.supportedLanguages,language:e.language.locale,languageFetched:e.language.fetched}))(w);t.b=Object(E.a)()(w)},"7y5B":function(e,t,a){"use strict";a.d(t,"a",(function(){return O}));var n=a("q1tI"),r=a.n(n),i=a("pJVQ"),o=a("/MKj"),s=a("lSCD"),c=a.n(s),l=a("r3a2"),m=a("qzmO");var d=a("zM5D"),u=a("UGc4"),p=a("0pzG"),h=a("gu+X"),g=a("f0zD"),b=a("17x9"),f=a.n(b),D=a("LCzB"),v=a("XzT5");const O="feeding-empty-forage-modal";class E extends r.a.Component{render(){const{show:e,handleHide:t,t:a,handleSubmit:n}=this.props;return r.a.createElement(d.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:n},r.a.createElement(u.b,{title:a("modals.feedingEmptyForageModal.title"),onCloseClick:t}),r.a.createElement(p.a,{className:O},v.a.t("modals.feedingEmptyForageModal.description",{type:a("modals.feedingEmptyForageModal.start")})),r.a.createElement(h.a,{hasConfirmButton:!0,confirmText:a("modals.feedingEmptyForageModal.start"),onCloseClick:t,formName:O})))}}E.propTypes={selectedNodes:f.a.array.isRequired},E=Object(i.a)({form:O,onSubmit:function(e,t,a){const{receivers:n,handleHide:r,clearSelection:i}=a;for(let o of n.values())o.individualDTM.forEach(({DevID:e,outputs:t})=>{t.forEach(t=>{Object(l.g)(e,{number:t.number})})}),o.individualNRF.devices.length>0&&Object(m.r)(o.individualNRF.devices);c()(r)&&r(),c()(i)&&i()}})(E);const y=Object(o.connect)(e=>({buildings:e.farms.buildings}))(E);E=Object(g.a)({name:O})(y);t.b=Object(D.a)()(E)},"8Hrd":function(e,t,a){},"8TgK":function(e,t,a){"use strict";a.d(t,"a",(function(){return X}));var n=a("J2iB"),r=a.n(n),i=a("lFKM"),o=a.n(i),s=a("mwIZ"),c=a.n(s),l=a("BkRI"),m=a.n(l),d=a("q1tI"),u=a.n(d),p=a("wQmL"),h=a("d/v1"),g=a("3t43"),b=a("pJVQ"),f=a("tDQA"),D=a("/MKj"),v=a("qPyV"),O=a.n(v),E=a("4qC0"),y=a.n(E),j=a("Y+p1"),w=a.n(j),C=a("Z0cm"),S=a.n(C),T=a("kCmh"),I=a("6uZD");var k=a("zM5D"),x=a("3Z9Z"),M=a("JI6e"),N=a("UGc4"),A=a("0pzG"),P=a("gu+X"),F=a("f0zD"),z=a("17x9"),B=a.n(z),R=a("1Exf"),W=a("a+pQ"),L=a("VfnB"),V=a("zDJl"),q=a("kCVf"),H=a("uSQv"),U=a("4huo"),G=a("0b+E"),Y=a("LCzB"),J=a("XzT5"),K=a("w2lk");const X="settings-buildings-pair-standings";class Q extends u.a.Component{constructor(e){super(e);const{dispatch:t,chamber:a,devices:n}=this.props;let i=m()(c()(a,"Boxes",[])).map(e=>{let t=T.a.getDevicesInPlcmnt(e);console.log(t);let a=null;if(t[0]){let n=t[0].getAddressForLocation(e.BID),r={DevID:t[0].DevID,DevAdr:t[0].Address};null!==n&&(r.Adr=n),a=r}return{BID:e.BID,name:e.BoxesName,device:a,devicesLen:t.length}});t(Object(p.c)(X,{standings:i,startingValues:i}));let o=Object(L.m)(n.filter(e=>[V.d.DISPENSER,V.d.DISPENSER_NRF].includes(e.DevType)));this.state={dispenserOptions:o.map(e=>{let t={DevID:e.device.DevID};return r()(e.device.Address)||(t.DevAdr=+e.device.Address),r()(e.index)||(t.Adr=+e.index),{value:t,name:Object(L.g)(t)}}),standingOptions:m()(a).Boxes.map((e,t)=>({name:e.BoxesName,value:t}))},G.a.modalview(X)}setDevices(){const{devices:e,startingDevice:{DevID:t,Adr:a},standings:n,dispatch:r,startingStanding:i,fillEmpty:s}=this.props,l=T.a.getDeviceByID(t);if(!l)throw new Error("No device found for automatic pairing");const d=Object(L.m)(e),u=[];d.forEach(({device:e,index:t})=>{l.DevType===e.DevType&&e.DevType===l.DevType&&e.ParentID===l.ParentID&&e.Interface===l.Interface&&(e.DevType===V.d.DISPENSER_NRF&&e.Address>=l.Address?u.push({DevID:e.DevID,SortKey:+e.Address||0,DevAdr:+e.Address}):e.DevType===V.d.DISPENSER&&e.Address>=l.Address&&(e.DevID!==l.DevID||t>=a)&&u.push({DevID:e.DevID,SortKey:100*+e.Address+t,Adr:+t,DevAdr:+e.Address}))}),u.sort((e,t)=>c()(e,"SortKey",0)-c()(t,"SortKey",0));const h=m()(n),g=o()(+i)?+i:0;let b=0;n.forEach((e,t)=>{t>=g&&(s&&c()(e,"device.DevID")||u[b]&&(delete u[b].SortKey,h[t].device=u[b],b++))}),r(Object(p.a)(X,"standings",h))}render(){const{chamber:e,updating:t,show:a,handleHide:n,startingDevice:r,t:i,handleSubmit:o}=this.props,{standingOptions:s,dispenserOptions:c}=this.state;let l=[{name:i("modals.standingsPairDeviceModal.standingName"),field:"name",fieldToGet:"name",dontShowInput:!0},{name:i("modals.standingsPairDeviceModal.dispenser"),component:R.a,options:[{name:"Nieprzypisany",value:null},...c],field:"device",colWidth:2}];return u.a.createElement(k.a,{onHide:n,show:a,backdrop:"static",size:"lg"},u.a.createElement("form",{onSubmit:o},u.a.createElement(N.b,{title:J.a.t("modals.standingsPairDeviceModal.pairingStandingsIn",{type:Object(q.k)(e)}),onCloseClick:n}),u.a.createElement(A.a,{className:X},u.a.createElement(x.a,null,u.a.createElement(M.a,{md:6},u.a.createElement(h.a,{name:"startingDevice",id:"startingDevice",options:c,component:U.b,label:i("modals.standingsPairDeviceModal.startFromDevice"),sortKey:U.a.ADDRESS})),u.a.createElement(M.a,{md:6},u.a.createElement(h.a,{name:"startingStanding",id:"startingStanding",options:s,component:U.b,label:i("modals.standingsPairDeviceModal.startFromStanding")})),u.a.createElement(M.a,{xs:12},u.a.createElement(h.a,{name:"fillEmpty",id:"fillEmpty",component:K.a,label:i("fillOnlyEmptyStandings")}))),u.a.createElement(H.a,{type:"button",onClick:()=>this.setDevices(),disabled:!r},i("modals.standingsPairDeviceModal.set")),u.a.createElement(g.a,{component:W.a,name:"standings",headers:l})),u.a.createElement(P.a,{hasConfirmButton:!0,confirmText:i("add"),onCloseClick:n,formName:X,submitting:t})))}}Q.propTypes={chamber:B.a.string.isRequired},Q=Object(b.a)({form:X,onSubmit:function(e,t,a){console.log(e,a);const n=[],i=T.a.getDevices(a.farm),{startingValues:o,standings:s}=e;for(let[l,m]of s.entries())if(!w()(m,o[l])||o[l].devicesLen>0){if(O()([...i,...n],e=>e.DevID).forEach(e=>{const t=e.clone(),a=y()(e.PlcmntID)&&e.PlcmntID===m.BID,r=S()(e.PlcmntID)&&!!e.PlcmntID.filter(e=>e.PlcmntID===m.BID).length;if(a||r){t.removeLocation(m.BID);const e=n.findIndex(e=>e.DevID===t.DevID);-1!==e?n[e]=t:n.push(t)}}),m.device){const e=n.findIndex(e=>e.DevID===m.device.DevID);let t;-1!==e?t=n[e]:(t=i.find(e=>e.DevID===m.device.DevID),t&&(t=t.clone())),t?(t.addLocation(m.BID,r()(m.device.Adr)?null:m.device.Adr),-1!==e?n[e]=t:n.push(t)):console.error("Device not found id: ",m.device.DevID)}}const c=n.map(e=>e.prepareBeanToSave());c.length>0&&t(Object(I.e)(c,a.farm,a.user.ClientID,a.user.LocalUserID)),a.handleHide()},validate:function(e,t){const a={},{standings:n=[]}=e||{},{t:r}=t;return a.standings=n.map((e,t)=>{const a={};for(let i=0;i({farm:e.location.farm,devices:e.farmDevices.devices,updating:e.farms.updating,user:e.user.user,startingDevice:_(e,"startingDevice"),startingStanding:_(e,"startingStanding"),fillEmpty:_(e,"fillEmpty"),standings:_(e,"standings")}))(Q);Q=Object(F.a)({name:X})(Z);t.b=Object(Y.a)()(Q)},"98E9":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("9jj8"),o=a("3Z9Z"),s=a("JI6e"),c=a("3k8n"),l=a("wd/R"),m=a.n(l),d=(a("mvGM"),a("UMpK")),u=a.n(d),p=a("4qC0"),h=a.n(p),g=a("GoyQ"),b=a.n(g),f=a("J2iB"),D=a.n(f),v=a("Y+p1"),O=a.n(v),E=a("Znm+"),y=a.n(E),j=a("mwIZ"),w=a.n(j),C=a("MOzw"),S=a("17x9"),T=a.n(S),I=a("LCzB");class k extends n.Component{render(){const{code:e,t:t}=this.props,a=t(["logsView.shortNames","{}"],{returnObjects:!0});return r.a.createElement("h4",{className:"text-break"},e.map(e=>a[e]?"".concat(a[+e]," (").concat(e,")"):"(".concat(e,")")).join(", "))}}k.propTypes={code:T.a.array.isRequired};var x=Object(I.a)()(k);class M extends n.Component{constructor(e){super(e),this.cellRenderer=(e,{path:t,defaultRenderer:a})=>{const{diff:n}=this.state,{log:i}=this.props;return console.log(t,n,e,"DKDK"),t&&w()(n,t)?r.a.createElement(r.a.Fragment,null,!D()(w()(i.ObjOld,t))&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"color-error"},a(w()(i.ObjOld,t))),"\u2192"),r.a.createElement("span",{className:"color-primary"},a(e))):a(e)},this.isNull=e=>!b()(e)||!Object.keys(e).length;const{log:t}=this.props;this.state={diff:vt(t.ObjNew,this.isNull(t.ObjOld)?t.ObjNew:t.ObjOld)}}render(){const{log:e,code:t}=this.props;return r.a.createElement("div",null,r.a.createElement(x,{code:t}),!this.isNull(e.ObjNew)&&!this.isNull(e.ObjOld)&&r.a.createElement(C.a,{key:"tab-1",json:e.ObjNew||{},cellRenderer:this.cellRenderer}),!this.isNull(e.ObjNew)&&!!this.isNull(e.ObjOld)&&r.a.createElement(C.a,{key:"tab-2",json:e.ObjNew||{}}))}}var N=M,A=(a("WmuQ"),a("q17X")),P=a("kB5K"),F=a("pxzG"),z=a("15cA"),B=a("6/k7"),R=a("G7tO");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 L(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class V extends n.Component{constructor(...e){super(...e),this.renderCurve=e=>{const{t:t}=this.props,a=Object(A.getSettingClass)(e);if(!(a instanceof P.a))return null;const n=w()(a,"SetData.InseminationJumpTo",-151),i=Object(A.getFeedingUnit)(),o=[{color:"green",dataKey:"ForageAmount",name:t("dosage"),unit:Object(F.l)("weight",i),valueConverter:e=>Object(F.j)(e,{unit:i,showUnit:!1,fixed:2}),yAxisId:"left"},{color:"error",dataKey:"ForageAmount1",name:t("dosage"),unit:Object(F.l)("weight",i),valueConverter:e=>Object(F.j)(e,{unit:i,showUnit:!1,fixed:2}),yAxisId:"right"}],s=[Object(z.f)(a)===B.a.BOTH?{x:"".concat(Object(z.d)(n,a)),color:"blue",position:"middle",name:B.c.includes(a.SetData.Type)?t("modals.feedingManageFeedingModal.inseminationDate"):t("modals.feedingManageFeedingModal.parturitionDate")}:null].filter(e=>!!e),c=w()(a,"SetData.Days",[]);return r.a.createElement("div",{style:{height:"20rem"}},r.a.createElement(R.a,{dataDef:o,tooltipLabelFormatter:e=>"".concat(t("curveDay")," ").concat(e),data:c.map((e,t)=>function(e){for(var t=1;tObject(F.j)(e,{unit:i,showUnit:!1,fixed:2}),yAxisId:"left"},{color:"green",dataKey:"ForageAmount",name:n("$t(dosage) [$t(after)]"),chartType:"Bar",unit:Object(F.l)("weight",i),valueConverter:e=>Object(F.j)(e,{unit:i,showUnit:!1,fixed:2}),yAxisId:"left"},{color:"warning",dataKey:"DailyPlan1",name:n("$t(newSettings.chainFeeding.scheduleAnalog.title) [$t(before)]"),chartType:"Area",type:"step",valueConverter:e=>e+1,yAxisId:"right"},{color:"info",dataKey:"DailyPlan",name:n("$t(newSettings.chainFeeding.scheduleAnalog.title) [$t(after)]"),chartType:"Area",type:"step",valueConverter:e=>e+1,yAxisId:"right"}],s=w()(e,"SetData.Days",[]),c=w()(t,"SetData.Days",[]),l=Math.max(s.length,c.length),m=[];for(let r=0;r"".concat(n("curveDay")," ").concat(e),data:m,type:"Composed",Yaxis:{name:n("dosage")},secondYaxis:{name:n("newSettings.chainFeeding.scheduleAnalog.title")},Xaxis:{name:n("curveDay"),dataKey:"name"}})))}}var q=Object(I.a)()(V),H=(a("i8MS"),a("17UY"),a("XzT5")),U=a("AAik"),G=a("uw8+");class Y extends n.Component{render(){const{log:{ObjNew:e,ObjOld:t},code:a,t:n}=this.props,i=w()(e,"SetData.Doses.length",0),o=w()(t,"SetData.Doses.length",0),s=Math.max(i,o),c=[],l=[];for(let r=0;r{const{t:t}=this.props,a=Object(A.getFeedingUnit)();return[{name:t("newSettings.dispenserWST.feeding.maxSingleDose"),value:X()(e,"maxSingularDose")&&(n=w()(e,"maxSingularDose"),Object(F.j)(n,{showUnit:!0,unit:a,fixed:a?2:0}))},{name:t("newSettings.dispenserWST.feeding.timeBetweenDoses"),value:X()(e,"timeBetweenDoses")&&"".concat(w()(e,"timeBetweenDoses"),"s")},{name:t("newSettings.dispenserWST.feeding.globalLock"),value:w()(e,"globalLock")},{name:t("newSettings.dispenserWST.feeding.overloadDetection"),value:w()(e,"overloadDetection")},{name:t("newSettings.dispenserWST.feeding.maxCurrentFluctuation"),value:X()(e,"maxCurrentFluctuation")&&"".concat(w()(e,"maxCurrentFluctuation"),"mA")},{name:t("newSettings.dispenserWST.feeding.maxOverfluctuationTime"),value:X()(e,"maxOverfluctuationTime")&&"".concat(w()(e,"maxOverfluctuationTime"),"ms")}];var n}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props;return[{name:t("newSettings.silo.generalSetup.sweepWeights"),value:X()(e,"sweepWeights")&&w()(e,"sweepWeights")},{name:t("newSettings.silo.generalSetup.isPin"),value:X()(e,"isPin")&&w()(e,"isPin")},{name:t("newSettings.silo.generalSetup.pin"),value:w()(e,"pin")},{name:t("newSettings.silo.generalSetup.flashDisplay"),value:X()(e,"flashDisplay")&&w()(e,"flashDisplay")},...new Array(8).fill(0).map((a,n)=>{return{name:t("newSettings.silo.generalSetup.minWeights",{type:n+1}),value:X()(e,"minWeights[".concat(n,"].value"))&&(r=w()(e,"minWeights[".concat(n,"].value")),Object(F.j)(r,{showUnit:!0,unit:ne.a.MEDIUM,fixed:0}))};var r})]}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,a=e=>Object(F.f)(e,{fixed:1,unit:ne.a.SMALL,showUnit:!0,acceptNil:!0}),n=e=>Object(F.e)(e,{fixed:1,unit:ne.a.SMALL,showUnit:!0,acceptNil:!0}),r=e=>"".concat(Object(ce.c)(e).toFixed(1),"%");return[{name:t("settings.desiredTemp"),value:X()(e,"requestedAirTemperature")?a(w()(e,"requestedAirTemperature")):null},{name:t("settings.desiredTempDeviation"),value:X()(e,"requestedTemperatureDeviation")?a(w()(e,"requestedTemperatureDeviation")):null},{name:t("settings.bandwithVenting"),value:X()(e,"bandWidth")?a(w()(e,"bandWidth")):null},{name:t("settings.minVenting"),value:X()(e,"ventilationConfiguration.minimumVentilation")?r(w()(e,"ventilationConfiguration.minimumVentilation")):null},{name:t("settings.maxVenting"),value:X()(e,"ventilationConfiguration.maximumVentilation")?r(w()(e,"ventilationConfiguration.maximumVentilation")):null},{name:t("settings.stopVenting"),value:X()(e,"ventilationConfiguration.ventilationSuspension")?Object(G.e)(1e3*w()(e,"ventilationConfiguration.ventilationSuspension")):null},{name:t("settings.minVentingDeviation"),value:X()(e,"ventilationConfiguration.minimumVentilationDeviation")?r(w()(e,"ventilationConfiguration.minimumVentilationDeviation")):null},{name:t("settings.maximumVentilationDeviation"),value:X()(e,"ventilationConfiguration.maximumVentilationDeviation")?r(w()(e,"ventilationConfiguration.maximumVentilationDeviation")):null},{name:t("$t(settings.floor) 1"),value:X()(e,"floors[0]")?a(w()(e,"floors[0]")):null},{name:t("$t(settings.floor) 2"),value:X()(e,"floors[1]")?a(w()(e,"floors[1]")):null},{name:t("$t(settings.floor) 3"),value:X()(e,"floors[2]")?a(w()(e,"floors[2]")):null},{name:t("settings.holdFor20Percent"),value:X()(e,"maximumHoldFor20Percent")?a(w()(e,"maximumHoldFor20Percent")):null},{name:t("settings.manualOperation"),value:X()(e,"manual")?Object(G.c)(w()(e,"manual")):null},{name:t("settings.minTempAlarmDeviation"),value:X()(e,"alarms.minimumTemperatureAlarmDeviation")?a(w()(e,"alarms.minimumTemperatureAlarmDeviation")):null},{name:t("settings.maxTempAlarmDeviation"),value:X()(e,"alarms.maximumTemperatureAlarmDeviation")?a(w()(e,"alarms.maximumTemperatureAlarmDeviation")):null},{name:t("settings.alarmDeviationFromTemp"),value:X()(e,"alarms.outsideAlarmDeviation")?a(w()(e,"alarms.outsideAlarmDeviation")):null},{name:t("settings.absoluteAlarm"),value:X()(e,"alarms.absoluteAlarm")?a(w()(e,"alarms.absoluteAlarm")):null},{name:t("settings.heaterVentilation"),value:X()(e,"additionalHeatingVentilation")?Object(G.c)(w()(e,"additionalHeatingVentilation")):null},{name:t("settings.heatingDeviation"),value:X()(e,"heatingDeviation")?a(w()(e,"heatingDeviation")):null},{name:t("settings.heaterOpTime"),value:X()(e,"heatingWorkTime")?Object(G.e)(1e3*w()(e,"heatingWorkTime")):null},{name:t("settings.heaterBreakTime"),value:X()(e,"heatingBreakTime")?Object(G.e)(1e3*w()(e,"heatingBreakTime")):null},{name:t("$t(settings.switchOnTemp) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingEnableTemperature")?a(w()(e,"coolingConfiguration.coolingEnableTemperature")):null},{name:t("$t(settings.operatingTime) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingWorkTime")?Object(G.e)(1e3*w()(e,"coolingConfiguration.coolingWorkTime")):null},{name:t("$t(settings.breakTime) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingBreakTime")?Object(G.e)(1e3*w()(e,"coolingConfiguration.coolingBreakTime")):null},{name:t("$t(settings.maxHumidity) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingMaximumHumidity")?Object(G.c)(w()(e,"coolingConfiguration.coolingMaximumHumidity")):null},{name:t("$t(settings.minPressure) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingMinimumPressure")?n(w()(e,"coolingConfiguration.coolingMinimumPressure")):null},{name:t("$t(settings.maxPressuer) ($t(chamber.chart.cooling))"),value:X()(e,"coolingConfiguration.coolingMaximumPressure")?n(w()(e,"coolingConfiguration.coolingMaximumPressure")):null}]}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props;return[{name:t("modals.cageWorkMode.title"),value:X()(e,"workType")?(a=w()(e,"workType"),t("chamber.separationCageInfo.work.".concat(a))):null}];var a}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,a=Object(A.getFeedingUnit)(),n=e=>Object(F.j)(e,{showUnit:!0,unit:a,fixed:a?2:0});return[{name:t("newSettings.dispenserNRF.workType.workType"),value:X()(e,"workType")?(e=>{switch(e){case B.g.RFID:return t("rfid");case B.g.SCHEDULE:return t("schedule");case B.g.TRIGGER:return t("newSettings.dispenserNRF.workType.toy");default:return null}})(w()(e,"workType")):null},{name:t("newSettings.dispenserNRF.workType.initDose"),value:X()(e,"initDose")?n(w()(e,"initDose")):null},{name:t("newSettings.dispenserNRF.workType.maxOneDose"),value:X()(e,"maxOneDose")?n(w()(e,"maxOneDose")):null},{name:t("newSettings.dispenserNRF.workType.timeOrImpulse"),value:X()(e,"timeOrImpulse")?(e=>{switch(e){case"T":return t("time");case"I":return t("newSettings.dispenserNRF.workType.impulse");default:return null}})(w()(e,"timeOrImpulse")):null},{name:t("newSettings.dispenserNRF.workType.buttonWorkType"),value:X()(e,"optButt")?(e=>{switch(e){case 0:return t("newSettings.dispenserNRF.workType.punishment");case 1:return t("newSettings.dispenserNRF.workType.extraFeeding");default:return null}})(w()(e,"optButt")):null}]}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props;return[{name:t("workType"),value:X()(e,"workType")?(a=w()(e,"workType"),t("deviceRows.chainFeeding.chainFeedingRow.workTypes.".concat(["inactive","manual","automatic","schedule"][a]))):null},{name:t("modals.chainFeedingConfigureModal.excessWorkTime"),value:X()(e,"excessWorkTime")?Object(G.b)(w()(e,"excessWorkTime")):null},{name:t("modals.chainFeedingConfigureModal.maxWorkTime"),value:X()(e,"maxWorkTime")?Object(G.b)(w()(e,"maxWorkTime")):null},{name:t("modals.chainFeedingConfigureModal.activeSensor"),value:X()(e,"sensorID")?(e=>t("modals.chainFeedingConfigureModal.sensor",{number:e+1}))(w()(e,"sensorID")):null}];var a}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,a=e=>t("newSettings.feeding.curves.editDays.days",{count:e});return[{name:t("chamber.separationCageInfo.work.1"),value:X()(e,"training1")?a(w()(e,"training1")):null},{name:t("chamber.separationCageInfo.work.2"),value:X()(e,"training2")?a(w()(e,"training2")):null},{name:t("chamber.separationCageInfo.work.3"),value:X()(e,"training3")?a(w()(e,"training3")):null},{name:t("chamber.separationCageInfo.work.4"),value:X()(e,"separation")?a(w()(e,"separation")):null},{name:t("chamber.separationCageInfo.work.5"),value:X()(e,"expedition")?a(w()(e,"expedition")):null}]}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,a=e=>"".concat(e,"ms");return[{name:t("newSettings.dispenserNRF.motorSetup.timeOn"),value:X()(e,"timeOn")?a(w()(e,"timeOn")):null},{name:t("newSettings.dispenserNRF.motorSetup.timeBreak"),value:X()(e,"timeBreak")?Object(G.e)(w()(e,"timeBreak")):null},{name:t("newSettings.dispenserNRF.motorSetup.timeBetweenImpulses"),value:X()(e,"timeBetweenImpulses")?a(w()(e,"timeBetweenImpulses")):null},{name:t("newSettings.dispenserNRF.motorSetup.currentOverloadTime"),value:X()(e,"currentOverloadTime")?a(w()(e,"currentOverloadTime")):null},{name:t("newSettings.dispenserNRF.motorSetup.timeAbsent"),value:X()(e,"timeAbsent")?Object(G.b)(w()(e,"timeAbsent")):null}]}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props;return[{name:t("curveDay"),value:X()(e,"currentCurveDay")?(a=w()(e,"currentCurveDay"),a-w()(e,"stages.[1].days",0)||null):null},{name:t("modals.climateCurve.recorderEraseHour"),value:X()(e,"recorderEraseTime")?Et(w()(e,"recorderEraseTime")):null}];var a},this.convertStages=e=>(Pe()(e)?e:[]).map((e,t)=>({Days:+e.days,Ventilation:[+e.minimumVentilation,+e.maximumVentilation],ExpectedTemperature:+e.requestedTemperature}))}render(){const{log:{ObjNew:e,ObjOld:t},code:a,t:n}=this.props,i=this.getData(e),o=this.getData(t),s=this.convertStages(w()(e,"stages")),c=this.convertStages(w()(t,"stages")),l=i.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,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"];return[{name:t("settings.language"),value:X()(e,"language")?(n=w()(e,"language"),["polski","\u0440\u0443\u0441\u0441\u043a\u0438\u0439"][n]):null},{name:t("settings.chimneyFansAmount"),value:X()(e,"chimneyVentilatorsCount")?w()(e,"chimneyVentilatorsCount"):null},{name:t("settings.heatersAmount"),value:X()(e,"heatersCount")?w()(e,"heatersCount"):null},{name:t("settings.mastersAmount"),value:X()(e,"mastersCount")?w()(e,"mastersCount"):null},{name:t("settings.cooling"),value:X()(e,"cooling")?w()(e,"cooling"):null},{name:t("settings.heatingType"),value:X()(e,"heatingType")?(e=>[null,t("settings.floorType"),t("settings.waterType")][e])(w()(e,"heatingType")):null},{name:t("settings.floorHeatingCircuitsAmount"),value:X()(e,"floorHeating")?w()(e,"floorHeating"):null},{name:t("settings.objectDynamics"),value:X()(e,"objectDynamics")?Object(G.b)(w()(e,"objectDynamics")):null},{name:t("settings.ventilationIntensity"),value:X()(e,"ventilationIntensity")?(e=>"".concat(Object(ce.c)(e).toFixed(1),"%"))(w()(e,"ventilationIntensity")):null},{name:t("settings.ventilationCycleTime"),value:X()(e,"ventilationCycleTime")?Object(G.e)(w()(e,"ventilationCycleTime")):null},{name:t("settings.minRotations"),value:X()(e,"minimumRotation")?Object(G.c)(w()(e,"minimumRotation")):null},{name:t("settings.calibration55"),value:X()(e,"rotation55PercentCalibration")?Object(G.c)(w()(e,"rotation55PercentCalibration")):null},...new Array(5).fill(0).map((a,n)=>({name:t("$t(calibration) - $t(settings.tempSensor) ".concat(n+1)),value:X()(e,"temperatureSensorsCalibration[".concat(n,"]"))?Object(G.c)(w()(e,"temperatureSensorsCalibration[".concat(n,"]"))):null})),...new Array(15).fill(0).map((n,r)=>({name:t("$t(settings.firstAnalOutCurve) $t(settings.pointX)",{number:"".concat(r+1," ").concat(a[r])}),value:X()(e,"analogOutputs.firstAnalogOutputCurve[".concat(r,"]"))?Object(G.c)(w()(e,"analogOutputs.firstAnalogOutputCurve[".concat(r,"]"))):null})),...Ve()(new Array(5).fill(0).map((a,n)=>[{name:t("settings.minVoltageAnalOut",{number:n+2}),value:X()(e,"analogOutputs.additionalAnalogOutputs[".concat(n,"].minimumVoltage"))?Object(G.c)(w()(e,"analogOutputs.additionalAnalogOutputs[".concat(n,"].minimumVoltage"))):null},{name:t("settings.maxVoltageAnalOut",{number:n+2}),value:X()(e,"analogOutputs.additionalAnalogOutputs[".concat(n,"].maximumVoltage"))?Object(G.c)(w()(e,"analogOutputs.additionalAnalogOutputs[".concat(n,"].maximumVoltage"))):null}]))];var n}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props;return Ve()(new Array(3).fill(0).map((a,n)=>[{name:t("$t(punishment) - $t(newSettings.feeding.general.time)",{type:n+1}),value:X()(e,"[".concat(n,"].time"))?Object(G.b)(6e4*w()(e,"[".concat(n,"].time"))):null},{name:t("$t(punishment) - $t(newSettings.feeding.general.percentage)",{type:n+1}),value:X()(e,"[".concat(n,"].percentage"))?Object(G.c)(w()(e,"[".concat(n,"].percentage"))):null},{name:t("$t(punishment) - $t(newSettings.feeding.general.trigger)",{type:n+1}),value:X()(e,"[".concat(n,"].trigger"))?w()(e,"[".concat(n,"].trigger")):null}]))}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:a}=this.props,n=w()(e,"WData.Period"),r=w()(e,"WordID");return Ve()([{name:a("modals.editControlListSettingsModal.period"),value:X()(e,"WData.Period")&&(i=w()(e,"WData.Period"),{[Ze.b.END_OF_MONTH]:a("modals.editControlListSettingsModal.endOfMonth"),[Ze.b.X_DAYS]:a("modals.editControlListSettingsModal.xDays"),[Ze.b.TO_DAY_IN_MONTH]:a("modals.editControlListSettingsModal.dayOfMonth"),[Ze.b.RANGE]:a("modals.editControlListSettingsModal.range")}[i])},t||"0"===n?{name:a("numberOfDays"),value:X()(e,"WData.Day")?w()(e,"WData.Day"):null}:null,t||"2"===n?{name:a("modals.editControlListSettingsModal.monthDay"),value:X()(e,"WData.MonthDay")?w()(e,"WData.MonthDay"):null}:null,t||"3"===n?{name:a("modals.editControlListSettingsModal.startDay"),value:X()(e,"WData.StartDay")?yt(w()(e,"WData.StartDay")):null}:null,t||"3"===n?{name:a("modals.editControlListSettingsModal.endDay"),value:X()(e,"WData.EndDay")?yt(w()(e,"WData.EndDay")):null}:null,t||r===Ze.a.INSEMINATIONS?{name:a("modals.editControlListSettingsModal.daysToHeat"),value:X()(e,"WData.InseminationTime")?Pe()(w()(e,"WData.InseminationTime"))?"".concat(yt(w()(e,"WData.InseminationTime[0]"))," - ").concat(yt(w()(e,"WData.InseminationTime[1]"))):yt(w()(e,"WData.InseminationTime")):null}:null,t||r===Ze.a.REMANENT?{name:a("modals.editControlListSettingsModal.defaultActiveNipples"),value:X()(e,"WData.DefaultActiveNipples")?w()(e,"WData.DefaultActiveNipples"):null}:null,t||r===Ze.a.CONDITION?new Array(w()(e,"WData.ConditionDays.length",0)).fill(0).map((t,n)=>({name:a("modals.editControlListSettingsModal.dayAfterInsemination",{amount:n+1}),value:X()(e,"WData.ConditionDays[".concat(n,"]"))?w()(e,"WData.ConditionDays[".concat(n,"]")):null})):[],t||r===Ze.a.USG?new Array(w()(e,"WData.USGDays.length",0)).fill(0).map((t,n)=>({name:a("modals.editControlListSettingsModal.dayAfterInsemination",{amount:n+1}),value:X()(e,"WData.USGDays[".concat(n,"]"))?w()(e,"WData.USGDays[".concat(n,"]")):null})):[]]).filter(e=>!!e);var i}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t,!0),o=n.map((e,t)=>function(e){for(var t=1;te.name===t.name),"value")}));return r.a.createElement(Z,{code:a,data:o})}}var at=Object(I.a)()(tt),nt=a("r8wt");function rt(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 it(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ot extends n.Component{constructor(...e){super(...e),this.getData=e=>{const{t:t}=this.props;return[{name:t("modals.medicineModal.type"),value:X()(e,"WData.Type")&&(a=w()(e,"WData.Type"),{[nt.b.STIMULATOR]:t("modals.medicineModal.stimulator"),[nt.b.FORAGE]:t("medicalFeed"),[nt.b.VACCINE]:t("modals.medicineModal.vaccine"),[nt.b.DOSATRON]:t("dosatron")}[a])},{name:t("designation"),value:X()(e,"WData.Name")&&w()(e,"WData.Name")},{name:t("dosage"),value:X()(e,"WData.Dose")&&w()(e,"WData.Dose")},{name:t("unit"),value:X()(e,"WData.Unit")&&w()(e,"WData.Unit")},{name:t("modals.medicineModal.gracePeriod"),value:X()(e,"WData.GracePeriod")&&w()(e,"WData.GracePeriod")},{name:t("price"),value:X()(e,"WData.Price")&&w()(e,"WData.Price")},{name:t("color"),value:X()(e,"WData.Color")&&w()(e,"WData.Color")}];var a}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{const{t:t}=this.props,a={},n=w()(e,"WData",{}),r={Address:t("address"),HerdNumber:t("dictionariesView.herdNumber"),NIP:"NIP",Phone:t("phoneNumber"),Website:"WWW",Short:t("abbreviation"),Color:t("color")},i=Object.keys(n).filter(e=>"cimode"!==e);for(let o of i)(n[o]||[]).forEach(e=>{const{ID:t,Value:n}=e;a[o]||(a[o]={}),a[o][t]=n||"";const i=[];for(let a in r)D()(e[a])||i.push("".concat(r[a],"=").concat(e[a]));i.length&&(a[o][t]="".concat(a[o][t]," (").concat(i.join(", "),")"))});return console.log("updatedictinaryy",a,r),a}}render(){const{log:e,log:{ObjNew:t,ObjOld:a},code:n}=this.props,i=w()(t,"Type");if(_e.a.medicine===i)return r.a.createElement(st,{log:e,code:n});if(_e.a.controlLists===i)return r.a.createElement(at,{log:e,code:n});const o=this.getData(t),s=this.getData(a),c=vt(o,s);console.log("DIFFFF",c,o,s);const l=Object.keys(c),m=[],d=e=>w()(Qe.find(t=>t.code===e),"nativeName",e);for(let r of l){const e=d(r);Object.entries(c[r]).forEach(([t,a])=>{m.push({name:e,value:a,valueBefore:w()(s,"".concat(r,".").concat(t))})})}return console.log(d),r.a.createElement(Z,{code:n,data:m})}}var lt=Object(I.a)()(ct),mt=(a("kCmh"),a("eWv+")),dt=a("/MKj");function ut(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 pt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ht extends n.Component{constructor(...e){super(...e),this.getData=e=>{const{t:t,dictionaries:{NAMES:{MEDICINE:a}={}}={}}=this.props,n=e=>a[e]||null;return Ve()([{name:t("modals.medicineModal.type"),value:X()(e,"WData.AnimalKind")?(r=w()(e,"WData.AnimalKind"),t("animalKind.".concat(r))):null},{name:t("designation"),value:X()(e,"WData.Name")&&w()(e,"WData.Name")},...new Array(w()(e,"WData.MedicineList.length")).fill(0).map((a,r)=>[{name:t("medicine"),value:X()(e,"WData.MedicineList[".concat(r,"].Age"))?w()(e,"WData.MedicineList[".concat(r,"].Age")):null},{name:t("medicine"),value:X()(e,"WData.MedicineList[".concat(r,"].Medicine"))?n(w()(e,"WData.MedicineList[".concat(r,"].Medicine"))):null}])]);var r}}render(){const{log:{ObjNew:e,ObjOld:t},code:a}=this.props,n=this.getData(e),i=this.getData(t),o=n.map((e,t)=>function(e){for(var t=1;t{switch(t){case 2080:return r.a.createElement(q,null);case 2081:return r.a.createElement(J,null);case 2090:return r.a.createElement(ae,null);case 2091:return r.a.createElement(se,null);case 2092:return r.a.createElement(ue,null);case 2093:return r.a.createElement(be,null);case 2094:return r.a.createElement(Oe,null);case 2095:return r.a.createElement(we,null);case 2104:return r.a.createElement(Ie,null);case 2108:return r.a.createElement(Ne,null);case 2111:return r.a.createElement(We,null);case 2112:return r.a.createElement(Ge,null);case 2116:return r.a.createElement(Xe,null);case 2210:return r.a.createElement(lt,null);case 2211:return r.a.createElement(at,null);case 2212:return r.a.createElement(st,null);case 2213:return r.a.createElement(gt,null);default:return Object(bt.i)()?r.a.createElement(N,null):null}},Dt=e=>D()(e)?H.a.t("none"):y()(e)?r.a.createElement("i",{className:"fas fa-".concat(e?"check":"times")}):h()(e)&&e.startsWith("#")?r.a.createElement("div",{style:{background:e,height:"100%"}}):e,vt=(e,t)=>u()(e,(e,a,n)=>{b()(t)&&!O()(a,t[n])&&(e[n]=b()(a)&&b()(t[n])?vt(a,t[n]):a)}),Ot=e=>O()(e.value,e.valueBefore)?"":D()(e.value)||D()(e.valueBefore)?D()(e.value)?"error":"success":"info",Et=e=>m()(e).format("HH:mm"),yt=e=>m()(e).format("DD.MM.YY");var jt=a("mzFT"),wt=a("VyNe"),Ct=a("zM5D"),St=a("UGc4"),Tt=a("0pzG"),It=a("gu+X"),kt=a("v9qu"),xt=a("BkRI"),Mt=a.n(xt),Nt=a("x6Bg"),At=a("2wEF"),Pt=a("ANjH");class Ft extends n.Component{constructor(e){super(e),this.handleError=e=>{this.setState({isError:!0,isLoading:!1})},this.handleData=e=>{this.setState({isError:!1,isLoading:!1,data:Mt()(e)||null})},this.state={isLoading:!0,isError:!1,data:null}}componentDidMount(){const{ID:e,TableName:t}=this.props;Object(Nt.a)({ObjID:e,TableName:t}).then(this.handleData).catch(this.handleError)}render(){const{isLoading:e,isError:t,data:a}=this.state,{onClear:n,t:i}=this.props;return r.a.createElement("div",{onClick:n},e&&r.a.createElement("span",{className:"loading-animation"},i("logView.loading")),t&&r.a.createElement("span",null,i("farms.tabs.generalTab.errorLoadingData")),!D()(a)&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"table-responsive"},r.a.createElement(C.a,{json:a}))),D()(a)&&!e&&r.a.createElement(At.a,null))}}Ft.propTypes={ID:T.a.string.isRequired,TableName:T.a.string.isRequired};var zt=Object(Pt.d)(Object(I.a)())(Ft),Bt=a("nqY3");a("8Hrd");class Rt extends n.Component{constructor(...e){super(...e),this.state={selected:null},this.onSelect=({ID:e,TableName:t})=>{const{selected:a}=this.state;a&&a.ID===e?this.onClear():this.setState({selected:{ID:e,TableName:t}})},this.onClear=()=>{this.setState({selected:null})},this.renderRow=({ID:e,TableName:t})=>{const{dictionaries:a,t:n}=this.props,{iconClassName:i,name:c}=Mt()(Bt.a.createLogParser({ObjID:e,TableName:t},a).getData());return r.a.createElement(s.a,{xs:12},r.a.createElement(o.a,null,r.a.createElement(s.a,{xs:2,className:"d-flex position-relative justify-content-center align-items-center"},r.a.createElement("i",{className:"".concat(i," fa-2x opacity-25")}),r.a.createElement("div",null,r.a.createElement("strong",null,t))),r.a.createElement(s.a,{className:"d-flex justify-content-center align-items-center flex-column"},c,r.a.createElement("i",{className:"opacity-50"},"ID: ",e)),r.a.createElement(s.a,{className:"d-flex justify-content-center align-items-center"},r.a.createElement("i",{className:"pointer",onClick:()=>this.onSelect({ID:e,TableName:t})},n("logsView.showObject")))))}}render(){const{log:{LinkedIDs:e=[]}={},t:t}=this.props,{selected:a}=this.state;return Pe()(e)&&0!==e.length?r.a.createElement("div",{className:"log-linked-ids"},r.a.createElement("h4",{className:"justify-content-center"},t("logsView.linkedObjects")),r.a.createElement(s.a,{xs:12},e.map(({ID:e,TableName:n})=>r.a.createElement("div",{className:"linked-id".concat(a&&a.ID===e?" selected":"")},this.renderRow({ID:e,TableName:n}),!!a&&a.ID===e&&r.a.createElement(s.a,{xs:12},t("logsView.databaseObject"),r.a.createElement(zt,{onClear:this.onClear,key:"".concat(a.ID,"_").concat(a.TableName),ID:a.ID,TableName:a.TableName})))))):null}}Rt.propTypes={log:T.a.object.isRequired};var Wt=Object(Pt.d)(Object(I.a)(),Object(dt.connect)((function(e){return{dictionaries:Object(mt.b)(e)}})))(Rt),Lt=a("i8i4"),Vt=a.n(Lt);function qt(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 Ht(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class Ut extends n.Component{constructor(...e){super(...e),this.state={expanded:!1,mobile:Object(kt.a)()},this.onHide=()=>{this.setState({expanded:!1})},this.onShow=()=>{this.setState({expanded:!0})},this.getContent=()=>{const{log:e}=this.props,t=[];for(let a of e.Codes){const n=ft(0,+a);if(!n)continue;const r=t.findIndex(e=>e.component.type===n.type),i=t[r]||{props:{log:e,code:[]},component:n};i.props.code.push(+a),-1===r?t.push(i):t[r]=i}return t.map((e,t)=>r.a.cloneElement(e.component,function(e){for(var t=1;t!!e).length)return null;const o=Object(bt.i)();return r.a.createElement("div",null,r.a.createElement("i",{className:"pointer text-lowercase",onClick:this.onShow},a("modals.feedingSowInfoModal.details")),t&&r.a.createElement(jt.a,{name:a("modals.feedingSowInfoModal.details"),show:e,onHide:this.onHide},r.a.createElement(wt.a,null,i,!!o&&r.a.createElement(Wt,{log:n}))),!t&&Vt.a.createPortal(r.a.createElement(Ct.a,{restoreFocus:!1,onHide:this.onHide,show:e,size:"xl"},r.a.createElement(St.b,{title:a("modals.feedingSowInfoModal.details"),onCloseClick:this.onHide}),r.a.createElement(Tt.a,{disableFocus:!0},i,!!o&&r.a.createElement(Wt,{log:n})),r.a.createElement(It.a,{hasConfirmButton:!1,confirmText:a("close"),onCloseClick:this.onHide})),document.getElementById("center-content")||document.createElement("div")))}}var Gt=Object(I.a)()(Ut);class Yt extends n.Component{constructor(...e){super(...e),this.onClick=()=>{console.table(this.props.log.log)}}render(){const{index:e,style:t,log:{log:a,name:n,iconClassName:l,translation:d,params:u,user:p}}=this.props,h=m()(a.DtaCrtTime).startOf("day").isSame(m()().startOf("day")),g=m()(a.DtaCrtTime);return r.a.createElement(i.a,{style:t,className:"log-item pt-2 pb-2 col",onClick:this.onClick,index:e},r.a.createElement(o.a,null,r.a.createElement(s.a,{title:n,xs:6,sm:6,md:6,lg:6,xl:6,className:"no-break-word font-weight-bold"},r.a.createElement("i",{className:l}),r.a.createElement(c.a,{i18nKey:n,defaults:n})),r.a.createElement(s.a,{title:g.format("DD.MM.YY HH:mm"),xs:6,sm:6,md:6,lg:6,xl:6,className:"text-right opacity-75"},g.format(h?"HH:mm":"DD.MM.YY HH:mm"))),r.a.createElement(o.a,null,r.a.createElement(s.a,{xs:12,className:"text-break pt-1 pb-1"},d.map((e,t)=>r.a.createElement("span",{key:t,className:t>0?"pr-1 text-lowercase":"pr-1"},r.a.createElement(c.a,{i18nKey:e,values:u[t],components:{italic:r.a.createElement("i",null),bold:r.a.createElement("strong",null)}}),d.length-1>t&&";",d.length-1<=t&&".")))),r.a.createElement(o.a,null,r.a.createElement(s.a,{xs:6,className:"no-break-word text-left opacity-50"},r.a.createElement(Gt,{log:a})),r.a.createElement(s.a,{title:p.name,xs:6,className:"no-break-word text-right opacity-50"},p.name)))}}t.a=Yt},"9Zq/":function(e,t,a){"use strict";a.d(t,"a",(function(){return M}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("3Z9Z"),s=a("JI6e"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("f0zD"),u=a("17x9"),p=a.n(u),h=(a("/YCi"),a("/MKj")),g=a("0b+E"),b=a("d/v1"),f=a("pJVQ"),D=a("tDQA"),v=a("4huo"),O=a("vzZS"),E=a("kCVf"),y=a("gLBR"),j=a("4ltZ"),w=a("zDJl"),C=a("AF5L"),S=a("LCzB"),T=a("XzT5"),I=a("84Ez"),k=a("s506"),x=a("0gjr");const M="forage-reactivate-modal";class N extends r.a.Component{constructor(e){super(e),this.getName=({index:e,forage:t})=>t?"".concat(e+1," (").concat(t.SetData.Name,")"):e+1,g.a.modalview(M)}render(){const{show:e,place:t,license:a,handleHide:n,forage:d,t:u,foragesWithEmptySpaces:p=[],handleSubmit:h}=this.props,g=p.map(e=>({value:e,name:this.getName(e)})).slice(0,a===k.b.EXTENDED?x.a.FEEDING_FORAGE_EXTENDED:x.a.FEEDING_FORAGE_BASIC);return r.a.createElement(i.a,{show:e,size:"lg",onHide:n},r.a.createElement(c.b,{title:T.a.t("modals.forageReactivateModal.reactivateXcurve",{type:d.SetData.Name}),onCloseClick:n}),r.a.createElement(l.a,{className:M},r.a.createElement("form",{onSubmit:h},r.a.createElement(o.a,null,r.a.createElement(s.a,{md:12},!!t&&!!t.forage&&r.a.createElement(O.a,{boxColor:"warning"},u("modals.forageReactivateModal.foundActiveForage")),r.a.createElement(b.a,{component:v.b,name:"place",options:g,label:u("modals.forageReactivateModal.choosePlace")}))))),r.a.createElement(m.a,{hasConfirmButton:!0,onCloseClick:n,formName:M}))}}N.propTypes={foragesWithEmptySpaces:p.a.array.isRequired,forage:p.a.object},N=Object(f.a)({form:M,onSubmit:(e,t,a)=>{const n=a.forage.clone(),{gateways:r}=a,{place:{forage:i,index:o}}=e,s=i?i.clone():null;if(s){const e=Object(E.n)(a.buildings,n.SetID,s.SetID);s.deleteSetting(),e.forEach(e=>{t(Object(j.e)(e))})}n.unDeleteSetting(),n.SetData.Index=o,s&&t(Object(y.c)(s.prepareBeanToSave())),t(Object(y.c)(n.prepareBeanToSave(),()=>{r.forEach(e=>{Object(C.q)(e,n)})})),a.handleHide()},validate:(e,t)=>{const a={},{t:n}=t;return e.place||(a.place=n("required")),a}})(N);const A=Object(D.a)(M);N=Object(h.connect)(e=>({place:A(e,"place"),buildings:e.farms.buildings,gateways:e.farmDevices.devices.filter(e=>e.DevType===w.d.GATEWAY),license:Object(I.a)(e,{licenseName:k.a.DISPENSER})}))(N),N=Object(d.a)({name:M})(N),t.b=Object(S.a)()(N)},Cpk7:function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a("q1tI"),r=a.n(n),i=a("f0zD"),o=a("HIda"),s=a("d/v1"),c=a("pJVQ"),l=a("tDQA"),m=a("zM5D"),d=a("UGc4"),u=a("0pzG"),p=a("/MKj"),h=a("gu+X"),g=a("OahN"),b=a("lM7y"),f=a("XzT5");var D=a("0b+E"),v=a("26mJ"),O=a("4huo"),E=a("r8wt"),y=a("fckJ"),j=a("LCzB");const w="medicine-modal";class C extends r.a.Component{constructor(e){super(e),this.onTypeChange=(e,t)=>{let a;switch(console.log(t),t){case E.b.FORAGE:a="g/100kg";break;case E.b.VACCINE:a="ml/100kg";break;default:a=null}this.props.change("WData.Unit",a)};const{edit:t,medicine:a}=e;t&&this.props.initialize(a),D.a.modalview(w)}render(){const{show:e,handleHide:t,handleSubmit:a,type:n,edit:i,medicine:c,t:l}=this.props;return r.a.createElement(m.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:a},r.a.createElement(d.a,{title:i?f.a.t("modals.medicineModal.title2",{type:c.WData.Name}):l("modals.medicineModal.title1"),onCloseClick:t}),r.a.createElement(u.a,null,r.a.createElement(o.a,{name:"WData"},r.a.createElement(s.a,{name:"Name",component:v.a,type:"text",label:l("designation"),id:"name"}),r.a.createElement(s.a,{name:"Dose",component:v.a,type:"number",label:l("dosage"),id:"dose",min:1}),r.a.createElement(s.a,{name:"Type",component:O.b,label:l("modals.medicineModal.type"),options:[{name:l("modals.medicineModal.stimulator"),value:E.b.STIMULATOR},{name:l("medicalFeed"),value:E.b.FORAGE},{name:l("modals.medicineModal.vaccine"),value:E.b.VACCINE},{name:l("dosatron"),value:E.b.DOSATRON}],onChange:this.onTypeChange,init:!0}),(n===E.b.STIMULATOR||n===E.b.DOSATRON)&&r.a.createElement(s.a,{name:"Unit",component:O.b,label:l("unit"),options:[{name:"ml/100kg",value:"ml/100kg"},{name:"g/100kg",value:"g/100kg"}],init:!0}),r.a.createElement(s.a,{name:"GracePeriod",component:v.a,type:"number",label:l("modals.medicineModal.gracePeriod"),unit:l("days"),id:"gracePeriod",min:1}),r.a.createElement(s.a,{name:"Price",component:v.a,type:"number",label:l("price"),id:"price",min:1}),r.a.createElement("label",null,l("color")),r.a.createElement(s.a,{name:"Color",component:y.a}))),r.a.createElement(h.a,{hasConfirmButton:!0,confirmText:l("save"),onCloseClick:t,formName:w})))}}C=Object(c.a)({form:w,onSubmit:async function(e,t,a){const{edit:n,medicine:r}=a;let i=a.user.user;if(n){let a=r.clone();a.WData=e.WData,t(Object(b.d)(a.prepareBeanToSave(),i.ClientID,i.LocalUserID))}else{const{WData:{Color:a,Dose:n,GracePeriod:r,Name:o,Price:s,Type:c,Unit:l}}=e;let m=g.a.createMedicine(o,+n,c,l,+r,+s,a);t(Object(b.a)(m,i.ClientID,i.LocalUserID))}a.handleHide()},validate:function(e,t){const a={WData:{}},{t:n}=t;return e.WData?(e.WData.Name||(a.WData.Name=n("required")),e.WData.Dose?e.WData.Dose<=0&&(a.WData.Dose=f.a.t("errors.lessVal",{count:1})):a.WData.Dose=n("required"),e.WData.Type||(a.WData.Type=n("required")),e.WData.Unit||(a.WData.Unit=n("required")),e.WData.GracePeriod?e.WData.GracePeriod<=0&&(a.WData.GracePeriod=f.a.t("errors.lessVal",{count:1})):a.WData.GracePeriod=n("required"),e.WData.Price?e.WData.Price<=0&&(a.WData.Price=f.a.t("errors.lessVal",{count:1})):a.WData.Price=n("required"),e.WData.Color||(a.WData.Color=n("required"))):(a.WData.Name=n("required"),a.WData.Dose=n("required"),a.WData.Type=n("required"),a.WData.Unit=n("required"),a.WData.GracePeriod=n("required"),a.WData.Price=n("required"),a.WData.Color=n("required")),a}})(C),C=Object(i.a)({name:w})(C);const S=Object(l.a)(w);C=Object(p.connect)(e=>({user:e.user,type:S(e,"WData.Type")}))(C);t.b=Object(j.a)()(C)},ETy9:function(e,t,a){},EooJ:function(e,t,a){"use strict";a.d(t,"a",(function(){return pe}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("17x9"),d=a.n(m),u=a("RFJ0"),p=a("3t43"),h=a("pJVQ"),g=a("d/v1"),b=a("26mJ"),f=a("/MKj"),D=a("PRyg"),v=a("LCzB"),O=a("BvFm");class E extends r.a.Component{constructor(...e){super(...e),this.checkDate=e=>{const{farm:t,t:a}=this.props;if(!Object(O.i)()&&Object(D.isEventDateInvalid)(e,t))return a("required")}}render(){const{member:e,children:t,t:a,onChange:n}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement(g.a,{name:e?"".concat(e,".EvTime"):"EvTime",component:b.a,label:a("eventData.time"),type:"datetime-local",onChange:n,validate:this.checkDate}),t,r.a.createElement(g.a,{name:e?"".concat(e,".Comment"):"Comment",component:b.a,label:a("comment"),type:"text"}))}}(E=Object(f.connect)(e=>({farm:e.location.farm}))(E)).propTypes={member:d.a.string};var y=Object(v.a)()(E),j=a("4huo"),w=a("i8MS"),C=a("tkTQ");class S extends r.a.Component{constructor(e){super(e),this.state={boars:w.a.getAllAnimals(e.farm,C.a.BOAR,!0).map(e=>({name:e.AnmNo1,value:e.AnmID}))||[]}}render(){const{member:e,t:t}=this.props,{boars:a}=this.state;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.BoarID"):"EvData.BoarID",component:j.b,label:t("boar"),options:a}))}}(S=Object(f.connect)(e=>({farm:e.location.farm}))(S)).propTypes={member:d.a.string};var T=Object(v.a)()(S),I=a("Y+p1"),k=a.n(I),x=a("E+oP"),M=a.n(x),N=a("J2iB"),A=a.n(N),P=a("BkRI"),F=a.n(P),z=a("wd/R"),B=a.n(z),R=a("iaLV"),W=a("uUZO");function L(e){return F()(e).map(e=>{for(let t in e)if(Array.isArray(e[t]))for(let a of e[t])a.EvTime=B()(a.EvTime).format("YYYY-MM-DDTHH:mm");return e})}var V=a("10H7"),q=a("tDQA"),H=a("Dn3e");class U extends r.a.Component{render(){const{member:e,t:t,usgResult:a}=this.props,n=[{name:t("events.usgEvent.negative"),value:H.USG_STATE.NEGATIVE},{name:t("events.usgEvent.positive"),value:H.USG_STATE.POSITIVE},{name:t("events.usgEvent.toRepeat"),value:H.USG_STATE.REPEAT}],i=n.find(e=>e.value===a);return r.a.createElement(y,{member:e},r.a.createElement(g.a,{label:t("testResult"),name:e?"".concat(e,".EvData.Pregnant"):"EvData.Pregnant",component:j.b,options:n,init:i}))}}const G=Object(q.a)("edit-sow-cycle-modal");(U=Object(f.connect)((e,t)=>({usgResult:G(e,t.member?"".concat(t.member,".EvData.Pregnant"):"EvData.Pregnant")}))(U)).propTypes={member:d.a.string};var Y=Object(v.a)()(U);class J extends r.a.Component{render(){const{member:e,reasons:t,lang:a,t:n}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Reason"):"EvData.Reason",component:j.b,label:n("reason"),options:t.WData[a].map(e=>({name:e.Value,value:e.ID}))}))}}(J=Object(f.connect)(e=>({reasons:e.dictionary.noPreganancy,lang:e.language.lang.lang}))(J)).propTypes={member:d.a.string};var K=Object(v.a)()(J);class X extends r.a.Component{render(){const{member:e,t:t}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.HealthyCnt"):"EvData.HealthyCnt",component:b.a,type:"number",label:t("eventData.alive"),parse:e=>e?+e:null}),r.a.createElement(g.a,{name:e?"".concat(e,".EvData.DeadCnt"):"EvData.DeadCnt",component:b.a,type:"number",label:t("eventData.dead"),parse:e=>e?+e:null}),r.a.createElement(g.a,{name:e?"".concat(e,".EvData.MummyCnt"):"EvData.MummyCnt",component:b.a,type:"number",label:t("eventData.mummy"),parse:e=>e?+e:null}))}}X.propTypes={member:d.a.string};var Q=Object(v.a)()(X);class _ extends r.a.Component{render(){const{member:e,t:t}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.PiCnt"):"EvData.PiCnt",component:b.a,type:"number",label:t("eventData.piglets"),parse:e=>e?+e:null}),r.a.createElement(g.a,{name:e?"".concat(e,".EvData.PiWeight"):"EvData.PiWeight",component:b.a,type:"number",label:t("weight"),unit:"g",parse:e=>e?+e:null}))}}_.propTypes={member:d.a.string};var Z=Object(v.a)()(_);class $ extends r.a.Component{render(){const{member:e,t:t}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.PiCnt"):"EvData.PiCnt",component:b.a,type:"number",label:t("eventData.piglets"),parse:e=>e?+e:null}))}}$.propTypes={member:d.a.string};var ee=Object(v.a)()($);class te extends r.a.Component{render(){const{member:e,t:t}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.PiCnt"):"EvData.PiCnt",component:b.a,type:"number",label:t("eventData.piglets"),parse:e=>e?+e:null}))}}te.propTypes={member:d.a.string};var ae=Object(v.a)()(te);class ne extends r.a.Component{render(){const{member:e,reasons:t,lang:a,t:n}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Piglets"):"EvData.Piglets",component:b.a,type:"number",label:n("eventData.piglets"),parse:e=>e?+e:null}),r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Weight"):"EvData.Weight",component:b.a,type:"number",label:n("weight"),unit:"g",parse:e=>e?+e:null}),r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Reasn"):"EvData.Reasn",component:j.b,label:n("reason"),options:t.WData[a].map(e=>({name:e.Value,value:e.ID})),init:!0}))}}(ne=Object(f.connect)(e=>({reasons:e.dictionary.fallReasons,lang:e.language.lang.lang}))(ne)).propTypes={member:d.a.string};var re=Object(v.a)()(ne),ie=a("0b+E"),oe=a("pxzG"),se=a("eASP");class ce extends r.a.Component{render(){const{member:e,weighting:t,lang:a,t:n}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Reasn"):"EvData.Reasn",id:e?"".concat(e,".EvData.Reasn"):"EvData.Reasn",component:j.b,label:n("reason"),options:t?t.WData[a].map(e=>({name:e.Value,value:e.ID})):[]}),r.a.createElement(g.a,{component:b.a,name:e?"".concat(e,".EvData.Weight"):"EvData.Weight",label:n("weight"),unit:Object(oe.l)("weight",se.a.MEDIUM),type:"number",format:e=>void 0!==e?Object(oe.j)(+e,{unit:se.a.MEDIUM,rawValue:!0}):null,parse:e=>void 0!==e?Object(oe.i)(+e,{fromUnit:se.a.MEDIUM}):null}))}}(ce=Object(f.connect)((e,t)=>({weighting:e.dictionary.weighting,lang:e.language.lang.lang}))(ce)).propTypes={member:d.a.string};var le=Object(v.a)()(ce);class me extends r.a.Component{render(){const{member:e,t:t}=this.props;return r.a.createElement(y,{member:e},r.a.createElement(g.a,{name:e?"".concat(e,".EvData.Nipples"):"EvData.Nipples",component:b.a,type:"number",label:t("eventData.nipples"),parse:e=>e?+e:null}))}}me.propTypes={member:d.a.string};var de=Object(v.a)()(me),ue=a("XzT5");const pe="edit-sow-cycle-modal";class he extends r.a.Component{constructor(e){super(e),this.onCycleChange=e=>{this.setState({selectValue:e}),this.props.initialize(e)},this.renderData=({fields:e,type:t})=>r.a.createElement(r.a.Fragment,null,e.map((a,n)=>r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"d-flex justify-content-between"},r.a.createElement("strong",null,n+1),r.a.createElement("i",{className:"fas fa-trash pointer",onClick:()=>this.onRemoveClick(e,n)})),he.getEventRenderer(t,{member:a}),r.a.createElement("hr",null))),0===e.length&&r.a.createElement("p",{className:"empty-list"},r.a.createElement("i",null,"- ",this.props.t("modals.editSowCycle.noData")," -")));let t=L(e.cycles),a=Object(W.a)(t).map(e=>({name:ue.a.t("cycle",{count:e.cycle}),value:e})),n=a.length>0?a[a.length-1].value:null;this.state={selectValue:n,selectData:a},this.props.initialize(n),ie.a.modalview(pe)}onRemoveClick(e,t){let a=e.get(t);this.props.array.push("deleted",a),e.remove(t)}static getEventRenderer(e,t){switch(e){case V.b.INSEMINATION:return r.a.createElement(T,t);case V.b.USG:return r.a.createElement(Y,t);case V.b.PARTURITION:return r.a.createElement(Q,t);case V.b.FALL_PIGLETS:return r.a.createElement(re,t);case V.b.SEPARATION_TO_MOMMY:return r.a.createElement(ee,t);case V.b.MOMMY:return r.a.createElement(ae,t);case V.b.SEPARATION:return r.a.createElement(Z,t);case V.b.ACTIVE_NIPPLES:return r.a.createElement(de,t);case V.b.WEIGHTING:return r.a.createElement(le,t);case V.b.NO_PREGNANCY:return r.a.createElement(K,t);default:return r.a.createElement("div",null,"Nie rozpoznano")}}render(){const{show:e,handleHide:t,animal:a,t:n,submitting:l}=this.props,{selectData:m,selectValue:d}=this.state;return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement(o.b,{title:ue.a.t("modals.editSowCycle.title",{type:a.AnmNo1}),onCloseClick:t}),r.a.createElement(s.a,null,r.a.createElement(u.a,{label:n("cycle"),options:m,value:d,onChange:this.onCycleChange}),d&&r.a.createElement(r.a.Fragment,null,r.a.createElement("h5",null,n("modals.editSowCycle.inseminations")),r.a.createElement(p.a,{name:"I",component:this.renderData,type:V.b.INSEMINATION}),r.a.createElement("h5",null,n("modals.editSowCycle.usgs")),r.a.createElement(p.a,{name:"U",component:this.renderData,type:V.b.USG}),r.a.createElement("h5",null,n("birth")),r.a.createElement(p.a,{name:"P",component:this.renderData,type:V.b.PARTURITION}),r.a.createElement("h5",null,n("fallPiglets")),r.a.createElement(p.a,{name:"V",component:this.renderData,type:V.b.FALL_PIGLETS}),r.a.createElement("h5",null,n("modals.editSowCycle.separationToMommy")),r.a.createElement(p.a,{name:"M",component:this.renderData,type:V.b.SEPARATION_TO_MOMMY}),r.a.createElement("h5",null,n("mommy")),r.a.createElement(p.a,{name:"W",component:this.renderData,type:V.b.MOMMY}),r.a.createElement("h5",null,n("modals.editSowCycle.separationToPiglethouse")),r.a.createElement(p.a,{name:"S",component:this.renderData,type:V.b.SEPARATION}),r.a.createElement("h5",null,n("activeNipples")),r.a.createElement(p.a,{name:"AN",component:this.renderData,type:V.b.ACTIVE_NIPPLES}),r.a.createElement("h5",null,n("weighting")),r.a.createElement(p.a,{name:"WE",component:this.renderData,type:V.b.WEIGHTING}),r.a.createElement("h5",null,n("noPregnancy")),r.a.createElement(p.a,{name:"N",component:this.renderData,type:V.b.NO_PREGNANCY}))),r.a.createElement(c.a,{hasConfirmButton:!0,confirmText:n("save"),submitting:l,onCloseClick:t,formName:pe}))}}he=Object(h.a)({form:pe,onSubmit:function(e,t,a){const{animal:n,cycles:r}=a,i=[],o=F()(e),s=L(r),c=Object(W.a)(s),l=Array.isArray(c)?c.find(e=>e.cycle===o.cycle):{};if(!M()(l))for(let u in o)if(o.hasOwnProperty(u)&&Array.isArray(o[u])&&"deleted"!==u)for(let e of o[u]){const t=l[u].find(t=>t.EvID===e.EvID);k()(e,t)||(e.EvTime=B()(e.EvTime).toDate().getTime(),e.DtaModTime=B()().toDate().getTime(),i.push(e))}const m=o.deleted?o.deleted.map(e=>{const t=Object(D.getClass)(e);return t.EvTime=B()(t.EvTime).toDate().getTime(),t.deleteEvent(),t.prepareBeanToSave()}):[],d={AnmID:n.AnmID,eventsToUpdate:i,eventsToDelete:m};return Object(R.a)(d).then(e=>{Object(R.c)(e),a.handleHide()}).catch(e=>{Object(R.b)(e)})},validate:function(e,t){const a={},{t:n}=t,r=Object(O.i)();for(let i in e)if(Array.isArray(e[i])&&"deleted"!==i){let o=e[i].map(e=>{let a={EvData:{}};return!r&&Object(D.isEventDateInvalid)(e.EvTime,t.farm)&&(a.EvTime=n("required")),e.EvTime||r||(a.EvTime=n("required")),A()(e.EvData.Reason)&&(a.EvData.Reason=n("required")),A()(e.EvData.Reasn)&&(a.EvData.Reasn=n("required")),A()(e.EvData.BoarID)&&(a.EvData.BoarID=n("required")),A()(e.EvData.OperID)&&(a.EvData.OperID=n("required")),A()(e.EvData.Weight)&&(a.EvData.Weight=n("required")),A()(e.EvData.PiCnt)&&(a.EvData.PiCnt=n("required")),A()(e.EvData.PiWeight)&&(a.EvData.PiWeight=n("required")),A()(e.EvData.HealthyCnt)&&(a.EvData.HealthyCnt=n("required")),A()(e.EvData.DeadCnt)&&(a.EvData.DeadCnt=n("required")),A()(e.EvData.MummyCnt)&&(a.EvData.MummyCnt=n("required")),A()(e.EvData.Piglets)&&(a.EvData.Piglets=n("required")),A()(e.EvData.Nipples)&&(a.EvData.Nipples=n("required")),a});a[i]=o}return a}})(he);const ge=Object(f.connect)(e=>({user:e.user.user,farm:e.location.farm}))(he);(he=Object(l.a)({name:pe})(ge)).propTypes={animal:d.a.object.isRequired,cycles:d.a.array.isRequired};t.b=Object(v.a)()(he)},EvVL:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("ZVfr"),l=a("S8cm"),m=(a("kUvp"),a("wd/R")),d=a.n(m),u=a("7UKU");class p extends n.Component{constructor(...e){super(...e),this.state={loadingSubTasks:[]}}setLoadingStatus(e,t){this.setState(a=>{let n=a.loadingSubTasks.slice();return n[e]=t,{loadingSubTasks:n}})}async onCheckboxClick(e,t){const{task:a}=this.props;try{this.setLoadingStatus(e,!t),await Object(u.a)(a.IssueID,e,!t)}catch(n){this.setLoadingStatus(e,!1)}}employeeFormatter(e){const{employees:t}=this.props;let a=t.find(t=>t.LocalUserID===e);if(a)return a.userName}render(){const{task:e,t:t}=this.props,{loadingSubTasks:a}=this.state;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h4",null,e.Title),r.a.createElement("p",null,e.Description),r.a.createElement("div",null,t("eventGrid.operator"),": ",this.employeeFormatter(e.AssignTo)),r.a.createElement("div",null,t("priority"),": ",Object(c.a)(e.Priority)),r.a.createElement("div",null,t("estimatedTime"),": ",e.EstimatedTime,"h"),r.a.createElement("div",null,t("date"),": ",d()(e.DtaPlanned).format("DD.MM.YYYY")),e.ListTODO.length>0&&r.a.createElement(r.a.Fragment,null,r.a.createElement("h5",null,t("list")),r.a.createElement("ul",{className:"task-list-checkbox"},e.ListTODO.map((e,t)=>r.a.createElement("li",{key:t},r.a.createElement(l.a,{label:e.Title,checked:void 0!==a[t]?a[t]:e.Done,id:t,onChange:()=>this.onCheckboxClick(t,void 0!==a[t]?a[t]:e.Done)}))))))}}t.a=Object(s.d)(Object(o.a)(),Object(i.connect)((function(e){return{employees:e.user.employees}})))(p)},EyHs:function(e,t,a){"use strict";a.d(t,"a",(function(){return q}));var n=a("lFKM"),r=a.n(n),i=a("Y+p1"),o=a.n(i),s=a("mwIZ"),c=a.n(s),l=a("BkRI"),m=a.n(l),d=a("q1tI"),u=a.n(d),p=a("d/v1"),h=a("pJVQ"),g=a("tDQA"),b=a("/MKj"),f=a("JQpV"),D=a("zM5D"),v=a("UGc4"),O=a("0pzG"),E=a("gu+X"),y=a("f0zD"),j=a("17x9"),w=a.n(j),C=a("4huo"),S=a("26mJ"),T=a("wd/R"),I=a.n(T),k=a("q17X"),x=a("6/k7"),M=a("0b+E"),N=a("G7tO"),A=a("pxzG"),P=a("15cA"),F=a("udB/"),z=a("zDJl"),B=a("piEO"),R=a("mr+a"),W=a("LCzB");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 V(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const q="feeding-manage-feeding-modal";class H extends u.a.Component{constructor(e){super(e),this.getCurveDay=()=>{const{repetitionDate:e,curveDay:t,curve:a}=this.props,n=Object(P.f)(a),i=c()(a,"SetData.Days.length",0),o=c()(a,"SetData.InseminationJumpTo",0);switch(n){case x.a.BOTH:return e?I()().startOf("day").diff(I()(e,"YYYY-MM-DD").subtract(o,"day").startOf("day"),"day"):1;case x.a.AFTER:return e?I()().startOf("day").diff(I()(e,"YYYY-MM-DD").startOf("day"),"day")+1:1;case x.a.BEFORE:return e?I()().startOf("day").diff(I()(e,"YYYY-MM-DD").subtract(i,"day").startOf("day"),"day")+1:1;case x.a.NORMAL:default:return r()(t)?Math.max(Math.min(t,i||1),1):1}};const{selectedNodes:t,initialize:a,curves:n,sectorType:i}=this.props;if(t.length){const e=c()(t[0],"curve.id"),o=n.find(t=>t.SetID===e&&Object(P.e)({sectorType:i}).includes(t.SetData.Type)),s=!!t.filter(e=>e.workType===x.g.TRIGGER).length,l=Object(P.f)(o),m=c()(t[0],"curve.day",1),d=l.NORMAL?c()(t[0],"loop.endDay",0):c()(t[0],"loop.endDay",0)+c()(t[0],"loop.insemination",0);let u;console.log(m,d,t[0]);let p=c()(o,"SetData.InseminationJumpTo",0),h=c()(o,"SetData.Days.length",0);const g=I()().startOf("day").subtract(m+d-1,"day").format("YYYY-MM-DD");switch(l){case x.a.BEFORE:u=I()().startOf("day").subtract(m+d-1-h,"day").format("YYYY-MM-DD");break;case x.a.AFTER:u=g;break;case x.a.BOTH:u=I()().startOf("day").subtract(m+d-1-Math.max(0,p-1),"day").format("YYYY-MM-DD");break;default:u=g}a({curve:Object(k.getSettingClass)(o||null),curveShift:c()(t[0],"curve.offset",0),curveDay:r()(m)?m:1,repetitionDate:u,doseCorrection:c()(t[0],"curve.correction",0),punishment:s?c()(t[0],"curve.punishment",0):0})}M.a.modalview(q)}componentDidUpdate(e,t,a){const{curve:n,change:r}=this.props;if(void 0!==e.curve&&!o()(e.curve,n)){const e=Object(P.f)(n),t=c()(n,"SetData.Days.length",0),a=c()(n,"SetData.InseminationJumpTo",1);switch(e){case x.a.BOTH:r("repetitionDate",I()().startOf("day").add(a-1,"day").format("YYYY-MM-DD"));break;case x.a.AFTER:r("repetitionDate",I()().startOf("day").format("YYYY-MM-DD"));break;case x.a.BEFORE:r("repetitionDate",I()().startOf("day").add(t,"day").format("YYYY-MM-DD"));break;default:r("curveDay",1)}}}render(){const{initialized:e,sectorType:t,show:a,selectedNodes:n,receivers:i,handleHide:o,curves:s,curve:l,type:d,t:h,handleSubmit:g}=this.props;let b=c()(l,"SetData.Type");const f=!!n.filter(e=>e.workType===x.g.TRIGGER).length,y=Object(P.f)(l),j=!!(1&Object(P.h)(i)),w=m()(s.filter(e=>Object(P.e)({sectorType:t}).includes(e.SetData.Type)&&(!j||Object(P.l)({curve:e,devType:z.d.DISPENSER})))).sort((e,t)=>e.SetData.Index-t.SetData.Index).map(e=>({name:e.SetData.Name,value:e}));console.log(l,"curve");const T=c()(l,"SetData.Days",[]);let I=this.getCurveDay();console.log("curveDay",I),I=Math.min(Math.max(I,1),T.length);const M=c()(l,"SetData.InseminationJumpTo",-151),R=Object(k.getFeedingUnit)(),W=[{color:"green",dataKey:"ForageAmount",name:h("dosage"),unit:Object(A.l)("weight",R),valueConverter:e=>Object(A.j)(e,{unit:R,showUnit:!1,fixed:2})}],H=[{x:"".concat(Object(P.d)(I,l)),color:"blue",name:h("curveDay")},Object(P.f)(l)===x.a.BOTH?{x:"".concat(Object(P.d)(M,l)),color:"blue",position:"middle",name:x.c.includes(b)?h("modals.feedingManageFeedingModal.inseminationDate"):h("modals.feedingManageFeedingModal.parturitionDate")}:null].filter(e=>!!e);return u.a.createElement(D.a,{onHide:o,show:a,size:"lg"},u.a.createElement("form",{onSubmit:g},u.a.createElement(v.b,{title:h("modals.feedingManageFeedingModal.manageFeeding"),onCloseClick:o}),u.a.createElement(O.a,{className:q},u.a.createElement("div",{className:"mh-5rem"},!e&&u.a.createElement(F.a,{isLoading:!e}),!!e&&u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{style:{height:"20rem"}},u.a.createElement(N.a,{dataDef:W,tooltipLabelFormatter:e=>"".concat(h("curveDay")," ").concat(e),data:T.map((e,t)=>function(e){for(var t=1;t"".concat(e),parse:e=>r()(parseInt(e))?parseInt(e):e,component:S.a})),y!==x.a.NORMAL&&u.a.createElement(p.a,{name:"repetitionDate",label:y===x.a.BEFORE?x.c.includes(b)?h("modals.feedingManageFeedingModal.plannedInseminationDate"):h("modals.feedingManageFeedingModal.plannedParturitionDate"):x.c.includes(b)?h("modals.feedingManageFeedingModal.inseminationDate"):h("modals.feedingManageFeedingModal.parturitionDate"),id:"repetitionDate",type:"date",component:S.a}),[x.f.INDIVIDUAL].includes(d)&&f&&u.a.createElement(p.a,{name:"punishment",id:"punishment",type:"number",required:!0,step:1,min:0,max:3,component:B.a,valueFormatter:e=>e?"".concat(e):h("modals.feedingManageFeedingModal.noPunishment"),label:h("punishment")}),u.a.createElement(p.a,{name:"doseCorrection",id:"doseCorrection",type:"number",required:!0,step:5,min:-25,max:25,component:B.a,valueFormatter:e=>"".concat(e,"%"),label:h("modals.feedingManageFeedingModal.doseCorrection")})))),u.a.createElement(E.a,{hasConfirmButton:!0,confirmText:h("modals.feedingManageFeedingModal.set"),onCloseClick:o,formName:q})))}}H.propTypes={selectedNodes:w.a.array.isRequired},H=Object(h.a)({form:q,onSubmit:f.a,validate:f.b,initialValues:{doseCorrection:0,curveDay:1,curveShift:0,curve:void 0,punishment:0}})(H),H=Object(b.connect)(e=>({curves:Object(R.c)(e)}))(H);const U=Object(g.a)(q),G=Object(W.a)()(Object(b.connect)(e=>({curve:U(e,"curve"),curveDay:U(e,"curveDay"),repetitionDate:U(e,"repetitionDate")}))(H));t.b=Object(y.a)({name:q})(G)},F2x4:function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("ANjH"),m=a("LCzB"),d=a("f0zD"),u=a("d/v1"),p=a("pJVQ"),h=a("4huo"),g=a("6szu"),b=a("+PoS");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 D(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const v="select-default-farm-modal";class O extends r.a.Component{constructor(e){super(e),this.state={options:O.getFarmsOptions(this.props)}}render(){const{t:e,handleHide:t,show:a,submitting:n}=this.props,{options:l}=this.state;return r.a.createElement(i.a,{onHide:t,show:a,size:"lg"},r.a.createElement(o.a,{title:e("modals.selectDefaultFarmModal.title"),onCloseClick:t}),r.a.createElement(s.a,null,r.a.createElement(u.a,{name:"defaultFarm",component:h.b,label:e("modals.selectDefaultFarmModal.selectFarm"),options:l,init:!0})),r.a.createElement(c.a,{hasConfirmButton:!0,confirmText:e("save"),onCloseClick:t,formName:v,submitting:n}))}}O.getFarmsOptions=e=>e.farms.map(e=>({name:e.FarmName,value:e.FarmID}));t.b=Object(l.d)(Object(m.a)(),Object(d.a)({name:v}),Object(p.a)({form:v,onSubmit:function(e,t,a){const{defaultFarm:n}=e,{userValues:r}=a;return Object(g.a)(function(e){for(var t=1;t{Object(g.c)(e),t(Object(b.a)("/farmSettings/users"))}).catch(e=>{Object(g.b)(e)})},validate:function(e,t){const a={},{defaultFarm:n}=e,{t:r}=t;return n||(a.defaultFarm=r("required")),a}}))(O)},FivL:function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("UGc4"),l=a("0pzG"),m=a("zM5D"),d=a("gu+X"),u=a("f0zD"),p=a("uSQv"),h=a("0IDN"),g=a("EvVL"),b=a("HGzA"),f=a("niph"),D=a("Imit"),v=a("lRfV");function O(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 E(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const y="task-view-modal";class j extends n.Component{constructor(...e){super(...e),this.state={changingStatus:!1,removingTask:!1},this.onEditClick=()=>{const{task:e,handleHide:t}=this.props;this.props.show(h.a,{task:e}),t()},this.onConfirmed=async()=>{const{task:e}=this.props;try{this.setState({changingStatus:!0});let t=await Object(f.a)(e.IssueID);Object(f.c)(t),this.setState({changingStatus:!1})}catch(t){Object(f.b)(t),this.setState({changingStatus:!1})}},this.onDeleteClick=async()=>{const{task:e,handleHide:t}=this.props;try{this.setState({removingTask:!0});let a=await Object(v.a)(e.IssueID);Object(v.c)(a),t()}catch(a){Object(v.b)(a),this.setState({removingTask:!1})}}}render(){const{handleHide:e,show:t,task:a,t:n}=this.props,{changingStatus:i,removingTask:o}=this.state;return a?r.a.createElement(m.a,{onHide:e,show:t,size:"lg"},r.a.createElement(c.b,{title:n("taskDescription"),onCloseClick:e}),r.a.createElement(l.a,{className:y},r.a.createElement(g.a,{task:a})),r.a.createElement(d.a,{hasConfirmButton:!0,hasCloseButton:!1,confirmText:n("taskDone")+"?",confirmIcon:a&&a.Status===b.a.DONE?r.a.createElement("i",{className:"fas fa-check-square"}):r.a.createElement("i",{className:"fas fa-square"}),optionalButtons:[r.a.createElement(p.a,{key:1,icon:r.a.createElement("i",{className:"fas fa-edit"}),onClick:this.onEditClick},n("edit")),r.a.createElement(p.a,{buttonColor:"error",key:2,icon:r.a.createElement("i",{className:"fas fa-trash"}),onClick:this.onDeleteClick,isLoading:o},n("delete"))],onConfirmed:this.onConfirmed,submitting:i})):null}}t.b=Object(s.d)(Object(u.a)({name:y}),Object(o.a)(),Object(i.connect)((function(e){return{task:Object(D.a)(e)}}),(function(e){return function(e){for(var t=1;t{r(),Object(p.e)(e)}).catch(e=>{Object(p.d)(e)})}})(E),E=Object(h.connect)(e=>({dispenserLicense:Object(b.a)(e,{licenseName:f.a.DISPENSER})}))(E),E=Object(d.a)({name:O})(E),E=Object(D.a)({clientPackage:{[f.a.DISPENSER]:f.b.BASIC}})(E);t.b=Object(v.a)()(E)},Il7A:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("PbGg"),u=a("d/v1"),p=a("pJVQ"),h=a("f0zD"),g=a("/MKj"),b=a("VfnB"),f=a("VrKS"),D=a("zDJl");var v=a("0b+E"),O=a("LCzB"),E=a("thTS"),y=a("XoCd"),j=a("pxzG"),w=a("eASP");function C(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 S(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const T="climate-bandwidth-modal";class I extends o.a.Component{constructor(e){super(e),this.getValues=()=>{const{shadow:e}=this.props;return{bandwidth:r()(e,"configuration.bandwidth",4)}},this.temperatureFormatter=e=>Object(j.f)(e,{unit:w.a.SMALL,fixed:1,showUnit:!0}),this.ventilationFormatter=e=>"".concat(e.toFixed(1),"%"),v.a.modalview(T)}componentDidMount(){const{initialize:e}=this.props;e(this.getValues())}render(){const{show:e,handleHide:t,t:a,initialized:n}=this.props;return o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement(c.b,{title:a("settings.bandwithVenting"),onCloseClick:t}),o.a.createElement(l.a,{className:"".concat(T," mh-5rem"),isLoading:!n},o.a.createElement(u.a,{name:"bandwidth",id:"bandwidth",label:a("settings.bandwithVenting"),min:0,max:10,step:.2,valueFormatter:this.temperatureFormatter,component:y.a})),o.a.createElement(m.a,{hasConfirmButton:!0,confirmText:a("save"),onCloseClick:t,formName:T}))}}I=Object(p.a)({form:T,onSubmit:function(e,t,a){const{climates:n}=a,{bandwidth:r}=e,i=Object(b.r)(n);return Promise.all([...i.values()].map(e=>new Promise((t,a)=>{Object(f.b)(e[D.d.CLIMATE_SK3],{bandwidth:r},{onSuccess:t,onFailure:a})}))).then(()=>{a.handleHide()})}})(I),I=Object(g.connect)((function(e,t){const a=Object(E.a)(),{climates:n}=t,r={DevID:n[0].DevID};return function(e){return function(e){for(var t=1;te)&&(a.curveDay=g.a.t("errors.mustBeInRange",{start:1,end:e}))}else a.curveDay=n("required");if(m){if(!c()(i)){const e=Object(l.f)(i),t=r()(i,"SetData.Days.length",0),n=r()(i,"SetData.InseminationJumpTo",0),o=p()(m,"YYYY-MM-DD").startOf("day"),s=p()().startOf("day");let c=o.diff(s,"days");switch(console.log(c,t,o,s),e){case h.a.BEFORE:c>t&&(a.repetitionDate=g.a.t("errors.curveCantBeSetInFuturePleaseSetDateBelowX",{date:s.clone().add(t+1,"days").format("DD.MM.YYYY")}));break;case h.a.AFTER:c>0&&(a.repetitionDate=g.a.t("errors.curveCantBeSetInFuturePleaseSetDateBelowX",{date:s.clone().add(1,"days").format("DD.MM.YYYY")}));break;case h.a.BOTH:c>=n&&(a.repetitionDate=g.a.t("errors.curveCantBeSetInFuturePleaseSetDateBelowX",{date:s.clone().add(n,"days").format("DD.MM.YYYY")}));break;case h.a.NORMAL:}}}else a.repetitionDate=n("required");return a}},JsV9:function(e,t,a){"use strict";a.d(t,"a",(function(){return D}));var n=a("q1tI"),r=a.n(n),i=a("d/v1"),o=a("pJVQ"),s=a("/MKj"),c=a("zM5D"),l=a("UGc4"),m=a("0pzG"),d=a("gu+X"),u=a("f0zD"),p=a("17x9"),h=a.n(p),g=a("LCzB"),b=a("26mJ"),f=a("OknT");const D="client-alias-modal";class v extends r.a.Component{componentDidMount(){const{initialize:e,ClientID:t,Alias:a}=this.props;e({alias:a||t})}render(){const{show:e,handleHide:t,t:a,handleSubmit:n,submitting:o}=this.props;return r.a.createElement(c.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:n},r.a.createElement(l.b,{title:a("newSettings.devices.form.alias"),onCloseClick:t}),r.a.createElement(m.a,{className:D},r.a.createElement(i.a,{name:"alias",id:"alias",label:a("newSettings.devices.form.alias"),component:b.a,type:"text"})),r.a.createElement(d.a,{hasConfirmButton:!0,confirmText:a("save"),submitting:o,onCloseClick:t,formName:D})))}}v.propTypes={ClientID:h.a.string.isRequired,Alias:h.a.string.isRequired},v=Object(o.a)({form:D,onSubmit:(e,t,a)=>{const{user:{LocalUserID:n},ClientID:r}=a,{alias:i}=e;return Object(f.a)({ClientID:r,LocalUserID:n,Alias:i}).then(()=>{a.handleHide(),Object(f.c)(),window.location.reload()}).catch(()=>{Object(f.b)()})}})(v),v=Object(s.connect)(e=>({user:e.user.user}))(v),v=Object(u.a)({name:D})(v),t.b=Object(g.a)()(v)},KbNz:function(e,t,a){"use strict";a.d(t,"a",(function(){return k}));var n=a("FyPc"),r=a.n(n),i=a("mwIZ"),o=a.n(i),s=a("q1tI"),c=a.n(s),l=a("zM5D"),m=a("UGc4"),d=a("0pzG"),u=a("gu+X"),p=a("tDQA"),h=a("PbGg"),g=a("d/v1"),b=a("pJVQ"),f=a("f0zD"),D=a("/MKj"),v=a("VfnB"),O=a("VrKS"),E=a("zDJl");var y=a("0b+E"),j=a("LCzB"),w=a("thTS"),C=a("XoCd"),S=a("4huo");function T(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 I(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const k="climate-mats-modal";class x extends c.a.Component{constructor(e){super(e),this.getValues=()=>{const{shadow:e,climates:t,selectedMat:a=0}=this.props,n=r()(t,e=>e.getMatsSize()).getMatsSize(),i=Math.min(a||0,n);return{day:o()(e,"mats[".concat(a,"].day"),0),deviation:o()(e,"mats[".concat(a,"].deviation"),0),selectedMat:i,maximumMats:n}},this.getOptions=()=>{const{maximumMats:e=0,t:t}=this.props,a=[];for(let n=0;n"".concat((e||0).toFixed(1),"%"),y.a.modalview(k)}componentDidMount(){const{initialize:e}=this.props;e(this.getValues())}componentDidUpdate(e,t,a){const{initialize:n,selectedMat:r}=this.props;r!==e.selectedMat&&n(this.getValues())}render(){const{show:e,handleHide:t,t:a,initialized:n,submitting:r}=this.props,i=this.getOptions();return c.a.createElement(l.a,{onHide:t,show:e,size:"lg"},c.a.createElement(m.b,{title:a("farmView.climate.matSettings"),onCloseClick:t}),c.a.createElement(d.a,{className:"".concat(k," mh-5rem"),isLoading:!n},c.a.createElement(g.a,{name:"selectedMat",id:"selectedMat",label:a("farmView.climate.mat"),options:i,component:S.b}),c.a.createElement(g.a,{name:"day",id:"day",label:a("curveDay"),min:0,max:99,step:1,component:C.a}),c.a.createElement(g.a,{name:"deviation",id:"deviation",label:a("level"),min:-99,max:99,step:1,valueFormatter:this.ventilationFormatter,component:C.a})),c.a.createElement(u.a,{hasConfirmButton:!0,submitting:r,confirmText:a("save"),onCloseClick:t,formName:k}))}}x=Object(b.a)({form:k,onSubmit:function(e,t,a){const{climates:n}=a,{selectedMat:r,day:i,deviation:o}=e,s=Object(v.r)(n);return Promise.all([...s.values()].map(e=>new Promise((t,a)=>{Object(O.i)(e[E.d.CLIMATE_SK3],{number:r+1,day:i,deviation:o},{onSuccess:t,onFailure:a})}))).then(()=>{a.handleHide()})}})(x),x=Object(D.connect)((function(e,t){const a=Object(w.a)(),{climates:n}=t,r={DevID:n[0].DevID},i=Object(p.a)(k);return function(e){return function(e){for(var t=1;t{const{name:t}=e;switch(t){case"BName":return L;case"SName":return V;case"CName":return q;case"BoxesName":return H;default:return W}},this.onAddLocationButtonClick=()=>{const{location:e,dispatch:t}=this.props,a=this.getLocationType(e),n=this.checkPlacement(z({},e,{type:a}));t(Object(j.a)(R,"chosenLocations",n.chosenPlcmnts)),this.setState({userClicked:!0})},this.locationTypeFormatter=e=>{const{t:t}=this.props;switch(e){case L:return t("newSettings.buildings.building");case V:return t("newSettings.buildings.sector");case q:return t("newSettings.buildings.chamber");case H:return t("standing");default:return t("notFound.dataNotFound")}};const{farm:t,initialPlacements:a}=e,n=k.a.getObjectForTreeSelect(t,!0);this.state={locations:n,toDelete:[]},this.props.dispatch(Object(j.c)(R,{chosenLocations:this.initializeChosenLocations(a)}))}initializeChosenLocations(e){const t=[];return e.forEach(e=>{const a=k.a.getLocationByID(e);a&&t.push({locName:Object(A.k)(a),locType:a.BName?L:a.SName?V:a.CName?q:H,locationID:e})}),t}componentDidUpdate(e,t,a){if(!r()(e.location,this.props.location)){const{location:e}=this.props,t=this.getLocationType(e),a=this.checkPlacement(z({},e,{type:t})),n=c()(a,"deletedPlcmtns",[]);this.setState({toDelete:n,userClicked:!1})}}checkPlacement(e){const{type:t,children:a,parent:n}=e,{chosenLocations:r}=this.props;let i=u()(r);const s=[];if(t===L)if(!o()(a)&&Array.isArray(a)){let n=i.filter(e=>{const t=m()(a,t=>t.object[t.key]===e.locationID);-1===t?a.forEach(t=>{const a=m()(c()(t,"children",[]),t=>t.object[t.key]===e.locationID);-1===a?c()(t,"children",[]).forEach(t=>{const a=m()(c()(t,"children",[]),t=>t.object[t.key]===e.locationID);if(-1===a)return e;s.push(t.children[a].object[t.children[a].name])}):s.push(t.children[a].object[t.children[a].name])}):s.push(a[t].object[a[t].name])}).filter(t=>t.locationID!==e.object[e.key]);i=[...n,{locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]}]}else i.push({locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]});else if(t===V)if(!o()(n)&&Array.isArray(n)||!o()(a)&&Array.isArray(a)){let r=i.filter(e=>{const t=m()(a,t=>t.object[t.key]===e.locationID),r=m()(n,t=>t.object[t.key]===e.locationID);-1===t&&-1===r?a.forEach(t=>{const a=m()(c()(t,"children",[]),t=>t.object[t.key]===e.locationID);if(-1===a)return e;s.push(t.children[a].object[t.children[a].name])}):t>=0?s.push(a[t].object[a[t].name]):r>=0&&s.push(n[r].object[n[r].name])}).filter(t=>t.locationID!==e.object[e.key]);i=[...r,{locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]}]}else i.push({locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]});else if(t===q)if(!o()(n)&&Array.isArray(n)||!o()(a)&&Array.isArray(a)){let r=i.filter(e=>{const t=m()(a,t=>t.object[t.key]===e.locationID),r=m()(n,t=>t.object[t.key]===e.locationID);if(-1===t&&-1===r)return e;t>=0?s.push(a[t].object[a[t].name]):r>=0&&s.push(n[r].object[n[r].name])}).filter(t=>t.locationID!==e.object[e.key]);i=[...r,{locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]}]}else i.push({locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]});else if(t===H)if(!o()(n)&&Array.isArray(n)){let a=i.filter(e=>{const t=m()(n,t=>t.object[t.key]===e.locationID);if(-1===t)return e;s.push(n[t].object[n[t].name])}).filter(t=>t.locationID!==e.object[e.key]);i=[...a,{locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]}]}else i.push({locName:Object(A.k)(e.object),locType:t,locationID:e.object[e.key]});return{chosenPlcmnts:i,deletedPlcmtns:s}}render(){const{show:e,handleHide:t,handleSubmit:a,adding:n,t:r}=this.props,{locations:i,userClicked:s,toDelete:c}=this.state;let l="";o()(c)||(l=c.join(", "));const m=[{name:r("designation"),field:"locName",dontShowInput:!0},{name:r("type"),field:"locType",dontShowInput:!0,valueFormatter:this.locationTypeFormatter}];return h.a.createElement(g.a,{onHide:t,show:e,size:"lg"},h.a.createElement("form",{onSubmit:a},h.a.createElement(O.b,{title:r("locactionSelection"),onCloseClick:t}),h.a.createElement(E.a,{className:R},!o()(c)&&!s&&h.a.createElement(P.a,{boxColor:"warning"},r("modals.placementsCustomRoleModal.warningInfo",{names:l})),h.a.createElement("label",null,r("pickLocation")),h.a.createElement(b.a,{className:"w-100 justify-content-center"},h.a.createElement(f.a,{lg:10},h.a.createElement(w.a,{name:"location",component:I.a,expanded:!0,options:i})),h.a.createElement(x.a,{type:"button",buttonColor:"success",onClick:this.onAddLocationButtonClick},h.a.createElement("i",{className:"fas fa-plus"})," ",r("add"))),h.a.createElement("hr",null),h.a.createElement("label",null,r("chosenLocations")),h.a.createElement(C.a,{component:N.a,name:"chosenLocations",headers:m,addRemoveButton:!0,minLength:0})),h.a.createElement(y.a,{hasConfirmButton:!0,confirmText:r("save"),formName:R,onCloseClick:t,submitting:n})))}}U=Object(S.a)({form:R,onSubmit:function(e,t,a){console.log(e,a," <= custom role submit");const{chosenLocations:n}=e,r={type:3,Plcmnts:[]};n.forEach(e=>{const{locationID:t}=e;r.Plcmnts.push(t)}),0===r.Plcmnts.length&&(r.type=0),a.onModalSubmit(r.type,r.Plcmnts),a.handleHide()},touchOnChange:!0})(U);const G=Object(T.a)(R);U=Object(M.connect)(e=>({location:G(e,"location"),chosenLocations:G(e,"chosenLocations")}))(U),U=Object(v.a)({name:R})(U);t.b=Object(D.a)()(U)},M6XY:function(e,t,a){"use strict";a.d(t,"a",(function(){return A}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("UGc4"),l=a("0pzG"),m=a("f0zD"),d=a("gu+X"),u=a("/MKj"),p=a("d/v1"),h=a("3t43"),g=a("pJVQ"),b=a("tDQA"),f=a("lFKM"),D=a.n(f),v=a("wd/R"),O=a.n(v),E=a("lwfn"),y=a("Zayz");const j=["inactive","manual","automatic","schedule"];var w=a("LCzB"),C=a("uSQv"),S=a("Y/op"),T=a("a+pQ"),I=a("lAGl"),k=a("piEO"),x=a("thTS");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 N(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const A="chain-feeding-configure-modal",P=["inactive","manual","automatic","schedule"];class F extends o.a.Component{constructor(e){super(e);const{shadow:t}=e,a={};a.schedule=t?t.schedule.map(e=>({start:O()(e.start).format("HH:mm"),stop:O()(e.stop).format("HH:mm"),time:Math.max(1,e.workTime/6e4)})):[{start:"10:15",stop:"12:45",time:"10"}],a.sensor=r()(t,"workType.sensorID",1),a.workType=P[r()(t,"workType.workType",0)],a.excessWorkTime=r()(t,"workType.excessWorkTime",6e4)/6e4,a.maxWorkTime=r()(t,"workType.maxWorkTime",6e4)/6e4,this.props.initialize(a)}render(){const{submitting:e,show:t,handleHide:a,t:n,workType:i,devices:m}=this.props,u=[{name:n("modals.chainFeedingConfigureModal.start"),field:"start",type:"time",component:I.a},{name:n("modals.chainFeedingConfigureModal.stop"),field:"stop",type:"time",component:I.a},{name:n("modals.chainFeedingConfigureModal.time"),field:"time",type:"number",unit:n("modals.chainFeedingConfigureModal.minute"),component:I.a}];return o.a.createElement(s.a,{onHide:a,show:t,size:"lg"},o.a.createElement(c.b,{title:n("modals.chainFeedingConfigureModal.title"),onCloseClick:a}),o.a.createElement(l.a,{lassName:A},o.a.createElement(p.a,{name:"workType",component:S.a},P.map((e,t)=>o.a.createElement(C.a,{buttonStyle:"text",value:e},n("deviceRows.chainFeeding.chainFeedingRow.workTypes.".concat(e))))),"schedule"===i&&o.a.createElement(o.a.Fragment,null,o.a.createElement(h.a,{shouldIndex:!0,addDefaultValue:{start:0,stop:0,time:0},component:T.a,name:"schedule",headers:u,addAddButton:!0,addRemoveButton:!0})),"automatic"===i&&o.a.createElement(o.a.Fragment,null,o.a.createElement("label",null,n("modals.chainFeedingConfigureModal.activeSensor")),o.a.createElement(p.a,{name:"sensor",component:S.a},new Array(4).fill(1).map((e,t)=>{return o.a.createElement(C.a,{buttonStyle:"text",value:t},(a=t,1===r()(m,"length",0)&&r()(m,"[0].Settings.Aliases[".concat(a,"]"))||n("modals.chainFeedingConfigureModal.sensor",{number:a+1})));var a})),o.a.createElement(p.a,{id:"excessWorkTime",name:"excessWorkTime",label:n("modals.chainFeedingConfigureModal.excessWorkTime"),component:k.a,valueFormatter:e=>"".concat(e).concat(n("modals.chainFeedingConfigureModal.minute")),min:1,max:60,step:1}),o.a.createElement(p.a,{id:"maxWorkTime",name:"maxWorkTime",label:n("modals.chainFeedingConfigureModal.maxWorkTime"),component:k.a,valueFormatter:e=>"".concat(e).concat(n("modals.chainFeedingConfigureModal.minute")),min:1,max:60,step:1}))),o.a.createElement(d.a,{submitting:e,onCloseClick:a,hasConfirmButton:!0,confirmText:n("save"),formName:A}))}}F=Object(g.a)({form:A,onSubmit:function(e,t,a){console.log(e,a);const{workType:n,sensor:r,schedule:i,maxWorkTime:o,excessWorkTime:s}=e,{devices:c,handleHide:l}=a,m={};m.workType=j.indexOf(n),m.excessWorkTime=60*s*1e3,m.maxWorkTime=60*o*1e3,m.sensorID=r;const d=[];"schedule"===n&&(i.forEach(e=>{d.push({start:+O()(e.start,"HH:mm"),stop:+O()(e.stop,"HH:mm"),workTime:60*e.time*1e3})}),i.sort((e,t)=>e.start-t.start)),c.forEach(e=>{Object(E.d)(e,m),"schedule"===n&&Object(E.a)(e,{schedule:d})}),console.log(m,d),l()},validate:function(e,t){const a={},{t:n}=t,{excessWorkTime:i,maxWorkTime:o,sensor:s,workType:c,schedule:l=[]}=e;if(D()(i)||(a.excessWorkTime=n("required")),D()(o)||(a.maxWorkTime=n("required")),D()(s)||(a.sensor=n("required")),j.includes(c)){if("schedule"===c)if(0===r()(l,"length",0))a.schedule=n("required");else{const e=l.map((e,t)=>{const a={};if(e.time&&D()(+e.time)&&0!==+e.time||(a.time=n("required")),e.start||(a.start=n("required")),e.stop||(a.stop=n("required")),e.start&&e.stop){let r=!1;l.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=n("errors.duplicate"),a.stop=n("errors.duplicate")),Object(y.c)(e.start)>Object(y.c)(e.stop)&&(a.start=n("errors.mustBeBelow")+n("modals.chainFeedingConfigureModal.stop"),a.stop=n("errors.mustBeAbove")+n("modals.chainFeedingConfigureModal.start"))}return a});a.schedule=e}}else a.workType=n("required");return a}})(F);const z=Object(b.a)(A);F=Object(u.connect)((function(){const e=Object(x.a)();return function(t,a){return function(e){for(var t=1;to.a.createElement(g.a,null,e.map((e,t)=>o.a.createElement(b.a,{lg:3,key:t},o.a.createElement(d.a,{name:e,id:e,component:O.a,label:this.props.t("modals.pigletScaleSettings.cell",{number:t+1})}))));let t=e.scales[0];t.Settings.Configuration&&t.Settings.Configuration.SET_CONFIGURATION?this.props.initialize(t.Settings.Configuration.SET_CONFIGURATION):this.props.initialize({fromRaw:!1,cell:[!1,!1,!1,!1],offset:0})}render(){const{t:e,handleHide:t,show:a,submitting:n}=this.props;return o.a.createElement(f.a,{onHide:t,show:a,size:"lg"},o.a.createElement(h.b,{title:e("modals.pigletScaleSettings.title"),onCloseClick:t}),o.a.createElement(D.a,null,o.a.createElement(d.a,{name:"minTare",component:v.a,label:e("modals.pigletScaleSettings.minTare"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"maxTare",component:v.a,label:e("modals.pigletScaleSettings.maxTare"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"scale",component:v.a,label:e("modals.pigletScaleSettings.scale"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"tare",component:v.a,label:e("modals.pigletScaleSettings.tare"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"peaksMinHeight",component:v.a,label:e("modals.pigletScaleSettings.peaksMinHeight"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"maxDifferentBetweenValues",component:v.a,label:e("modals.pigletScaleSettings.maxDifferentBetweenValues"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"maxTaraValues",component:v.a,label:e("modals.pigletScaleSettings.maxTaraValues"),type:"number",parse:e=>r()(e)||""===e?null:+e}),o.a.createElement(d.a,{name:"offset",component:j.a,label:e("modals.pigletScaleSettings.offset"),min:0,max:1,step:.1}),o.a.createElement("div",null,o.a.createElement(d.a,{name:"fromRaw",component:O.a,label:e("modals.pigletScaleSettings.fromRaw"),id:"fromRaw"})),o.a.createElement(u.a,{name:"cell",component:this.renderCells})),o.a.createElement(E.a,{hasConfirmButton:!0,confirmText:e("save"),onCloseClick:t,formName:w,submitting:n}))}}t.b=Object(l.d)(Object(c.a)(),Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)({name:w}),Object(p.a)({form:w,onSubmit:function(e,t,a){const{scales:n}=a;let r=[];for(let i of n){let t=i.prepareBeanToSave();t.Settings.Configuration||(t.Settings.Configuration={}),t.Settings.Configuration.SET_CONFIGURATION=e,r.push(t)}return Object(y.a)(r).then(e=>{a.handleHide(),Object(y.c)(e)}).catch(e=>{Object(y.b)(e)})},validate:function(e,t){const{t:a}=t,n={};return r()(e.minTare)?n.minTare=a("required"):+e.minTare<0&&(n.minTare=a("errors.noLess",{number:0})),r()(e.maxTare)?n.maxTare=a("required"):+e.maxTare<0&&(n.maxTare=a("errors.noLess",{number:0})),r()(e.scale)?n.scale=a("required"):+e.scale<0&&(n.scale=a("errors.noLess",{number:0})),r()(e.tare)?n.tare=a("required"):+e.tare<0&&(n.tare=a("errors.noLess",{number:0})),r()(e.peaksMinHeight)?n.peaksMinHeight=a("required"):+e.peaksMinHeight<0&&(n.peaksMinHeight=a("errors.noLess",{number:0})),r()(e.maxDifferentBetweenValues)?n.maxDifferentBetweenValues=a("required"):+e.maxDifferentBetweenValues<0&&(n.maxDifferentBetweenValues=a("errors.noLess",{number:0})),r()(e.maxTaraValues)?n.maxTaraValues=a("required"):+e.maxTaraValues<0&&(n.maxTaraValues=a("errors.noLess",{number:0})),n}}))(C)},NK1v:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),i=a("mwIZ"),o=a.n(i),s=a("sEfC"),c=a.n(s),l=a("q1tI"),m=a.n(l),d=a("/MKj"),u=a("U4G4"),p=a("pDHb"),h=a("eWv+"),g=(a("tJ+o"),a("xohT")),b=a("CuyV"),f=a("ANjH"),D=a("LCzB");class v extends l.Component{constructor(...e){super(...e),this.handleSelect=()=>{const{dispatch:e,value:t,onSelect:a,selected:n,onRemove:r}=this.props;e(r&&n?r(t):a(n?null:t))},this.name=()=>{const{name:e,search:t}=this.props,a=t.trim().toLowerCase(),n=e.toLowerCase(),r=a.length,i=n.split(a),o=i.length-1,s=[];let c=0;const l=e.substr(n.indexOf(a),a.length);return i.forEach((t="",a)=>{console.log(c,t.length,e.substr(c,t.length)),s.push(e.substr(c,t.length)),c+=t.length,o!==a&&(c+=Math.max(0,r),s.push(m.a.createElement("span",{className:"font-weight-bold"},l)))}),s}}render(){const{name:e,selected:t,type:a,value:n,t:r}=this.props,i=["fetura-log-chip",t?"selected":""].filter(e=>!!e).join(" ");return m.a.createElement(b.a,{tooltipContent:r(t?"logsView.removeFilter":"logsView.addFilter",{name:e})},m.a.createElement("div",{className:i,onClick:this.handleSelect,id:t?"selected-".concat(n):"item-".concat(n)},m.a.createElement("i",{className:Object(g.a)(a)}),t?e:this.name(),m.a.createElement("i",{className:t?"pl-1 fas fa-fw fa-times":"pl-1"})))}}var O=Object(f.d)(Object(D.a)(),Object(d.connect)(e=>({search:e.logs.search})))(v),E=a("1j/Y"),y=a("pQ8y");class j extends l.Component{constructor(e){super(e),this.state={text:""},this.handleLocalChange=(e="")=>{this.setState({text:e}),this.handleChange(e)},this.handleChange=e=>{const{dispatch:t}=this.props;t(Object(p.f)(e))},this.refresh=({ObjID:e,DtaCrtTime:t,UserID:a,Codes:n})=>{const{dispatch:r}=this.props;console.table({ObjID:e,DtaCrtTime:t,UserID:a,Codes:n}),r(Object(p.b)({ObjID:e,DtaCrtTime:t,UserID:a,Codes:n}))},this.handleClearClick=()=>{const{dispatch:e}=this.props;e(Object(p.g)(null)),e(Object(p.h)(null)),e(Object(p.e)(null)),e(Object(p.d)(null))},this.handleEnterClick=()=>{const{dispatch:e,search:{dates:t,users:a,objects:n,codes:r},userId:i,text:o,startFrom:s,objectId:c,searchCode:l}=this.props,m=[t[0],a[0],n[0],r[0]].filter(e=>!!e);let d=null;if(0===m.length)return null;if(1===m.length)d=m[0];else{const e=Object(E.findBestMatch)(o.toLowerCase(),m.map(e=>e.name.toLowerCase()));d=m[e.bestMatchIndex]}if(!d)return null;let u=i,h=c,g=s;switch(d.type){case"date":g=d.value,e(Object(p.g)(g));break;case"user":u=d.value,e(Object(p.h)(u));break;case"codes":l.includes(d.value)||e(Object(p.d)(d.value));break;default:h=d.value,e(Object(p.e)(h))}return null},this.getParams=e=>{switch(e.type){case"date":return{handleChange:p.g,valueKey:"startFrom"};case"user":return{handleChange:p.h,valueKey:"userId"};case"codes":return{handleChange:p.d,onRemove:p.c,valueKey:"searchCode"};default:return{handleChange:p.e,valueKey:"objectId"}}},this.renderChip=(e,t)=>{if(!e)return null;const a=this.getParams(e);return m.a.createElement(y.a,{key:t,in:!0,timeout:300,classNames:"fade-in",mountOnEnter:!0,unmountOnExit:!0,appear:!0},m.a.createElement(O,{selected:"".concat(t).startsWith("selected"),key:"".concat(e.type,"_").concat(t),onSelect:a.handleChange,name:e.name,value:e.value,type:e.type,onRemove:a.onRemove}))},this.handleKey=e=>{if(114===e.keyCode||e.ctrlKey&&70===e.keyCode){e.preventDefault();try{document.getElementById("log-search-input").focus(),document.body.scrollIntoView()}catch(e){}}},this.handleChange=c()(this.handleChange,200),this.refresh=c()(this.refresh,500)}componentDidUpdate(e,t,a){const{objectId:n,text:i,startFrom:o,userId:s,searchCode:c}=this.props,{text:l}=this.state;t.text===l&&l!==i&&this.setState({text:i}),(!r()(e.searchCode,c)||e.objectId!==n||e.startFrom!==o||e.userId!==s)&&this.refresh({ObjID:n,DtaCrtTime:o,UserID:s,Codes:c})}componentDidMount(){window.addEventListener("keydown",this.handleKey)}componentWillUnmount(){window.removeEventListener("keydown",this.handleKey)}render(){const{text:e,search:{objects:t,dates:a,users:n,selectedDate:r,selectedObject:i,selectedUser:s,codes:c,selectedCodes:l}}=this.props,d=[a.slice(0,3),n.slice(0,3),t.slice(0,3),c.slice(0,3)],p=e.trim().toLowerCase();return d.sort((e,t)=>Object(E.compareTwoStrings)(p,o()(t,"[0].name","").toLowerCase())-Object(E.compareTwoStrings)(p,o()(e,"[0].name","").toLowerCase())),m.a.createElement(m.a.Fragment,null,m.a.createElement(u.a,{id:"log-search-input",className:"mb-4",onClear:this.handleClearClick,onEnter:this.handleEnterClick,onChange:this.handleLocalChange,value:this.state.text}),m.a.createElement("div",{className:"mb-4"},(!!r||!!i||!!s||!!l.length)&&m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"font-weight-bold opacity-50"},"Aktywne filtry"),this.renderChip(r,"selected_00"),this.renderChip(i,"selected_11"),this.renderChip(s,"selected_22"),l.map((e,t)=>this.renderChip(e,"selected_".concat(t)))),(!!a.length||!!n.length||!!t.length||!!c.length)&&m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"font-weight-bold opacity-50"},"Suggestie"),d.map(e=>e.map((e,t)=>this.renderChip(e,t))))))}}t.a=Object(d.connect)((function(e){return{search:Object(h.d)(e),objectId:e.logs.objectId,startFrom:e.logs.startFrom,searchCode:e.logs.searchCode,text:e.logs.search,userId:e.logs.userId}}))(j)},NbQE:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("pJVQ"),l=a("gu+X"),m=a("f0zD"),d=a("0b+E"),u=a("LCzB");const p="requirement-modal";class h extends r.a.Component{constructor(e){super(e),d.a.modalview(p)}render(){const{show:e,handleHide:t,t:a}=this.props;return r.a.createElement(i.a,{show:e,size:"lg",onHide:t},r.a.createElement("form",null,r.a.createElement(o.b,{title:a("requirements.requirements"),onCloseClick:t}),r.a.createElement(s.a,null,r.a.createElement("a",null,a("requirements.browsers")," :"),r.a.createElement("ul",null,r.a.createElement("li",null,r.a.createElement("a",null,"-",a("requirements.browsersValueGoogle"),",")),r.a.createElement("li",null,r.a.createElement("a",null,"-",a("requirements.browsersValueFirefox"),",")),r.a.createElement("li",null,r.a.createElement("a",null,"-",a("requirements.browsersValueOpera"),",")),r.a.createElement("li",null,r.a.createElement("p",null,"-",a("requirements.browsersValueSafari")))),r.a.createElement("p",null,a("requirements.netSpeed")," : ",a("requirements.netSpeedValue")),r.a.createElement("p",null,a("requirements.operatingSystem")," : ",a("requirements.operatingSystemValue")),r.a.createElement("p",null,a("requirements.ramMemory")," : ",a("requirements.ramMemoryValue")),r.a.createElement("p",null,a("requirements.memory")," : ",a("requirements.memoryValue")),r.a.createElement("p",null,a("requirements.resolution")," : ",a("requirements.resolutionValue"))),r.a.createElement(l.a,{onCloseClick:t})))}}h=Object(c.a)({form:p})(h),h=Object(m.a)({name:p})(h),t.b=Object(u.a)()(h)},Ndvx:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("wd/R"),d=a.n(m),u=a("Tt2W"),p=(a("/MUC"),a("uSQv")),h=a("2dKy"),g=a("0b+E"),b=a("LCzB");const f="compare-day-data";class D extends r.a.Component{constructor(e){super(e),this.state={day1:d.a.utc().startOf("day"),day2:d.a.utc().subtract(1,"day").startOf("day")},g.a.modalview(f)}setData(e,t){e.toDate().getTime()<=d.a.utc().startOf("day").toDate().getTime()&&this.setState({[t]:d.a.utc(e,"YYYY-MM-DD")})}onSubtractDay(e){let t=this.state[e].clone();t.subtract(1,"day"),this.setData(t,e)}onAddDay(e){let t=this.state[e].clone();t.add(1,"day"),this.setData(t,e)}onDayChange(e,t){this.setData(d.a.utc(e,"YYYY-MM-DD"),t)}createDatePicker(e){return r.a.createElement("div",null,r.a.createElement("label",null,"Dzie\u0144 ",e),r.a.createElement("div",{className:"compare-day-data-controls-container"},r.a.createElement(p.a,{icon:r.a.createElement("i",{className:"fas fa-chevron-left"}),onClick:()=>this.onSubtractDay("day".concat(e))}),r.a.createElement(h.a,{type:"date",value:this.state["day".concat(e)].format("YYYY-MM-DD"),onChange:t=>this.onDayChange(t,"day".concat(e))}),r.a.createElement(p.a,{icon:r.a.createElement("i",{className:"fas fa-chevron-right"}),onClick:()=>this.onAddDay("day".concat(e))})))}render(){const{show:e,handleHide:t,chart:a,device:n,t:l}=this.props,{day1:m,day2:d}=this.state;return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement(o.b,{title:l("modals.compareDaysModal.title"),onCloseClick:t}),r.a.createElement(s.a,{className:f},r.a.createElement("div",{className:"compare-day-data-controls"},this.createDatePicker(1),this.createDatePicker(2)),r.a.createElement("div",{className:"compare-day-data-chart"},"passes"===a&&r.a.createElement(u.a,{cage:n,date:m,applyShadow:!0,shadowDate:d}))),r.a.createElement(c.a,{hasConfirmButton:!0,onCloseClick:t,formName:f}))}}D=Object(l.a)({name:f})(D),t.b=Object(b.a)()(D)},NpuV:function(e,t,a){"use strict";a.d(t,"a",(function(){return L}));var n=a("J2iB"),r=a.n(n),i=a("mwIZ"),o=a.n(i),s=a("BkRI"),c=a.n(s),l=a("q1tI"),m=a.n(l),d=a("/MKj"),u=a("zM5D"),p=a("UGc4"),h=a("0pzG"),g=a("gu+X"),b=a("f0zD"),f=a("17x9"),D=a.n(f),v=a("pxzG"),O=a("AAik"),E=a("wd/R"),y=a.n(E),j=a("G7tO"),w=a("q17X"),C=a("eASP"),S=a("0b+E"),T=a("6/k7"),I=a("UZWR"),k=a("mr+a"),x=a("/kok"),M=a("dxSB"),N=a("udB/"),A=a("84Ez"),P=a("s506"),F=a("vzZS"),z=a("/S4a"),B=a("LCzB"),R=a("i7k/"),W=a("c5t2");const L="feeding-history-modal";class V extends m.a.Component{constructor(e,t){super(e,t),this.getParams=()=>({AggDataTimeFrom:+y.a.utc().startOf("day").subtract(30,"days"),AggDataTimeTo:+y.a.utc().startOf("day")}),this.getDeviceIDs=()=>{const{type:e,selectedNodes:t}=this.props,a=[],n=e=>({device:o()(e,"device"),DevID:o()(e,"receiver.deviceId"),GwID:o()(e,"receiver.gatewayId"),index:o()(e,"receiver.index")});if(e===T.f.INDIVIDUAL)a.push(n(t[0]));else{const{rfidDevices:e}=this.props;for(const t of e)a.push(n(t))}return a},this.filterData=(e,t,a)=>e?e.filter(e=>e.AggTi>=t&&e.AggTi<=a):[],this.getData=()=>{const{license:e}=this.props;return Object(w.isUsingFakeData)()?Object(W.d)():e===P.b.EXTENDED?this.getDataExtended():this.getDataSimple()},this.getDataSimple=()=>{const{selectedNodes:e}=this.props,t=c()(o()(e,"[0].lastWeekHistory",[])).map(e=>({plannedUsage:e.plannedUsage||0,usage:e.usage||0,time:e.date,name:y()(e.date).format("DD.MM.YY")}));return t.sort((e,t)=>t.time-e.time),t},this.getDataExtended=()=>{const e=this.getParams(),{devices:t}=this.state,{data:a}=this.props,n={},i=[];return t.forEach(({DevID:t,index:n})=>{let o=r()(n)?t:"".concat(t,"_").concat(n);i.push(...this.filterData(a.get(o),e.AggDataTime?e.AggDataTime:e.AggDataTimeFrom,e.AggDataTime?e.AggDataTime:e.AggDataTimeTo))}),i.forEach(e=>{const{type:t,selectedNodes:a}=this.props;let r=0,i=0,s=e.AggTi;if(t===T.f.INDIVIDUAL){const t=o()(a,"[0].animal.AnmID");switch(e.AggDt.length){case 0:break;case 1:i=e.AggDt[0].PCons,r=e.AggDt[0].Cons.reduce((e,t)=>(t.C||0)+e,0);break;default:if(t){const a=e.AggDt.find(e=>e.AnmID===t);a&&(i=a.PCons,r=a.Cons.reduce((e,t)=>t.C+e,0))}}}else if(t===T.f.GROUP){const t=o()(a,"[0].name");if(t){const a=e.AggDt.find(e=>e.RFID===t);a&&(i=a.PCons,r=a.Cons.reduce((e,t)=>t.C+e,0))}}n[s]?(n[s].usage+=r,!n[s].plannedUsage&&(n[s].plannedUsage=i)):(n[s]={},n[s].usage=r,n[s].plannedUsage=i,n[s].time=s,n[s].name=y.a.utc(s).format("DD.MM.YY"))}),Object.values(n).sort((e,t)=>t.time-e.time)},this.formatTime=e=>y.a.utc(e).format("DD.MM.YY"),this.formatForage=e=>Object(v.j)(e,{showUnit:!0,fixed:this.unit?2:0,unit:this.unit}),this.formatPlannedUsage=e=>"".concat((e.plannedUsage?100*e.usage/e.plannedUsage:0).toFixed(0),"%"),this.infoBox=()=>{const{license:e,t:t}=this.props;return{show:!0,text:t("deviceRows.siloses.siloRow.lastXdays",{count:e===P.b.EXTENDED?30:7}),color:"info"}},this.handleChange=e=>{this.setState({showChart:0!==e})},this.unit=Object(w.getFeedingUnit)();const{selectedNodes:a=[],handleHide:n,license:i}=this.props;1!==a.length&&n(),this.state={loading:!Object(w.isUsingFakeData)()&&i===P.b.EXTENDED,showChart:!0,devices:i===P.b.EXTENDED?this.getDeviceIDs():[]},S.a.modalview(L)}static getDerivedStateFromProps(e,t){const a=V.checkLoading(t,e);return t.loading!==a?{loading:a}:null}componentDidMount(){if(!Object(w.isUsingFakeData)()){const{devices:e}=this.state,{dispatch:t,data:a,license:n}=this.props;if(n===P.b.EXTENDED){const n=this.getParams();e.forEach(({device:e,index:i})=>{let o=e.DevID;r()(i)||(n.index=i,o="".concat(o,"_").concat(i)),x.a.sendRequestForAggregatedData(e);let s=!1;if(a.has(o)){Math.abs(n.AggDataTime?0:y()(n.AggDataTimeFrom).diff(y()(n.AggDataTimeTo),"days"))+1!==this.filterData(a.get(o),n.AggDataTime?n.AggDataTime:n.AggDataTimeFrom,n.AggDataTime?n.AggDataTime:n.AggDataTimeTo).length&&(s=!0)}else s=!0;s&&t(Object(M.a)(e,n))})}}}render(){const{show:e,handleHide:t,t:a,selectedNodes:n}=this.props;this.unit=Object(w.getFeedingUnit)();const r=this.getData(),{showChart:i,loading:s}=this.state,c=o()(n,"[0].name",a("modals.feedingHistoryModal.feedingHistory")),l=this.infoBox(),d=[{name:a("date"),field:"time",valueFormatter:this.formatTime,customSort:R.c},{name:a("forageAmount"),field:"usage",valueFormatter:this.formatForage},{name:a("modals.feedingHistoryModal.dailyPercentage"),field:"",valueFormatter:this.formatPlannedUsage}];return m.a.createElement(u.a,{onHide:t,show:e,size:"lg"},m.a.createElement(p.b,{title:c,loading:s&&!!r.length,onCloseClick:t}),m.a.createElement(h.a,{className:L},m.a.createElement(N.a,{isLoading:s&&!r.length}),l.show&&m.a.createElement(F.a,{boxColor:l.color},l.text),m.a.createElement(z.a,{className:"mb-2",onChange:this.handleChange,value:+i,options:[{name:a("chart"),value:1},{name:a("table"),value:0}]}),m.a.createElement("div",null,i&&m.a.createElement("div",{style:{height:"20rem"}},m.a.createElement(j.a,{data:r.slice(0).reverse(),type:"Composed",dataDef:[{color:"blue",dataKey:"usage",chartType:"Bar",name:a("modals.feedingHistoryModal.fed"),unit:Object(v.l)("weight",C.a.MEDIUM),valueConverter:e=>Object(v.j)(e,{showUnit:!1,rawValue:!0,unit:this.unit,fixed:this.unit?2:0,defaultValue:0}),opacity:1},{color:"green",dataKey:"plannedUsage",name:a("modals.feedingHistoryModal.curve"),chartType:"Area",unit:Object(v.l)("weight",C.a.MEDIUM),valueConverter:e=>Object(v.j)(e,{showUnit:!1,rawValue:!0,unit:this.unit,fixed:this.unit?2:0,defaultValue:0}),opacity:.1}],Xaxis:{name:a("day"),dataKey:"name"},Yaxis:{name:a("forageAmount"),domain:[0,"auto"]}})),!i&&m.a.createElement(O.a,{headers:d,data:r}))),m.a.createElement(g.a,{hasConfirmButton:!1,onCloseClick:t}))}}V.checkLoading=(e,t)=>{if(Object(w.isUsingFakeData)())return!1;const{devices:a}=e,{license:n}=t;if(n!==P.b.EXTENDED)return!1;for(let i=0;i({forages:e.settings.forage,rfidDevices:Object(k.e)(e,{CID:t.locationID}),fetchingMap:e.aggregatedData.fetchingMap,data:e.aggregatedData.data,settlement:Object(I.c)(e,{CID:t.locationID}),license:Object(A.a)(e,{licenseName:P.a.DISPENSER})}))(V),V=Object(b.a)({name:L})(V),t.b=V=Object(B.a)()(V)},OomU:function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("d/v1"),l=a("pJVQ"),m=a("26mJ"),d=a("gu+X"),u=a("f0zD"),p=a("cD3Q"),h=a("Bffz"),g=a("fz41"),b=a("0MVo"),f=a("XzT5");function D(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function v(e){for(var t=1;t{this.captchaDemo=e},size:"normal",hl:u.lang.toString(),"data-theme":"dark",render:"explicit",sitekey:"6Ldsx8UUAAAAAOFoZ9Up22CRa2wCoGgPzUNVi9c5",onloadCallback:this.onLoadRecaptcha,verifyCallback:this.verifyCaptcha})),r.a.createElement(d.a,{hasConfirmButton:l,confirmText:this.props.t("send"),onCloseClick:t,formName:C})))}}S=Object(l.a)({form:C,onSubmit:async function(e,t,a,n={}){try{await Object(g.c)(v({},h.a.sendEmail(),{body:e})),n=v({},n,{title:f.a.t("notifications.mailSuccess"),status:"success",dismissible:!0,dismissAfter:3e3}),t(Object(p.addNotification)(n))}catch(r){n.title=f.a.t("notifications.mailFailure"),n.message=r+"",n.status="error",n.dismissible=!0,n.dismissAfter=3e3,t(Object(p.addNotification)(n))}a.handleHide()},validate:(e,t)=>{const a={},{t:n}=t;return e.email?Object(b.f)(e.email)||(a.email=n("errors.invalidEmail")):a.email=n("required"),e.message?e.message.length<10&&(a.message=f.a.t("errors.messageMustBeGreaterThan",{count:10})):a.message=n("required"),a}})(S),S=Object(E.connect)(e=>({lang:e.language.lang,user:e.user.user.ClientID}))(S),S=Object(u.a)({name:C})(S);t.b=Object(w.a)()(S)},QAqx:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a("mwIZ"),r=a.n(n),i=a("AF5L");function o(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 s(e){for(var t=1;t{e.push({PlcmntID:t.LocID,animals:t.animals.map(e=>s({},e,{correction:m}))})}),u.individualDTM.length&&u.individualDTM.forEach(t=>{e.push({DevID:t.DevID,dispensers:t.outputs.map(e=>({number:e.number,AnmID:e.AnmID,correction:m}))})}),u.individualNRF.devices.length&&u.individualNRF.devices.forEach(t=>{e.push({DevID:t,AnmID:r()(n.find(e=>e.animal&&r()(e,"receiver.deviceId")===t),"animal.AnmID"),correction:m})}),e.length&&Object(i.p)(d,{devices:e})}c(),l()}},RNJp:function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("17x9"),d=a.n(m),u=a("wd/R"),p=a.n(u),h=a("/MKj"),g=a("AAik"),b=a("dxSB"),f=a("uSQv"),D=(a("TmYi"),a("2dKy")),v=a("0b+E"),O=a("pxzG"),E=a("eASP"),y=a("LCzB");const j="cage-expand-data";class w extends r.a.Component{constructor(e){super(e),this.onDateChange=e=>{let t=p.a.utc(e);this.setState({date:t}),this.checkIfNeedToGetAggregatedData(t.toDate().getTime())},this.weightValueFormatter=e=>Object(O.j)(e,{unit:E.a.MEDIUM,showUnit:!0,fixed:2}),this.timeValueFormatter=e=>p()(e).format("HH:mm"),this.onLowerDateClick=()=>{let e=this.findLowerDateWithData();this.setState({date:e}),this.checkIfNeedToGetAggregatedData(e.toDate().getTime())},this.onAddDateClick=()=>{let e=this.findHigherDateWithData();this.setState({date:e}),this.checkIfNeedToGetAggregatedData(e.toDate().getTime())},this.state={date:p.a.utc().startOf("day")},v.a.modalview(j)}getHeaders(){switch(this.props.type){case"RFID":return[{name:this.props.t("currentWeight"),field:"weight",valueFormatter:this.weightValueFormatter},{name:"RFID",field:"RFID"},{name:this.props.t("time"),field:"time",valueFormatter:this.timeValueFormatter}];case"Middle":return[{name:this.props.t("currentWeight"),field:"W",valueFormatter:this.weightValueFormatter},{name:this.props.t("time"),field:"T",valueFormatter:this.timeValueFormatter}];default:return[]}}checkIfNeedToGetAggregatedData(e){let t=this.props.cageData.get(this.props.cage.DevID),a=!!t;if(a&&(a=t.filter(t=>t.AggTi===e).length>0),!a){let t={AggDtTime:e};this.props.dispatch(Object(b.a)(this.props.cage,t))}}getShadow(){try{return this.props.shadows.get(this.props.cage.DevID)}catch(e){return}}getMiddlePasses(){try{const{date:e}=this.state;if(e.isSame(p.a.utc(),"day")){return this.getShadow().ExpeditionMiddlePasses.slice(0).sort((e,t)=>e.time-t.time)}return this.props.cageData.get(this.props.cage.DevID).find(t=>t.AggTi===e.toDate().getTime()).AggDt[0].ExpMidPass.slice(0).sort((e,t)=>e.T-t.T)}catch(e){return console.error(e),[]}}getRFIDPasses(){try{const{date:e}=this.state;let t=this.props.cageData.get(this.props.cage.DevID).find(t=>t.AggTi===e.toDate().getTime());console.log(t);let a=[];for(let n of t.AggDt[0].RFIDPass)for(let e of n.P)a.push({weight:e.W,time:e.T,RFID:n.RFID});return a.sort((e,t)=>t.time-e.time)}catch(e){return console.error(e),[]}}getData(){switch(this.props.type){case"RFID":return this.getRFIDPasses();case"Middle":return this.getMiddlePasses();default:return[]}}getTitle(){switch(this.props.type){case"RFID":return this.props.t("chamber.separationCageInfo.rfidPasses");case"Middle":return this.props.t("chamber.separationCageInfo.middlePasses");default:return""}}checkIfHaveMiddleData(e){return e.AggDt[0].ExpMidPass&&e.AggDt[0].ExpMidPass.length>0}checkIfHaveRFIDData(e){return e.AggDt[0].RFIDPass&&e.AggDt[0].RFIDPass.length>0}findLowerDateWithData(){const{date:e}=this.state,{cageData:t,cage:a}=this.props;let n=t.get(a.DevID),r=null;switch(this.props.type){case"RFID":r=n.filter(t=>t.AggTit.AggTi-e.AggTi)[0];break;case"Middle":r=n.filter(t=>t.AggTit.AggTi-e.AggTi)[0]}return r?p()(r.AggTi):e.clone().subtract(1,"day")}findHigherDateWithData(){const{date:e}=this.state,{cageData:t,cage:a}=this.props;let n=t.get(a.DevID),r=null;switch(this.props.type){case"RFID":r=n.filter(t=>t.AggTi>e.toDate().getTime()&&this.checkIfHaveRFIDData(t)).sort((e,t)=>e.AggTi-t.AggTi)[0];break;case"Middle":r=n.filter(t=>t.AggTi>e.toDate().getTime()&&this.checkIfHaveMiddleData(t)).sort((e,t)=>e.AggTi-t.AggTi)[0]}return r?p()(r.AggTi):e.clone().add(1,"day")}render(){const{show:e,handleHide:t}=this.props,{date:a}=this.state;return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement(o.b,{title:this.getTitle(),onCloseClick:t}),r.a.createElement(s.a,{className:j},r.a.createElement("div",{className:"controls"},r.a.createElement(f.a,{icon:r.a.createElement("i",{className:"fas fa-chevron-left"}),onClick:this.onLowerDateClick}),r.a.createElement(D.a,{type:"date",value:a.format("YYYY-MM-DD"),onChange:this.onDateChange}),r.a.createElement(f.a,{icon:r.a.createElement("i",{className:"fas fa-chevron-right"}),onClick:this.onAddDateClick})),r.a.createElement(g.a,{data:this.getData(),headers:this.getHeaders(),shouldIndex:!0})),r.a.createElement(c.a,{onCloseClick:t}))}}w.propTypes={cage:d.a.object,type:d.a.string};const C=Object(h.connect)(e=>({cageData:e.aggregatedData.data,shadows:e.shadows.shadows}))(w);w=Object(l.a)({name:j})(C),t.b=Object(y.a)()(w)},"Rj/F":function(e,t,a){},SXbh:function(e,t,a){"use strict";a.d(t,"a",(function(){return V}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("d/v1"),d=a("pJVQ"),u=a("tDQA"),p=a("PbGg"),h=a("26mJ"),g=a("4huo"),b=a("/MKj"),f=a("PMCe"),D=a("J2iB"),v=a.n(D),O=a("i8MS"),E=a("PRyg"),y=a("CX8Q"),j=a("n7pt"),w=a("7e/R"),C=a("pYWN"),S=a("kCmh"),T=a("wd/R"),I=a.n(T);function k(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function x(e){for(var t=1;te.Role===z.c._SERVICE);return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement("form",{onSubmit:b},r.a.createElement(o.b,{title:R.a.t("modals.editBasicsAnimal.title",{type:a.AnmNo1}),onCloseClick:t}),r.a.createElement(s.a,null,r.a.createElement(m.a,{component:h.a,type:"text",name:"AnmNo1",label:p("animalNumber")}),r.a.createElement(m.a,{component:h.a,type:"text",name:"AnmNo2",label:p("secondaryNumber")}),!!j&&r.a.createElement(m.a,{component:g.b,name:"AnimalKind",label:p("animalType"),options:[{name:p("animalKind.0"),value:f.SOW},{name:p("animalKind.2"),value:f.PIGLET},{name:p("animalKind.3"),value:f.PORKER},{name:p("animalKind.4"),value:f.BOAR},{name:p("animalKind.5"),value:f.RENOVATION_SOW}]}),r.a.createElement(m.a,{component:A.a,label:p("modals.editBasicsAnimal.isDead"),name:"isDead",disabled:!a.DtaDthTime}),d&&r.a.createElement(r.a.Fragment,null,u!==I()(a.DtaDthTime).format("YYYY-MM-DDTHH:mm")&&r.a.createElement(P.a,{boxColor:"error"},p("modals.editBasicsAnimal.changeDate")),r.a.createElement(m.a,{name:"DtaDthTime",component:h.a,type:"datetime-local",label:p("modals.editBasicsAnimal.dtaDthTime")})),!d&&r.a.createElement(r.a.Fragment,null,!!a.DtaDthTime&&r.a.createElement(P.a,{boxColor:"info"},p("modals.editBasicsAnimal.removeEvent")),(!Array.isArray(a.PlcmntID)||1===a.PlcmntID.length)&&r.a.createElement(r.a.Fragment,null,!this.isSowOrBoar()&&r.a.createElement(m.a,{name:"AnmCnt",component:h.a,label:p("animalCount"),type:"number"}))),r.a.createElement(m.a,{component:h.a,name:"Weight",label:p("weight"),type:"number",unit:"kg",parse:e=>e?+e:null}),r.a.createElement(m.a,{component:h.a,name:"RFID",label:p("rfid"),type:"number",normalize:N.c}),r.a.createElement(m.a,{component:h.a,name:"Price",label:p("price"),type:"number",parse:e=>e?+e:null}),r.a.createElement(m.a,{component:g.b,name:"SupplierID",label:p("supplier"),options:O.map(e=>({name:e.Value,value:e.ID}))}),r.a.createElement(m.a,{label:p("race"),component:g.b,name:"Race",options:n.WData[l]?n.WData[l].map(e=>({name:e.Value,value:e.ID})):[]}),r.a.createElement(m.a,{label:p("birthDate"),component:h.a,name:"DtaBrthTime",type:"datetime-local"}),!E&&r.a.createElement(P.a,{boxColor:"warning"},p("errors.invalidDate"))),r.a.createElement(c.a,{hasConfirmButton:!0,confirmText:p("save"),hasButtonDisabled:!y,onCloseClick:t,formName:V,submitting:v})))}}q=Object(d.a)({form:V,onSubmit:function(e,t,a){let n=new y.a(e).prepareBeanToSave();return console.log(n),delete n.isDead,e.isDead||delete n.DtaDthTime,Object(C.a)([{animal:x({},n,{DtaBrthTime:e.DtaBrthTime?I()(n.DtaBrthTime).toDate().getTime():null,RFID:Object(w.a)(n.RFID)}),devices:S.a.getDevicesInPlcmntID(n.PlcmntID,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID}))}]).then(e=>{a.handleHide(),Object(C.c)(e)}).catch(e=>{Object(C.b)(e)})},validate:function(e,t){const a={},{t:n,animal:r}=t;if(e.AnmNo1?e.AnmNo1!==r.AnmNo1&&O.a.checkIfAnimalExistOnFarm(e.AnmNo1,e.FarmID,e.AnmID)&&(a.AnmNo1=n("errors.exist")):a.AnmNo1=n("required"),e.DtaBrthTime&&Object(E.isEventDateInvalid)(e.DtaBrthTime,t.farm)&&(a.DtaBrthTime=n("required")),(v()(e.DtaDthTime)||Object(E.isEventDateInvalid)(e.DtaDthTime,t.farm))&&(a.DtaDthTime=n("required")),e.RFID){const t=Object(w.a)(e.RFID);(O.a.checkIfHaveRFID(t,e.FarmID)||j.a.getLocationByRFID(t,e.FarmID))&&t!==r.RFID?a.RFID=n("errors.duplicate"):+e.AnmCnt>1&&(a.RFID=n("errors.anmCntTooBigForRFID"))}return v()(e.AnimalKind)&&(a.AnimalKind=n("required")),e.AnmCnt||(a.AnmCnt=n("required")),a}})(q);const H=Object(u.a)(V),U=Object(b.connect)(e=>({farm:e.location.farm,lang:e.language.lang.lang,race:e.dictionary.race,user:e.user.user,suppliers:e.dictionary.suppliers.WData[e.language.lang.lang],AnimalKind:H(e,"AnimalKind"),isDead:H(e,"isDead"),DtaDthTime:H(e,"DtaDthTime"),DtaBrthTime:H(e,"DtaBrthTime"),PlcmntID:H(e,"PlcmntID"),dirty:Object(p.a)(V)(e)}))(q);q=Object(l.a)({name:V})(U);t.b=Object(B.a)()(q)},T34T:function(e,t,a){"use strict";a.d(t,"a",(function(){return k}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("d/v1"),c=a("pJVQ"),l=a("tDQA"),m=a("/MKj"),d=a("W6fe"),u=a("zM5D"),p=a("3Z9Z"),h=a("JI6e"),g=a("UGc4"),b=a("0pzG"),f=a("gu+X"),D=a("f0zD"),v=a("17x9"),O=a.n(v),E=a("XoCd"),y=a("pxzG"),j=a("q17X"),w=a("2HEh"),C=a("0b+E"),S=a("VyNe"),T=a("mr+a"),I=a("LCzB");const k="feeding-extra-feeding-modal",x=[200,500,1e3,1500,2e3];class M extends o.a.Component{constructor(e){super(e),this.handleClick=e=>{x[e]?this.setState({showDose:!1},()=>{const{change:t}=this.props;t("forageDose",x[e])}):this.setState({showDose:!0})},C.a.modalview(k);const{initialize:t,cookies:a}=this.props,n=x.map(e=>({name:Object(y.j)(e,{unit:Object(j.getFeedingUnit)(),showUnit:!0,fixed:Object(j.getFeedingUnit)()?2:0}),value:e})),i=a.get(k);let o=!x.includes(r()(i,"forageDose",500));t({forageDose:r()(i,"forageDose",500)}),this.state={doseOptions:n,showDose:o}}render(){const{show:e,handleHide:t,t:a,handleSubmit:n,forageDose:r}=this.props,{doseOptions:i,showDose:c}=this.state,l=Object(j.getFeedingUnit)();return o.a.createElement(u.a,{onHide:t,show:e,size:"lg"},o.a.createElement("form",{onSubmit:n},o.a.createElement(g.b,{title:a("extraFeeding"),onCloseClick:t}),o.a.createElement(b.a,{className:k},o.a.createElement("div",null,o.a.createElement(p.a,null,i.map((e,t)=>o.a.createElement(h.a,{xs:6,sd:4,md:3,key:t},o.a.createElement(S.a,{onClick:()=>this.handleClick(t),selected:!c&&e.value===r},e.name))),o.a.createElement(h.a,{xs:6,sd:4,md:3},o.a.createElement(S.a,{onClick:()=>this.handleClick(9999),selected:c},a("modals.feedingExtraFeedingModal.other")))),c&&o.a.createElement(s.a,{name:"forageDose",id:"forageDose",type:"number",required:!0,step:100,min:100,max:2500,component:E.a,valueFormatter:e=>Object(y.j)(e,{unit:l,showUnit:!0,fixed:l?2:0}),label:a("modals.feedingExtraFeedingModal.forageDose")}))),o.a.createElement(f.a,{hasConfirmButton:!0,confirmText:a("modals.feedingExtraFeedingModal.start"),onCloseClick:t,formName:k})))}}M.propTypes={selectedNodes:O.a.array.isRequired},M=Object(c.a)({form:k,onSubmit:d.a,validate:d.b,initialValues:{forageDose:500}})(M);const N=Object(l.a)(k),A=Object(m.connect)(e=>({forages:Object(T.d)(e),buildings:e.farms.buildings,forageDose:N(e,"forageDose")}))(M);M=Object(w.a)(Object(D.a)({name:k})(A)),t.b=Object(I.a)()(M)},TV8c:function(e,t,a){},TbHc:function(e,t,a){"use strict";a.d(t,"a",(function(){return F}));var n=a("q1tI"),r=a.n(n),i=a("f0zD"),o=a("tDQA"),s=a("d/v1"),c=a("3t43"),l=a("pJVQ"),m=a("3Z9Z"),d=a("JI6e"),u=a("zM5D"),p=a("UGc4"),h=a("0pzG"),g=a("/MKj"),b=a("gu+X"),f=a("mwIZ"),D=a.n(f),v=a("qeiZ"),O=a("0MVo"),E=a("fAk8"),y=a("ta7J");var j=a("JZ7A"),w=a("XM6k"),C=a("26mJ"),S=a("lAGl"),T=a("uSQv"),I=a("vzZS"),k=a("w2lk"),x=a("LCzB"),M=a("ANjH");function N(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 A(e){for(var t=1;t{const{newDataArray:r,i18n:i,locale:o}=this.props;let s=+n.split("[")[1].split("]")[0],c=[];if(t)for(let l=0;le.parent!==s);this.props.change("newDataArray",c)},this.renderFieldArray=({fields:e})=>r.a.createElement("div",null,r.a.createElement(m.a,null,r.a.createElement(d.a,{xs:10},r.a.createElement(m.a,null,r.a.createElement(d.a,{xs:6},this.props.t("modals.addTranslation.key")),r.a.createElement(d.a,{xs:6},this.props.t("value")))),r.a.createElement(d.a,{xs:1},"Licznik"),r.a.createElement(d.a,{xs:1})),e.map((t,a)=>{let n=e.get(a);return console.log(n),r.a.createElement(m.a,null,r.a.createElement(d.a,{xs:10},r.a.createElement(m.a,null,r.a.createElement(d.a,{xs:6},r.a.createElement(s.a,{name:"".concat(t,".key"),component:S.a,type:"text"})),r.a.createElement(d.a,{xs:6},r.a.createElement(s.a,{name:"".concat(t,".value"),component:S.a,type:"text"})))),r.a.createElement(d.a,{xs:1,style:{paddingTop:".25rem"}},!n.generated&&r.a.createElement(s.a,{component:k.a,name:"".concat(t,".count"),id:"".concat(t,".count"),label:"",onChange:this.onChangeCount})),r.a.createElement(d.a,{xs:1,style:{paddingTop:".25rem"}},!n.generated&&r.a.createElement(T.a,{buttonStyle:"round",icon:r.a.createElement("i",{className:"fas fa-trash pointer"}),onClick:()=>e.remove(a),disabled:1===e.length})))}),r.a.createElement(T.a,{icon:r.a.createElement("i",{className:"fas fa-plus"}),onClick:()=>e.push({})},this.props.t("modals.addTranslation.addNext"))),this.props.initialize({addNewObject:!1,showTextArea:!1,newDataArray:[{}]})}createTreeData(e,t=""){let a=[];if("object"===typeof e)for(let n in e)if(e[n]&&"string"!==typeof e[n]){let r=t?"".concat(t,".").concat(n):n;a.push({name:"key",object:{key:n,path:r,object:e[n]},key:"path",children:this.createTreeData(e[n],r)})}return""===t&&a.push({name:"name",object:{name:this.props.t("modals.addTranslation.new"),path:t,isNew:!0},key:"path",children:[]}),a}hasValueType(e){const{path:t}=this.props;if(t){if(t.object.isNew)return!0;for(let a in t.object.object)if(typeof t.object.object[a]===e)return!0}return!1}render(){const{show:e,handleHide:t,handleSubmit:a,submitting:n,addNewObject:i,showTextArea:o,t:l}=this.props,{tree:g}=this.state;return r.a.createElement(u.a,{onHide:t,show:e,size:"xl"},r.a.createElement("form",{onSubmit:a},r.a.createElement(p.a,{title:l("modals.addTranslation.title"),onCloseClick:t}),r.a.createElement(h.a,null,r.a.createElement(s.a,{name:"path",component:j.a,options:g}),r.a.createElement(m.a,null,r.a.createElement(d.a,{sm:6},r.a.createElement(s.a,{name:"addNewObject",component:w.a,label:l("modals.addTranslation.addNewObject"),id:"addNewObject"})),r.a.createElement(d.a,{sm:6},r.a.createElement(s.a,{name:"showTextArea",component:w.a,label:l("modals.addTranslation.addWithObject"),id:"showTextArea"}))),i&&r.a.createElement(r.a.Fragment,null,!this.hasValueType("object")&&r.a.createElement(I.a,{boxColor:"warning"},l("modals.addTranslation.noObjectWarning")),r.a.createElement(s.a,{name:"newObjectKey",component:C.a,type:"text",label:l("modals.addTranslation.newKeyName")})),!i&&!this.hasValueType("string")&&r.a.createElement(I.a,{boxColor:"warning"},l("modals.addTranslation.noStringWarning")),o&&r.a.createElement(s.a,{name:"newDataObject",component:C.a,type:"textarea",label:l("value")}),!o&&r.a.createElement(c.a,{name:"newDataArray",component:this.renderFieldArray})),r.a.createElement(b.a,{hasConfirmButton:!0,confirmText:l("save"),onCloseClick:t,formName:F,submitting:n})))}}t.b=Object(M.d)(Object(x.a)(),Object(i.a)({name:F}),Object(g.connect)((function(e,t){return{language:Object(y.b)(e,t.locale),validationLanguage:Object(y.c)(e,t.locale),addNewObject:z(e,"addNewObject"),showTextArea:z(e,"showTextArea"),path:z(e,"path"),newDataArray:z(e,"newDataArray")}})),Object(l.a)({form:F,onSubmit:function(e,t,a){const{locale:n}=a,{addNewObject:r,path:i,showTextArea:o,newObjectKey:s,newDataObject:c,newDataArray:l}=e;let m=i.object.path;r&&(m+=""!==m?".".concat(s):"".concat(s));let d=[];if(o){let e=JSON.parse(c);for(let t in e)d.push({lang:n,path:"".concat(m,".").concat(t),value:e[t]})}else d=l.map(e=>({lang:n,path:""!=="".concat(m)?"".concat(m,".").concat(e.key):"".concat(e.key),value:e.value}));return Object(v.c)(d).then(e=>{Object(v.e)(e),t(Object(E.e)([n],!1)),a.handleHide()}).catch(e=>{Object(v.d)(e)})},validate:function(e,t){const a={},{t:n,language:r}=t;if(e.newDataObject)try{let t=JSON.parse(e.newDataObject);if(e.path){let i=e.path.object.path;e.newObjectKey&&(i+="."+e.newObjectKey);let o=Object(y.a)(t,i);for(let e of o)D()(r,e.path)&&(a.newDataObject=n("errors.foundKeyDuplicate",{key:e.path}))}}catch(i){a.newDataObject=n("errors.cantParse")}else a.newDataObject=n("required");return e.newObjectKey||(a.newObjectKey=n("required")),e.path||(a.path=n("required")),e.newDataArray&&(a.newDataArray=e.newDataArray.map(a=>{const i={};if(a.key){if(e.path){let t=e.path.object.path;e.newObjectKey&&(t+="."+e.newObjectKey),t+="."+a.key,D()(r,t)&&(i.key=n("errors.foundKeyDuplicate",{key:t}))}}else i.key=n("required");return a.value||(i.value=n("required")),2===t.i18n.services.pluralResolver.getRule(t.locale).numbers.length?(a.generated&&!a.key.includes("_plural")&&(i.key=Object(O.d)(n("errors.mustInclude"),"_plural")),!a.generated&&!a.count||a.value.includes("{{count}}")||(i.value=Object(O.d)(n("errors.mustInclude"),"{{count}}"))):(a.count&&!a.key.includes("_0")&&(i.key=Object(O.d)(n("errors.mustInclude"),"_0")),a.index&&!a.key.includes("_".concat(a.index))&&(i.key=Object(O.d)(n("errors.mustInclude"),"_".concat(a.index))),!a.index&&!a.count||a.value.includes("{{count}}")||(i.value=Object(O.d)(n("errors.mustInclude"),"{{count}}"))),i})),a},warn:function(e,t){const a={},{t:n,validationLanguage:r}=t;try{let t=JSON.parse(e.newDataObject);if(e.path){let i=e.path.object.path;e.newObjectKey&&(i+="."+e.newObjectKey);let o=Object(y.a)(t,i);console.log(o);for(let e of o){let t=r.find(t=>t.value===e.value);t&&(a.newDataObject=n("errors.foundValueDuplicate",{key:t.path}))}}}catch(i){}return e.newDataArray&&(a.newDataArray=e.newDataArray.map(e=>{const t={};if(e.value){let a=r.find(t=>t.value===e.value.trim().toLowerCase());a&&(t.value=n("errors.foundValueDuplicate",{key:a.path}))}return t})),console.log(a),a}}))(B)},TmYi:function(e,t,a){},UGc4:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a("q1tI"),r=a.n(n),i=a("17x9"),o=a.n(i),s=a("/MKj"),c=a("ANjH"),l=a("f0zD"),m=a("uSQv");class d extends r.a.Component{constructor(e){super(e),this.state={title:e.title}}render(){const{title:e}=this.state,{onCloseClick:t,loading:a}=this.props;return r.a.createElement("div",{className:"modal-header"},r.a.createElement("h4",null,r.a.createElement("span",null,e,!!a&&r.a.createElement("i",{className:"fas fa-circle-notch fa-spin ml-1"}))),r.a.createElement(m.a,{className:"modal-exit",onClick:()=>t(),buttonStyle:"text",icon:r.a.createElement("i",{className:"fas fa-times"}),type:"button"}))}}d=Object(s.connect)(null,e=>Object(c.b)({show:l.d,hide:l.b},e))(d);t.b=Object(s.connect)(e=>({modals:e.modal,inactive:e.inactive.inactive}))(d),d.propTypes={title:o.a.string.isRequired,onCloseClick:o.a.func.isRequired,loading:o.a.bool}},Uj9J:function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a("Y+p1"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("d/v1"),u=a("pJVQ"),p=a("tDQA"),h=a("f0zD"),g=a("4huo"),b=a("/MKj"),f=a("XoCd"),D=a("VfnB"),v=a("Yh51");var O=a("ZiuD"),E=(a("db/I"),a("0b+E")),y=a("LCzB");function j(){return(j=Object.assign||function(e){for(var t=1;t{let a=t.getMinAndMax().min;this.props.change("curveDay",a)};let t=e.climates[0],a=e.shadows.get(t.DevID);try{let t=a.configuration;const{climateCurves:n}=e;let i=n.find(e=>r()(e.getBackendStages(),a.climateCurve.stages))||null;e.initialize({expectedTemperature:t.requestedAirTemperature,minimumVentilation:t.ventilationConfiguration.minimumVentilation,maximumVentilation:t.ventilationConfiguration.maximumVentilation,minimumAlarm:t.alarms.minimumTemperatureAlarmDeviation,maximumAlarm:t.alarms.maximumTemperatureAlarmDeviation,curveDay:i&&a.climateCurve.currentCurveDay?a.climateCurve.currentCurveDay+i.getMinAndMax().min-1:1,curveActive:!1,curve:i})}catch(n){console.log(n,"ERROR CLIMAT CONFIG MODAL"),e.initialize({expectedTemperature:10,minimumVentilation:0,maximumVentilation:0,minimumAlarm:9.8,maximumAlarm:12,curveActive:!1})}E.a.modalview(w)}render(){const{show:e,handleHide:t,climateCurves:a,curveActive:n,minimumVentilation:r,curve:i,t:u,expectedTemperature:p}=this.props;return console.log(i),o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement(c.b,{title:u("modals.climateConfiguration.title"),onCloseClick:t}),o.a.createElement(l.a,{className:w},n&&o.a.createElement(o.a.Fragment,null,o.a.createElement(O.a,{stages:i?i.SetData.Stages:[]}),o.a.createElement(d.a,{component:g.b,name:"curve",label:u("climateCurve"),options:a.map(e=>({name:e.SetData.Name,value:e})),onChange:this.onCurveChange}),i&&o.a.createElement(d.a,j({component:f.a,name:"curveDay",label:u("curveDay")},i.getMinAndMax()))),!n&&o.a.createElement(o.a.Fragment,null,o.a.createElement(d.a,{component:f.a,name:"expectedTemperature",label:u("requestedTemperature"),min:10,max:50,step:.2,valueFormatter:e=>e?"".concat(e.toFixed(1),"\xb0C"):""}),o.a.createElement(d.a,{component:f.a,name:"minimumVentilation",label:u("minimumVentilation"),min:0,max:190,valueFormatter:e=>void 0!==e?"".concat(Object(D.c)(e),"%"):""}),o.a.createElement(d.a,{component:f.a,name:"maximumVentilation",label:u("maximumVentilation"),min:r,max:190,valueFormatter:e=>void 0!==e?"".concat(Object(D.c)(e),"%"):""}),o.a.createElement(d.a,{component:f.a,name:"minimumAlarm",label:u("minTempAlarm"),min:-40,max:-2,step:2,valueFormatter:e=>e?"".concat((p+e/10).toFixed(1),"\xb0C"):"",parse:e=>e?Math.abs(e)/10:null,format:e=>e?10*-e:null}),o.a.createElement(d.a,{component:f.a,name:"maximumAlarm",label:u("maxTempAlarm"),min:2,max:20,step:.2,valueFormatter:e=>e?"".concat((e+p).toFixed(1),"\xb0C"):""}))),o.a.createElement(m.a,{hasConfirmButton:!0,confirmText:u("save"),onCloseClick:t,formName:w}))}}C=Object(u.a)({form:w,onSubmit:function(e,t,a){console.log(e);const{expectedTemperature:n,minimumVentilation:r,maximumVentilation:i,minimumAlarm:o,maximumAlarm:s}=e,{climates:c}=a;Object(v.c)(c,{requestedAirTemperature:n,ventilationConfiguration:{minimumVentilation:r,maximumVentilation:i},alarms:{minimumTemperatureAlarmDeviation:o,maximumTemperatureAlarmDeviation:s}}),a.handleHide()},validate:function(e,t){const{t:a}=t,n={};return e.curve||(n.curve=a("required")),n}})(C);const S=Object(p.a)(w),T=Object(b.connect)(e=>({climateCurves:e.settings.climateCurves,shadows:e.shadows.shadows,curveActive:S(e,"curveActive"),minimumVentilation:S(e,"minimumVentilation"),curve:S(e,"curve"),expectedTemperature:S(e,"expectedTemperature")}))(C);C=Object(h.a)({name:w})(T);t.b=Object(y.a)()(C)},ViHu:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("mzFT"),l=a("EvVL"),m=a("VyNe"),d=(a("0rkb"),a("IXwn")),u=a("uSQv"),p=a("HGzA"),h=a("Imit"),g=a("niph"),b=a("lRfV");class f extends n.Component{constructor(...e){super(...e),this.state={changingStatus:!1,removingTask:!1},this.container=r.a.createRef(),this.onEditClick=()=>{const{onEditClick:e}=this.props;e(),setTimeout(()=>{this.container.current.onHide()},400)},this.onConfirmed=async()=>{const{task:e}=this.props;try{this.setState({changingStatus:!0});let t=await Object(g.a)(e.IssueID);Object(g.c)(t),this.setState({changingStatus:!1})}catch(t){Object(g.b)(t),this.setState({changingStatus:!1})}},this.onDeleteClick=async()=>{const{task:e,onHide:t}=this.props;try{this.setState({removingTask:!0});let a=await Object(b.a)(e.IssueID);Object(b.c)(a),t()}catch(a){Object(b.b)(a),this.setState({removingTask:!1})}}}render(){const{task:e,show:t,onHide:a,t:n}=this.props,{removingTask:i,changingStatus:o}=this.state;return r.a.createElement(c.a,{name:n("taskDescription"),show:t,className:"task-view-drawer",addPaddingForButtons:!0,onHide:a,ref:this.container},r.a.createElement(m.a,null,r.a.createElement(l.a,{task:e})),r.a.createElement(d.a,{className:"task-view-drawer-buttons"},r.a.createElement(u.a,{icon:r.a.createElement("i",{className:"fas fa-edit"}),onClick:this.onEditClick}),r.a.createElement(u.a,{icon:r.a.createElement("i",{className:"fas fa-trash"}),onClick:this.onDeleteClick,isLoading:i}),r.a.createElement(u.a,{icon:e&&e.Status===p.a.DONE?r.a.createElement("i",{className:"far fa-check-square"}):r.a.createElement("i",{className:"far fa-square"}),onClick:this.onConfirmed,isLoading:o})))}}t.a=Object(s.d)(Object(o.a)(),Object(i.connect)((function(e){return{task:Object(h.a)(e)}})))(f)},"W/wb":function(e,t,a){"use strict";a.d(t,"a",(function(){return I}));var n=a("J2iB"),r=a.n(n),i=a("E+oP"),o=a.n(i),s=a("mwIZ"),c=a.n(s),l=a("q1tI"),m=a.n(l),d=a("zM5D"),u=a("3Z9Z"),p=a("JI6e"),h=a("UGc4"),g=a("0pzG"),b=a("gu+X"),f=a("f0zD"),D=a("wd/R"),v=a.n(D),O=(a("/YCi"),a("/MKj")),E=a("q17X"),y=a("0b+E"),j=a("j0Y2"),w=a("uUZO"),C=a("Ty5D"),S=a("LCzB"),T=a("XzT5");const I="feeding-sow-info-modal";class k extends m.a.Component{constructor(e){super(e),this.clearAnimals=()=>{const{dispatch:e}=this.props;e(Object(j.a)(null))},this.getValues=(e=this.props)=>{const{selectedNodes:t,cycleTable:a}=this.props,n=c()(t,"[0].animal"),i=o()(a)?[]:Object(w.a)(a);let s=0,l=0;i.forEach((e,t)=>{e&&!r()(e.cycle)&&(s=Math.max(s,e.cycle),l=Math.max(l,t))});const m=c()(i,"[".concat(l,"].I"),[]),d=c()(i,"[".concat(l,"].P"),[]),u=!!d.length,p=l?c()(i,"[".concat(l-1,"].P"),[]):[],h=!!p.length,g=e=>[e.reduce((e,t)=>e+ +c()(t,"EvData.HealthyCnt",0),0),e.reduce((e,t)=>e+ +c()(t,"EvData.DeadCnt",0),0),e.reduce((e,t)=>e+ +c()(t,"EvData.MummyCnt",0),0)],b=c()(i,"[".concat(l,"].W"),[]);return{inseminationDate:m.length?v()(m[m.length-1].EvTime).format("DD.MM.YY HH:mm"):"-",plannedParturitionDate:m.length?v()(m[m.length-1].EvTime).startOf("day").add(Object(E.getTimeFromInseminationToPartuition)(),"days").format("DD.MM.YY"):"-",activeNipples:c()(n,"ActiveNipples","-"),newestAliveDeadMummies:u?g(d):["-","-","-"],lastAliveDeadMummies:h?g(p):["-","-","-"],cycle:s,mothering:b.length?b.reduce((e,t)=>e+ +c()(t,"EvData.PiCnt",0),0):"-"}};const{dispatch:t}=this.props;this.clearAnimals();const a=c()(this.props,"selectedNodes[0].animal");a&&t(Object(j.a)(a)),y.a.modalview(I)}componentWillUnmount(){this.clearAnimals()}render(){const{show:e,handleHide:t,fetchingEvent:a,t:n,selectedNodes:r}=this.props,i=c()(r,"[0].animal");console.log("Animalssssss:",i);const{inseminationDate:o,plannedParturitionDate:s,activeNipples:l,newestAliveDeadMummies:f,lastAliveDeadMummies:D,cycle:v,mothering:O}=this.getValues();return m.a.createElement(d.a,{show:e,size:"lg",onHide:t},m.a.createElement(h.b,{title:i?T.a.t("modals.feedingSowInfoModal.title",{animal:i.AnmNo1}):n("modals.feedingSowInfoModal.titleNotFound"),onCloseClick:t}),m.a.createElement(g.a,{className:I,isLoading:a},i&&m.a.createElement("h5",null,T.a.t("cycle",{count:v})),m.a.createElement("div",{className:"basic-info-box"},m.a.createElement(u.a,null,m.a.createElement(p.a,{md:6},m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("modals.feedingSowInfoModal.inseminationDate")),m.a.createElement("div",{className:"info-column"},o)),m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("modals.feedingSowInfoModal.plannedParturitionDate")),m.a.createElement("div",{className:"info-column"},s)),m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("activeNipples")),m.a.createElement("div",{className:"info-column"},l))),m.a.createElement(p.a,{md:6},m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("modals.feedingSowInfoModal.newestAliveDeadMummies")),m.a.createElement("div",{className:"info-column"},f.join(" / "))),m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("modals.feedingSowInfoModal.lastAliveDeadMummies")),m.a.createElement("div",{className:"info-column"},D.join(" / "))),m.a.createElement("div",{className:"info-row"},m.a.createElement("div",{className:"info-column header"},n("modals.feedingSowInfoModal.mothering")),m.a.createElement("div",{className:"info-column"},O)))))),m.a.createElement(b.a,{hasConfirmButton:!0,confirmText:n("modals.feedingSowInfoModal.details"),onConfirmed:()=>{this.props.history.push("/".concat(this.props.farm,"/farm/inventory?documentsAnimal=").concat(i.AnmID))},onCloseClick:t,formName:I}))}}k=Object(O.connect)(e=>({fetchingEvent:e.animalDocuments.fetchingEvent,cycleTable:e.animalDocuments.cycleTable,farm:e.location.farm}))(k),t.b=Object(C.o)(Object(S.a)()(Object(f.a)({name:I})(k)))},W6fe:function(e,t,a){"use strict";a.d(t,"a",(function(){return l})),a.d(t,"b",(function(){return m}));var n=a("r3a2"),r=a("qzmO"),i=a("T34T");function o(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 s(e){for(var t=1;t{t.forEach(t=>{Object(n.h)(e,s({},u,{number:t.number}))})}),i.individualNRF.devices.length>0&&Object(r.t)(i.individualNRF.devices,u);l(),m()}function m(e,t){const a={},{t:n}=t,{forageDose:r}=e;return r||(a.type=n("required")),a}},WNbV:function(e,t,a){"use strict";a.d(t,"a",(function(){return z}));var n=a("GoyQ"),r=a.n(n),i=a("UfWW"),o=a.n(i),s=a("J2iB"),c=a.n(s),l=a("mwIZ"),m=a.n(l),d=a("q1tI"),u=a.n(d),p=a("d/v1"),h=a("3t43"),g=a("pJVQ"),b=a("tDQA"),f=a("/MKj"),D=a("r3a2"),v=a("qzmO"),O=a("zDJl");var E=a("zM5D"),y=a("UGc4"),j=a("0pzG"),w=a("gu+X"),C=a("f0zD"),S=a("17x9"),T=a.n(S),I=a("wd/R"),k=a.n(I),x=a("w2lk"),M=a("vzZS"),N=a("0b+E"),A=a("ZRKa"),P=a("LCzB"),F=a("XzT5");const z="feeding-skip-doses-modal";class B extends u.a.Component{constructor(e){super(e),this.getDoses=(e=[])=>new Array(6).fill(0).map((t,a)=>!!e[a]),this.renderSchedules=({fields:e,meta:{touched:t,error:a,submitFailed:n}})=>u.a.createElement(u.a.Fragment,null,e.map((t,a)=>u.a.createElement(u.a.Fragment,{key:a},u.a.createElement(M.a,null,F.a.t("modals.feedingSkipDosesModal.affectedStandings",{type:e.get(a).standingNames.join(", ")})),m()(e.get(a),"schedule.SetData.Doses",e.get(a).skipDoses).map((e,a)=>u.a.createElement(p.a,{key:a,name:"".concat(t,".skipDoses[").concat(a,"]"),id:"".concat(t,".skipDoses[").concat(a,"]"),component:x.a,label:r()(e)?"".concat(k()(e.Start).format("HH:mm"),"-").concat(k()(e.Stop).format("HH:mm")," (").concat(e.Percent,"%)"):F.a.t("dosage",{count:a+1})})),a+1{const t=m()(e,"schedule.id"),a=m()(e,"receiver.deviceId"),r=m()(e,"receiver.index");let s=c()(r)?O.d.DISPENSER_NRF:O.d.DISPENSER,l=m()(e,"box.BoxesName");if(t){let i=n.get(t)||{dispensers:[],standingNames:[],skipDoses:this.getDoses(m()(e,"skipDoses")),schedule:A.a.getSettingByID(t,{showDeleted:!0})},d=o()(i.dispensers,e=>e.DevID===a);~d?i.dispensers[d].indexes=[...new Set([...i.dispensers[d].indexes,r])].filter(e=>!c()(e)):i.dispensers.push({DevID:a,indexes:[r].filter(e=>!c()(e)),DevType:s}),i.standingNames=[...new Set([...i.standingNames,l])],n.set(t,i)}else i.push(l)}),a({schedules:[...n.values()],nonEligible:i}),N.a.modalview(z)}render(){const{show:e,handleHide:t,t:a,nonEligible:n=[],handleSubmit:r}=this.props;return u.a.createElement(E.a,{onHide:t,show:e,size:"lg"},u.a.createElement("form",{onSubmit:r},u.a.createElement(y.b,{title:a("modals.feedingSkipDosesModal.titleSkipDoses"),onCloseClick:t}),u.a.createElement(j.a,{className:z},u.a.createElement("div",null,!!n.length&&u.a.createElement(M.a,{boxColor:"warning"},F.a.t("modals.feedingSkipDosesModal.nonEligible",{type:n.join(", ")})),u.a.createElement(h.a,{name:"schedules",component:this.renderSchedules}))),u.a.createElement(w.a,{hasConfirmButton:!0,confirmText:a("modals.feedingSkipDosesModal.set"),onCloseClick:t,formName:z})))}}B.propTypes={dispensers:T.a.array.isRequired,selectedNodes:T.a.array.isRequired},B=Object(g.a)({form:z,onSubmit:function(e,t,a){const{schedules:n=[]}=e,{handleHide:r,clearSelection:i}=a;console.log(e,a,"DSJKAADSIOSDAJADSIOJDASIOASDJASDIOXD");for(let o of n)for(let e of o.dispensers)if(e.DevType===O.d.DISPENSER_NRF)Object(v.y)(e.DevID,{dosesToSkip:o.skipDoses.map(e=>+e)});else if(e.DevType===O.d.DISPENSER){let t=[];e.indexes.forEach(e=>{t.push({dosesToSkip:o.skipDoses.map(e=>+e),number:e+1})}),Object(D.j)(e.DevID,t)}r(),i()}})(B);const R=Object(b.a)(z),W=Object(P.a)()(Object(f.connect)(e=>({nonEligible:R(e,"nonEligible")}))(B));t.b=Object(C.a)({name:z})(W)},ZkcS:function(e,t,a){"use strict";a.d(t,"a",(function(){return S}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("3Z9Z"),l=a("JI6e"),m=a("UGc4"),d=a("0pzG"),u=a("gu+X"),p=a("d/v1"),h=a("pJVQ"),g=a("tDQA"),b=a("f0zD"),f=a("XoCd"),D=a("QAqx"),v=a("/MKj"),O=a("0b+E"),E=a("VyNe"),y=a("wd/R"),j=a.n(y),w=a("krkt"),C=a("LCzB");const S="feeding-condition-modal",T=[-25,-10,0,10,25];class I extends o.a.Component{constructor(e){super(e),this.handleClick=e=>{const{change:t}=this.props;this.setState({showSlider:e>900}),e<900&&t("doseCorrection",T[e])};const{selectedNodes:t}=this.props,a=r()(t[0],"curve.settings.doseCorrection",0);this.props.initialize({doseCorrection:a}),this.state={showSlider:!T.includes(a)},O.a.modalview(S)}render(){const{show:e,handleHide:t,t:a,handleSubmit:n,doseCorrection:r,selectedNodes:i}=this.props,{showSlider:h}=this.state,g=i.map(e=>{const t=[e.name];return e.animal?(t.push(e.animal.AnmNo1),e.animal.ConditionTime?t.push(j()(e.animal.ConditionTime).format("DD.MM.YY")):t.push(a("modals.feedingConditionModal.notChecked"))):t.push(a("modals.feedingConditionModal.noAnimal")),t.join(" - ")});return o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement("form",{onSubmit:n},o.a.createElement(m.b,{title:a("reportCondition"),onCloseClick:t}),o.a.createElement(d.a,{className:S},o.a.createElement("div",null,o.a.createElement(w.a,{list:g,header:a("modals.feedingConditionModal.lastConditions"),maxItems:10}),o.a.createElement("hr",null),o.a.createElement(c.a,null,T.map((e,t)=>o.a.createElement(l.a,{xs:6,sd:4,md:3,key:t},o.a.createElement(E.a,{onClick:()=>this.handleClick(t),selected:!h&&e===r},"".concat(e>0?"+":"").concat(e,"%")))),o.a.createElement(l.a,{xs:6,sd:4,md:3},o.a.createElement(E.a,{onClick:()=>this.handleClick(9999),selected:h},a("modals.feedingConditionModal.other")))),h&&o.a.createElement(p.a,{name:"doseCorrection",id:"doseCorrection",type:"number",required:!0,step:5,min:-25,max:25,component:f.a,valueFormatter:e=>"".concat(e,"%"),label:a("doseCorrection")}))),o.a.createElement(u.a,{hasConfirmButton:!0,onCloseClick:t,formName:S})))}}I=Object(h.a)({form:S,onSubmit:D.a})(I);const k=Object(g.a)(S);I=Object(v.connect)(e=>({doseCorrection:k(e,"doseCorrection")}))(I),I=Object(b.a)({name:S})(I),t.b=Object(C.a)()(I)},bST7:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("pJVQ"),m=a("f0zD"),d=a("DWSH");var u=a("0b+E"),p=a("s506"),h=a("qx5e"),g=a("LCzB");const b="chamber-transfer-modal";class f extends r.a.Component{constructor(e){super(e),u.a.modalview(b)}render(){const{show:e,submitting:t,handleHide:a,t:n,handleSubmit:l,endInsertion:m}=this.props;return r.a.createElement(i.a,{onHide:a,show:e,size:"lg"},r.a.createElement("form",{onSubmit:l},r.a.createElement(o.b,{title:n(m?"modals.chamberTransferModal.titleEndInsertion":"modals.chamberTransferModal.title"),onCloseClick:a}),r.a.createElement(s.a,{className:b},r.a.createElement("p",null,n(m?"modals.chamberTransferModal.endInsertionText":"modals.chamberTransferModal.transferText"))),r.a.createElement(c.a,{hasConfirmButton:!0,onCloseClick:a,submitting:t,formName:b,confirmText:n("yes")})))}}f=Object(l.a)({form:b,onSubmit:function(e,t,a){const{chamberId:n,handleHide:r,onSuccess:i,endInsertion:o}=a;let s=Array.isArray(n)?n:[n],c=[];for(let l of s)c.push(Object(d.j)({PlcmntID:l}));return Promise.all(c).then(e=>{r(),o?Object(d.b)(e):Object(d.l)(e),i&&i()}).catch(e=>{o?Object(d.a)(e):Object(d.k)(e)})}})(f),f=Object(m.a)({name:b})(f),f=Object(h.a)({clientPackage:{[p.a.DISPENSER]:p.b.BASIC}})(f);t.b=Object(g.a)()(f)},dAwh:function(e,t,a){"use strict";a.d(t,"a",(function(){return j}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("3t43"),s=a("pJVQ"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("f0zD"),u=a("Am/I"),p=a("5Z9N");var h=a("/MKj"),g=a("0b+E"),b=a("xQ2f"),f=(a("DV4J"),a("a+pQ")),D=a("wd/R"),v=a.n(D),O=a("uSQv"),E=a("vzZS"),y=a("LCzB");const j="edit-treatment-modal";class w extends r.a.Component{constructor(e){super(e),this.onChange=e=>{this.setState({selectedDates:e})},this.daysValueFormatter=e=>e.map(e=>v()(e).format("DD.MM.YYYY")).join(", "),this.medicinesValueFormatter=e=>{const{medicines:t}=this.props;return e.map(e=>t.find(t=>t.WordID===e)).filter(e=>e).map(e=>e.WData.Name).join(", ")},this.onAddClick=()=>{const{selectedDates:e,selectedMedicines:t}=this.state;e.length>0&&t.length>0?(this.props.array.push("EvData.Treatment",{Medicine:t,Dates:e.map(e=>e.toDate().getTime())}),this.setState({selectedDates:[],selectedMedicines:[],failedAdd:!1})):this.setState({failedAdd:!0})};let t=e.treatment.EvData.Treatment.reduce((e,t)=>{let a=Math.min(...t.Dates);return at===e.WordID)}onMedicineClick(e){let{selectedMedicines:t}=this.state,a=t.slice(0);!!a.find(t=>t===e.WordID)?a=a.filter(t=>t!==e.WordID):a.push(e.WordID),this.setState({selectedMedicines:a})}render(){const{show:e,handleHide:t,medicines:a,t:n,failedAdd:s,selectedMedicines:d}=this.props,{selectedDates:u,minDate:p}=this.state,h=[{name:n("medicine"),field:"Medicine",dontShowInput:!0,valueFormatter:this.medicinesValueFormatter},{name:n("days"),field:"Dates",dontShowInput:!0,valueFormatter:this.daysValueFormatter}];return r.a.createElement(i.a,{show:e,size:"lg"},r.a.createElement(c.b,{title:n("modals.editTreatmentModal.title"),onCloseClick:t}),r.a.createElement(l.a,{className:"treatment"},a.map((e,t)=>r.a.createElement("div",{className:this.isSelected(e)?"medicine-item selected":"medicine-item",key:t,onClick:()=>this.onMedicineClick(e)},r.a.createElement("div",{className:"medicine-text"},e.WData.Name),r.a.createElement("div",{style:{background:e.WData.Color||"#fff"},className:"color"}))),r.a.createElement(b.a,{selectedDates:u,onChange:this.onChange,startingDate:p}),r.a.createElement(O.a,{buttonColor:"primary",type:"button",onClick:this.onAddClick},n("add")),s&&(0===d.length||0===u.length)&&r.a.createElement(E.a,{boxColor:"error"},n("events.treatmentEvent.treatmentRequirement")),r.a.createElement(o.a,{component:f.a,name:"EvData.Treatment",headers:h,addRemoveButton:!0,minLength:0})),r.a.createElement(m.a,{hasConfirmButton:!0,confirmText:"Zapisz",onCloseClick:t,formName:j}))}}w=Object(s.a)({form:j,onSubmit:function(e,t,a){const{user:n}=a;let r=new u.a(e);r.setDtaModTime(),t(Object(p.e)(r.prepareBeanToSave(),n.ClientID,n.LocalUserID)),a.handleHide()},validate:function(e,t){const a={EvData:{}},{t:n}=t;return!e.EvData||e.EvData.Treatment&&e.EvData.Treatment.length||(a.EvData.Treatment={_error:n("required")}),a}})(w),w=Object(d.a)({name:j})(w),w=Object(h.connect)(e=>({medicines:e.dictionary.medicine,user:e.user.user}))(w);t.b=Object(y.a)()(w)},"db/I":function(e,t,a){},dfNF:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("LCzB"),s=a("ANjH"),c=a("d/v1"),l=a("3t43"),m=a("pJVQ"),d=a("26mJ"),u=a("4huo"),p=a("4Q+/"),h=a("EnvE"),g=a("wd/R"),b=a.n(g),f=a("pQXl");var D=a("lAGl"),v=a("uSQv"),O=(a("HMDl"),a("w2lk")),E=a("XM6k");function y(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function j(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class w extends n.Component{constructor(e){super(e),this.renderList=({fields:e})=>r.a.createElement("div",null,e.map((t,a)=>{let n=e.get(a);return r.a.createElement("div",{className:"task-list-row"},r.a.createElement("div",null,a+1),!n.isAdded&&!n.edit&&r.a.createElement("div",{className:"task-name".concat(n.Done?" done":""),onClick:()=>this.setEditing(t)},n.Title),(n.isAdded||n.edit)&&r.a.createElement(c.a,{name:"".concat(t,".Title"),type:"text",component:D.a,id:"".concat(t,".name")}),r.a.createElement(c.a,{name:"".concat(t,".Done"),component:O.a,label:"",disabled:!this.props.task,id:"".concat(t,".isDone")}),r.a.createElement(v.a,{buttonStyle:"round",icon:r.a.createElement("i",{className:"fas fa-trash"}),onClick:()=>e.remove(a),disabled:1===e.length}))}),r.a.createElement(v.a,{icon:r.a.createElement("i",{className:"fas fa-plus"}),onClick:()=>e.push({isAdded:!0,Done:!1})},this.props.t("add")));const{task:t}=this.props;t?this.props.initialize(function(e){for(var t=1;t({name:e.userName,value:e.LocalUserID})),label:e("eventGrid.operator")}),r.a.createElement(c.a,{name:"Category",component:u.b,options:t.map(e=>({name:e.Value,value:e.ID})),label:e("category")}),r.a.createElement(c.a,{name:"Private",component:E.a,label:e("private")}),r.a.createElement(c.a,{name:"Priority",component:p.a,buttons:[{name:e("morning"),value:1},{name:e("noon"),value:2},{name:e("afternoon"),value:3}],label:e("priority")}),r.a.createElement(c.a,{name:"EstimatedTime",component:p.a,buttons:[{name:"0.5h",value:.5},{name:"1h",value:1},{name:"2h",value:2},{name:"4h",value:4}],label:e("estimatedTime")}),r.a.createElement("hr",null),r.a.createElement("h5",null,e("list")),r.a.createElement(l.a,{component:this.renderList,name:"ListTODO",rerenderOnEveryChange:!0}))}}t.a=Object(s.d)(Object(o.a)(),Object(m.a)({form:"task-add-modal",onSubmit:function(e,t,a){console.log(e);const{task:n}=a,{AssignTo:r,DtaPlanned:i,Private:o,Category:s,Priority:c,ListTODO:l,Title:m,Description:d,EstimatedTime:u}=e,p=+b.a.utc(i).startOf("day"),g=[];for(let h of l)h.Title&&g.push({Title:h.Title,Done:h.Done});return n?Object(f.a)(n.IssueID,{AssignTo:r,DtaPlanned:p,Private:o,Category:s,Priority:c,ListTODO:g,Title:m,Description:d,EstimatedTime:u}).then(e=>{Object(f.c)(e),a.hide()}).catch(e=>{Object(f.b)(e)}):Object(h.a)({AssignTo:r,DtaPlanned:p,Private:o,Category:s,Priority:c,ListTODO:g,Title:m,Description:d,EstimatedTime:u}).then(e=>{Object(h.c)(e),a.hide()}).catch(e=>{Object(h.b)(e)})},validate:function(e,t){const{t:a}=t,n={};return e.date||(n.date=a("required")),e.name||(n.name=a("required")),e.description||(n.description=a("required")),e.operator||(n.operator=a("required")),e.priority||(n.priority=a("required")),e.time||(n.time=a("required")),n}}),Object(i.connect)((function(e){return{farm:e.location.farm,categories:e.dictionary.taskCategory.WData[e.language.lang.lang],employees:e.user.employees}})))(w)},"e8/y":function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("d/v1"),s=a("pJVQ"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("f0zD"),u=a("26mJ"),p=a("ba6h"),h=a("fckJ"),g=a("hPO2"),b=a("BXH4"),f=a("lM7y");var D=a("/MKj"),v=a("0b+E"),O=a("LCzB");const E="edit-dictionary-modal";class y extends r.a.Component{constructor(e){super(e),v.a.modalview(E)}render(){const{show:e,handleHide:t,handleSubmit:a}=this.props;return r.a.createElement(i.a,{show:e,size:"lg"},r.a.createElement("form",{onSubmit:a},r.a.createElement(c.b,{title:"Edit ".concat(this.props.title),onCloseClick:t}),r.a.createElement(l.a,null,r.a.createElement(o.a,{name:"newValue",id:"newValue",type:"text",label:this.props.t("designation"),required:!0,component:u.a}),p.a.medicine===this.props.type&&r.a.createElement("div",null,r.a.createElement("label",null,this.props.t("color")),r.a.createElement(o.a,{name:"color",id:"color",component:h.a})),[p.a.fallReasons].includes(this.props.type)&&r.a.createElement(o.a,{name:"abbreviation",id:"abbreviation",type:"text",label:this.props.t("dictionariesView.abbreviation"),required:!0,component:u.a}),p.a.suppliers===this.props.type&&r.a.createElement("div",null,r.a.createElement(o.a,{name:"phone",id:"phone",type:"text",label:this.props.t("phoneNumber"),required:!0,component:u.a}),r.a.createElement(o.a,{name:"address",id:"address",type:"text",label:this.props.t("address"),required:!0,component:u.a}),r.a.createElement(o.a,{name:"nip",id:"nip",type:"text",label:"NIP",required:!0,component:u.a,normalize:g.b}),r.a.createElement(o.a,{name:"website",id:"website",type:"text",label:"WWW",required:!0,component:u.a}),r.a.createElement(o.a,{name:"herdNumber",id:"herdNumber",type:"text",label:this.props.t("dictionariesView.herdNumber"),component:u.a}))),r.a.createElement(m.a,{hasConfirmButton:!0,confirmText:this.props.t("edit"),onCloseClick:t,formName:E})))}}y=Object(s.a)({form:E,onSubmit:function(e,t,a){let n=b.a.findDictionary(a.type),r=Object.assign({},n[0]);r.DtaModTime=(new Date).getTime(),function(e,t,a){a.supportedLanguages.map(n=>{e.WData[n.lang]||(e.WData[n.lang]=[]);let r=e.WData[n.lang].map(e=>e.ID).indexOf(a.dictionaryItem.ID);switch(e.WData[n.lang].splice(r,1),a.type){case p.a.suppliers:e.WData[n.lang].push({ID:a.dictionaryItem.ID,Value:t.newValue,Phone:t.phone,Address:t.address,NIP:t.nip,Website:t.website,HerdNumber:t.herdNumber,isShowing:!0});break;case p.a.medicine:e.WData[n.lang].push({ID:a.dictionaryItem.ID,Value:t.newValue,Color:t.color,Amount:a.dictionaryItem.Amount,Unit:a.dictionaryItem.Unit,isShowing:!0});break;case p.a.fallReasons:e.WData[n.lang].push({ID:a.dictionaryItem.ID,Value:t.newValue,Short:t.abbreviation.trim()});break;default:e.WData[n.lang].push({Value:t.newValue,ID:a.dictionaryItem.ID,isShowing:!0})}})}(r,e,a),delete r.$loki,t(Object(f.d)(r,a.user.ClientID,a.user.LocalUserID)),a.handleHide()},validate:(e,t)=>{const a={},{t:n}=t;return e.newValue||(a.newValue=n("required")),e.abbreviation?1!==e.abbreviation.trim().length&&(a.abbreviation=n("errors.mustBe1Char")):a.abbreviation=n("required"),e.phone||(a.phone=n("required")),e.address||(a.address=n("required")),e.nip||(a.nip=n("required")),e.website||(a.website=n("required")),e.herdNumber||(a.herdNumber=n("required")),e.nip&&13!==e.nip.length&&(a.nip=n("errors.nipLength")),e.nip&&13===e.nip.length&&!Object(g.a)(e.nip)&&(a.nip=n("errors.nipError")),e.unit||(a.unit=n("required")),e.amountFor100||(a.amountFor100=n("required")),a}})(y),y=Object(d.a)({name:E})(y),y=Object(D.connect)(e=>({user:e.user.user,dictionary:e.dictionary,lang:e.language.lang.lang,userAttr:e.user.attributes,supportedLanguages:e.language.supportedLanguages}))(y);t.b=Object(O.a)()(y)},fe8b:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("r/wR"),s=a("pDHb"),c=a("9jj8"),l=a("wd/R"),m=a.n(l),d=a("ANjH"),u=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.loadMoreData=()=>{const{fetching:e,lastEvaluatedKey:t,dispatch:a,objectId:n,userId:r,searchCode:i}=this.props;!e&&t&&a(Object(s.b)({lastEvaluatedKey:t,ObjID:n,UserID:r,Codes:i}))}}render(){const{fetching:e,lastEvaluatedKey:t,index:a,t:n}=this.props;return r.a.createElement(c.a,{index:a,disableHover:!0,className:"row pb-2 pt-2"},!e&&!!t&&r.a.createElement("div",{onClick:this.loadMoreData,className:"pointer d-flex justify-content-center w-100 align-items-center"},n("logsView.loadedLogsTo",{date:m()(t).format("DD.MM.YY HH:mm")})),!t&&r.a.createElement("div",{onClick:this.loadMoreData,className:"d-flex justify-content-center w-100 align-items-center".concat(e?" opacity-0":"")},n("logsView.noMoreLogsFound")),!!e&&!!t&&r.a.createElement("div",{className:"mh-5rem pb-4 pt-4 d-flex justify-content-center w-100 align-items-center"},r.a.createElement("i",{className:"fas fa-fw fa-spin fa-circle-notch fa-2x"})),r.a.createElement(o.a,{onBottom:this.loadMoreData}))}}t.a=Object(d.d)(Object(u.a)(),Object(i.connect)((function(e){return{lastEvaluatedKey:e.logs.lastEvaluatedKey,fetching:e.logs.fetching,objectId:e.logs.objectId,userId:e.logs.userId,searchCode:e.logs.searchCode}})))(p)},"g+Zn":function(e,t,a){"use strict";a.d(t,"a",(function(){return H}));var n=a("Y+p1"),r=a.n(n),i=a("mwIZ"),o=a.n(i),s=a("q1tI"),c=a.n(s),l=a("zM5D"),m=a("UGc4"),d=a("0pzG"),u=a("f0zD"),p=a("gu+X"),h=a("/MKj"),g=a("d/v1"),b=a("pJVQ"),f=a("tDQA"),D=a("sZ7W");var v=a("IXwn"),O=a("uSQv"),E=a("XoCd"),y=a("pxzG"),j=a("eASP"),w=a("vzZS"),C=a("BkRI"),S=a.n(C),T=a("fckJ"),I=a("3Z9Z"),k=a("JI6e"),x=a("VyNe"),M=a("ml9u"),N=a("6uZD"),A=a("VfnB"),P=a("zDJl"),F=a("3xDe"),z=a("LCzB");class B extends s.Component{constructor(e){super(e);const{initialize:t,cages:a,marker:n}=this.props;t({color:o()(a,"[0]Settings.Marker[".concat(n-1,"].Color"),Object(F.c)("primary")),amount:o()(a,"[0]Settings.Marker[".concat(n-1,"].Amount"),1800)})}render(){const{handleSubmit:e,t:t}=this.props;return c.a.createElement(x.a,{className:"draw-long-shadow overflow-visible"},c.a.createElement("form",{onSubmit:e},c.a.createElement(I.a,null,c.a.createElement(k.a,{md:6},c.a.createElement("label",null,t("modals.cageMarkerModal.cageMarkerFillPage.color")),c.a.createElement(g.a,{name:"color",id:"color",component:T.a})),c.a.createElement(k.a,{md:6},c.a.createElement(g.a,{name:"amount",id:"amount",type:"number",label:t("modals.cageMarkerModal.cageMarkerFillPage.amount"),min:0,max:1800,step:5,valueFormatter:e=>Object(y.h)(e,{unit:j.a.SMALL,showUnit:!0,fixed:0}),component:E.a}))),c.a.createElement(O.a,{icon:c.a.createElement("i",{className:"fas fa-check"})},t("save"))))}}B=Object(b.a)({form:"cage-marker-fill-page-form",onSubmit:(e,t,a)=>{console.log("CageMarkerFillPageSubmit",e,a);const n=[],{cages:r,farm:i,user:{LocalUserID:o,ClientID:s},marker:c}=a;r.forEach(t=>{if(t instanceof M.a){const a=S()(t);a.setMarker(c,{fluidAmount:e.amount,fluidColor:e.color}),n.push(a)}}),t(Object(N.e)(n,i,s,o));let l=Object(A.r)(n);if(l)for(let[m,d]of l.entries())m&&d[P.d.CAGE].length&&Object(D.d)(d[P.d.CAGE],{marker1:1===c,marker2:2===c});a.toggle()}})(B),B=Object(h.connect)(e=>({farm:e.location.farm,user:e.user.user}))(B);var R=Object(z.a)()(B),W=a("0b+E"),L=a("XzT5");function V(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function q(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const H="cage-marker-configurator";class U extends c.a.Component{constructor(e){super(e),this.onMarkerChange=e=>{const{initialize:t}=this.props;t(function(e){for(var t=1;t{const t={},{shadows:a,cages:n}=this.props;return t.marker=e,t.exit=o()(a.get(n[0].DevID),"markers[".concat(e-1,"].workType"),0),t.weightRange=[o()(a.get(n[0].DevID),"markers[".concat(e-1,"].minWeight"),0),o()(a.get(n[0].DevID),"markers[".concat(e-1,"].maxWeight"),0)],t.time=o()(a.get(n[0].DevID),"markers[".concat(e-1,"].time"),500),t},this.weightValueFormatter=e=>0===e[0]&&0===e[1]?this.props.t("all").toUpperCase():"".concat(Object(y.j)(e[0],{showUnit:!1,fixed:0,unit:j.a.MEDIUM}),"-").concat(Object(y.j)(e[1],{showUnit:!0,fixed:0,unit:j.a.MEDIUM})),this.toggleFillup=()=>{this.setState(e=>({showFillup:!e.showFillup}))},this.onMarkerChange(1),this.state={showFillup:!1},W.a.modalview(H)}UNSAFE_componentWillReceiveProps(e,t){r()(this.props.cages,e.cages)||this.onMarkerChange(e.marker),r()(this.props.marker,e.marker)||this.state.showFillup&&this.setState({showFillup:!1})}render(){const{show:e,handleHide:t,t:a,marker:n,change:r,exit:i,cages:s}=this.props,{showFillup:u}=this.state,h=s.filter(e=>!o()(e,"Settings.Marker[".concat(n-1,"]"))),b=s.filter(e=>o()(e,"Settings.Marker[".concat(n-1,"]")));return c.a.createElement(l.a,{onHide:t,show:e,size:"lg"},c.a.createElement(m.b,{title:a("modals.cageMarkerModal.title"),onCloseClick:t}),c.a.createElement(d.a,{className:H},!!h.length&&c.a.createElement(w.a,{boxColor:"warning"},L.a.t("modals.cageMarkerModal.noMarkerInstalled",{type:h.map(e=>e.Name).join(", ")})),c.a.createElement("label",null,a("marker")),c.a.createElement(v.a,null,c.a.createElement(O.a,{selected:1===n,onClick:()=>this.onMarkerChange(1),icon:c.a.createElement("i",{className:"fas fa-fill-drip"})},"1"),c.a.createElement(O.a,{selected:2===n,onClick:()=>this.onMarkerChange(2),icon:c.a.createElement("i",{className:"fas fa-fill-drip"})},"2"),c.a.createElement(O.a,{buttonColor:"info",icon:u?c.a.createElement("i",{className:"fas fa-chevron-up"}):c.a.createElement("i",{className:"fas fa-chevron-down"}),buttonStyle:"text",onClick:this.toggleFillup,selected:u},a("modals.cageMarkerModal.paintConf"))),u&&c.a.createElement(R,{cages:b,marker:n,toggle:this.toggleFillup}),c.a.createElement("label",null,a("worktype")),c.a.createElement(v.a,null,new Array(5).fill(1).map((e,t)=>{return n=t,c.a.createElement(O.a,{selected:i===n,onClick:()=>r("exit",n)},a("modals.cageMarkerModal.exit.".concat(n)));var n})),c.a.createElement(g.a,{label:a("modals.cageMarkerModal.weightRange"),isRange:!0,min:0,max:18e4,step:1e3,valueFormatter:this.weightValueFormatter,component:E.a,name:"weightRange",id:"weightRange"}),c.a.createElement(g.a,{label:a("modals.cageMarkerModal.time"),min:100,max:500,step:100,valueFormatter:e=>"".concat(e,"ms"),component:E.a,name:"time",id:"time"})),c.a.createElement(p.a,{onCloseClick:t,hasConfirmButton:!0,confirmText:a("modals.cageMarkerModal.set"),formName:H}))}}U=Object(b.a)({form:H,onSubmit:function(e,t,a){console.log(e,a);const n={number:e.marker-1,time:e.time,workType:e.exit,minWeight:e.weightRange[0],maxWeight:e.weightRange[1]};console.log(n),Object(D.m)(a.cages,n)}})(U);const G=Object(f.a)(H);U=Object(h.connect)(e=>({marker:G(e,"marker"),exit:G(e,"exit"),shadows:e.shadows.shadows}))(U),U=Object(u.a)({name:H})(U);t.b=Object(z.a)()(U)},"gu+X":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("17x9"),o=a.n(i),s=a("wQmL"),c=a("uSQv"),l=(a("11I8"),a("LCzB")),m=a("/MKj");class d extends n.Component{constructor(e){super(e),this.onClick=e=>{e.preventDefault();const{formName:t,onConfirmed:a,dispatch:n}=this.props;this.setState({confirmButtonClicked:!0}),t&&n(Object(s.e)(t)),a&&a()},this.handleOnEnter=e=>{"Enter"!==e.key||e.Handled||this.onClick(e),e.Handled=!0},this.state={confirmButtonClicked:!1}}componentDidMount(){window.addEventListener("keydown",this.handleOnEnter)}componentWillUnmount(){window.removeEventListener("keydown",this.handleOnEnter)}render(){const{hasConfirmButton:e,confirmText:t,confirmIcon:a,hasCloseButton:n,closeText:i,optionalButtons:o,onCloseClick:s,submitting:l,forceLoadingOnClick:m,t:d,hasButtonDisabled:u}=this.props,{confirmButtonClicked:p}=this.state;return r.a.createElement("div",{className:"modal-footer"},n&&r.a.createElement(c.a,{type:"button",buttonColor:"secondary",buttonStyle:"text",icon:a,onClick:()=>{s()}},i||d("close")),o,e&&r.a.createElement(c.a,{buttonColor:"primary",icon:a,isLoading:l||p&&m,onClick:this.onClick,disabled:u},t||"Ok"))}}d.propTypes={hasConfirmButton:o.a.bool,confirmText:o.a.string,confirmIcon:o.a.node,hasCloseButton:o.a.bool,closeText:o.a.string,optionalButtons:o.a.node,onCloseClick:o.a.func.isRequired,submitting:o.a.bool,formName:o.a.string,forceLoadingOnClicked:o.a.bool,onConfirmed:o.a.func,hasButtonDisabled:o.a.bool},d.defaultProps={hasCloseButton:!0,hasConfirmButton:!1,forceLoadingOnClicked:!1,hasButtonDisabled:!1},d=Object(m.connect)()(d),d=Object(l.a)()(d),t.a=d},hpEo:function(e,t,a){"use strict";a.d(t,"a",(function(){return T}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("PbGg"),u=a("d/v1"),p=a("pJVQ"),h=a("f0zD"),g=a("/MKj"),b=a("VfnB"),f=a("VrKS"),D=a("zDJl");var v=a("0b+E"),O=a("LCzB"),E=a("thTS"),y=a("XoCd"),j=a("pxzG"),w=a("eASP");function C(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 S(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const T="climate-alarms-modal";class I extends o.a.Component{constructor(e){super(e),this.getValues=()=>{const{shadow:e}=this.props;return{minimumTemperatureAlarmDeviation:r()(e,"configuration.alarms.minimumTemperatureAlarmDeviation",4),maximumTemperatureAlarmDeviation:r()(e,"configuration.alarms.maximumTemperatureAlarmDeviation",10),absoluteAlarm:r()(e,"configuration.alarms.absoluteAlarm",35)}},this.temperatureFormatter=e=>Object(j.f)(e,{unit:w.a.SMALL,fixed:1,showUnit:!0}),v.a.modalview(T)}componentDidMount(){const{initialize:e}=this.props;e(this.getValues())}render(){const{show:e,handleHide:t,t:a,initialized:n,submitting:r}=this.props;return o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement(c.b,{title:a("deviceRows.waterFlowMeter.waterTab.alarms"),onCloseClick:t}),o.a.createElement(l.a,{className:"".concat(T," mh-5rem"),isLoading:!n},o.a.createElement(u.a,{name:"absoluteAlarm",id:"absoluteAlarm",label:a("settings.absoluteAlarm"),min:20,max:55,step:1,valueFormatter:this.temperatureFormatter,component:y.a}),o.a.createElement(u.a,{name:"minimumTemperatureAlarmDeviation",id:"minimumTemperatureAlarmDeviation",label:a("settings.minTempAlarmDeviation"),min:.2,max:20,step:.2,valueFormatter:this.temperatureFormatter,component:y.a}),o.a.createElement(u.a,{name:"maximumTemperatureAlarmDeviation",id:"maximumTemperatureAlarmDeviation",label:a("settings.maxTempAlarmDeviation"),min:2,max:20,step:.2,valueFormatter:this.temperatureFormatter,component:y.a})),o.a.createElement(m.a,{hasConfirmButton:!0,submitting:r,confirmText:a("save"),onCloseClick:t,formName:T}))}}I=Object(p.a)({form:T,onSubmit:function(e,t,a){const{climates:n}=a,r=Object(b.r)(n);return Promise.all([...r.values()].map(t=>new Promise((a,n)=>{Object(f.d)(t[D.d.CLIMATE_SK3],e,{onSuccess:a,onFailure:n})}))).then(()=>{a.handleHide()})}})(I),I=Object(g.connect)((function(e,t){const a=Object(E.a)(),{climates:n}=t,r={DevID:n[0].DevID};return function(e){return function(e){for(var t=1;te.DevType===g.d.CAGE).map(e=>({name:e.Name,value:e}));return r.a.createElement("form",{onSubmit:t},r.a.createElement(m.a,{name:"cage",component:p.b,label:this.props.t("modals.cageWeightConfiguration.separationCage"),options:a}),r.a.createElement(h.a,{boxColor:"info"},this.props.t("modals.cageWeightConfiguration.info1")),r.a.createElement("div",{className:"placeholder"},"PLACEHOLDER"))}}D=Object(d.a)({form:"cage-weight-configurator",destroyOnUnmount:!1,forceUnregisterOnUnmount:!0,validate:u})(D),D=Object(b.connect)(e=>({devices:e.farmDevices.devices}))(D);var v=Object(f.a)()(D),O=a("sZ7W"),E=a("26mJ"),y=a("pxzG"),j=a("eASP");class w extends r.a.Component{render(){const{handleSubmit:e}=this.props;return r.a.createElement("form",{onSubmit:e},r.a.createElement(h.a,{boxColor:"info"},this.props.t("modals.cageWeightConfiguration.info2")),r.a.createElement(m.a,{name:"weight",component:E.a,type:"number",label:this.props.t("modals.cageWeightConfiguration.weight"),unit:Object(y.l)("weight",j.a.MEDIUM)}),r.a.createElement("div",{className:"placeholder"},"PLACEHOLDER"))}}w=Object(d.a)({form:"cage-weight-configurator",destroyOnUnmount:!1,forceUnregisterOnUnmount:!0,validate:u})(w);var C=Object(f.a)()(w),S=a("tDQA"),T=a("uSQv"),I=a("/kok");class k extends r.a.Component{componentDidMount(){I.a.startSendingDeviceState(this.props.cage)}getWeight(){const{shadows:e,cage:t}=this.props;try{let a=e.get(t.DevID);return Object(y.j)(a.weight,{unit:j.a.MEDIUM,showUnit:!0,fixed:1})}catch(a){return"-"}}render(){return r.a.createElement("div",{className:"cage-weight-configuration-page-3"},r.a.createElement(h.a,{boxColor:"info"},r.a.createElement("p",null,this.props.t("modals.cageWeightConfiguration.info3")),r.a.createElement("p",null,this.props.t("modals.cageWeightConfiguration.info4")),r.a.createElement("p",null,this.props.t("modals.cageWeightConfiguration.info5"))),r.a.createElement("div",{className:"current-weight"},this.props.t("currentWeight")," ",r.a.createElement("strong",null,this.getWeight())),r.a.createElement("div",null,this.props.t("currentWeight")),r.a.createElement("div",null,r.a.createElement(T.a,{buttonColor:"success",onClick:this.props.onYesClick},this.props.t("yes")),r.a.createElement(T.a,{buttonColor:"error",onClick:this.props.onNoClick},this.props.t("modals.cageWeightConfiguration.no"))))}}k=Object(d.a)({form:"cage-weight-configurator",destroyOnUnmount:!1,forceUnregisterOnUnmount:!0})(k);const x=Object(S.a)("cage-weight-configurator");k=Object(b.connect)(e=>({cage:x(e,"cage"),shadows:e.shadows.shadows}))(k);var M,N=Object(f.a)()(k),A=a("wQmL"),P=(a("pPxQ"),a("0b+E"));const F="cage-weight-configurator";let z=Object(b.connect)()(M=class extends r.a.Component{constructor(e){super(e),this.onFailure=()=>{this.setState({loading:!1})},this.onTareSuccess=()=>{this.setState(e=>({step:e.step+1,loading:!e.loading}))},this.onFirstPageSubmit=e=>{const{cage:t}=e;this.setState({loading:!0}),Object(O.a)(t,this.onTareSuccess,this.onFailure)},this.onScaleSuccess=()=>{this.setState(e=>({loading:!1,step:e.step+1}))},this.onSecondPageSubmit=e=>{const{cage:t,weight:a}=e;this.setState({loading:!0}),Object(O.p)(t,Object(y.i)(+a,{fromUnit:j.a.MEDIUM}),this.onScaleSuccess,this.onFailure)},this.onNoClick=()=>{this.setState({step:1})},this.state={step:1,loading:!1},this.props.dispatch(Object(A.d)(F)),P.a.modalview(F)}render(){const{step:e,loading:t}=this.state,{show:a,handleHide:n}=this.props;return r.a.createElement(i.a,{onHide:n,show:a,size:"lg"},r.a.createElement(o.b,{title:this.props.t("modals.cageWeightConfiguration.title"),onCloseClick:n}),r.a.createElement(s.a,{className:F,isLoading:t},1===e&&r.a.createElement(v,{onSubmit:this.onFirstPageSubmit}),2===e&&r.a.createElement(C,{onSubmit:this.onSecondPageSubmit}),3===e&&r.a.createElement(N,{onYesClick:n,onNoClick:this.onNoClick})),r.a.createElement(l.a,{onCloseClick:n,hasConfirmButton:3!==e,confirmText:this.props.t("modals.cageWeightConfiguration.next"),formName:F,submitting:t}))}})||M;z=Object(c.a)({name:F})(z);t.b=Object(f.a)()(z)},iWju:function(e,t,a){"use strict";a.d(t,"a",(function(){return C}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("d/v1"),m=a("pJVQ"),d=a("tDQA"),u=a("f0zD"),p=a("wd/R"),h=a.n(p),g=a("pxzG"),b=a("eASP"),f=a("kCVf"),D=a("DWSH"),v=a("byFs");var O=a("0b+E"),E=a("LCzB"),y=a("26mJ"),j=a("/MKj"),w=a("XoCd");const C="chamber-settlement-weight-modal";class S extends r.a.Component{constructor(e){super(e),this.state={onlyWeight:!1},O.a.modalview(C);const{scales:t,settlements:a}=e;let n=!0;for(let r of t){let e=r.getLocation(),t=Object(f.j)(e[0]||{});a.find(e=>e.PlcmntID===t&&!e.DtaEndTime)||(n=!1)}this.state.onlyWeight=n,this.props.initialize({date:h()().format(h.a.HTML5_FMT.DATE),weight:8,age:28,plannedWeight:30})}render(){const{show:e,submitting:t,handleHide:a,t:n,handleSubmit:m,weight:d}=this.props,{onlyWeight:u}=this.state,p=Object(g.l)("weight",b.a.MEDIUM);return r.a.createElement(i.a,{onHide:a,show:e,size:"lg"},r.a.createElement("form",{onSubmit:m},r.a.createElement(o.b,{title:n("settlement"),onCloseClick:a}),r.a.createElement(s.a,{className:C},!u&&r.a.createElement(l.a,{name:"date",component:y.a,type:"date",label:n("settlementDate")}),r.a.createElement(l.a,{name:"weight",component:y.a,type:"number",unit:p,label:n("modals.chamberSettlementWeightModal.weight")}),r.a.createElement(l.a,{name:"age",component:y.a,type:"number",unit:n("days"),label:n("modals.chamberSettlementWeightModal.age")}),r.a.createElement(l.a,{name:"plannedWeight",component:w.a,label:n("modals.chamberSettlementWeightModal.plannedWeight"),min:d?+d:30,max:200,valueFormatter:e=>e?e+p:"-"})),r.a.createElement(c.a,{hasConfirmButton:!0,onCloseClick:a,submitting:t,formName:C,confirmText:n("save")})))}}S=Object(m.a)({form:C,onSubmit:function(e,t,a){const{scales:n,settlements:r}=a;let i=h.a.utc(e.date),o=Object(g.i)(+e.weight,{fromUnit:b.a.MEDIUM}),s=Object(g.i)(+e.plannedWeight,{fromUnit:b.a.MEDIUM}),c=[],l=[];for(let m of n){let t=m.getLocation(),a=Object(f.j)(t[0]||{});if(a){let t=r.find(e=>e.PlcmntID===a&&!e.DtaEndTime);if(t){let a=m.prepareBeanToSave();a.startInsertion(t.DtaStartTime,o,+e.age,s),c.push(a)}else l.push(Object(D.g)({DevID:m.DevID,time:i.toDate().getTime(),weight:o,age:+e.age,plannedSellWeight:s}))}}return c.length>0&&l.push(Object(v.a)(c)),Promise.all(l).then(e=>{a.handleHide(),Object(D.i)(e)}).catch(e=>{Object(D.h)(e)})},validate:function(e,t){const a={},{t:n}=t;if(e.date){let r=h.a.utc(e.date);if(r.isAfter(h.a.utc(),"days"))a.date=n("errors.future");else for(let e of t.scales){let i=e.getLocation(),o=Object(f.j)(i[0]||{});if(o){let e=t.settlements.filter(e=>e.PlcmntID===o);for(let t of e){if(r.isBetween(t.DtaStartTime,t.DtaEndTime)){let e=Object(f.k)(i[0]);a.date=n("errors.hasSettlement",{name:e});break}if(r.isBefore(t.DtaStartTime)){let e=Object(f.k)(i[0]);a.date=n("errors.hasLaterSettlement",{name:e});break}}}}}else a.date=n("required");return e.weight||(a.weight=n("required")),e.age||(a.age=n("required")),a}})(S);const T=Object(d.a)(C);S=Object(j.connect)(e=>({settlements:e.settlement.settlement,weight:T(e,"weight")}))(S),S=Object(u.a)({name:C})(S);t.b=Object(E.a)()(S)},kUvp:function(e,t,a){},krHZ:function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a("J2iB"),r=a.n(n),i=a("lSCD"),o=a.n(i),s=a("lFKM"),c=a.n(s),l=a("mwIZ"),m=a.n(l),d=a("qzmO"),u=a("wd/R"),p=a.n(u),h=a("15cA"),g=a("6/k7");function b(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function f(e){for(var t=1;t(console.log(e,t,a,"isValid"),a?Object(h.a)(s.find(e=>e.name===a),O.curve,O.day,D):e&&c()(t)?Object(h.a)(s.find(a=>a.receiver&&a.receiver.deviceId===e&&a.receiver.index===t-1),v.curve,v.day,D):Object(h.a)(s.find(a=>a.receiver&&a.receiver.deviceId===e&&r()(t)),O.curve,O.day,D));for(let[r,o]of l.entries()){const e=[];if(v.curve&&o.individualDTM.length&&o.individualDTM.forEach(t=>{t.outputs.forEach(a=>{j({DevID:t.DevID,number:a.number})&&e.push(f({},a,{feeding:f({},E,{number:a.number})}))})}),O.curve){if(o.groupNRF.length&&o.groupNRF.forEach(t=>{t.animals.forEach(a=>{j({rfid:a.RFID})&&e.push(f({PlcmntID:t.LocID},a,{feeding:y}))})}),o.individualNRF.devices.length>0){const t=o.individualNRF.devices.filter(e=>j({DevID:e}));o.individualNRF.animals.filter(e=>{const a=s.find(t=>t.id===e.PlcmntID);return!!a&&t.includes(m()(a,"receiver.deviceId"))}).forEach(t=>{e.push(f({},t,{feeding:y}))})}e.length&&n(r,e)}}o()(u)&&u(),o()(b)&&b()}},l6DA:function(e,t,a){},lDiB:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("IWeY"),s=a("smLN"),c=a("f0zD"),l=a("HS/c"),m=a.n(l),d=a("JZab"),u=a("/MKj"),p=a("LCzB"),h=a("ANjH"),g=a("pJVQ");const b="add-payment-methods-modal";class f extends r.a.Component{constructor(e){super(e),e.dispatch(Object(d.d)())}render(){const{handleHide:e,show:t,title:a}=this.props;return r.a.createElement(i.a,{onHide:e,show:t},r.a.createElement(s.a,{onCloseClick:e,closeButton:e},r.a.createElement("h4",null,a)),r.a.createElement(o.a,null,r.a.createElement(m.a,{options:{authorization:this.props.clientToken,locale:this.props.t("subscriptions.locale"),card:{cardholderName:!0}},onInstance:e=>{this.instance=e,this.instance.clearSelectedPaymentMethod(),this.props.dispatch(Object(d.g)(this.instance))},onPaymentMethodRequestable:()=>{this.instance.requestPaymentMethod(),this.props.dispatch(Object(d.f)(!0))},onNoPaymentMethodRequestable:()=>{this.props.dispatch(Object(d.f)(!1))},onPaymentOptionSelected:()=>{this.props.dispatch(Object(d.f)(!0))}})))}}t.b=Object(h.d)(Object(p.a)(),Object(c.a)({name:b}),Object(u.connect)((function(e){return{clientToken:e.braintree.clientToken,fetched:e.braintree.fetched,dropinLoaded:e.braintree.dropinLoaded}})),Object(g.a)({form:b}))(f)},lVFi:function(e,t,a){"use strict";a.d(t,"a",(function(){return s})),a.d(t,"b",(function(){return c}));var n=a("TYy9"),r=a.n(n),i=a("qzmO"),o=a("AF5L");function s(e={},t,a){const{alert:n=!1}=e,{receivers:s,handleHide:c,clearSelection:l}=a;if(n)for(let r of s.values())r.individualNRF.devices.length&&Object(i.k)(r.individualNRF.devices,!0);else for(let[i,m]of s.entries()){let e=[...m.individualNRF.devices.map(e=>({DevID:e})),...m.individualDTM.map(e=>e.outputs.map(t=>({DevID:e.DevID,number:t.number})))];Object(o.d)(i,{DeviceIDs:r()(e)})}l&&l(),c()}function c(e,t){return{}}},mvGM:function(e,t,a){},"o6/V":function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("BqhJ"),d=(a("Kl5y"),a("wd/R")),u=a.n(d),p=a("RFJ0"),h=a("B7Ps"),g=a("UvEz"),b=a("0b+E"),f=a("LCzB"),D=a("/MKj"),v=a("kCVf"),O=a("UZWR"),E=a("ANjH");const y="compare-insertion-modal";class j extends r.a.Component{constructor(e){super(e);const{settlements:t}=e;this.state={insertion1:t[t.length-2],insertion2:t[t.length-1]},b.a.modalview(y)}onSelectChange(e,t){this.setState({[t]:e})}render(){const{show:e,handleHide:t,cage:a,chart:n,t:l,settlements:d}=this.props,{insertion1:b,insertion2:f}=this.state;return r.a.createElement(i.a,{onHide:t,show:e,size:"lg"},r.a.createElement(o.b,{title:l("modals.compareInsertionModal.title"),onCloseClick:t}),r.a.createElement(s.a,{className:y},r.a.createElement("div",{className:"compare-insertion-modal-controls"},r.a.createElement("div",null,r.a.createElement(p.a,{label:l("modals.compareInsertionModal.insertion1"),value:b,options:d.map(e=>({name:e.DtaEndTime?"".concat(u.a.utc(e.DtaStartTime).format("DD.MM.YYYY")," - ").concat(u.a.utc(e.DtaEndTime).format("DD.MM.YYYY")):"".concat(u.a.utc(e.DtaStartTime).format("DD.MM.YYYY")," - ..."),value:e})),onChange:e=>this.onSelectChange(e,"insertion1")})),r.a.createElement("div",null,r.a.createElement(p.a,{label:l("modals.compareInsertionModal.insertion2"),value:f,options:d.map(e=>({name:e.DtaEndTime?"".concat(u.a.utc(e.DtaStartTime).format("DD.MM.YYYY")," - ").concat(u.a.utc(e.DtaEndTime).format("DD.MM.YYYY")):"".concat(u.a.utc(e.DtaStartTime).format("DD.MM.YYYY")," - ..."),value:e})),onChange:e=>this.onSelectChange(e,"insertion2")}))),r.a.createElement("div",{className:"compare-insertion-modal-chart"},"weight"===n&&r.a.createElement(m.a,{cage:a,applyShadow:!0,settlement:b,shadowInsertion:f}),"gain"===n&&r.a.createElement(h.a,{cage:a,applyShadow:!0,settlement:b,shadowInsertion:f}),"dayPasses"===n&&r.a.createElement(g.a,{cage:a,applyShadow:!0,settlement:b,shadowInsertion:f}))),r.a.createElement(c.a,{hasConfirmButton:!0,onCloseClick:t,formName:y}))}}t.b=Object(E.d)(Object(l.a)({name:y}),Object(f.a)(),Object(D.connect)((e,t)=>{const{cage:a}=t;if(a){let t=a.getLocation(),n=Object(v.j)(t[0]);return{settlements:Object(O.d)(e,{CID:n})}}return{settlements:[]}}))(j)},op23:function(e,t,a){"use strict";a.d(t,"a",(function(){return D}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("pJVQ"),m=a("f0zD"),d=a("DWSH");var u=a("/MKj"),p=a("0b+E"),h=a("84Ez"),g=a("s506"),b=a("qx5e"),f=a("LCzB");const D="chamber-settlement-modal";class v extends r.a.Component{constructor(e){super(e),p.a.modalview(D)}render(){const{show:e,submitting:t,handleHide:a,t:n,handleSubmit:l}=this.props;return r.a.createElement(i.a,{onHide:a,show:e,size:"lg"},r.a.createElement("form",{onSubmit:l},r.a.createElement(o.b,{title:n("settlement"),onCloseClick:a}),r.a.createElement(s.a,{className:D},r.a.createElement("p",null,n("modals.chamberSettlementModal.settlementText"))),r.a.createElement(c.a,{hasConfirmButton:!0,onCloseClick:a,submitting:t,formName:D,confirmText:n("yes")})))}}v=Object(l.a)({form:D,onSubmit:function(e,t,a){const{chamberId:n,handleHide:r}=a;let i=Array.isArray(n)?n:[n],o=[];for(let s of i)o.push(Object(d.f)({PlcmntID:s}));return Promise.all(o).then(e=>{r(),Object(d.i)(e)}).catch(e=>{Object(d.h)(e)})}})(v),v=Object(u.connect)(e=>({dispenserLicense:Object(h.a)(e,{licenseName:g.a.DISPENSER})}))(v),v=Object(m.a)({name:D})(v),v=Object(b.a)({clientPackage:{[g.a.DISPENSER]:g.b.BASIC}})(v);t.b=Object(f.a)()(v)},pPxQ:function(e,t,a){},"q/em":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("d/v1"),o=a("pJVQ"),s=a("tDQA"),c=a("/MKj"),l=a("J2iB"),m=a.n(l),d=a("4ltZ"),u=a("kCVf");var p=a("26mJ"),h=a("4huo"),g=a("vYJ8"),b=a("zM5D"),f=a("UGc4"),D=a("0pzG"),v=a("gu+X"),O=a("f0zD"),E=a("17x9"),y=a.n(E),j=a("XM6k"),w=a("a4gc"),C=a("Jxr4"),S=a("KVmA"),T=a("nPqS"),I=a("unVT"),k=a("HuqI"),x=a("feJH"),M=a("ZVDl"),N=a("pEX4"),A=a("0b+E"),P=a("LCzB"),F=a("XzT5");const z="settings-buildings-add-location-modal";class B extends r.a.Component{constructor(e){super(e),this.renderSectorAttributes=()=>{const{t:e}=this.props;let{STypes:t}=this.state;const a=[];return t.forEach((e,t)=>{a.push({name:e,value:t+1})}),r.a.createElement(i.a,{name:"sectorType",id:"sectorType",type:"text",required:!0,component:h.b,options:a,label:e("sectorType")})},this.renderChamberAttributes=()=>{const{chamberIndividualFeeding:e,t:t}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{name:"chamberIndividualFeeding",id:"chamberIndividualFeeding",type:"text",component:j.a,label:t("modals.addLocationModal.individualFeeding")}),r.a.createElement(g.a,{in:e,mountOnEnter:!0,unmountOnExit:!0},r.a.createElement("div",null,r.a.createElement(i.a,{name:"chamberStandingInRow",id:"chamberStandingInRow",type:"number",required:!0,component:p.a,label:t("standingsInRow")}),r.a.createElement(i.a,{name:"chamberStandingsOrder",id:"chamberStandingsOrder",type:"text",showLabels:!0,required:!0,component:w.a,options:[{value:0,svgPath:C.a,label:"A1"},{value:1,svgPath:S.a,label:"A2"},{value:2,svgPath:T.a,label:"A3"},{value:3,svgPath:I.a,label:"A4"},{value:4,svgPath:k.a,label:"B1"},{value:5,svgPath:x.a,label:"B2"},{value:6,svgPath:M.a,label:"B3"},{value:7,svgPath:N.a,label:"B4"}],label:t("modals.addLocationModal.standingsOrder")}),r.a.createElement("hr",null),r.a.createElement(i.a,{name:"chamberStandingName",id:"chamberStandingName",type:"text",required:!0,component:p.a,label:t("modals.addLocationModal.standingsName")}),r.a.createElement(i.a,{name:"chamberStandingFrom",id:"chamberStandingFrom",required:!0,type:"number",component:p.a,label:t("modals.addLocationModal.standingsStartNumber")}),r.a.createElement(i.a,{name:"chamberStandingSize",id:"chamberStandingSize",required:!0,type:"number",component:p.a,label:t("modals.addLocationModal.standingsSize")}))),r.a.createElement(g.a,{in:!e,unmountOnExit:!0,mountOnEnter:!0},r.a.createElement("div",null,r.a.createElement(i.a,{name:"chamberSize",id:"chamberSize",required:!0,type:"number",component:p.a,label:t("modals.addLocationModal.chamberSize")}))))},this.renderStandingAttributes=()=>{const{t:e}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{name:"boxFrom",id:"boxFrom",type:"number",required:!0,component:p.a,label:e("modals.addLocationModal.boxFrom")}),r.a.createElement(i.a,{name:"boxAmount",id:"boxAmount",type:"number",required:!0,component:p.a,label:e("modals.addLocationModal.boxAmount")}))},this.state={STypes:F.a.t("SType",{returnObjects:!0})},A.a.modalview(z)}componentDidUpdate(e,t,a){e!==this.props&&this.setState({STypes:F.a.t("SType",{returnObjects:!0})})}render(){const{parent:e={},adding:t,show:a,handleHide:n,t:o,handleSubmit:s}=this.props;return console.log(this.props),r.a.createElement(b.a,{onHide:n,show:a,size:"lg"},r.a.createElement("form",{onSubmit:s},r.a.createElement(f.b,{title:F.a.t("modals.addLocationModal.addLocationTo",{type:e.BName||e.CName||e.BoxesName||e.FarmName||e.SName}),onCloseClick:n}),r.a.createElement(D.a,{className:z},r.a.createElement(i.a,{name:"locationName",id:"locationName",type:"text",required:!0,component:p.a,label:o("designation")}),e.BgID&&this.renderSectorAttributes(),e.SID&&this.renderChamberAttributes(),e.CID&&this.renderStandingAttributes()),r.a.createElement(v.a,{hasConfirmButton:!0,confirmText:o("add"),onCloseClick:n,formName:z,submitting:t})))}}B.propTypes={parent:y.a.string.isRequired},B=Object(o.a)({form:z,onSubmit:function(e,t,a){console.log(e,a,"DJIJIOJSAOIJDAIODSIOJ");const{parent:n,handleHide:r}=a,i=["CID","SID","BgID","BID","FarmID"].filter(e=>!!n[e])[0];let o;switch(i){case"CID":o=Object(u.f)({name:e.locationName,startFrom:+e.boxFrom,amount:+e.boxAmount});break;case"SID":o=Object(u.d)({name:e.locationName,individualFeeding:e.chamberIndividualFeeding,standingsInRow:+e.chamberStandingInRow,standingsOrder:+e.chamberStandingsOrder,chamberSize:e.chamberSize,createStandings:!(!e.chamberStandingFrom||!e.chamberStandingSize),standingsAmount:+e.chamberStandingSize,standingsFrom:+e.chamberStandingFrom,standingsName:e.chamberStandingName});break;case"BgID":o=Object(u.e)({name:e.locationName,type:+e.sectorType});break;case"FarmID":o=Object(u.c)({name:e.locationName,FarmID:a.parent.FarmID});break;default:throw new Error("not implemented")}return t(Object(d.a)(o,n[i],()=>r()))},validate:function(e,t){const a={},{t:n}=t,{locationName:r,sectorType:i,chamberSize:o,chamberStandingInRow:s,boxFrom:c,boxAmount:l,chamberStandingFrom:d,chamberStandingSize:u,chamberStandingsOrder:p,chamberStandingName:h}=e;return r||(a.locationName=n("required")),(!i||+i<=0)&&(a.sectorType=n("required")),h||(a.chamberStandingName=n("required")),h&&h.length>16&&(a.chamberStandingName=n("errors.standingError")),(!o||+o<=0)&&(a.chamberSize=n("required")),(!d||+d<=0)&&(a.chamberStandingFrom=n("required")),(!s||+s<=0)&&(a.chamberStandingInRow=n("required")),(!u||+u<=0)&&(a.chamberStandingSize=n("required")),+u>200&&(a.chamberStandingSize=n("errors.chamberSize")),(m()(p)||+p<0)&&(a.chamberStandingsOrder=n("required")),(!l||+l<=0)&&(a.boxAmount=n("required")),(!c||+c<0)&&(a.boxFrom=n("required")),a}})(B),B=Object(c.connect)(e=>({farm:e.location.farm,adding:e.farms.adding}))(B);const R=Object(s.a)(z);let W=Object(c.connect)(e=>({chamberIndividualFeeding:!!R(e,"chamberIndividualFeeding")}))(B);W=Object(O.a)({name:z})(W);t.a=Object(P.a)()(W)},qhCA:function(e,t,a){"use strict";a.d(t,"a",(function(){return H}));var n=a("q1tI"),r=a.n(n),i=a("zM5D"),o=a("UGc4"),s=a("0pzG"),c=a("gu+X"),l=a("f0zD"),m=a("HIda"),d=a("d/v1"),u=a("pJVQ"),p=a("tDQA"),h=a("/MKj"),g=a("BkRI"),b=a.n(g),f=a("Hk1H"),D=a("lM7y"),v=a("wd/R"),O=a.n(v);var E=a("0b+E"),y=a("4huo"),j=a("XoCd"),w=a("JFfd"),C=a("wQmL"),S=a("LCzB");class T extends r.a.Component{constructor(...e){super(...e),this.onIsArrayChange=(e,t)=>{setTimeout(()=>{t?this.props.dispatch(Object(C.a)(this.props.formName,"WData.InseminationTime",[this.props.InseminationTime,30])):this.props.dispatch(Object(C.a)(this.props.formName,"WData.InseminationTime",this.props.InseminationTime[0]))})}}render(){const{isArray:e,t:t}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement(d.a,{name:"isArray",component:y.b,label:"Typ",options:[{name:t("modals.editControlListSettingsModal.oneDay"),value:!1},{name:t("modals.editControlListSettingsModal.rangeOfDays"),value:!0}],onChange:this.onIsArrayChange}),e&&r.a.createElement(d.a,{name:"InseminationTime",component:j.a,isRange:!0,label:t("modals.editControlListSettingsModal.daysToHeat"),min:15,max:30,valueFormatter:e=>"".concat(e[0]," - ").concat(e[1])}),!e&&r.a.createElement(d.a,{name:"InseminationTime",component:j.a,label:t("modals.editControlListSettingsModal.daysToHeat"),min:15,max:30,valueFormatter:e=>e}))}}T=Object(h.connect)((e,t)=>{let a=Object(p.a)(t.formName);return{isArray:a(e,"WData.isArray"),InseminationTime:a(e,"WData.InseminationTime")}})(T);var I=Object(S.a)()(T),k=a("3t43"),x=a("q17X"),M=a("uSQv"),N=a("17x9"),A=a.n(N),P=a("XzT5");class F extends r.a.Component{constructor(...e){super(...e),this.renderConditionDays=({fields:e,days:t})=>{let a=Object(x.getTimeFromInseminationToPartuition)();return r.a.createElement(r.a.Fragment,null,e.map((n,i)=>r.a.createElement("div",{className:"slider-with-remove"},r.a.createElement("div",null,r.a.createElement(d.a,{id:n,component:j.a,name:n,label:P.a.t("modals.editControlListSettingsModal.dayAfterInsemination",{amount:i+1}),min:0===i?1:t[i-1]+1,max:a})),r.a.createElement("div",null,r.a.createElement("i",{className:"fas fa-trash pointer",onClick:1!==e.length?()=>e.remove(i):null})))),r.a.createElement(M.a,{icon:r.a.createElement("i",{className:"fas fa-plus"}),onClick:()=>this.onAddNewClick(e,t),disabled:t[t.length-1]===a},this.props.t("modals.editControlListSettingsModal.addNew")))}}onAddNewClick(e,t){e.push(t[t.length-1]+1)}render(){const{days:e,name:t}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement(k.a,{name:t,component:this.renderConditionDays,days:e}))}}F.propTypes={name:A.a.string.isRequired,formName:A.a.string.isRequired},F=Object(h.connect)((e,t)=>({days:Object(p.a)(t.formName)(e,"WData.".concat(t.name))}))(F);var z=Object(S.a)()(F),B=(a("l6DA"),a("26mJ"));class R extends r.a.Component{render(){const{t:e}=this.props;return r.a.createElement(d.a,{name:"DefaultActiveNipples",component:j.a,label:e("modals.editControlListSettingsModal.defaultActiveNipples"),min:1,max:15})}}var W=Object(S.a)()(R);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 V(e){for(var t=1;te?O.a.utc(e).toDate().getTime():null,format:e=>e?O.a.utc(e).format(O.a.HTML5_FMT.DATE):null}),r.a.createElement(d.a,{name:"EndDay",component:B.a,label:n("modals.editControlListSettingsModal.endDay"),type:"date",parse:e=>e?O.a.utc(e).toDate().getTime():null,format:e=>e?O.a.utc(e).format(O.a.HTML5_FMT.DATE):null})),this.getOtherFields())),r.a.createElement(c.a,{hasConfirmButton:!0,confirmText:n("save"),onCloseClick:t,formName:H}))}}U=Object(u.a)({form:H,onSubmit:function(e,t,a){const{user:n}=a;let r=new f.a(b()(e));delete r.WData.isArray,r.setDtaModTime(),t(Object(D.d)(r.prepareBeanToSave(),n.ClientID,n.LocalUserID)),a.handleHide()},validate:function(e,t){const a={WData:{}},{t:n}=t;return e.WData&&(e.WData.StartDay||(a.WData.StartDay=n("required")),e.WData.EndDay||(a.WData.EndDay=n("required")),e.WData.StartDay&&e.WData.EndDay&&e.WData.StartDay>e.WData.EndDay&&(a.WData.StartDay=n("errors.mustBeBelowOrEqualStartTime")+O()(e.WData.EndDay).format("DD.MM.YYYY"))),a}})(U);const G=Object(p.a)(H);U=Object(h.connect)(e=>({Period:G(e,"WData.Period"),user:e.user.user}))(U),U=Object(l.a)({name:H})(U);t.b=Object(S.a)()(U)},ra4M:function(e,t,a){"use strict";var n=a("zM5D"),r=a("q1tI"),i=a.n(r),o=(a("TV8c"),a("LCzB")),s=a("gu+X");class c extends i.a.Component{constructor(e){super(e),this.onButtonClick=()=>{this.props.action()},this.state={counter:e.counter}}componentDidMount(){this.interval=setInterval(()=>{this.state.counter<1?this.onButtonClick():this.setState({counter:this.state.counter-1})},1e3)}componentWillUnmount(){clearInterval(this.interval)}render(){const{show:e,counter:t,t:a}=this.props;return i.a.createElement(n.a,{className:"confirmModal",onHide:()=>{},show:e,counter:t},i.a.createElement(n.a.Header,null,i.a.createElement("h1",null,a("signSuccessfullModal.header"))),i.a.createElement(n.a.Body,null,i.a.createElement("a",null,a("signSuccessfullModal.message1")),i.a.createElement("a",null,a("signSuccessfullModal.message2")),i.a.createElement("a",null,a("signSuccessfullModal.message3"),this.state.counter,".")),i.a.createElement(s.a,{confirmText:a("signSuccessfullModal.goToLogin"),hasCloseButton:!1,hasConfirmButton:!0,onConfirmed:this.onButtonClick}))}}t.a=Object(o.a)()(c)},sJAb:function(e,t,a){"use strict";a.d(t,"a",(function(){return N}));var n=a("44Ds"),r=a.n(n),i=a("mwIZ"),o=a.n(i),s=a("q1tI"),c=a.n(s),l=a("/MKj"),m=a("17x9"),d=a.n(m),u=a("tDQA"),p=a("d/v1"),h=a("pJVQ"),g=a("2HEh"),b=a("f0zD"),f=a("LCzB"),D=a("R7+t"),v=a("UGc4"),O=a("0pzG"),E=a("zM5D"),y=a("3Z9Z"),j=a("JI6e"),w=a("pxzG"),C=a("eASP"),S=a("VyNe"),T=a("wd/R"),I=a.n(T),k=a("qzmO"),x=a("XoCd"),M=a("gu+X");const N="feeding-extra-water-modal",A=Object(u.a)(N),P=[250,500,750,1e3,1500,2e3];class F extends s.Component{constructor(...e){super(...e),this.notSupportedNames=r()(e=>e.filter(e=>!(e.device instanceof D.a)||!e.device.hasWater()).map(e=>e.name),(...e)=>JSON.stringify(e)),this.handleChange=e=>{const{change:t}=this.props,a=eObject(w.h)(e,{showUnit:!0,fixed:1,unit:C.a.SMALL})}componentWillUnmount(){const{cookies:e,amount:t}=this.props;this.notSupportedNames.cache.clear(),e.set(N,{amount:t||500},{path:"/",expires:I()().add(1,"year").toDate()})}componentDidMount(){const{initialize:e,cookies:t}=this.props,a=+o()(t.get(N),"amount",500),n=P.indexOf(a);e({amount:a,index:-1!==n?n:P.length})}render(){const{handleHide:e,handleSubmit:t,show:a,t:n,amount:r,index:i,submitting:o}=this.props,s=i>=P.length;return c.a.createElement(E.a,{onHide:e,show:a,size:"lg"},c.a.createElement("form",{onSubmit:t},c.a.createElement(v.b,{title:n("extraWater"),onCloseClick:e}),c.a.createElement(O.a,{className:N},c.a.createElement(y.a,null,P.map((e,t)=>c.a.createElement(j.a,{xs:6,sd:4,md:3,key:t},c.a.createElement(S.a,{onClick:()=>this.handleChange(t),selected:!s&&r===e},this.formatter(e)))),c.a.createElement(j.a,{xs:6,sd:4,md:3},c.a.createElement(S.a,{onClick:()=>this.handleChange(2137),selected:s},n("modals.feedingExtraWater.other")))),s&&c.a.createElement(p.a,{name:"amount",id:"amount",min:250,step:10,max:1e4,label:n("modals.feedingExtraWater.amount"),component:x.a,valueFormatter:this.formatter})),c.a.createElement(M.a,{hasConfirmButton:!0,confirmText:n("start"),onCloseClick:e,formName:N,submitting:o})))}}F.propTypes={selectedNodes:d.a.array.isRequired},F=Object(h.a)({form:N,onSubmit:(e,t,a)=>{const{amount:n,selectedNodes:r,receivers:i,handleHide:o}=a,s=r.filter(e=>e.device instanceof D.a&&!!e.device.hasWater()).map(e=>e.device.DevID);return Promise.all([...i.values()].map(e=>new Promise((t,a)=>{const r=e.individualNRF.devices.filter(e=>s.includes(e));let i;r.length&&(i=Object(k.j)(r,{amount:n},{onFailure:a,onSuccess:t})),i||t()}))).then(e=>{o()}).catch(e=>{console.error(e)})},initialValues:{amount:P[0],index:0}})(F),F=Object(l.connect)((function(e){return{amount:A(e,"amount"),index:A(e,"index")}}))(F),F=Object(g.a)(Object(b.a)({name:N})(F)),t.b=Object(f.a)()(F)},"tJ+o":function(e,t,a){},tnGu:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("pDHb"),s=a("9jj8"),c=a("ANjH"),l=a("LCzB");class m extends n.Component{constructor(...e){super(...e),this.clicked=!1,this.refresh=()=>{const{dispatch:e,objectId:t,startFrom:a,userId:n,searchCode:r}=this.props;this.clicked=!0,e(Object(o.b)({ObjID:t,DtaCrtTime:a,UserID:n,Codes:r}))}}componentDidUpdate(e,t,a){const{fetching:n}=this.props,{fetching:r}=e;r&&r!==n&&!0===this.clicked&&(this.clicked=!1)}render(){const{props:{index:e,fetching:t,lastEvaluatedKey:a,t:n},clicked:i}=this,o=!!t&&i&&!a;return r.a.createElement(s.a,{index:e,disableHover:!0,className:"row pb-2 pt-2 pointer"},r.a.createElement("div",{onClick:this.refresh,className:"d-flex justify-content-center w-100 align-items-center"},n("logsView.loadNewer"),!!o&&r.a.createElement("i",{className:"fas fa-fw fa-circle-notch fa-spin"})))}}t.a=Object(c.d)(Object(l.a)(),Object(i.connect)((function(e){return{fetching:e.logs.fetching,lastEvaluatedKey:e.logs.lastEvaluatedKey,objectId:e.logs.objectId,startFrom:e.logs.startFrom,searchCode:e.logs.searchCode,userId:e.logs.userId}})))(m)},"vXv+":function(e,t,a){"use strict";a.d(t,"a",(function(){return W}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("zM5D"),c=a("UGc4"),l=a("0pzG"),m=a("gu+X"),d=a("tDQA"),u=a("PbGg"),p=a("d/v1"),h=a("pJVQ"),g=a("f0zD"),b=a("/MKj"),f=a("J2iB"),D=a.n(f),v=a("VrKS"),O=a("VfnB"),E=a("zDJl");var y=a("0b+E"),j=a("LCzB"),w=a("thTS"),C=a("Y/op"),S=a("uSQv"),T=a("vzZS"),I=a("XoCd"),k=a("re1K"),x=a("4huo"),M=a("rBIo"),N=a("SlBD"),A=a("pxzG"),P=a("eASP"),F=a("2UNB"),z=a("P0Qa");function B(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}const W="climate-work-type-modal",L=["inactive","manual","automatic","curve"];class V extends o.a.Component{constructor(e){super(e),this.getValues=()=>{const{shadow:e,climateCurves:t}=this.props,a=r()(e,"climateCurve.stages",[]);return this.deviceCurve.setBackendStages(a),{workType:L[r()(e,"ambientConditions.workType",0)],requestedTemperature:r()(e,"configuration.requestedTemperature",20),requestedTemperatureDeviation:r()(e,"configuration.requestedTemperatureDeviation",0),maximumVentilation:r()(e,"configuration.ventilationConfiguration.maximumVentilation",100),minimumVentilation:r()(e,"configuration.ventilationConfiguration.minimumVentilation",10),minimumVentilationDeviation:r()(e,"configuration.ventilationConfiguration.minimumVentilationDeviation",0),currentCurveDay:r()(e,"climateCurve.currentCurveDay",1)||1,manual:r()(e,"configuration.manual",90),curve:t.find(e=>e.equalCheck(a))||8===this.deviceCurve.SetData.Stages.length?this.deviceCurve:null}},this.getCurveOptions=()=>{const{climateCurves:e}=this.props,t=this.deviceCurve.getBackendStages();return[...8!==this.deviceCurve.SetData.Stages.length||e.find(e=>e.equalCheck(t))?[]:[this.deviceCurve],...e].map(e=>({value:e,name:e.SetData.Name}))},this.temperatureFormatter=e=>Object(A.f)(e,{unit:P.a.SMALL,fixed:1,showUnit:!0}),this.ventilationFormatter=e=>"".concat(e.toFixed(1),"%");const{t:t}=this.props;this.deviceCurve=F.a.createSetting(z.a.CLIMATE_SK3_CURVE,{Name:t("settings.unknownCurveOnDevice"),Stages:[]}),y.a.modalview(W)}componentDidMount(){const{initialize:e}=this.props;e(this.getValues())}render(){const{show:e,handleHide:t,t:a,initialized:n,workType:r,curve:i,currentCurveDay:d,submitting:u}=this.props,h=this.getCurveOptions(),g=["deviceRows.chainFeeding.chainFeedingRow.workTypes.inactive","deviceRows.chainFeeding.chainFeedingRow.workTypes.manual","deviceRows.chainFeeding.chainFeedingRow.workTypes.automatic","modals.feedingHistoryModal.curve"];return o.a.createElement(s.a,{onHide:t,show:e,size:"lg"},o.a.createElement(c.b,{title:a("worktype"),onCloseClick:t}),o.a.createElement(l.a,{className:"".concat(W," mh-5rem"),isLoading:!n},o.a.createElement("label",null,a("worktype")),o.a.createElement(p.a,{name:"workType",component:C.a},L.map((e,t)=>o.a.createElement(S.a,{buttonStyle:"text",value:e},a(g[L.indexOf(e)])))),"inactive"===r&&o.a.createElement(o.a.Fragment,null,o.a.createElement(T.a,{boxColor:"info"},a("farmView.climate.inactiveDesc"))),"manual"===r&&o.a.createElement(o.a.Fragment,null,o.a.createElement(T.a,{boxColor:"info"},a("farmView.climate.manualDesc")),o.a.createElement(p.a,{name:"manual",id:"manual",label:a("settings.manualOperation"),min:0,max:100,step:.2,valueFormatter:this.ventilationFormatter,component:I.a})),"automatic"===r&&o.a.createElement(o.a.Fragment,null,o.a.createElement(T.a,{boxColor:"info"},a("farmView.climate.automaticDesc")),o.a.createElement(p.a,{name:"requestedTemperature",id:"requestedTemperature",label:a("requestedTemperature"),min:10,max:50,step:.2,valueFormatter:this.temperatureFormatter,component:I.a}),o.a.createElement(p.a,{name:"minimumVentilation",id:"minimumVentilation",label:a("minimumVentilation"),min:0,max:50,step:.2,valueFormatter:this.ventilationFormatter,component:I.a}),o.a.createElement(p.a,{name:"maximumVentilation",id:"maximumVentilation",label:a("maximumVentilation"),min:50.6,max:100,step:.2,valueFormatter:this.ventilationFormatter,component:I.a})),"curve"===r&&o.a.createElement(o.a.Fragment,null,o.a.createElement(T.a,{boxColor:"info"},a("farmView.climate.curveDesc")),o.a.createElement(N.a,{curveDay:d,stages:i instanceof M.a?i.getBackendStages():[]}),o.a.createElement(p.a,{name:"curve",id:"curve",label:a("climateCurve"),options:h,disableSort:!0,component:x.b}),o.a.createElement(p.a,{name:"currentCurveDay",id:"currentCurveDay",label:a("curveDay"),min:1,max:i instanceof M.a?i.getLength():1,step:1,component:I.a}),o.a.createElement(p.a,{name:"requestedTemperatureDeviation",id:"requestedTemperatureDeviation",label:a("settings.desiredTempDeviation"),min:-10,max:10,step:.2,valueFormatter:this.temperatureFormatter,component:I.a}),o.a.createElement(p.a,{name:"minimumVentilationDeviation",id:"minimumVentilationDeviation",label:a("settings.minVentingDeviation"),min:-50,max:50,step:.2,valueFormatter:this.ventilationFormatter,component:I.a}))),o.a.createElement(m.a,{hasConfirmButton:!0,submitting:u,confirmText:a("save"),onCloseClick:t,formName:W}))}}V=Object(h.a)({form:W,onSubmit:function(e,t,a){const{workType:n}=e,{climates:r}=a,i={},o=Object(O.r)(r);return Promise.all([...o.values()].map(t=>new Promise((a,r)=>{switch(n){case"inactive":Object(v.n)(t[E.d.CLIMATE_SK3],null,{onSuccess:a,onFailure:r});break;case"manual":const{manual:n}=e;i.workType=1,i.manual=n,Object(v.o)(t[E.d.CLIMATE_SK3],i,{onSuccess:a,onFailure:r});break;case"automatic":const{maximumVentilation:o,minimumVentilation:s,requestedTemperature:c}=e;i.workType=3,i.maximumVentilation=o,i.minimumVentilation=s,i.requestedTemperature=c,Object(v.l)(t[E.d.CLIMATE_SK3],i,{onSuccess:a,onFailure:r});break;case"curve":const{curve:l,currentCurveDay:m,minimumVentilationDeviation:d,requestedTemperatureDeviation:u}=e;i.workType=4,i.currentCurveDay=m,i.minimumVentilationDeviation=d,i.requestedTemperatureDeviation=u,i.stages=l.getBackendStages(),Object(v.m)(t[E.d.CLIMATE_SK3],i,{onSuccess:a,onFailure:r});break;default:console.error("wrong work type provided")}}))).then(()=>{a.handleHide()})},validate:function(e,t){const{t:a}=t,n={};return D()(e.workType)&&(n.workType=a("required")),D()(e.curve)&&(n.curve=a("required")),n}})(V),V=Object(b.connect)((function(e,t){const a=Object(w.a)(),{climates:n}=t,r={DevID:n[0].DevID},i=Object(d.a)(W);return function(e){return function(e){for(var t=1;t!e.hasOwnProperty("forageID"))||[]).map(e=>({name:e.CName,value:e}))}render(){const{show:e,handleHide:t,handleSubmit:a,t:n}=this.props;return o.a.createElement(m.a,{onHide:t,show:e,size:"lg"},o.a.createElement("form",{onSubmit:a},o.a.createElement(d.a,{title:n("addChamber"),onCloseClick:t}),o.a.createElement(u.a,null,o.a.createElement(c.a,{name:"chamber",id:"chamber",type:"text",label:n("modals.addChamberModal.chamber"),options:this.getChamberOptions(),component:h.b})),o.a.createElement(p.a,{hasConfirmButton:!0,confirmText:n("add"),onCloseClick:t,formName:D})))}}v=Object(l.a)({form:D,onSubmit:function(e,t,a){const{chamber:n}=e,{forage:i}=a;let o=r()(n);o.forageID=i.SetID,t(Object(g.e)(o)),a.handleHide()}})(v),v=Object(s.a)({name:D})(v);t.a=Object(f.a)()(v)},xUPz:function(e,t,a){"use strict";a.d(t,"a",(function(){return D}));var n=a("q1tI"),r=a.n(n),i=a("/MKj"),o=a("f0zD"),s=a("d/v1"),c=a("pJVQ"),l=a("zM5D"),m=a("UGc4"),d=a("0pzG"),u=a("gu+X"),p=a("XoCd"),h=a("pxzG"),g=a("eASP"),b=a("Gaw7");var f=a("LCzB");const D="silo-settings-modal";class v extends n.Component{constructor(e){super(e);const{siloses:t,shadows:a}=this.props;try{let e=a.get(t[0].device.DevID).configuration.minWeights[t[0].index].value||1e3;this.props.initialize({weight:e})}catch(n){console.error(n),this.props.initialize({weight:0})}}render(){const{handleHide:e,show:t,t:a}=this.props;return r.a.createElement(l.a,{onHide:e,show:t,size:"lg"},r.a.createElement(m.b,{title:a("modals.siloSettings.title"),onCloseClick:e}),r.a.createElement(d.a,null,r.a.createElement(s.a,{name:"weight",component:p.a,min:0,max:5e6,step:1e5,label:a("modals.siloSettings.weight"),valueFormatter:e=>null!==e&&void 0!==e?0===e?a("modals.siloSettings.alarmOff"):Object(h.j)(e,{unit:g.a.BIG,showUnit:!0,fixed:1}):"-"})),r.a.createElement(u.a,{hasConfirmButton:!0,confirmText:a("save"),onCloseClick:e,formName:D}))}}v=Object(c.a)({form:D,onSubmit:function(e,t,a){const{weight:n}=e,{siloses:r}=a;let i={};for(let o of r){let e=o.device.DevID,t=i[e]||{silo:o.device,minWeights:[]};t.minWeights.push({number:o.index,value:n}),i[e]=t}for(let o of Object.values(i))Object(b.b)(o.silo,{minWeights:o.minWeights});a.handleHide()}})(v),v=Object(i.connect)((function(e){return{shadows:e.shadows.shadows}}))(v),v=Object(o.a)({name:D})(v);t.b=Object(f.a)()(v)},xi04:function(e,t,a){"use strict";a.d(t,"a",(function(){return se}));var n=a("D1y2"),r=a.n(n),i=a("J2iB"),o=a.n(i),s=a("lFKM"),c=a.n(s),l=a("Y+p1"),m=a.n(l),d=a("E+oP"),u=a.n(d),p=a("mwIZ"),h=a.n(p),g=a("BkRI"),b=a.n(g),f=a("q1tI"),D=a.n(f),v=a("zM5D"),O=a("3Z9Z"),E=a("JI6e"),y=a("LCzB"),j=a("UGc4"),w=a("gu+X"),C=a("0pzG"),S=a("f0zD"),T=a("i8MS"),I=a("tkTQ"),k=a("/MKj"),x=a("d/v1"),M=a("HIda"),N=a("pJVQ"),A=a("tDQA"),P=a("4qC0"),F=a.n(P),z=a("kCmh"),B=a("n7pt"),R=a("aIXM"),W=a("JQpV"),L=a("15cA"),V=a("zDJl"),q=a("9PNC"),H=a("v9qu"),U=a("CX8Q"),G=a("+t3Z"),Y=a("B2Cw"),J=a("wd/R"),K=a.n(J),X=a("10H7"),Q=a("5Z9N"),_=a("msTn");var Z=a("4huo"),$=a("26mJ"),ee=a("XM6k"),te=a("6/k7"),ae=a("vzZS"),ne=a("mr+a");function re(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 ie(e){for(var t=1;t{const{farm:t,time:a,t:n,curves:r,standing:{device:i}={},sectorType:s}=e;let c=T.a.getAllAnimals(t,{$in:[I.a.RENOVATION_SOW,I.a.SOW,I.a.BOAR]},void 0,!1).map(e=>({name:e.AnmNo1,value:e}));return c.unshift({name:"+ ".concat(n("modals.assignAnimalToStandingModal.createNewAnimal")),value:null}),{animalsOptions:c,curvesOptions:!i||b()(r.filter(e=>Object(L.e)({sectorType:s}).includes(e.SetData.Type)&&Object(L.l)({curve:e,devType:o()(i.Index)?V.d.DISPENSER_NRF:V.d.DISPENSER}))).sort((e,t)=>e.SetData.Index-t.SetData.Index).map(e=>({name:h()(e,"SetData.Name"),value:e})),time:a,optionsLoaded:!0}},this.onSearchChange=e=>{const{animalsOptions:t}=this.state;if(!u()(t)&&e){this.props.change("setFeeding",!0);const a=[];for(let n of t){const{name:t}=n;"string"===typeof t&&t.startsWith(e)&&a.push(n)}u()(a)?this.setState({createNewAnimalMod:!0,initialSearchValue:""},()=>{this.props.change("newAnmNo1",e)}):this.setState({createNewAnimalMod:!1,initialSearchValue:e},()=>{this.props.change("newAnmNo1",void 0)})}else e||u()(t)?this.props.change("setFeeding",!1):this.setState({createNewAnimalMod:!1,initialSearchValue:e},()=>{this.props.change("newAnmNo1",void 0)})},this.onMobileAnmNo1Change=e=>{e?(this.props.change("feeding",this.initializeFeeding(this.props,{no1:e})),this.props.change("setFeeding",!0)):this.props.change("setFeeding",!1)},this.initializeFeeding=(e,t={},a=!1)=>{const{animal:n,curves:i,farm:o,sectorType:s}=e,{no1:c}=t,l=b()(Object(H.a)()?T.a.getAnimalByAnmNo1(c,o):n);return a&&r()(l,"feedParam.curveStart",void 0),Object(L.k)({animal:l,curves:i,sectorType:s})},this.getBoxName=e=>{const{standing:t,chamber:a}=e;return a.Boxes.find(e=>e.BID===t.id).BoxesName},this.getAnmLocation=e=>T.a.getAnimalLocationsByPlcmntID(e.PlcmntID).map(e=>e.name).join(", "),this.onSelectAnimalChange=e=>{if(!o()(e))return e;{let e=b()(this.state.initialSearchValue);this.setState({createNewAnimalMod:!0,initialSearchValue:""},()=>{this.props.change("newAnmNo1",e),this.props.change("animal",null)})}},this.state={initialSearchValue:"",createNewAnimalMod:!1,animalsOptions:[],curvesOptions:[],optionsLoaded:!1,time:0}}static getDerivedStateFromProps(e,t){return t.time!==e.time?{optionsLoaded:!1}:null}componentDidMount(){this.setState(ie({},this._getOptions(this.props)))}componentDidUpdate(e,t,a){const{animal:n,curve:r,newAnmNo1:i,change:o}=this.props,{optionsLoaded:s}=this.state;if(e.optionsLoaded!==s&&(s||this.setState(ie({},this._getOptions(this.props)))),!Object(H.a)())if(m()(e.animal,n))if(m()(e.newAnmNo1,i)){if(!m()(e.curve,r)){const{curves:e,sectorType:t}=this.props;n&&r&&h()(n,"feedParam.curveNr")===h()(r,"SetData.Index",0)+1||o("feeding",Object(L.k)({animal:{feedParam:{startTime:+new Date,curveNr:r?r.SetData.Index+1:0,stage:0}},curves:e,sectorType:t}))}}else i&&o("setFeeding",!0),o("animal",null),o("feeding",this.initializeFeeding(this.props));else n?this.setState({initialSearchValue:""},()=>{o("feeding",this.initializeFeeding(this.props)),o("setFeeding",!0)}):o("setFeeding",!1)}render(){const{submitting:e,handleHide:t,show:a,t:n,standing:{device:r,animal:i},setFeeding:o,curve:s,chamber:l,anmNo1:d,farm:u,animal:p,newAnmNo1:g}=this.props,{animalsOptions:b,curvesOptions:f,optionsLoaded:y,createNewAnimalMod:S,initialSearchValue:I}=this.state,k=!r||Object(L.f)(s),N=!r||h()(s,"SetData.Type"),A=Object(H.a)();let P=A&&T.a.checkIfAnimalExistOnFarm(d,u);return P&&(P=T.a.getAnimalByAnmNo1(d,u)),D.a.createElement(v.a,{onHide:t,show:a,size:"lg"},D.a.createElement(j.a,{title:"".concat(n("modals.assignAnimalToStandingModal.title")," - ").concat(this.getBoxName(this.props)),onCloseClick:t}),D.a.createElement(C.a,{isLoading:!y,className:se},!!i&&D.a.createElement(ae.a,{boxColor:"warning"},n("modals.assignAnimalToStandingModal.animalPresent",{animal:i.AnmNo1,chamber:l.CName})),Object(H.a)()&&!P&&d&&!m()(P,i)&&D.a.createElement(ae.a,{boxColor:"success"},n("modals.assignAnimalToStandingModal.willBeCreated",{number:d})),Object(H.a)()&&p&&"+"!==p&&!g&&!m()(P,i)?D.a.createElement(ae.a,{boxColor:"info"},n("modals.assignAnimalToStandingModal.animalGoal",{AnmNo1:P.AnmNo1,PlcmntID:this.getAnmLocation(P)})):!p||g||m()(p,i)?null:D.a.createElement(ae.a,{boxColor:"info"},n("modals.assignAnimalToStandingModal.animalGoal",{AnmNo1:p.AnmNo1,PlcmntID:this.getAnmLocation(p)})),A&&D.a.createElement(x.a,{name:"anmNo1",component:$.a,label:n("modals.assignAnimalToStandingModal.animal"),onChange:this.onMobileAnmNo1Change,required:!0}),S||A?!A&&D.a.createElement(x.a,{name:"newAnmNo1",component:$.a,label:n("newAnimalNumber"),onChange:this.onSearchChange,autofocus:!0,required:!0}):D.a.createElement(x.a,{name:"animal",onChange:this.onSelectAnimalChange,component:Z.b,label:n("modals.assignAnimalToStandingModal.animal"),options:b,clearButton:!1,placeholder:n("modals.assignAnimalToStandingModal.insertAnimalNumber"),initialSearch:I,onSearchChange:this.onSearchChange,autofocus:!0}),D.a.createElement(D.a.Fragment,null,!!r&&D.a.createElement(O.a,{className:"align-items-center justify-content-end"},D.a.createElement(E.a,{className:"col-auto"},D.a.createElement(x.a,{name:"setFeeding",component:ee.a,disabled:S&&!Object(H.a)()?!g:Object(H.a)()?!d:!p,reverseOrder:!0,label:n("configureCurveFeeding")}))),!!o&&D.a.createElement(M.a,{name:"feeding"},D.a.createElement(x.a,{name:"curve",id:"curve",required:!0,component:Z.b,clearButton:!1,placeholder:n("modals.assignAnimalToStandingModal.insertFeedingCurve"),options:f,label:n("feedingCurve")}),k===te.a.NORMAL&&D.a.createElement(D.a.Fragment,null,D.a.createElement(x.a,{name:"curveDay",label:n("curveDay"),id:"curveDay",type:"number",placeholder:n("modals.assignAnimalToStandingModal.insertCurveDay"),required:!0,format:e=>"".concat(e),parse:e=>c()(parseInt(e))?parseInt(e):e,component:$.a})),k!==te.a.NORMAL&&D.a.createElement(x.a,{name:"repetitionDate",label:k===te.a.BEFORE?te.c.includes(N)?n("modals.feedingManageFeedingModal.plannedInseminationDate"):n("modals.feedingManageFeedingModal.plannedParturitionDate"):te.c.includes(N)?n("modals.feedingManageFeedingModal.inseminationDate"):n("modals.feedingManageFeedingModal.parturitionDate"),id:"repetitionDate",placeholder:n("modals.feedingManageFeedingModal.plannedDate"),type:"date",component:$.a})))),D.a.createElement(w.a,{submitting:e,onCloseClick:t,hasConfirmButton:!0,confirmText:n("modals.assignAnimalToStandingModal.assign"),formName:se}))}}ce=Object(N.a)({form:se,onSubmit:function(e,t,a){const{animal:n,setFeeding:r,feeding:i,newAnmNo1:o,anmNo1:s}=e,{standing:c,chamber:l,handleHide:m,farm:d}=a;let u=!1,p={},g=B.a.getSectorTypeByChamberID(l.CID)===_.a.RENOVATION_SOWS;if(Object(H.a)()||o)if(!Object(H.a)()&&o)p=U.a.createAnimal(o,g?I.a.RENOVATION_SOW:I.a.SOW,1,d,l.CID),u=!0;else if(Object(H.a)()&&s){T.a.checkIfAnimalExistOnFarm(s,d)?(p=T.a.getAnimalByAnmNo1(s,d),u=!1):(p=U.a.createAnimal(s,g?I.a.RENOVATION_SOW:I.a.SOW,1,d,l.CID),u=!0)}else u=!1;else p=n,u=!1;const b=e=>F()(e)?z.a.getDevicesInPlcmntID(e,{showDevicesInChildren:!1}).map(e=>({GwID:e.GatewayID,DevID:e.DevID})):[],f=e=>!!e&&h()(R.a.getGroupWithAnimal(e,d),"[0].GrID")||void 0,D=Object(L.m)({curve:h()(i,"curve"),curveDay:h()(i,"curveDay"),doseCorrection:h()(i,"percentCorrection")||0,punishment:h()(i,"punishment")||0,repetitionDate:h()(i,"repetitionDate"),stage:h()(i,"stage")||0},V.d.DISPENSER_NRF),v={AnmID:p.AnmID,transferTo:c.id,amount:1,GrID:f(p.AnmID),EvTime:+new Date,stand:!0,clearFeeding:!!F()(p.PlcmntID)&&!!h()(B.a.getLocationByID(p.PlcmntID),"BID"),animalInStand:c.animal?{AnmID:c.animal.AnmID,transferTo:l.CID,GrID:f(c.animal.AnmID),DevIDsOldPlcmnt:b(c.animal.PlcmntID),DevIDsNewPlcmnt:b(l.CID)}:void 0,DevIDsNewPlcmnt:[{GwID:c.device.GatewayID,DevID:c.device.DevID}],DevIDsOldPlcmnt:b(p.PlcmntID),feeding:r?{curveNumber:D.curveNr,doseCorrection:D.percentCorrection,curveStart:D.startTime,punishment:D.punishment,stage:D.stage}:void 0};if(!u)return Object(q.a)([v]).then(e=>{m(),Object(q.c)(e)}).catch(e=>{Object(q.b)(e)});t(Object(Y.a)({animals:[p]},{onSuccess:({animals:e,response:a})=>{console.log(e,a),g||e.forEach(e=>{const a=G.a.createEvent(e.AnmID,X.b.SOW_CYCLES,e.AnmCnt,+K()(),{Cycles:1,LastSeparation:+K()()});t(Object(Q.a)({events:[a]},{type:X.b.SOW_CYCLES}))}),Object(q.a)([v]).then(e=>{Object(q.c)(e)}).catch(e=>{Object(q.b)(e)})}})),m()},validate:function(e,t){const{t:a}=t,n={feeding:Object(W.b)(e.feeding||{},t)},{standing:{animal:r},farm:i}=t,{animal:o,newAnmNo1:s,anmNo1:c}=e;return o||(n.animal=a("required")),r&&o&&r.AnmNo1===o.AnmNo1&&(n.animal=a("modals.assignAnimalToStandingModal.isAssigned")),s||(n.newAnmNo1=a("required")),c||(n.anmNo1=a("required")),r&&r.AnmNo1===c&&(n.anmNo1=a("modals.assignAnimalToStandingModal.isAssigned")),r&&r.AnmNo1===s&&(n.newAnmNo1=a("modals.assignAnimalToStandingModal.isAssigned")),s&&T.a.checkIfAnimalExistOnFarm(s,i)&&(n.newAnmNo1=a("errors.exist")),n},destroyOnUnmount:!0})(ce);const le=Object(A.a)(se);ce=Object(k.connect)(e=>({farm:e.location.farm,animal:le(e,"animal"),curve:le(e,"feeding.curve"),setFeeding:le(e,"setFeeding"),newAnmNo1:le(e,"newAnmNo1"),anmNo1:le(e,"anmNo1"),shadows:e.shadows.shadows,curves:Object(ne.c)(e),time:e.animals.time}))(ce),ce=Object(S.a)({name:se})(ce);t.b=Object(y.a)()(ce)},zpA0:function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a("mwIZ"),r=a.n(n),i=a("q1tI"),o=a.n(i),s=a("/MKj"),c=a("f0zD"),l=a("tDQA"),m=a("d/v1"),d=a("pJVQ"),u=a("zM5D"),p=a("UGc4"),h=a("0pzG"),g=a("gu+X"),b=a("pLLp"),f=a("6uZD");var D=a("pxzG"),v=a("eASP"),O=a("piEO"),E=a("wd/R"),y=a("LCzB"),j=a("XzT5");const w="water-meter-alarm-modal",C=Object(l.a)(w);class S extends i.Component{constructor(...e){super(...e),this.flowFormatter=e=>{const{t:t}=this.props;if(!e)return t("noLimit");const a=Object(D.h)(e/6,{unit:v.a.MEDIUM,showUnit:!0,fixed:1});return j.a.t("modals.waterMeterAlarmModal.YXmins",{value1:a,value2:10})},this.timeFormatter=e=>{const{t:t}=this.props;return e?E.utc(e).format("HH:mm"):t("noLimit")}}componentDidMount(){const{initialize:e,devices:t}=this.props;e({maxWaterConsumption:r()(t,"[0].Settings.FlowValueAlertLimit",0),maxWaterFlowTime:r()(t,"[0].Settings.FlowTimeAlertLimit",0)})}render(){const{handleHide:e,show:t,t:a,initialized:n}=this.props;return o.a.createElement(u.a,{onHide:e,show:t,size:"lg"},o.a.createElement(p.b,{title:a("modals.waterMeterAlarmModal.title"),onCloseClick:e}),o.a.createElement(h.a,null,!!n&&o.a.createElement(o.a.Fragment,null,o.a.createElement(m.a,{name:"maxWaterConsumption",component:O.a,min:0,max:9e4,step:3e3,label:a("modals.waterMeterAlarmModal.maxWaterConsumption"),valueFormatter:this.flowFormatter}),o.a.createElement(m.a,{name:"maxWaterFlowTime",component:O.a,min:0,max:864e5,step:3e5,label:a("modals.waterMeterAlarmModal.maxWaterFlowTime"),valueFormatter:this.timeFormatter}))),o.a.createElement(g.a,{submitting:!n,hasConfirmButton:!0,confirmText:a("save"),onCloseClick:e,formName:w}))}}S=Object(d.a)({form:w,onSubmit:function(e,t,a){const{maxWaterFlowTime:n,maxWaterConsumption:r}=e,{devices:i,handleHide:o}=a,s=[];for(let c of i)if(c instanceof b.a){const e=c.clone();let t=c.Settings||{};delete t.FlowTimeAlertLimit,delete t.FlowValueAlertLimit,n&&(t.FlowTimeAlertLimit=n),r&&(t.FlowValueAlertLimit=r),e.Settings=t,e.setDtaModTime(),s.push(e.prepareBeanToSave())}s.length&&t(Object(f.e)(s,s[0].FarmID)),o()}})(S),S=Object(s.connect)((function(e){return{shadows:e.shadows.shadows,minAlarm:C(e,"minAlarm"),maxAlarm:C(e,"maxAlarm")}}))(S);t.b=Object(y.a)()(Object(c.a)({name:w})(S))}}]); //# sourceMappingURL=main~a0fc626b.72f361bd.chunk.js.map