(this["webpackJsonpgonzo-test-client"]=this["webpackJsonpgonzo-test-client"]||[]).push([[94],{"+Hr+":function(e,t,a){},"05li":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("d/v1"),c=a("pJVQ"),l=a("r8wt"),m=a("PRyg"),u=a("jjk5"),d=a("n90m");var p=a("3Z9Z"),h=a("JI6e"),g=a("hQYu"),f=a("i8MS"),b=a("I8zd"),v=a("5Z9N"),E=a("ANjH"),y=a("LCzB"),D=a("pxzG"),O=a("eASP");class A extends n.Component{constructor(e){super(e);const{location:{state:t},farm:a}=this.props;if(t){let{animals:e,location:a}=t;a&&(e=f.a.getAllAnimalsForLocation(a,b.a.CHAMBER,{joinEvents:!1}),console.log(e)),this.props.dispatch(Object(v.d)(e.map(e=>e.AnmID))),this.props.initialize({animals:e,amount:0,forage:0})}else this.props.history.push("/".concat(a,"/mobile"))}getName(){const{match:{params:{medicineType:e}},t:t}=this.props;switch(+e){case l.b.VACCINE:return t("grafting");case l.b.FORAGE:return t("medicalFeed");default:return""}}getLink(){const{match:{params:{medicineType:e}}}=this.props;switch(+e){case l.b.VACCINE:return"vaccine";case l.b.FORAGE:return"forage";default:return""}}getBreadcrumbs(){const{location:{state:e},farm:t,t:a}=this.props,{medicine:n}=e;return[{name:a("pigletsTreatment"),link:"/".concat(t,"/mobile/events/graftingPiglets")},{name:this.getName(),link:"/".concat(t,"/mobile/events/graftingPiglets/").concat(this.getLink())},{name:n.WData.Name}]}render(){const{handleSubmit:e,location:{state:t},submitting:a,submitFailed:n,error:s,match:{params:{medicineType:c}},submitSucceeded:m,t:u}=this.props;if(!t)return null;const{medicine:d}=t;return r.a.createElement(i.a,{handleSubmit:e,breadcrumbs:this.getBreadcrumbs(),submitting:a,status:t.status,eventType:t.eventType,counterName:"graftingPiglets",submitFailed:n,error:s,formName:"graftingPigletsAdd",submitSucceeded:m,additionalState:{medicine:d}},r.a.createElement(p.a,{className:"justify-content-center h-100"},r.a.createElement(h.a,{xs:8,className:"d-flex flex-column justify-content-center align-items-center w-100"},+c===l.b.VACCINE&&r.a.createElement(o.a,{name:"amount",component:g.a,label:u("pigletsAmount")}),+c===l.b.FORAGE&&r.a.createElement(o.a,{name:"forage",component:g.a,label:u("forageAmount"),step:.5,valueFormatter:e=>e.toFixed(1)+Object(D.l)("weight",O.a.MEDIUM)}))))}}t.a=Object(E.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(y.a)(),Object(c.a)({form:"graftingPigletsAdd",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{match:{params:{medicineType:n}},t:r}=t;if(+n===l.b.FORAGE)if(0===e.forage)a._error=r("rfidApp.forageAmountError",{error:r("errors.lessVal",{count:.5})});else for(let s of e.animals){0===Object(m.getPigBalanceForSowFromState)(s,(new Date).getTime())&&(a._error=r("rfidApp.noPigletsInAnimal",{AnmNo1:s.AnmNo1}))}else if(0===e.amount)a._error=r("rfidApp.pigletsError",{error:r("errors.lessVal",{count:1})});else for(let s of e.animals){let t=Object(m.getPigBalanceForSowFromState)(s,(new Date).getTime());e.amount>t&&(a._error=r("rfidApp.amountNotEnoughPiglets",{AnmNo1:s.AnmNo1}))}return a}(e,a);if(n._error)throw new u.a(n);const{animals:r,amount:s,forage:i}=e,{location:{state:{medicine:o}},match:{params:{medicineType:c}},farm:p,history:h,t:g}=a,f=(new Date).getTime();let b=r.map(e=>({AnmID:e.AnmID,Medicine:o.WordID,Weight:0,TreatmentType:+c,AnmCnt:e.AnmCnt,EvTime:f,GrID:Object(m.getGrIDByAnimal)(e,f),PiCnt:+c===l.b.FORAGE?Object(m.getPigBalanceForSowFromState)(e,f):s,ForageAmount:+c===l.b.FORAGE?i:void 0}));return console.log(b),Object(d.a)(b).then(e=>{setTimeout(()=>{h.push({pathname:"/".concat(p,"/mobile/scanner"),state:{medicine:o,breadcrumbs:[{name:g("pigletsTreatment"),link:"/".concat(p,"/mobile/events/graftingPiglets")},{name:+c===l.b.VACCINE?g("grafting"):g("medicalFeed")}],eventType:"graftingPiglets",status:"".concat(c,"/add"),advancedAnimalScanner:!0,medicineType:c}})},1500),t({type:"ADD_GRAFTING_PIGLETS",payload:b})}).catch(e=>{throw new u.a({_errors:g("rfidApp.graftingGeneralError")})})}}))(A)},"0Ogf":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("3Z9Z"),c=a("JI6e"),l=a("d/v1"),m=a("pJVQ"),u=a("SobL"),d=a("jjk5"),p=a("PRyg"),h=a("5tUy"),g=a("tkTQ"),f=a("pxzG"),b=a("eASP");var v=a("ANjH"),E=a("LCzB");class y extends n.Component{constructor(e){super(e);const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.initialize({weight:0,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}render(){const{location:{state:e},match:{params:{reasonID:t}},weightingReasons:a,handleSubmit:n,submitting:s,submitFailed:m,error:d,farm:p,submitSucceeded:h,t:g}=this.props;let v=a.find(e=>e.ID===t);if(!e||!v)return null;const{animals:E}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:g("weighting"),link:"/".concat(p,"/mobile/events/weighting")},{name:v.Value}],handleSubmit:n,submitting:s,submitFailed:m,error:d,formName:"weighting",status:e.status,eventType:e.eventType,counterName:"weighting",submitSucceeded:h},1===E.length&&r.a.createElement("div",{className:"animal-info"},g("rfidApp.animalNumber"),": ",r.a.createElement("span",null,E[0].AnmNo1)),r.a.createElement(o.a,{className:"justify-content-center h-100"},r.a.createElement(c.a,{xs:6,className:"d-flex flex-column justify-content-center align-items-center w-100"},r.a.createElement(l.a,{name:"weight",component:u.a,columns:3,label:g("rfidApp.weightInUnit",{unit:Object(f.l)("weight",b.a.MEDIUM)})+":"}))))}}t.a=Object(v.d)(Object(s.connect)((function(e){return{farm:e.location.farm,weightingReasons:e.dictionary.weighting.WData[e.language.lang.lang],user:e.user.user}})),Object(E.a)(),Object(m.a)({form:"weighting",onSubmit:function(e,t,a){let n=function(e,t){const a={},{t:n}=t;0===e.weight&&(a._error=n("rfidApp.weightError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new d.a(n);const{match:{params:{reasonID:r}},weightingReasons:s,history:i,farm:o,t:c}=a,{animals:l,weight:m}=e;let u=l.map(e=>({AnmID:e.AnmID,AnmCnt:e.AnmCnt,EvTime:(new Date).getTime(),GrID:Object(p.getGrIDByAnimal)(e,(new Date).getTime()),Weight:Object(f.i)(m,{fromUnit:b.a.MEDIUM}),Reason:r,Plcmnt:Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID}));return Object(h.a)(u).then(e=>{let a=s.find(e=>e.ID===r);setTimeout(()=>{i.push({pathname:"/".concat(o,"/mobile/scanner"),state:{eventType:"weighting",status:a.ID,breadcrumbs:[{name:c("weighting"),link:"/".concat(o,"/mobile/events/weighting")},{name:a.Value}],animalType:[g.a.SOW,g.a.RENOVATION_SOW]}})},1500),t({type:"ADD_WEIGHTING",payload:u})}).catch(e=>{throw new d.a({_error:c("rfidApp.weightingGeneralError")})})}}))(y)},"0hjh":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("lKVh"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{match:{params:{reasonID:a}}}=this.props,{animalsToSave:n,animals:r}=this.state;let s=(t?r:n).map(t=>({AnmID:t.AnmID,GrID:Object(l.getGrIDByAnimal)(t,e.getTime()),EvTime:e.getTime(),Reason:a}));return Object(m.a)(s).then(e=>{this.props.dispatch({type:"ADD_NO_PREGNANCY",payload:s})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.noPregnancyGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},match:{params:{reasonID:t}},noPregnancyReasons:a,farm:n,t:s}=this.props;let o=a.find(e=>e.ID===t);if(!e||!o)return null;const{animals:l,show:m,error:u}=this.state,{status:p}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:s("noPregnancy"),link:"/".concat(n,"/mobile/events/noPregnancy")},{name:o.Value}],text:r.a.createElement(d.a,{i18nKey:"rfidApp.noPregnancyText",count:l.length,values:{AnmNo1:l[0].AnmNo1,reason:o.Value},components:{bold:r.a.createElement("strong",null)}}),additionalText:s("rfidApp.noPregnancyAdditionalText",{count:l.length,reason:o.Value}),animals:l,eventType:"noPregnancy",status:p,onSubmit:this.onSubmit,additionalState:{animalType:[c.a.SOW]},counterName:"noPregnancy",closeError:this.onCloseClick,error:this.getError(),showError:m,errorType:0===u?"error":"warning"})}}h=Object(o.a)({findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,noPregnancyReasons:e.dictionary.noPreganancy.WData[e.language.lang.lang],user:e.user.user}})),Object(p.a)())(h)},"0sq6":function(e,t,a){},"1F3U":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("ANjH"),l=a("LCzB");class m extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("pigletsTreatment")}]},r.a.createElement(o.a,{name:t("castration"),href:"/".concat(e,"/mobile/events/graftingPiglets/castration")}),r.a.createElement(o.a,{name:t("grafting"),href:"/".concat(e,"/mobile/events/graftingPiglets/vaccine")}),r.a.createElement(o.a,{name:t("medicalFeed"),href:"/".concat(e,"/mobile/events/graftingPiglets/forage")}))}}t.a=Object(c.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(l.a)())(m)},"2Qla":function(e,t,a){},"3O+u":function(e,t,a){},"44Gh":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s),o=(a("nA2k"),a("/MKj")),c=a("UNta"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{breadcrumbs:e,children:t,additionalData:a,secondPart:n,t:s}=this.props;return r.a.createElement("div",{className:"event-main-view"},r.a.createElement(c.a,{breadcrumbs:e,secondPart:n,home:!0}),r.a.createElement("div",{className:"event-main-view-container"},r.a.createElement("div",{className:"event-main-view-buttons"},t),a&&r.a.createElement("div",{className:"event-main-view-additional-data"},a),!a&&r.a.createElement("div",{className:"event-main-view-text"},r.a.createElement("h4",null,s("rfidApp.chooseMode")))))}}u.propTypes={breadcrumbs:i.a.arrayOf(i.a.shape({name:i.a.string.isRequired,link:i.a.oneOfType([i.a.object,i.a.string])})).isRequired,secondPart:i.a.string,additionalData:i.a.node},t.a=Object(l.d)(Object(o.connect)((function(e){return{}})),Object(m.a)())(u)},"4Wsv":function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("eXa9"),l=a("tDQA"),m=a("d/v1"),u=a("pJVQ"),d=a("PFzG"),p=a("PRyg"),h=a("uZGJ"),g=a("r8wt"),f=a("jjk5");var b=a("i8MS"),v=a("I8zd"),E=a("5Z9N"),y=a("udB/"),D=a("10H7"),O=a("vzZS"),A=a("ANjH"),T=a("LCzB"),N=a("kCVf");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 I(e){for(var t=1;te.AnmID))),this.props.initialize({animals:a})}else this.props.history.push("/".concat(a,"/mobile"))}static getReasons(e){let t=[];const{reasons:a}=e;for(let n=0;n({name:e.Value,value:e.ID})));return t}static getDerivedStateFromProps(e,t){return{reasons:w.getReasons(e)}}getLevel(e){return e.FarmID?v.a.FARM:e.BgID?v.a.BUILDING:e.SID?v.a.SECTOR:e.CID?v.a.CHAMBER:e.BID?v.a.BOX:void 0}componentDidUpdate(e,t,a){if(!r()(this.props.eventsLoading,e.eventsLoading)){const{animals:e,eventsLoading:t,events:a,match:{params:{medicineType:n}},location:{state:r,state:{medicine:s,location:i}},farm:o}=this.props;let c=!1;for(let l of e){t.get(l.AnmID)&&(c=!0)}if(!c){let t=[];for(let r of e){let e=a.get(r.AnmID);t=[...t,...e.filter(e=>e.EvCode===D.b.GRAFTING&&e.EvData.TreatmentType===+n&&e.EvData.Medicine===s.WordID&&e.EvData.StartTime&&!e.EvData.EndTime)]}t.length>0?this.props.history.push({pathname:"/".concat(o,"/mobile/events/grafting/").concat(n,"/unfinished"),state:I({},r,{events:t,location:i})}):this.setState({loading:c})}}}getName(){const{match:{params:{medicineType:e}},t:t}=this.props;switch(+e){case g.b.DOSATRON:return t("dosatron");case g.b.VACCINE:return t("grafting");case g.b.FORAGE:return t("medicalFeed");default:return""}}getLink(){const{match:{params:{medicineType:e}}}=this.props;switch(+e){case g.b.DOSATRON:return"dosatron";case g.b.VACCINE:return"vaccine";case g.b.FORAGE:return"forage";default:return""}}getBreadcrumbs(){const{match:{params:{medicineType:e}},location:{state:t},farm:a,t:n}=this.props,{location:r,medicine:s}=t;let i=[{name:n("treatment"),link:"/".concat(a,"/mobile/events/grafting")},{name:this.getName(),link:"/".concat(a,"/mobile/events/grafting/").concat(this.getLink())}];return i=+e!==g.b.VACCINE?[...i,{name:Object(N.k)(r)}]:[...i,{name:s.WData.Name}],i}render(){console.log(this.props);const{handleSubmit:e,location:{state:t},submitting:a,submitFailed:n,error:r,farm:s,match:{params:{medicineType:o}},submitSucceeded:l,t:u}=this.props;if(!t)return null;const{reasons:p,loading:h,animals:f}=this.state;return i.a.createElement(c.a,{handleSubmit:e,breadcrumbs:this.getBreadcrumbs(),submitting:a,status:t.status,eventType:t.eventType,counterName:"grafting",submitFailed:n,error:r,formName:"graftingAdd",disabledSubmit:0===f.length,additionalState:{medicine:t.medicine,breadcrumbs:[{name:u("treatment"),link:"/".concat(s,"/mobile/events/grafting")},{name:this.getName()}],locationNextPath:"/".concat(s,"/mobile/medicineChooser"),medicineType:+o},timesPath:+o!==g.b.VACCINE?"/".concat(s,"/mobile/locationScanner"):null,submitSucceeded:l},i.a.createElement(y.a,{isLoading:h}),0===f.length&&i.a.createElement(O.a,{boxColor:"error"},u("rfidApp.noAnimalsInCurrentLocation")),f.length>0&&i.a.createElement(m.a,{name:"reason",component:d.a,data:p,label:u("rfidApp.chooseReason")+":"}))}}t.a=Object(A.d)(Object(o.connect)((function(e){return{farm:e.location.farm,reasons:e.dictionary.graftingReason.WData[e.language.lang.lang],events:e.events.eventsForAnimals,eventsLoading:e.events.eventsForAnimalsLoading,animals:S(e,"animals")}})),Object(T.a)(),Object(u.a)({form:"graftingAdd",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{t:n}=t;e.reason||(a._error=n("rfidApp.reasonError",{error:n("required")}));return a}(e,a);if(n._error)throw new f.a(n);const{animals:r,reason:s}=e,{location:{state:{medicine:i,breadcrumbs:o}},match:{params:{medicineType:c}},history:l,farm:m,t:u}=a,d=(new Date).getTime();let b=r.map(e=>({AnmID:e.AnmID,Medicine:i.WordID,Reason:s,Weight:0,TreatmentType:+c,StartTime:+c!==g.b.VACCINE?d:void 0,AnmCnt:e.AnmCnt,EvTime:d,GrID:Object(p.getGrIDByAnimal)(e,d)}));return console.log(b),Object(h.a)(b).then(e=>{setTimeout(()=>{l.replace({pathname:+c===g.b.VACCINE?"/".concat(m,"/mobile/scanner"):"/".concat(m,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(c,"/add"),breadcrumbs:o,locationNextPath:"/".concat(m,"/mobile/medicineChooser"),medicine:i,medicineType:+c}})},1500),t({type:"ADD_GRAFTING",payload:b})}).catch(e=>{throw new f.a({_errors:u("rfidApp.graftingGeneralError")})})}}))(w)},"5PEU":function(e,t,a){},"5axh":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("i8MS"),l=a("PkbN"),m=a("3Z9Z"),u=a("JI6e"),d=a("7xGa"),p=a("uSQv"),h=(a("jfHD"),a("nBOt")),g=a("JPoY"),f=a("PRyg"),b=a("wxLp"),v=a("tkTQ"),E=a("ANjH"),y=a("LCzB");class D extends n.Component{constructor(...e){super(...e),this.state={animals:[],page:0,editing:null,isTaken:!1,editIndex:null,show:!1,error:null},this.onPageChange=e=>{this.setState({page:e})},this.closeChangeNumber=()=>{this.setState({editing:null})},this.onChangeNumber=(e,t)=>{console.log(e,t);const{index:a}=t,n=this.state.animals.slice(0);n[a].AnmNo1=(e+"").padStart(4,"0"),this.setState({animals:n})},this.onSubmit=(e,t)=>{const a=this.state.animals.slice(0),{location:{state:n}}=this.props;let r=[];for(let s of n.animals){let t=[];for(let e=0;e<(s.AnmCnt0))break;r.push({AnmID:s.AnmID,newAnimals:t,EvTime:e.getTime(),GrID:Object(f.getGrIDByAnimal)(s,e.getTime())})}return Object(b.a)(r).then(e=>{this.props.dispatch({type:"ADD_RECLASSIFY",payload:r})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}componentDidUpdate(e,t,a){const{tagReader:{tag:n,animal:r,location:s},location:{state:i}}=this.props;let o=i?i.animals.reduce((e,t)=>e+ +t.AnmCnt,0):0;const l=this.state.animals.slice(0);if(n!==e.tagReader.tag&&n)if(r||s)this.state.show||(r&&this.setState({error:1,show:!0}),s&&this.setState({error:2,show:!0}));else if(l.lengthe.RFID===n))this.setState({error:4,show:!0});else{let t={RFID:n,AnmNo1:e};l.push(t),c.a.checkIfAnimalExistOnFarm(e,this.props.farm)?this.setState({animals:l,editing:t,isTaken:!0,editIndex:l.length-1}):this.setState({animals:l,isTaken:!1,editing:null,editIndex:null})}}else this.setState({error:3,show:!0})}onEditClick(e,t){this.setState({editing:e,editIndex:t})}getCarouselPages(){const{animals:e}=this.state;let t=[];for(let a=0;ar.a.createElement(m.a,null,r.a.createElement(u.a,{xs:7},e.RFID),r.a.createElement(u.a,{xs:3},e.AnmNo1),r.a.createElement(u.a,{xs:2},r.a.createElement(p.a,{icon:r.a.createElement("i",{className:"far fa-edit"}),buttonStyle:"round",onClick:()=>this.onEditClick(e,a+t)}))))))}return t}getError(){const{t:e}=this.props,{error:t}=this.state;switch(t){case 0:return e("rfidApp.reclassifyGeneralError");case 1:return e("rfidApp.foundAnimalWithNumber");case 2:return e("rfidApp.foundLocationWithNumber");case 3:return e("rfidApp.scannedMaxAnimals");case 4:return e("rfidApp.scannedNumberIsOnList");default:return""}}getErrorType(){const{error:e}=this.state;switch(e){case 0:return"error";case 1:case 2:return"warning";default:return"info"}}render(){const{location:{state:e},t:t}=this.props;if(!e)return null;const{status:a}=e,{page:n,editing:s,isTaken:o,editIndex:c,animals:l,show:m}=this.state;let u=e?e.animals.reduce((e,t)=>e+ +t.AnmCnt,0):0;return console.log(this.getError()),r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,{breadcrumbs:[{name:t("reclassify")}],eventType:"reclassify",text:r.a.createElement(r.a.Fragment,null,0===l.length&&t("rfidApp.reclassifyText1"),l.length>0&&r.a.createElement(g.a,{page:n,onPageChange:this.onPageChange},this.getCarouselPages())),status:a,additionalText:t("rfidApp.reclassifyAdditionalText",{remaining:u-l.length}),animals:[],onSubmit:this.onSubmit,submitOnlyOnButton:!0,className:l.length>0?"reclassify":null,counterName:"reclassify",additionalState:{animalType:v.a.PORKER},showError:m,error:this.getError(),errorType:this.getErrorType(),closeError:this.onCloseClick,disableSubmit:0===l.length}),r.a.createElement(d.a,{in:!!s,mountOnEnter:!0,unmountOnExit:!0},r.a.createElement("div",{className:"change-number"},r.a.createElement(h.a,{number:s&&s.AnmNo1,onClose:this.closeChangeNumber,onSubmitDone:this.onChangeNumber,isTaken:o,index:c}))))}}t.a=Object(E.d)(Object(o.a)(),Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(y.a)())(D)},"6m9I":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("r8wt"),l=(a("2Qla"),a("ANjH")),m=a("LCzB");class u extends n.Component{render(){const{farm:e,medicines:t,t:a}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("medicalFeed")}],additionalData:r.a.createElement("div",{className:"medicine-list"},t.slice(0,4).map((t,n)=>r.a.createElement(o.a,{key:n,name:t.WData.Name,href:"/".concat(e,"/mobile/scanner"),state:{medicine:t,breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("medicalFeed")}],eventType:"graftingPiglets",status:"".concat(c.b.FORAGE,"/add"),advancedAnimalScanner:!0}},r.a.createElement("div",{className:"color",style:{background:t.WData.Color||"#FFFFFF"}}))),t.length>4&&r.a.createElement(o.a,{name:a("other"),href:"/".concat(e,"/mobile/medicineChooser"),state:{breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("medicalFeed")}],eventType:"graftingPiglets",status:"".concat(c.b.FORAGE,"/add"),medicineType:c.b.FORAGE}}))},r.a.createElement(o.a,{name:a("castration"),href:"/".concat(e,"/mobile/events/graftingPiglets/castration")}),r.a.createElement(o.a,{name:a("grafting"),href:"/".concat(e,"/mobile/events/graftingPiglets/vaccine")}),r.a.createElement(o.a,{name:a("medicalFeed"),href:"/".concat(e,"/mobile/events/graftingPiglets/forage"),selected:!0}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm,medicines:e.dictionary.medicine.filter(e=>e.WData.Type===c.b.FORAGE)}})),Object(m.a)())(u)},"7zge":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=(a("x2Ff"),a("uSQv")),u=(a("lQXj"),a("ANjH")),d=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.state={page:0,selectedMedicines:[]},this.onPageChange=e=>{this.setState({page:e})},this.onAcceptClick=()=>{this.props.history.push({pathname:"/".concat(this.props.farm,"/mobile/events/treatment/reason"),state:{medicines:this.state.selectedMedicines,animals:this.props.location.state.animals}})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}splitReasons(e){let t=[];for(let a=0;at.WordID===e.WordID)?t=t.filter(t=>t.WordID!==e.WordID):t.push(e),this.setState({selectedMedicines:t})}isSelected(e){return!!this.state.selectedMedicines.find(t=>t.WordID===e.WordID)}render(){const{medicines:e,farm:t,t:a}=this.props,{page:n,selectedMedicines:s}=this.state;return r.a.createElement("div",{className:"event treatment"},r.a.createElement(i.a,{breadcrumbs:[{name:a("scheduleOfTreatment"),link:{pathname:"/".concat(t,"/mobile/scanner"),state:{breadcrumbs:[{name:a("scheduleOfTreatment")}],eventType:"treatment",status:"medicine"}}},{name:"Lek"}],home:!0}),0===e.length&&r.a.createElement(o.a,{boxColor:"warning"},a("rfidApp.medicinesNotFound")),e.length>0&&r.a.createElement(c.a,{page:n,onPageChange:this.onPageChange,title:a("rfidApp.chooseMedicine")+":"},this.splitReasons(e).map((e,t)=>r.a.createElement(l.a,{key:t},e.map((e,t)=>r.a.createElement("div",{className:"fetura-mobile-link".concat(this.isSelected(e)?" selected":""," active"),key:t,onClick:()=>this.onMedicineClick(e)},e.WData.Name))))),r.a.createElement(m.a,{buttonStyle:"text",type:"button",className:"submit",disabled:0===s.length,onClick:this.onAcceptClick},r.a.createElement("i",{className:"far fa-check-circle"})))}}t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,medicines:e.dictionary.medicine}})),Object(d.a)())(p)},"9MCJ":function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("LCzB"),l=a("ANjH"),m=a("E0aH"),u=a("5Z9N"),d=a("udB/"),p=a("10H7"),h=a("tkTQ"),g=a("wd/R"),f=a.n(g),b=a("PRyg"),v=a("uZGJ");class E extends s.Component{constructor(e){super(e),this.state={grafting:null},this.onSubmit=()=>{const{location:{state:{animals:e}},medicines:t,history:a,farm:n,t:r}=this.props;let s=e[0];const{grafting:i}=this.state;let o=t.find(e=>e.WordID===i.medicine),c=[{AnmID:s.AnmID,Medicine:i.medicine,Reason:i.reason,Weight:0,TreatmentType:o.WData.Type,AnmCnt:s.AnmCnt,EvTime:(new Date).getTime(),GrID:Object(b.getGrIDByAnimal)(s,(new Date).getTime())}];return Object(v.a)(c).then(()=>{setTimeout(()=>{a.replace({pathname:"/".concat(n,"/mobile/scanner"),state:{eventType:"checkGrafting",status:"animal",breadcrumbs:[{name:r("rfidApp.checkGrafting")}]}})},1500),this.props.dispatch({type:"ADD_GRAFTING",payload:c})})};const{location:{state:t},farm:a}=this.props;if(t){let e=t.animals[0];this.props.dispatch(Object(u.c)(e))}else this.props.history.push("/".concat(a,"/mobile"))}componentDidMount(){this.props.events.length>0&&this.setState({grafting:this.calculateGrafting()})}componentDidUpdate(e,t,a){r()(this.props.events,e.events)||this.setState({grafting:this.calculateGrafting()})}checkIfHadGraftingToday(e){const{events:t}=this.props;return!!t.filter(e=>e.EvCode===p.b.GRAFTING).find(t=>t.EvData.Medicine===e&&f()(t.EvTime).isSame(new Date,"day"))}calculateGrafting(){const{graftingProgram:e,events:t,location:{state:{animals:a}}}=this.props;let n=a[0];if(e){let a=null;if(n.AnimalKind===h.a.SOW){let e=t.slice(0).sort((e,t)=>t.EvTime-e.EvTime).find(e=>e.EvCode===p.b.INSEMINATION&&e.EvTime<(new Date).getTime());e&&(a=f()(e.EvTime).startOf("day"))}else(n.DtaBrthTime||n.DtaInTime)&&(a=f()(n.DtaBrthTime||n.DtaInTime).startOf("day"));if(a){let t=f()().startOf("day").diff(a,"days"),n=e.WData.MedicineList.filter(e=>e.Age===t);for(let e of n)if(!this.checkIfHadGraftingToday(e.Medicine))return{medicine:e.Medicine,reason:"2"}}}let r=t.filter(e=>e.EvCode===p.b.TREATMENT);console.log(r);for(let s of r)for(let e of s.EvData.Treatment)for(let t of e.Dates)if(f()(t).isSame(new Date,"day"))for(let a of e.Medicine)if(!this.checkIfHadGraftingToday(a))return{medicine:a,reason:s.EvData.Reason||""}}getText(){const{grafting:e}=this.state,{location:{state:{animals:t}},medicines:a,t:n}=this.props;if(!e)return n("rfidApp.noMedicinesToday",{AnmNo1:t[0].AnmNo1});let r=a.find(t=>t.WordID===e.medicine);return r?n("rfidApp.giveMedicine",{Name:r.WData.Name}):void 0}render(){const{location:{state:e},loading:t,t:a}=this.props,{grafting:n}=this.state;return e?i.a.createElement(i.a.Fragment,null,i.a.createElement(d.a,{isLoading:t}),i.a.createElement(m.a,{breadcrumbs:[{name:a("rfidApp.checkGrafting")}],animals:[],text:this.getText(),disableSubmit:!n,eventType:"checkGrafting",status:"animal",onSubmit:this.onSubmit})):null}}t.a=Object(l.d)(Object(c.a)(),Object(o.connect)((function(e,t){let a={farm:e.location.farm,events:[],medicines:e.dictionary.medicine};if(t.location.state){let n=t.location.state.animals[0];console.log(n),a.events=e.events.eventsForAnimals.get(n.AnmID)||[],a.loading=e.events.eventsForAnimalsLoading.get(n.AnmID)||!1,a.graftingProgram=e.dictionary.graftingPrograms.find(e=>e.WData.AnimalKind===n.AnimalKind)||null}return a})))(E)},"9sgT":function(e,t,a){},"Ans+":function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("UNta"),l=a("/Har"),m=a("wd/R"),u=a.n(m),d=a("5Z9N"),p=a("udB/"),h=a("10H7"),g=a("ANjH"),f=a("eAv4"),b=a("tkTQ"),v=a("i8MS"),E=a("LCzB");class y extends s.Component{constructor(e){super(e),this.state={loading:!1,loadingState:this.props.loading,usg:null,toRepeat:!1,animal:this.props.location.state?this.props.location.state.animals[0]:null};const{location:{state:t},farm:a}=this.props;t?this.props.dispatch(Object(d.d)([this.state.animal.AnmID],{FarmID:a})):this.props.history.push("/".concat(a,"/mobile"))}static getDerivedStateFromProps(e,t){const{location:{state:a},loading:n,events:s}=e;if(a&&!r()(t.loadingState,e.loadingState)){let e=null,a=!1,r=t.animal,o=n.get(r.AnmID);if(void 0!==o&&!o){let t=s.get(r.AnmID).slice(0).sort((e,t)=>t.EvTime-e.EvTime);e=t.find(e=>e.EvCode===h.b.USG);try{let e=t.filter(e=>(e.EvCode===h.b.INSEMINATION||e.EvCode===h.b.TO_REPEAT)&&e.EvTime<(new Date).getTime()&&!e.DtaDelTime);e.sort((e,t)=>t.EvTime-e.EvTime),a=e[0].EvCode===h.b.TO_REPEAT}catch(i){a=!1}}return console.log(n),{loading:o,loadingState:n,usg:e,toRepeat:a}}return{loadingState:n}}componentDidUpdate(e,t,a){if(!r()(this.props.tagReader.animal,e.tagReader.animal)&&this.props.tagReader.animal){const{farm:e}=this.props;this.setState({animal:this.props.tagReader.animal}),this.props.dispatch(Object(d.d)([this.props.tagReader.animal.AnmID],{FarmID:e}))}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{loading:n,usg:r,toRepeat:s,animal:o}=this.state;let m=v.a.getAnimalLocationsByPlcmntID(o.PlcmntID,{nameDeep:2});return i.a.createElement("div",{className:"check"},i.a.createElement(p.a,{isLoading:n}),i.a.createElement(c.a,{breadcrumbs:[{name:a("usg"),link:"/".concat(t,"/mobile/events/usg")},{name:a("check")}],back:!0}),i.a.createElement(l.a,{data:[{label:a("animalNumber"),value:o.AnmNo1},{label:a("location"),value:m[0]?m[0].name:"-"},{label:a("events.usgEvent.toRepeat"),value:a(s?"yes":"no"),valueClassName:s?"error":"success"},{label:a("testResult"),value:r?r.EvData.Pregnant?a("events.usgEvent.positive"):a("events.usgEvent.negative"):"-",valueClassName:r?r.EvData.Pregnant?"success":"error":""},{label:a("dateOfLastTest"),value:r?u()(r.EvTime).format("DD.MM.YYYY"):"-"}]}))}}t.a=Object(g.d)(Object(f.a)({animalKind:[b.a.SOW,b.a.RENOVATION_SOW],findAnimalInLocation:!0}),Object(E.a)(),Object(o.connect)((function(e){return{farm:e.location.farm,events:e.events.eventsForAnimals,loading:e.events.eventsForAnimalsLoading}})))(y)},B5br:function(e,t,a){},BVRj:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("r8wt"),l=(a("2Qla"),a("ANjH")),m=a("LCzB");class u extends n.Component{render(){const{farm:e,medicines:t,t:a}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:a("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:a("grafting")}],additionalData:r.a.createElement("div",{className:"medicine-list"},t.slice(0,4).map((t,n)=>r.a.createElement(o.a,{key:n,name:t.WData.Name,href:"/".concat(e,"/mobile/scanner"),state:{medicine:t,breadcrumbs:[{name:a("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:a("grafting")}],eventType:"grafting",status:"".concat(c.b.VACCINE,"/add"),advancedAnimalScanner:!0}},r.a.createElement("div",{className:"color",style:{background:t.WData.Color||"#FFFFFF"}}))),t.length>4&&r.a.createElement(o.a,{name:a("other"),href:"/".concat(e,"/mobile/medicineChooser"),state:{breadcrumbs:[{name:a("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:a("grafting")}],eventType:"grafting",status:"".concat(c.b.VACCINE,"/add"),medicineType:c.b.VACCINE}}))},r.a.createElement(o.a,{name:a("dosatron"),href:"/".concat(e,"/mobile/events/grafting/dosatron")}),r.a.createElement(o.a,{name:a("grafting"),href:"/".concat(e,"/mobile/events/grafting/vaccine"),selected:!0}),r.a.createElement(o.a,{name:a("medicalFeed"),href:"/".concat(e,"/mobile/events/grafting/forage")}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm,medicines:e.dictionary.medicine.filter(e=>e.WData.Type===c.b.VACCINE)}})),Object(m.a)())(u)},BjAU:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("MAs2"),o=a("tkTQ"),c=a("44Gh"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(c.a,{breadcrumbs:[{name:t("usg")}]},r.a.createElement(i.a,{name:t("check"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"check",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("check")}],animalType:[o.a.SOW,o.a.RENOVATION_SOW],singleSelect:!0}}),r.a.createElement(i.a,{name:t("testResult"),href:"/".concat(e,"/mobile/events/usg/result")}),r.a.createElement(i.a,{name:t("events.usgEvent.toRepeat"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"repeat",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("events.usgEvent.toRepeat")}],animalType:[o.a.SOW,o.a.RENOVATION_SOW]}}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},BmzB:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=a("MAs2"),u=a("tkTQ"),d=(a("pUGO"),a("LCzB"));class p extends n.Component{constructor(...e){super(...e),this.state={page:0},this.onPageChange=e=>{this.setState({page:e})}}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(c.a,{page:n,onPageChange:this.onPageChange,title:a("rfidApp.chooseReason")+":"},this.splitReasons(e).map((e,n)=>r.a.createElement(l.a,{key:n},e.map((e,n)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(t,"/mobile/scanner"),key:n,state:{eventType:"fallPiglets",status:e.ID,breadcrumbs:[{name:a("fallPiglets"),link:"/".concat(t,"/mobile/events/fallPiglets")},{name:e.Value}],animalType:[u.a.SOW,u.a.RENOVATION_SOW]}}))))))}}p=Object(s.connect)((function(e){return{farm:e.location.farm,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang]}}))(p),p=Object(d.a)()(p),t.a=p},C2jH:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("MAs2"),o=a("44Gh"),c=a("ANjH"),l=a("LCzB");class m extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(o.a,{breadcrumbs:[{name:t("searching")}]},r.a.createElement(i.a,{name:t("notEating"),href:"/".concat(e,"/mobile/locationScanner"),state:{breadcrumbs:[{name:t("searching"),link:"/".concat(e,"/mobile/events/search")},{name:t("notEating")}],eventType:"search",status:"notEating"}}),r.a.createElement(i.a,{name:t("eating"),href:"/".concat(e,"/mobile/locationScanner"),state:{breadcrumbs:[{name:t("searching"),link:"/".concat(e,"/mobile/events/search")},{name:t("eating")}],eventType:"search",status:"eating"}}))}}t.a=Object(c.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(l.a)())(m)},Ccvl:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("r8wt"),c=a("uZGJ"),l=a("ANjH"),m=a("3k8n"),u=a("LCzB"),d=a("wd/R"),p=a.n(d);class h extends n.Component{constructor(...e){super(...e),this.state={show:!1,error:null},this.onSubmit=e=>{const{location:{state:{events:t}}}=this.props;let a=t.map(t=>({EvID:t.EvID,EndTime:e}));return Object(c.d)(a).then(e=>{}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e&&this.getMedicine()||this.props.history.push("/".concat(t,"/mobile"))}getMedicine(){const{location:{state:{events:e}},medicines:t}=this.props;let a=e[0].EvData.Medicine;return t.find(e=>e.WordID===a)}getStartTime(){const{location:{state:{events:e}}}=this.props;return e[0].EvData.StartTime}getName(){const{match:{params:{medicineType:e}},t:t}=this.props;switch(+e){case o.b.DOSATRON:return t("dosatron");case o.b.FORAGE:return t("medicalFeed");default:return""}}getLink(){const{match:{params:{medicineType:e}}}=this.props;switch(+e){case o.b.DOSATRON:return"dosatron";case o.b.FORAGE:return"forage";default:return""}}getBreadcrumbs(){const{location:{state:e},farm:t,t:a}=this.props,{location:n}=e;return[{name:a("treatment"),link:"/".concat(t,"/mobile/events/grafting")},{name:this.getName(),link:"/".concat(t,"/mobile/events/grafting/").concat(this.getLink())},{name:n.CName}]}getError(){const{t:e}=this.props,{error:t}=this.state;switch(t){case 0:return e("rfidApp.endGraftingGeneralError");default:return""}}render(){const{location:{state:e},farm:t,match:{params:{medicineType:a}}}=this.props;if(!e)return null;let n=this.getMedicine();if(!n)return null;const{show:s}=this.state;return r.a.createElement(i.a,{breadcrumbs:this.getBreadcrumbs(),text:r.a.createElement(m.a,{i18nKey:"rfidApp.endGraftingText",values:{medicine:n.WData.Name,date:p()(this.getStartTime()).format("DD.MM.YYYY")},components:{bold:r.a.createElement("strong",null)}}),animals:[],eventType:"grafting",onSubmit:this.onSubmit,submitPath:"/".concat(t,"/mobile/events/grafting/").concat(a,"/add"),additionalState:e,closePath:"/".concat(t,"/mobile/locationScanner"),closeError:this.onCloseClick,showError:s,error:this.getError()})}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm,medicines:e.dictionary.medicine}})),Object(u.a)())(h)},"D/Sb":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("MAs2"),i=a("44Gh"),o=a("i8MS"),c=a("tkTQ"),l=a("vzZS"),m=(a("5PEU"),a("/MKj")),u=a("ANjH"),d=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.state={boars:o.a.getAllAnimals(this.props.farm,c.a.BOAR)}}render(){const{farm:e,t:t}=this.props,{boars:a}=this.state;let n=a.slice(0,4);return console.log(a),r.a.createElement(i.a,{breadcrumbs:[{name:t("insemination"),link:"/".concat(e,"/mobile/events/insemination")},{name:t("inseminate")}],additionalData:r.a.createElement("div",null,r.a.createElement("div",{className:"text-center"},t("rfidApp.chooseBoar"),":"),r.a.createElement("div",{className:"boar-list"},0===a.length&&r.a.createElement(l.a,{boxColor:"warning"},t("rfidApp.noBoars")),n.map((a,n)=>r.a.createElement(s.a,{key:n,name:a.AnmNo1,href:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("insemination"),link:"/".concat(e,"/mobile/events/insemination")},{name:t("inseminate")}],eventType:"insemination",status:"end/info",animalType:[c.a.SOW,c.a.RENOVATION_SOW],boar:a}})),a.length>4&&r.a.createElement(s.a,{name:t("other"),href:"/".concat(e,"/mobile/animalChooser"),state:{breadcrumbs:[{name:t("insemination"),link:"/".concat(e,"/mobile/events/insemination")},{name:t("inseminate")}],eventType:"insemination",status:"end/info",animalType:c.a.BOAR,singleSelect:!0,insertAs:"boar",insertAsObject:!0,animalScannerNextPath:"/".concat(e,"/mobile/scanner"),additionalState:{animalScannerNextPath:null,singleSelect:!1,insertAs:null,insertAsObject:!1,animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}})))},r.a.createElement(s.a,{name:t("check"),href:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("insemination"),link:"/".concat(e,"/mobile/events/insemination")},{name:t("check")}],eventType:"insemination",status:"status",animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}),r.a.createElement(s.a,{name:t("inseminate"),href:"/".concat(e,"/mobile/events/insemination/end"),selected:!0}))}}t.a=Object(u.d)(Object(m.connect)((function(e){return{farm:e.location.farm}})),Object(d.a)())(p)},Dda9:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("tkTQ"),o=a("eAv4"),c=a("UNta"),l=a("3Z9Z"),m=a("JI6e"),u=a("7xGa"),d=a("55Ip"),p=a("uSQv"),h=(a("qNCt"),a("9sgT"),a("nBOt")),g=a("i8MS"),f=a("LldF"),b=a("hGE3"),v=a("vmgh"),E=a("ANjH"),y=a("3k8n"),D=a("LCzB");class O extends n.Component{constructor(...e){super(...e),this.state={nextAnimalNumber:null,tag:"",submitting:!1,showChangeNumber:!1,isTaken:!1,error:null,show:!1,submitted:!1,blockButton:!1},this.showChangeNumber=()=>{this.setState({showChangeNumber:!0})},this.closeChangeNumber=()=>{this.setState({showChangeNumber:!1})},this.onChangeNumber=e=>{this.setState({nextAnimalNumber:(e+"").padStart(4,"0"),isTaken:!1})},this.onCloseClick=()=>{this.props.tagReader.clearTag(),this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.state.isTaken||this.state.showChangeNumber)this.props.tagReader.tag!==this.state.tag&&this.props.tagReader.tag&&this.props.tagReader.clearTag();else if(this.props.tagReader.tag!==this.state.tag&&this.props.tagReader.tag){const{tagReader:{animal:e,location:a}}=this.props;if(e||a)this.state.show||(e&&this.setState({error:1,show:!0}),a&&this.setState({error:2,show:!0}));else{this.state.tag&&this.submit(this.state.tag,t.nextAnimalNumber,!0);let e=this.props.tagReader.tag.slice(-4,this.props.tagReader.tag.length);g.a.checkIfAnimalExistOnFarm(e,this.props.farm)?this.setState({tag:this.props.tagReader.tag,nextAnimalNumber:e,showChangeNumber:!0,isTaken:!0,show:!1}):this.setState({tag:this.props.tagReader.tag,nextAnimalNumber:e,isTaken:!1,show:!1})}}}getName(){const{match:{params:{animalKind:e}},t:t}=this.props;switch(+e){case i.a.BOAR:return t("animalKind.4");case i.a.PIGLET:return t("animalKind.2");case i.a.PORKER:return t("animalKind.3");case i.a.SOW:return t("animalKind.0");case i.a.RENOVATION_SOW:return t("animalKind.5");default:return""}}submit(e,t,a=!1){this.setState({submitting:!0,submitted:!1});const{match:{params:{animalKind:n}}}=this.props;console.log(e,t,a);let r=[{AnmNo1:t,AnmCnt:1,PlcmntID:this.props.farm,AnimalKind:+n,devices:[],additionalData:{RFID:e,DtaInTime:(new Date).getTime()}}];Object(f.a)(r).then(()=>{this.props.dispatch({type:"ADD_INSERTION",payload:r}),this.setState({submitting:!1,submitted:!0,blockButton:!a},()=>{a||setTimeout(()=>{this.props.history.push("/".concat(this.props.farm,"/mobile/events/insertion"))},1500)})}).catch(()=>{this.setState({error:0,submitting:!1})})}getError(){const{t:e}=this.props,{error:t}=this.state;switch(t){case 0:return e("rfidApp.insertionGeneralError");case 1:return e("rfidApp.foundAnimalWithNumber");case 2:return e("rfidApp.foundLocationWithNumber");default:return""}}render(){const{farm:e,t:t}=this.props,{nextAnimalNumber:a,tag:n,submitting:s,showChangeNumber:i,isTaken:o,show:g,submitted:f,error:E,blockButton:D}=this.state;return r.a.createElement("div",{className:"last-view insertion-last-view"},r.a.createElement(c.a,{breadcrumbs:[{name:t("insertion"),link:"/".concat(e,"/mobile/events/insertion")},{name:this.getName()}]}),r.a.createElement(l.a,{className:"justify-content-center h-100"},r.a.createElement(m.a,{md:10,className:"d-flex flex-column justify-content-center".concat(n?" up":"")},r.a.createElement("h4",{className:"main-text"},!n&&t("rfidApp.insertionNoTagText"),n&&r.a.createElement(y.a,{i18nKey:"rfidApp.insertionTagText",values:{tag:n,AnmNo1:a},components:{bold:r.a.createElement("strong",null)}})),n&&r.a.createElement("div",{className:"additional-text"},r.a.createElement("i",{className:"far fa-wifi"}),r.a.createElement("small",null,t("rfidApp.insertionAdditionalText"))))),r.a.createElement(d.Link,{className:"last-view-close",to:"/".concat(e,"/mobile/events/insertion"),replace:!0},r.a.createElement("i",{className:"far fa-times-circle"})),r.a.createElement(p.a,{className:"last-view-save",buttonStyle:"text",disabled:s||!n||D,onClick:()=>this.submit(n,a)},r.a.createElement(v.a,{loading:s,success:f})),n&&r.a.createElement(p.a,{className:"insertion-change-number",buttonStyle:"text",onClick:this.showChangeNumber},r.a.createElement("div",null,t("changeNumber")),r.a.createElement("span",{className:"fa-stack"},r.a.createElement("i",{className:"far fa-circle fa-stack-2x"}),r.a.createElement("i",{className:"far fa-edit fa-stack-1x"}))),r.a.createElement(u.a,{in:i,unmountOnExit:!0,mountOnEnter:!0},r.a.createElement("div",{className:"change-number"},r.a.createElement(h.a,{number:a,onClose:this.closeChangeNumber,onSubmitDone:this.onChangeNumber,isTaken:o}))),r.a.createElement(b.a,{onCloseClick:this.onCloseClick,error:this.getError(),show:g,capitalizeFirstLetter:!1,type:0===E?"error":"warning"}))}}O=Object(o.a)()(O),t.a=Object(E.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(D.a)())(O)},E0aH:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("UNta"),l=a("17x9"),m=a.n(l),u=a("CX8Q"),d=(a("qNCt"),a("wd/R")),p=a.n(d),h=a("3Z9Z"),g=a("JI6e"),f=a("55Ip"),b=a("Ty5D"),v=a("uSQv"),E=a("hGE3"),y=a("vmgh");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 O(e){for(var t=1;t{console.log("onSaveClick");const{breadcrumbs:a,farm:n,eventType:r,status:s,additionalState:i,onSubmit:o,submitPath:c}=this.props,{startDate:l}=this.state;this.setState({submitting:!0,submitted:!1});let m=o(l,t);Promise.resolve(m).then(()=>{t?this.setState({submitted:!0,submitting:!1,blockButton:!0},()=>{setTimeout(()=>{this.props.history.replace({pathname:c||"/".concat(n,"/mobile/scanner"),state:O({breadcrumbs:a,eventType:r,status:s},i)})},1500)}):this.setState({submitted:!0,submitting:!1})}).catch(()=>{this.setState({submitting:!1})})},this.onCloseErrorClick=()=>{this.props.closeError()}}componentDidUpdate(e,t,a){r()(this.props.animals,e.animals)||(this.props.submitOnlyOnButton||this.props.disableSubmit||this.onSaveClick(null,!1),this.setState({startDate:new Date}))}componentWillUnmount(){clearTimeout(this.timeout)}getClassName(){const{animals:e,className:t}=this.props;let a="last-view";return 1===e.length&&(a+=" cropped"),t&&(a+=" "+t),a}render(){const{text:e,additionalText:t,breadcrumbs:a,showDate:n,farm:r,eventType:s,status:o,additionalState:l,counterName:m,counters:u,closePath:d,error:b,showError:D,errorType:A,disableSubmit:T}=this.props,{startDate:N,submitting:C,submitted:I,blockButton:j}=this.state;return i.a.createElement("div",{className:this.getClassName()},i.a.createElement(c.a,{breadcrumbs:a}),i.a.createElement(h.a,{className:"justify-content-center h-100"},i.a.createElement(g.a,{md:10,className:"d-flex flex-column justify-content-center"},i.a.createElement("h4",{className:"main-text"},e),n&&i.a.createElement("h4",null,p()(N).format("DD.MM.YYYY HH:mm")),t&&i.a.createElement("div",{className:"additional-text"},i.a.createElement("i",{className:"far fa-wifi"}),i.a.createElement("small",null,t)))),i.a.createElement(f.Link,{className:"last-view-close",to:{pathname:d||"/".concat(r,"/mobile/scanner"),state:O({breadcrumbs:a,eventType:s,status:o},l)},replace:!0},i.a.createElement("i",{className:"far fa-times-circle"})),i.a.createElement(v.a,{className:"last-view-save",buttonStyle:"text",disabled:C||j||T,onClick:this.onSaveClick},i.a.createElement(y.a,{loading:C,success:I})),m&&i.a.createElement("div",{className:"last-view-counter"},i.a.createElement("i",{className:"fa fa-wifi fa-fw"})," ",u[m]),i.a.createElement(E.a,{onCloseClick:this.onCloseErrorClick,error:b,show:D,type:A,capitalizeFirstLetter:!1}))}}T.propTypes={breadcrumbs:m.a.arrayOf(m.a.shape({name:m.a.string.isRequired,link:m.a.oneOfType([m.a.object,m.a.string])})).isRequired,animals:m.a.arrayOf(m.a.instanceOf(u.a)).isRequired,text:m.a.node.isRequired,additionalText:m.a.node,eventType:m.a.string.isRequired,status:m.a.string.isRequired,showDate:m.a.bool,additionalState:m.a.object,className:m.a.string,submitting:m.a.bool,onSubmit:m.a.func,submitOnlyOnButton:m.a.bool,counterName:m.a.string,submitPath:m.a.string,closePath:m.a.string,error:m.a.string,showError:m.a.bool,closeError:m.a.func,errorType:m.a.string,disableSubmit:m.a.bool},T.defaultProps={additionalState:{}},T=Object(b.o)(T),t.a=Object(o.connect)((function(e){return{farm:e.location.farm,counters:e.eventCounter}}))(T)},HBNl:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("UfWW"),i=a.n(s),o=a("q1tI"),c=a.n(o),l=a("/MKj"),m=a("LCzB"),u=a("ANjH"),d=a("UNta"),p=a("i8MS"),h=a("I8zd"),g=a("AF5L"),f=a("zDJl"),b=a("udB/"),v=a("AAik"),E=(a("tYrZ"),a("eAv4")),y=a("JUMO"),D=a("3xDe"),O=a("q17X"),A=a("zSa2");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 N(e){for(var t=1;t{const{CAnsw:t}=e,{messages:a}=this.state,{match:{params:{type:n}}}=this.props,r=this.state.animals.slice(0);let s=Object(O.getFeedingLevels)();for(let o of t){let e=i()(r,e=>e.animal.AnmID===o.AnmID);o.feeding&&("eating"===n&&o.feeding[0].got/o.feeding[0].amount>=s.FeedingMaximumLevel||"eating"!==n&&o.feeding[0].got/o.feeding[0].amount<=s.FeedingMinimumLevel?r[e]=N({},r[e],{feeding:o.feeding}):r.splice(e,1))}a[e.MsgId]=!1,this.setState({messages:a,animals:this.sortArray(r)})},this.onGetUsageForPigFailure=(e,t)=>{const{messages:a}=this.state;a[t.MsgId]=!1,this.setState({messages:a})},this.feedingFormatter=e=>{if(!e||!e.amount)return"-";let t=(e.got||0)/e.amount*100;return c.a.createElement(y.a,{now:t},c.a.createElement("div",{role:"progressbar",className:"progress-bar ".concat(Object(D.e)(t)),"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,style:{width:"".concat(t,"%")}}),c.a.createElement("span",null,t.toFixed(1),"%"))},this.rowClassName=e=>e.highlight?"highlight":null,this.onSelectedRowsChanged=e=>{this.setState({selectedRows:e})};const{location:{state:t},farm:a}=this.props;if(t){const{location:e}=t;let a=p.a.getAllAnimalsForLocation(e,this.getLevel(e),{joinEvents:!1}),n={},r=[],s=a.map(e=>(r.push({animal:e,feeding:null}),{AnmID:e.AnmID,PlcmntID:Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID,RFID:e.RFID}));if(console.log(s),Object(O.isUsingFakeData)())n.fake=!0,setTimeout(()=>{let e=[];for(let t=0;t!!a.feeding&&(a.animal.AnmID===e.AnmID&&("eating"===t?a.feeding[0].got/a.feeding[0].amount>n.FeedingMaximumLevel:a.feeding[0].got/a.feeding[0].amountN({},e,{highlight:t===r})),this.setState({animals:a},()=>{this.props.tagReader.clearTag(),r>=0&&(this.scrollToRow(r),navigator.vibrate([500,200,500,200,500]))})}}scrollToRow(e){let t=document.getElementsByClassName("body-container")[0],a=document.getElementsByClassName("table-row-box")[0].clientHeight;t.scroll({top:a*e,behavior:"smooth"})}sortFunction(e,t,a=!1){if(a){if(!e.feeding)return-1;if(!t.feeding)return 1}else{if(!e.feeding)return 1;if(!t.feeding)return-1}return e.feeding[0].got/e.feeding[0].amount-t.feeding[0].got/t.feeding[0].amount}sortArray(e){const{match:{params:{type:t}}}=this.props;return"eating"===t?e.sort((e,t)=>this.sortFunction(t,e,!0)):e.sort((e,t)=>this.sortFunction(e,t))}getLevel(e){return e.FarmID?h.a.FARM:e.BgID?h.a.BUILDING:e.SID?h.a.SECTOR:e.CID?h.a.CHAMBER:h.a.BOX}getName(){const{match:{params:{type:e}},t:t}=this.props;return t("eating"===e?"eating":"notEating")}isLoading(){const{messages:e}=this.state;for(let t in e)if(e[t])return!0;return!1}render(){const{farm:e,location:{state:t},t:a}=this.props;if(!t)return null;const{animals:n}=this.state,r=[{name:a("animalNumber"),field:"animal.AnmNo1"},{name:a("today"),field:"feeding[0]",valueFormatter:this.feedingFormatter,itemClassName:"d-flex"},{name:"-1",field:"feeding[1]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-2",field:"feeding[2]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-3",field:"feeding[3]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-4",field:"feeding[4]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-5",field:"feeding[5]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-6",field:"feeding[6]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"}];return c.a.createElement("div",{className:"search"},c.a.createElement(b.a,{isLoading:this.isLoading()}),c.a.createElement(d.a,{breadcrumbs:[{name:a("searching"),link:"/".concat(e,"/mobile/events/search")},{name:this.getName()}],back:!0}),c.a.createElement(v.a,{data:n,headers:r,shouldIndex:!0,rowClassName:this.rowClassName}))}}t.a=Object(u.d)(Object(m.a)(),Object(E.a)(),Object(l.connect)((function(e){return{farm:e.location.farm,gateways:e.farmDevices.devices.filter(e=>e.DevType===f.d.GATEWAY)}})))(I)},HMXA:function(e,t,a){},HUiU:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=(a("Q+eR"),a("3Z9Z")),o=a("JI6e"),c=a("d/v1"),l=a("pJVQ"),m=a("hQYu"),u=a("eXa9"),d=a("jjk5"),p=a("PRyg"),h=a("T891"),g=a("tkTQ");var f=a("5Z9N"),b=a("ANjH"),v=a("LCzB");class E extends n.Component{constructor(e){super(e);const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.dispatch(Object(f.d)(e.map(e=>e.AnmID))),this.props.initialize({animals:e,amount:1})}else this.props.history.push("/".concat(a,"/mobile"))}getReason(){const{match:{params:{reasonID:e}},fallReasons:t}=this.props;return t.find(t=>t.ID===e)}render(){const{location:{state:e},handleSubmit:t,submitting:a,submitFailed:n,error:s,farm:l,submitSucceeded:d,t:p}=this.props;let h=this.getReason();if(!h||!e)return null;const{animals:g}=e;return r.a.createElement(u.a,{breadcrumbs:[{name:p("fallPiglets"),link:"/".concat(l,"/mobile/events/fallPiglets")},{name:h.Value}],handleSubmit:t,submitting:a,submitFailed:n,error:s,formName:"fallPiglets",status:e.status,eventType:e.eventType,submitSucceeded:d},r.a.createElement(i.a,{className:"justify-content-center h-100"},r.a.createElement(o.a,{xs:8,className:"d-flex flex-column justify-content-center align-items-center w-100"},r.a.createElement("div",null,p("rfidApp.fallenPiglets"),":"),r.a.createElement(c.a,{name:"amount",component:m.a,label:p("rfidApp.amount")}))),1===g.length&&r.a.createElement("div",{className:"animal-info"},p("rfidApp.animalNumber"),": ",r.a.createElement("span",null,g[0].AnmNo1)))}}t.a=Object(b.d)(Object(s.connect)((function(e){return{farm:e.location.farm,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang],user:e.user.user}})),Object(v.a)(),Object(l.a)({form:"fallPiglets",onSubmit:function(e,t,a){let n=function(e,t){const a={},{t:n}=t;if(0===e.amount)a._error=n("rfidApp.amountError",{error:n("errors.lessVal",{count:1})});else for(let r of e.animals){let t=Object(p.getPigBalanceForSowFromState)(r,(new Date).getTime());e.amount>t&&(a._error=n("rfidApp.amountNotEnoughPiglets",{AnmNo1:r.AnmNo1}))}return a}(e,a);if(n._error)throw new d.a(n);const{animals:r,amount:s}=e,{match:{params:{reasonID:i}},fallReasons:o,farm:c,history:l,t:m}=a;let u=r.map(e=>({AnmID:e.AnmID,Piglets:s,EvTime:(new Date).getTime(),GrID:Object(p.getGrIDByAnimal)(e,(new Date).getTime()),Weight:0,Reason:i,PlcmntID:Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID}));return Object(h.a)(u).then(e=>{let a=o.find(e=>e.ID===i);setTimeout(()=>{l.push({pathname:"/".concat(c,"/mobile/scanner"),state:{eventType:"fallPiglets",status:i,breadcrumbs:[{name:m("fallPiglets"),link:"/".concat(c,"/mobile/events/fallPiglets")},{name:a.Value}],animalType:[g.a.SOW,g.a.RENOVATION_SOW]}})},1500),t({type:"ADD_FALL_PIGLETS",payload:u})}).catch(e=>{throw new d.a({_errors:m("rfidApp.fallPigletsGeneralError")})})}}))(E)},HdSz:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("JPoY"),l=(a("It6k"),a("PkbN")),m=a("kCmh"),u=a("PRyg"),d=a("9PNC"),p=a("n7pt"),h=a("LCzB"),g=a("msTn"),f=a("wd/R"),b=a.n(f);class v extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?[...this.props.location.state.animals]:[],page:0,show:!1,error:null,errorAddedAnimal:null,errorTag:null},this.onPageChange=e=>{this.setState({page:e})},this.onSubmit=(e,t)=>{const{location:{state:{location:a}}}=this.props;console.log(a);const{animals:n}=this.state;let r=m.a.getDevicesInPlcmnt(a,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID})),s=n.map(t=>{let n=Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,s=p.a.getLocationByID(n),i=m.a.getDevicesInPlcmnt(s,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID})),o=p.a.getTreeByLocationID(n);return{AnmID:t.AnmID,transferTo:a.CID,amount:t.AnmCnt,from:n,stand:!1,DevIDsNewPlcmnt:r,DevIDsOldPlcmnt:i,GrID:Object(u.getGrIDByAnimal)(t,e.getTime()),EvTime:e.getTime(),clearFeeding:!0,feeding:o.sector&&o.sector.SType===g.a.DELIVERY?{curveNumber:0,doseCorrection:0,curveStart:+b()().startOf("day"),punishment:0,stage:0}:void 0}});return console.log(s),Object(d.a)(s).then(()=>{this.props.dispatch({type:"ADD_TRANSFER",payload:s})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidUpdate(e,t,a){if(console.log(this.props),this.props.tagReader.tag!==e.tagReader.tag&&this.props.tagReader.tag)if(this.props.tagReader.animal){const{location:{state:{location:e}},tagReader:{animal:t}}=this.props;t.PlcmntID===e.CID||Array.isArray(t.PlcmntID)&&t.PlcmntID.find(t=>t.PlcmntID===e.CID)?this.setState({show:!0,error:3,errorAddedAnimal:t}):0===this.state.animals.filter(e=>e.AnmID===t.AnmID).length?(this.setState({animals:[...this.state.animals,t],show:!1,page:this.state.animals.length%15===0?this.state.page+1:this.state.page}),this.props.tagReader.clearTag()):this.setState({show:!0,error:1,errorAddedAnimal:t})}else this.setState({show:!0,error:2,errorTag:this.props.tagReader.tag})}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.replace("/".concat(t,"/mobile"))}sliceAnimals(e){let t=[];for(let a=0;ar.a.createElement(l.a,{key:t},r.a.createElement("div",{className:"animals"},e.map((a,n)=>r.a.createElement("div",{key:n,className:t===d.length-1&&n===e.length-1?"font-weight-bold":null},"[",r.a.createElement("span",null,a.AnmNo1),"]")))))),r.a.createElement("div",null,a("rfidApp.transferToChamber")," ",r.a.createElement("span",{className:"font-weight-bold"},u.CName),"?")),additionalText:a("rfidApp.transferToChamberAdditionalText"),animals:n,eventType:"transfer",status:m,additionalState:{advancedAnimalScanner:!0,onlyLocationScanner:!0,animalScannerNextPath:"/".concat(t,"/mobile/locationScanner"),chamberChooser:!0,onlyAnimalScanner:!0},backPath:"/".concat(t,"/mobile/locationScanner"),className:"transfer",onSubmit:this.onSubmit,submitOnlyOnButton:!0,counterName:"transfer",closeError:this.onCloseClick,error:this.getError(),showError:o,errorType:this.getErrorType()})}}v=Object(o.a)({findAnimalInLocation:!0})(v),v=Object(h.a)()(v),t.a=Object(s.connect)((function(e){return{farm:e.location.farm,user:e.user.user}}))(v)},HeQI:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("PRyg"),l=a("kCmh"),m=a("n7pt"),u=a("ptb0"),d=a("ANjH"),p=a("3k8n"),h=a("LCzB");class g extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{match:{params:{reasonID:a}}}=this.props,{animalsToSave:n,animals:r}=this.state;let s=(t?r:n).map(t=>{let n=Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,r=m.a.getLocationByID(n),s=l.a.getDevicesInPlcmnt(r,{showDevicesInChildren:!1});return{AnmID:t.AnmID,amount:1,from:n,EvTime:e.getTime(),GrID:Object(c.getGrIDByAnimal)(t,e.getTime()),devices:s.map(e=>({DevID:e.DevID,GwID:e.GatewayID})),clearFeeding:!0,Weight:0,Reason:a,AnimalKind:+t.AnimalKind}});return Object(u.a)(s).then(()=>{this.props.dispatch({type:"ADD_FALL",payload:s})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.fallGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},match:{params:{reasonID:t}},fallReasons:a,farm:n,t:s}=this.props;let o=a.find(e=>e.ID===t);if(!e||!o)return null;const{animals:c,show:l,error:m}=this.state,{status:u}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:s("fall"),link:"/".concat(n,"/mobile/events/fall")},{name:o.Value}],text:r.a.createElement(p.a,{i18nKey:"rfidApp.fallText",count:c.length,values:{AnmNo1:c[0].AnmNo1,reason:o.Value},components:{bold:r.a.createElement("strong",null)}}),additionalText:s("rfidApp.fallAdditionalText",{count:c.length}),animals:c,eventType:"fall",status:u,onSubmit:this.onSubmit,counterName:"fall",error:this.getError(),showError:l,closeError:this.onCloseClick,errorType:0===m?"error":"warning"})}}g=Object(o.a)({findAnimalInLocation:!0})(g),t.a=Object(d.d)(Object(s.connect)((function(e){return{farm:e.location.farm,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang],user:e.user.user}})),Object(h.a)())(g)},"I+i7":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("E0aH"),i=a("/MKj"),o=a("eAv4"),c=a("PRyg"),l=a("SZ9y"),m=a("n7pt"),u=a("kCmh"),d=a("ANjH"),p=a("3k8n"),h=a("LCzB");class g extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>{let a=Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,n=m.a.getLocationByID(a),r=u.a.getDevicesInPlcmnt(n,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID}));return{AnmID:t.AnmID,amount:t.AnmCnt,EvTime:e.getTime(),devices:r,clearFeeding:!0,GrID:Object(c.getGrIDByAnimal)(t,e.getTime()),Weight:0,Price:0,HCW:0,AnimalKind:+t.AnimalKind}});return Object(l.a)(r).then(()=>{this.props.dispatch({type:"ADD_SELL",payload:r})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.sellGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(console.log(e),!e)return null;const{animals:n,show:i,error:o}=this.state,{status:c}=e;return r.a.createElement(s.a,{breadcrumbs:[{name:a("sale"),link:"/".concat(t,"/mobile/events/sell")},{name:a("animal")}],text:r.a.createElement(p.a,{i18nKey:"rfidApp.sellText",count:n.length,values:{AnmNo1:n[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),additionalText:a("rfidApp.sellAdditionalText",{count:n.length}),animals:n,eventType:"sell",status:c,onSubmit:this.onSubmit,counterName:"sell",showError:i,error:this.getError(),closeError:this.onCloseClick,errorType:0===o?"error":"warning"})}}g=Object(o.a)({findAnimalInLocation:!0})(g),t.a=Object(d.d)(Object(i.connect)((function(e){return{farm:e.location.farm,user:e.user.user}})),Object(h.a)())(g)},IpKG:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("UVNL"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>({AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime())}));return Object(m.a)(r).then(e=>{this.props.dispatch({type:"ADD_HEAT",payload:r})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.heatGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{animals:n,show:s,error:o}=this.state,{status:l}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:a("heat"),link:"/".concat(t,"/mobile/events/heat")},{name:a("heatExamination")}],text:r.a.createElement(d.a,{i18nKey:"rfidApp.heatText",count:n.length,values:{AnmNo1:n[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),additionalText:a("rfidApp.heatAdditionalText"),animals:n,eventType:"heat",status:l,additionalState:{animalType:[c.a.SOW,c.a.RENOVATION_SOW]},onSubmit:this.onSubmit,counterName:"heat",closeError:this.onCloseClick,showError:s,error:this.getError(),errorType:0===o?"error":"warning"})}}h=Object(o.a)({animalKind:[c.a.SOW,c.a.RENOVATION_SOW],findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(s.connect)((function(e){return{user:e.user.user}})),Object(p.a)())(h)},It6k:function(e,t,a){},Iw7P:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("LCzB"),o=a("ANjH"),c=a("3Z9Z"),l=a("JI6e"),m=a("d/v1"),u=a("pJVQ"),d=a("SobL"),p=a("eXa9"),h=a("jjk5"),g=a("PRyg"),f=a("i8MS"),b=a("WlsQ");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 E(e){for(var t=1;tf.a.getAnimalById(e)).filter(e=>!!e&&(!e.DtaDthTime&&(Array.isArray(e.PlcmntID)?!!e.PlcmntID.find(e=>e.PlcmntID===o.CID):e.PlcmntID===o.CID)))[0];p[0]=E({},p[0],{addToAnimal:e.AnmID,addToGroup:i.AnmGrp})}else p[0]=E({},p[0],{newGroupNumber:c+"",newAnimalNumber:l+""});return Object(b.a)(p).then(e=>{setTimeout(()=>{m.push("/".concat(u,"/mobile/events/separationToPigletHouse"))},1500),t({type:"ADD_SEPARATION_TO_PIGLETHOUSE",payload:p})}).catch(e=>{throw new h.a({_error:d("rfidApp.separationGeneralError")})})}}))(I)},JxIW:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("3Z9Z"),c=a("JI6e"),l=a("d/v1"),m=a("pJVQ"),u=a("SobL"),d=a("kCmh"),p=a("PRyg"),h=a("SZ9y"),g=a("jjk5"),f=a("msTn");function b(e,t){const a={},{t:n}=t;if(0===e.amount)a._error=n("rfidApp.animalCountError",{error:n("errors.lessVal",{count:1})});else{let t=e.animals.reduce((e,t)=>{if(Array.isArray(t.PlcmntID)){return t.PlcmntID.find(e=>e.PlcmntID===location.CID).AnmCnt+e}return e+t.AnmCnt},0);t{if(Array.isArray(a.PlcmntID)){return t+a.PlcmntID.find(t=>t.PlcmntID===Object(O.j)(e)).AnmCnt}return t+a.AnmCnt},0);this.props.initialize({amount:n,animals:a})}else this.props.history.push("/".concat(a,"/mobile"))}getLevel(e){return e.FarmID?E.a.FARM:e.BgID?E.a.BUILDING:e.SID?E.a.SECTOR:e.CID?E.a.CHAMBER:e.BID?E.a.BOX:void 0}render(){const{location:{state:e},handleSubmit:t,submitting:a,submitFailed:n,error:s,farm:m,submitSucceeded:d,t:p}=this.props;return e?r.a.createElement(i.a,{breadcrumbs:[{name:p("sale"),link:"/".concat(m,"/mobile/events/sell")},{name:p("rfidApp.room")}],handleSubmit:t,submitting:a,submitFailed:n,error:s,formName:"sell",status:e.status,eventType:e.eventType,timesPath:"/".concat(m,"/mobile/locationScanner"),counterName:"sell",submitSucceeded:d,additionalState:{sectorTypes:[f.a.PIGLET_HOUSE,f.a.PORK_HOUSE]}},r.a.createElement(o.a,{className:"justify-content-center h-100"},r.a.createElement(c.a,{xs:6,className:"d-flex flex-column justify-content-center align-items-center w-100"},r.a.createElement(l.a,{name:"amount",component:u.a,columns:4,label:p("animalCount")+":"})))):null}}t.a=Object(y.d)(Object(D.a)(),Object(s.connect)((function(e){return{farm:e.location.farm,user:e.user.user}})),Object(m.a)({form:"sell",onSubmit:function(e,t,a){const{animals:n,amount:r}=e;let s=b(e,a);if(s._error)throw new g.a(s);const{location:i,history:o,farm:c,t:l}=a;let m=r,u=[];for(let h of n){let e=d.a.getDevicesInPlcmnt(i,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID})),t=0;if(Array.isArray(h.PlcmntID)){t=h.PlcmntID.find(e=>e.PlcmntID===i.CID).AnmCnt}else t=h.AnmCnt;let a=m>t?t:m;if(m-=t,u.push({AnmID:h.AnmID,amount:a,EvTime:(new Date).getTime(),devices:e,clearFeeding:!0,GrID:Object(p.getGrIDByAnimal)(h,(new Date).getTime()),Weight:0,Price:0,HCW:0,AnimalKind:+h.AnimalKind}),m<=0)break}return console.log(u),Object(h.a)(u).then(()=>{setTimeout(()=>{o.push({pathname:"/".concat(c,"/mobile/locationScanner"),state:{eventType:"sell",status:"location",breadcrumbs:[{name:l("sale"),link:"/".concat(c,"/mobile/events/sell")},{name:l("rfidApp.room")}],sectorTypes:[f.a.PIGLET_HOUSE,f.a.PORK_HOUSE]}})},1500),t({type:"ADD_SELL",payload:u})}).catch(e=>{throw console.error("error",e),new g.a({_error:l("rfidApp.sellGeneralError")})})}}))(A)},KExv:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("LCzB"),o=a("ANjH"),c=a("UNta"),l=(a("3O+u"),a("10H7")),m=a("17x9"),u=a.n(m),d=a("Y+p1"),p=a.n(d),h=a("UfWW"),g=a.n(h),f=a("AAik"),b=a("eAv4"),v=a("hGE3");function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function y(e){for(var t=1;te.highlighted?"highlight":null,this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){const{tagReader:{tag:n,animal:r}}=this.props;if(n!==e.tagReader.tag&&n)if(!p()(r,e.tagReader.animal)&&r){let e=this.getAllIndexes(this.props.data,r,n);if(e.length>0){const t=this.props.data.slice(0);for(let a of e)for(let n=0;nr(e,t,a),n)}getAllIndexes(e,t,a,n=0){let r=this.getIndex(e,t,a,n);if(r>=0){let n=[r],s=this.getAllIndexes(e,t,a,r+1);return n.push(...s),n}return[]}scrollToRow(e){let t=document.getElementsByClassName("body-container")[0],a=document.getElementsByClassName("table-row-box")[0].clientHeight;t.scroll({top:a*e,behavior:"smooth"})}getError(){const{t:e}=this.props,{error:t,errorTag:a}=this.state;switch(t){case 1:return e("rfidApp.notFoundOnList",{errorTag:a});case 2:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});default:return""}}render(){const{show:e,error:t}=this.state,{name:a,data:n,headers:s}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h4",null,a),r.a.createElement(f.a,{data:n,headers:s,shouldIndex:!0,rowClassName:this.rowClassName}),r.a.createElement(v.a,{onCloseClick:this.onCloseClick,error:this.getError(),show:e,type:1===t?"error":"warning"}))}}O.propTypes={data:u.a.array.isRequired,name:u.a.string.isRequired,headers:u.a.array.isRequired,onDataChange:u.a.func.isRequired,predicate:u.a.func,findDead:u.a.bool},O.defaultProps={predicate:(e,t)=>e.AnmID===t.AnmID,findDead:!1};var A=Object(o.d)(Object(i.a)(),Object(b.a)(e=>({getDeadAnimals:e.findDead})),Object(s.connect)((function(e){return{farm:e.location.farm}})))(O),T=a("i8MS"),N=a("wd/R"),C=a.n(N);a("S+6W");class I extends n.Component{render(){return this.props.value?r.a.createElement("div",{className:"rfid-history-scanned"}):null}}var j=I;class S extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.ACTIVE_NIPPLES)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("activeNipples"),field:"Nipples"},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("activeNipples"),data:t,headers:a,onDataChange:this.onDataChange})}}S.propTypes={item:u.a.object};var w=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(S);class P extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.onDataChange=e=>{this.setState({data:e})},this.reasonFormatter=e=>{const{fallReasons:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null},this.predicate=(e,t,a)=>!!T.a.getAllAnimalsWithRFID(a,this.props.farm).find(t=>t.AnmID===e.AnmID)}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.FALL)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("reason"),field:"Reason",valueFormatter:this.reasonFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("fall"),data:t,headers:a,onDataChange:this.onDataChange,findDead:!0,predicate:this.predicate})}}var k=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang],farm:e.location.farm}})))(P);class R extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.onDataChange=e=>{this.setState({data:e})},this.reasonFormatter=e=>{const{fallReasons:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.FALL_PIGLETS)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("pigletsAmount"),field:"Piglets"},{name:e("reason"),field:"Reason",valueFormatter:this.reasonFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("fallPiglets"),data:t,headers:a,onDataChange:this.onDataChange})}}R.propTypes={item:u.a.object};var F=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang]}})))(R);class x extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.onDataChange=e=>{this.setState({data:e})},this.getMedicine=e=>{const{medicines:t}=this.props;let a=t.find(t=>t.WordID===e);return a?a.WData.Name:null},this.getReason=e=>{const{graftingReasons:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.GRAFTING)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("medicine"),field:"Medicine",valueFormatter:this.getMedicine},{name:e("reason"),field:"Reason",valueFormatter:this.getReason},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("treatment"),data:t,onDataChange:this.onDataChange,headers:a})}}x.propTypes={item:u.a.object};var M=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,medicines:e.dictionary.medicine,graftingReasons:e.dictionary.graftingReason.WData[e.language.lang.lang]}})))(x);class L extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.onDataChange=e=>{this.setState({data:e})},this.getMedicine=e=>{const{medicines:t}=this.props;let a=t.find(t=>t.WordID===e);return a?a.WData.Name:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.PIGLETS_TREATMENT)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("medicine"),field:"Medicine",valueFormatter:this.getMedicine},{name:e("pigletsAmount"),field:"PiCnt"},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("pigletsTreatment"),data:t,headers:a,onDataChange:this.onDataChange})}}L.propTypes={item:u.a.object};var G=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,medicines:e.dictionary.medicine}})))(L);class B extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.HEAT)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("heat"),onDataChange:this.onDataChange,headers:a,data:t})}}B.propTypes={item:u.a.object};var H=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(B);class W extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.onDataChange=e=>{this.setState({data:e})}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.INSEMINATION)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("boar"),field:"boarID",valueFormatter:this.animalValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{data:t,name:e("insemination"),headers:a,onDataChange:this.onDataChange})}}W.propTypes={item:u.a.object};var V=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(W);class U extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.MOMMY)break;a.data.animals.map(e=>{e.EvTime=a.data.EvTime}),t=[...t,...a.data.animals]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("pigletsAmount"),field:"Piglets"},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("rfidApp.addToMommy"),onDataChange:this.onDataChange,headers:a,data:t})}}U.propTypes={item:u.a.object};var K=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(U),z=a("pxzG"),_=a("eASP");class q extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.weightFormatter=e=>Object(z.j)(e,{unit:_.a.MEDIUM,showUnit:!0,fixed:0})}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.SEPARATION_TO_MOMMY)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("pigletsAmount"),field:"Piglets"},{name:e("weight"),field:"Weight",valueFormatter:this.weightFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("rfidApp.getFromMommy"),data:t,headers:a,onDataChange:this.onDataChange})}}var Q=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(q);class Y extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.getReason=e=>{const{noPreganancy:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.NO_PREGNANCY)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("reason"),field:"Reason",valueFormatter:this.getReason},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("noPregnancy"),data:t,headers:a,onDataChange:this.onDataChange})}}Y.propTypes={item:u.a.object};var Z=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,noPreganancy:e.dictionary.noPreganancy.WData[e.language.lang.lang]}})))(Y);class J extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.aliveDeadMummyFormatter=e=>"".concat(e.HealthyCnt," / ").concat(e.DeadCnt," / ").concat(e.MummyCnt)}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.PARTURITION)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("rfidApp.parturitionHistoryShort"),valueFormatter:this.aliveDeadMummyFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("parturition"),data:t,headers:a,onDataChange:this.onDataChange})}}J.propTypes={item:u.a.object};var X=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(J);class $ extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.getReason=e=>{const{selectionReason:t}=this.props;console.log("XDDDD:",t);let a=t.find(t=>t.ID===e);return a?a.Value:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.SELECTION)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("reason"),field:"Reason",valueFormatter:this.getReason},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("selection"),data:t,onDataChange:this.onDataChange,headers:a})}}$.propTypes={item:u.a.object};var ee=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,selectionReason:e.dictionary.selectionReason.WData[e.language.lang.lang]||[]}})))($),te=a("aIXM");function ae(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 ne(e){for(var t=1;t{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.animalNumberFormatter=e=>e.addToAnimal?this.animalValueFormatter(e.addToAnimal):e.newAnimalNumber,this.groupNumberFormatter=e=>{if(e.addToGroup){let t=te.a.findGroupByID(e.addToGroup);if(t)return t.GrNo1}return e.groupNumber||e.newGroupNumber}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.SEPARATION)break;if(a.data.animals)for(let e of a.data.animals)t.push(ne({},e,{},a));else for(let e of a.data)t.push(e)}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("animalNumber"),valueFormatter:this.animalNumberFormatter},{name:e("group"),valueFormatter:this.groupNumberFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("rfidApp.separation"),data:t,headers:a,onDataChange:this.onDataChange})}}se.propTypes={item:u.a.object};var ie=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(se);class oe extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.predicate=(e,t,a)=>!!T.a.getAllAnimalsWithRFID(a,this.props.farm).find(t=>t.AnmID===e.AnmID)}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.SELL)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("sale"),data:t,headers:a,onDataChange:this.onDataChange,findDead:!0,predicate:this.predicate})}}var ce=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,farm:e.location.farm}})))(oe),le=a("n7pt");class me extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.transferToFormatter=e=>{let t=le.a.getTreeByLocationID(e),a=[];return t.chamber&&a.push(t.chamber.CName),t.box&&a.push(t.box.BoxesName),a.join(" - ")}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.TRANSFER)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("transferTo"),field:"transferTo",valueFormatter:this.transferToFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("transfer"),data:t,onDataChange:this.onDataChange,headers:a})}}var ue=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(me);class de extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.scannedValueFormatter=e=>e?r.a.createElement("i",{className:"far fa-check"}):r.a.createElement("i",{className:"far fa-times"})}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.USG)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("testResult"),field:"Pregnant",valueFormatter:this.scannedValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("usg"),data:t,onDataChange:this.onDataChange,headers:a})}}var pe=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(de);class he extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.weightFormatter=e=>Object(z.j)(e,{unit:_.a.MEDIUM,showUnit:!0,fixed:0}),this.getReason=e=>{const{weighting:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null},this.scannedValueFormatter=e=>e?r.a.createElement("i",{className:"far fa-check"}):r.a.createElement("i",{className:"far fa-times"})}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.WEIGHTING)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("weight"),field:"Weight",valueFormatter:this.weightFormatter},{name:e("reason"),field:"Reason",valueFormatter:this.getReason},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("weighting"),data:t,onDataChange:this.onDataChange,headers:a})}}var ge=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,weighting:e.dictionary.weighting.WData[e.language.lang.lang]}})))(he);class fe extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm"),this.scannedValueFormatter=e=>e?r.a.createElement("i",{className:"far fa-check"}):r.a.createElement("i",{className:"far fa-times"}),this.weightFormatter=e=>e?Object(z.j)(e,{unit:_.a.MEDIUM,showUnit:!0,fixed:0}):r.a.createElement("i",{className:"far fa-times"}),this.getReason=e=>{const{weighting:t}=this.props;let a=t.find(t=>t.ID===e);return a?a.Value:null}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.CASTRATION)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("castration"),field:"Castrate",valueFormatter:this.scannedValueFormatter,headerClassName:"index",itemClassName:"index"},{name:e("tails"),field:"Tails",valueFormatter:this.scannedValueFormatter,headerClassName:"index",itemClassName:"index"},{name:e("teeth"),field:"Teeth",valueFormatter:this.scannedValueFormatter,headerClassName:"index",itemClassName:"index"},{name:e("weight"),field:"Weight",valueFormatter:this.weightFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("castration"),data:t,onDataChange:this.onDataChange,headers:a})}}var be=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(fe);class ve extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.TO_INSEMINATION)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("toInsemination"),onDataChange:this.onDataChange,headers:a,data:t})}}var Ee=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(ve);class ye extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.TO_REPEAT)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("events.usgEvent.toRepeat"),onDataChange:this.onDataChange,headers:a,data:t})}}var De=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(ye),Oe=a("tkTQ");class Ae extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.typeFormatter=e=>{const{t:t}=this.props;switch(e){case Oe.a.BOAR:return t("animalKind.4");case Oe.a.PIGLET:return t("animalKind.2");case Oe.a.PORKER:return t("animalKind.3");case Oe.a.SOW:return t("animalKind.0");case Oe.a.RENOVATION_SOW:return t("animalKind.5");default:return""}},this.onDataChange=e=>{this.setState({data:e})},this.predicateScan=(e,t,a)=>e.additionalData.RFID===a}getData(){const{history:e}=this.props;let t=[];for(let a of e){if("INSERTION"!==a.type)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animalNumber"),field:"AnmNo1"},{name:e("type"),field:"AnimalKind",valueFormatter:this.typeFormatter},{name:"RFID",field:"additionalData.RFID"}];return r.a.createElement(A,{data:t,name:e("insertion"),headers:a,onDataChange:this.onDataChange,predicate:this.predicateScan})}}Ae.propTypes={item:u.a.object};var Te=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(Ae);class Ne extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>e.map(e=>C()(e).format("DD.MM.YYYY")).join(", "),this.medicinesValueFormatter=e=>{const{medicines:t}=this.props;return e.map(e=>{let a=t.find(t=>t.WordID===e);return a?a.WData.Name:"-"}).filter(e=>e).join(", ")},this.onDataChange=e=>{this.setState({data:e})}}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(console.log("Iwent:",a),a.type!==l.b.TREATMENT)break;let e=[],n=[];for(let r of a.data){for(let t of r.treatment)e=[...e,...t.medicines],n=[...n,...t.dates];n.sort((e,t)=>e-t);for(let a of r.animals)t.push({AnmID:a.AnmID,medicines:e,dates:n})}}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("date"),field:"dates",valueFormatter:this.dateFormatter},{name:e("time"),field:"medicines",valueFormatter:this.medicinesValueFormatter}];return r.a.createElement(A,{data:t,name:e("scheduleOfTreatment"),headers:a,onDataChange:this.onDataChange})}}Ne.propTypes={item:u.a.object};var Ce=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history,medicines:e.dictionary.medicine}})))(Ne);class Ie extends n.Component{constructor(...e){super(...e),this.state={data:this.getData()},this.onDataChange=e=>{this.setState({data:e})},this.animalValueFormatter=e=>{let t=T.a.getAnimalById(e);return t?t.AnmNo1:null},this.dateFormatter=e=>C()(e).format("HH:mm")}getData(){const{history:e}=this.props;let t=[];for(let a of e){if(a.type!==l.b.RECLASSIFY)break;t=[...t,...a.data]}return t.sort((e,t)=>t.EvTime-e.EvTime)}render(){const{t:e}=this.props,{data:t}=this.state,a=[{name:"",field:"scanned",headerClassName:"scanned",itemClassName:"scanned",component:r.a.createElement(j,null)},{name:e("animal"),field:"AnmID",valueFormatter:this.animalValueFormatter},{name:e("rfidApp.createdAmount"),field:"newAnimals.length"},{name:e("time"),field:"EvTime",valueFormatter:this.dateFormatter,headerClassName:"index",itemClassName:"index"}];return r.a.createElement(A,{name:e("reclassify"),data:t,headers:a,onDataChange:this.onDataChange})}}Ie.propTypes={item:u.a.object};var je=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(Ie);class Se extends n.Component{getClass(){const{history:e}=this.props;switch(e[0].type){case l.b.ACTIVE_NIPPLES:return w;case l.b.FALL:return k;case l.b.FALL_PIGLETS:return F;case l.b.GRAFTING:return M;case l.b.PIGLETS_TREATMENT:return G;case l.b.HEAT:return H;case l.b.INSEMINATION:return V;case l.b.MOMMY:return K;case l.b.SEPARATION_TO_MOMMY:return Q;case l.b.NO_PREGNANCY:return Z;case l.b.PARTURITION:return X;case l.b.SELECTION:return ee;case l.b.SELL:return ce;case l.b.SEPARATION:return ie;case l.b.TRANSFER:return ue;case l.b.USG:return pe;case l.b.WEIGHTING:return ge;case l.b.CASTRATION:return be;case l.b.TO_INSEMINATION:return Ee;case l.b.TO_REPEAT:return De;case"INSERTION":return Te;case l.b.TREATMENT:return Ce;case l.b.RECLASSIFY:return je;default:return"div"}}render(){const{history:e,t:t}=this.props;return r.a.createElement("div",null,r.a.createElement(c.a,{breadcrumbs:[{name:t("history")}],back:!0}),r.a.createElement("div",{className:"history-container"},0===e.length&&r.a.createElement("h4",null,t("noEventsFound")),e.length>0&&r.a.createElement(this.getClass())))}}t.a=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{history:e.eventCounter.history}})))(Se)},"KaR+":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("MAs2"),c=a("tkTQ"),l=(a("qrsb"),a("ANjH")),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement("div",{className:"animal-insertion"},r.a.createElement(i.a,{breadcrumbs:[{name:t("insertion")}],home:!0}),r.a.createElement("div",{className:"type-chooser"},r.a.createElement(o.a,{name:t("animalKind.5"),href:"/".concat(e,"/mobile/events/insertion/").concat(c.a.RENOVATION_SOW)}),r.a.createElement(o.a,{name:t("animalKind.0"),href:"/".concat(e,"/mobile/events/insertion/").concat(c.a.SOW)}),r.a.createElement(o.a,{name:t("animalKind.3"),href:"/".concat(e,"/mobile/events/insertion/").concat(c.a.PORKER)}),r.a.createElement(o.a,{name:t("animalKind.2"),href:"/".concat(e,"/mobile/events/insertion/").concat(c.a.PIGLET)}),r.a.createElement(o.a,{name:t("animalKind.4"),href:"/".concat(e,"/mobile/events/insertion/").concat(c.a.BOAR)})))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},LGmO:function(e,t,a){},Lu3o:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("tDQA"),c=a("pJVQ"),l=a("xQ2f"),m=a("3Z9Z"),u=a("JI6e"),d=a("PRyg"),p=a("Nkcp"),h=a("jjk5");var g=a("ANjH"),f=a("LCzB");const b=Object(o.a)("treatment");class v extends n.Component{constructor(e){super(e),this.onDateChange=e=>{this.props.change("dates",e)};const{location:{state:t},farm:a}=this.props;t?this.props.initialize({dates:[],animals:t.animals}):this.props.history.push("/".concat(a,"/mobile"))}render(){const{location:{state:e},handleSubmit:t,submitting:a,submitFailed:n,error:s,dates:o,farm:c,submitSucceeded:d,t:p}=this.props;return e?r.a.createElement(i.a,{breadcrumbs:[{name:p("scheduleOfTreatment"),link:{pathname:"/".concat(c,"/mobile/scanner"),state:{breadcrumbs:[{name:p("scheduleOfTreatment")}],eventType:"treatment",status:"medicine"}}},{name:"Lek",link:{pathname:"/".concat(c,"/mobile/events/treatment/medicine"),state:{animals:e.animals}}},{name:p("reason"),link:{pathname:"/".concat(c,"/mobile/events/treatment/reason"),state:e}},{name:p("date")}],handleSubmit:t,submitting:a,submitFailed:n,error:s,formName:"treatment",additionalState:{breadcrumbs:[{name:p("scheduleOfTreatment")}],eventType:"treatment",status:"medicine"},submitSucceeded:d},r.a.createElement(m.a,{className:"justify-content-center h-100 align-items-center"},r.a.createElement(u.a,{xs:10},r.a.createElement("h5",null,p("rfidApp.amountOfSelectedDays"),": ",(o||[]).length),r.a.createElement(l.a,{selectedDates:o||[],onChange:this.onDateChange})))):null}}v=Object(c.a)({form:"treatment",onSubmit:function(e,t,a){console.log("Valjus:",e);let n=function(e,t){const a={},{t:n}=t;e.dates&&0!==e.dates.length||(a._error=n("rfidApp.dateError",{error:t.errorText.required}));return a}(e,a);if(n._error)throw new h.a(n);const{animals:r,dates:s}=e,{history:i,farm:o,t:c}=a;let l=r.map(e=>({AnmID:e.AnmID,GrID:Object(d.getGrIDByAnimal)(e,(new Date).getTime()),AnmCnt:e.AnmCnt})),m=[{treatment:[{dates:s.map(e=>e.toDate().getTime()),medicines:a.location.state.medicines.map(e=>e.WordID)}],animals:l,EvTime:(new Date).getTime(),Reason:a.location.state.reason}];return console.log("Dejta:",m),Object(p.a)(m).then(()=>{setTimeout(()=>{i.push({pathname:"/".concat(o,"/mobile/scanner"),state:{eventType:"treatment",status:"medicine",breadcrumbs:[{name:c("scheduleOfTreatment")}]}})},1500),t({type:"ADD_TREATMENT",payload:m})}).catch(()=>{throw new h.a({_error:c("rfidApp.treatmentGeneralError")})})}})(v);t.a=Object(g.d)(Object(s.connect)((function(e){return{farm:e.location.farm,dates:b(e,"dates")}})),Object(f.a)())(v)},"N/7s":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("NOo4"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>({AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime())}));return Object(m.d)(r).then(e=>{this.props.dispatch({type:"ADD_TO_INSEMINATION",payload:r})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.toInseminationGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{animals:n,show:s}=this.state,{status:o,error:l}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:a("heat"),link:"/".concat(t,"/mobile/events/heat")},{name:"Do inseminacji"}],text:r.a.createElement(d.a,{i18nKey:"rfidApp.toInseminationText",values:{AnmNo1:n[0].AnmNo1},count:n.length,components:{bold:r.a.createElement("strong",null)}}),additionalText:a("rfidApp.toInseminationAdditionalText"),animals:n,eventType:"heat",status:o,additionalState:{animalType:[c.a.SOW,c.a.RENOVATION_SOW]},onSubmit:this.onSubmit,counterName:"toInsemination",closeError:this.onCloseClick,showError:s,error:this.getError(),errorType:0===l?"error":"warning"})}}h=Object(o.a)({animalKind:[c.a.SOW,c.a.RENOVATION_SOW],findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(s.connect)((function(e){return console.log(e),{}})),Object(p.a)())(h)},O7Gx:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s),o=a("2dKy");a("U7xw");class c extends n.Component{constructor(...e){super(...e),this.state={searchInput:"",timeout:null},this.onBackspaceClick=e=>{let{searchInput:t}=this.state;t.length>0&&(t=t.slice(0,-1),this.setState({searchInput:t},()=>{this.onChange()}))}}onChange(){const{onChange:e}=this.props;if(e){clearTimeout(this.state.timeout);let t=setTimeout(()=>{e(this.state.searchInput)},300);this.setState({timeout:t})}}renderKeyboard(){let e=[];for(let t=1;t<=9;t++)e.push(r.a.createElement("div",{className:"keyboard-item",onClick:e=>this.onKeyboardClick(e,t),key:t},t));return e.push(r.a.createElement("div",{className:"keyboard-item",onClick:e=>this.onKeyboardClick(e,0),key:0},"0")),e}onKeyboardClick(e,t){this.setState(e=>({searchInput:e.searchInput+t}),()=>{this.onChange()})}render(){const{searchInput:e}=this.state,{placeholder:t}=this.props;return r.a.createElement("div",{className:"keyboard"},r.a.createElement(o.a,{type:"number",readOnly:!0,placeholder:t,icon:r.a.createElement("i",{className:"fas fa-search"}),value:e}),r.a.createElement("div",{className:"keyboard-buttons"},this.renderKeyboard(),r.a.createElement("div",{className:"backspace",onClick:this.onBackspaceClick},r.a.createElement("span",null,r.a.createElement("i",{className:"fas fa-times"})))))}}c.propTypes={placeholder:i.a.string,onChange:i.a.func},c.defaultProps={placeholder:"Numer zwierz\u0119cia"},t.a=c},"Q+eR":function(e,t,a){},QOjb:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("r8wt"),o=a("E0aH"),c=a("eAv4"),l=a("eXa9"),m=a("d/v1"),u=a("pJVQ"),d=a("3Z9Z"),p=a("JI6e"),h=a("SobL"),g=a("jjk5"),f=a("PRyg"),b=a("pxzG"),v=a("eASP"),E=a("a2io");function y(e,t,a){let n=function(e,t){const a={},{t:n}=t;0===e.weight&&(a._error=n("rfidApp.weightError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new g.a(n);const{animals:r,weight:s}=e,{location:{state:{selectedTypes:o},state:c},history:l,farm:m,t:u}=a;let d=r.map(e=>({AnmID:e.AnmID,EvTime:(new Date).getTime(),GrID:Object(f.getGrIDByAnimal)(e,(new Date).getTime()),Castrate:o.includes(i.a.CASTRATE),Tails:o.includes(i.a.TAILS),Teeth:o.includes(i.a.TEETH),Weighting:o.includes(i.a.WEIGHTING),Weight:s?Object(b.i)(s,{fromUnit:v.a.MEDIUM}):void 0}));return Object(E.a)(d).then(e=>{setTimeout(()=>{l.push({pathname:"/".concat(m,"/mobile/scanner"),state:c})},1500),t({type:"ADD_CASTRATION",payload:d})}).catch(e=>{throw new g.a({_errors:u("rfidApp.castrationGeneralError")})})}var D=a("tkTQ"),O=a("ANjH"),A=a("3k8n"),T=a("LCzB");const N="graftingPigletsCastrationWeighting";class C extends n.Component{constructor(e){super(e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[]},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;return y({animals:t?n:a},this.props.dispatch,this.props)};const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.initialize({weight:0,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}static getDerivedStateFromProps(e,t){return e.tagReader.animal&&0===t.animals.filter(t=>t.AnmID===e.tagReader.animal.AnmID).length?{animals:[e.tagReader.animal],animalsToSave:t.animals}:null}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}render(){const{location:{state:e},handleSubmit:t,submitting:a,submitFailed:n,error:s,submitSucceeded:c,t:u}=this.props;if(!e)return null;const{selectedTypes:g,breadcrumbs:f,status:b}=e,{animals:v}=this.state;return g.includes(i.a.WEIGHTING)?r.a.createElement(l.a,{breadcrumbs:f,handleSubmit:t,submitting:a,submitFailed:n,error:s,formName:N,status:e.status,eventType:e.eventType,additionalState:{selectedTypes:g,animalType:[D.a.SOW]},counterName:"graftingPiglets",submitSucceeded:c},r.a.createElement(d.a,{className:"justify-content-center h-100"},r.a.createElement(p.a,{xs:6,className:"d-flex flex-column justify-content-center align-items-center w-100"},r.a.createElement(m.a,{name:"weight",component:h.a,columns:3,label:u("rfidApp.weightInKilograms")+":"})))):r.a.createElement(o.a,{breadcrumbs:f,text:r.a.createElement(A.a,{i18nKey:"rfidApp.castrationText",count:v.length,values:{AnmNo1:v[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),additionalText:u("rfidApp.castrationAdditionalText",{count:v.length}),animals:v,eventType:"graftingPiglets",status:b,additionalState:{selectedTypes:g,animalType:[D.a.SOW]},onSubmit:this.onSubmit,counterName:"castration"})}}t.a=Object(O.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(c.a)({findAnimalInLocation:!0}),Object(T.a)(),Object(u.a)({form:N,onSubmit:y}))(C)},Qjbh:function(e,t,a){"use strict";var n=a("mwIZ"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("kCmh"),l=a("n7pt"),m=a("3k8n"),u=a("LCzB"),d=a("eXa9"),p=a("tDQA"),h=a("d/v1"),g=a("pJVQ"),f=a("3Z9Z"),b=a("JI6e"),v=a("hQYu"),E=a("mr+a"),y=a("15cA"),D=a("zDJl"),O=a("E0aH"),A=a("PRyg"),T=a("9PNC"),N=a("jjk5"),C=a("i8MS");function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function j(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function S(e,t,a){let n=C.a.getAllAnimalsByPlcmntID(e.BID,{joinEvents:!1})[0];if(n){let r=l.a.getTreeByLocationID(e.BID),s=c.a.getDevicesInPlcmnt(r.chamber,{showDevicesInChildren:!1});return{AnmID:n.AnmID,transferTo:r.chamber.CID,DevIDsNewPlcmnt:s.map(e=>({DevID:e.DevID,GwID:e.GatewayID})),DevIDsOldPlcmnt:t,GrID:Object(A.getGrIDByAnimal)(n,a)}}}function w(e,t,a){const{animals:n,stand:r,curve:s}=e,{history:i,farm:o,curves:m,t:u}=a;let d,p=c.a.getDevicesInPlcmnt(r,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID}));if(void 0!==s){let t=m[s],a=Object(y.m)(function(e){for(var t=1;t{let t=Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID,a=l.a.getLocationByID(t),n=c.a.getDevicesInPlcmnt(a,{showDevicesInChildren:!1}).map(e=>({DevID:e.DevID,GwID:e.GatewayID}));return{AnmID:e.AnmID,transferTo:r.BID,from:Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID,amount:1,stand:!0,DevIDsNewPlcmnt:p,DevIDsOldPlcmnt:n,GrID:Object(A.getGrIDByAnimal)(e,(new Date).getTime()),EvTime:(new Date).getTime(),clearFeeding:!0,animalInStand:S(r,p,(new Date).getTime()),feeding:d}});return Object(T.a)(h).then(e=>{setTimeout(()=>{i.push({pathname:"/".concat(o,"/mobile/scanner"),state:{eventType:"transfer",status:"stand",breadcrumbs:[{name:u("transfer"),link:"/".concat(o,"/mobile/events/transfer")},{name:u("standing")}],onlyLocationScanner:!0,standsChooser:!0,onlyAnimalScanner:!0,animalScannerNextPath:"/".concat(o,"/mobile/locationScanner"),singleSelect:!0}})},1500),t({type:"ADD_TRANSFER",payload:h})}).catch(e=>{throw new N.a({_errors:u("transferFailure")})})}var P=a("6/k7"),k=a("wd/R"),R=a.n(k);function F(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function x(e){for(var t=1;t{const{stand:e,animals:t}=this.state;return w({animals:t,stand:e},this.props.dispatch,this.props)},this.onCloseClick=()=>{this.setState({show:!1}),this.props.tagReader.clearTag()},this.curveValueFormatter=e=>{const{fittingCurves:t}=this.state;return t[e]?t[e].SetData.Name:"-"};const{location:{state:t},farm:a,curves:n}=this.props;if(t){let e=l.a.getTreeByLocationID(this.props.location.state.stand.BID),t=c.a.getDevicesInPlcmntID(this.props.location.state.stand.BID);const{sector:a}=e;let r=t.filter(e=>e.DevType===D.d.DISPENSER||e.DevType===D.d.DISPENSER_NRF)[0];this.state=x({},this.state,{sector:a,foundDevice:r,fittingCurves:n.filter(e=>Object(y.e)({sectorType:a.SType}).includes(e.SetData.Type)&&Object(y.l)({curve:e,devType:r?r.DevType:null}))});let s=Object(y.k)({animal:this.props.location.state.animals[0],sectorType:a.SType,curves:this.state.fittingCurves,initializeIndex:!0});this.props.initialize(x({animals:this.props.location.state.animals,stand:this.props.location.state.stand},s))}else this.props.history.push("/".concat(a,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorAnimal:a}=this.state;switch(t){case 0:return e("transferFailure");case 1:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:a.AnmNo1});default:return""}}getMaxDate(e,t){const a=R()().startOf("day"),n=r()(t,"SetData.Days.length",0),s=r()(t,"SetData.InseminationJumpTo",0);switch(e){case P.a.BEFORE:return a.clone().add(n,"days").toDate().getTime();case P.a.AFTER:return a.clone().toDate().getTime();case P.a.BOTH:return a.clone().add(s-1,"days").toDate().getTime();case P.a.NORMAL:return n}}render(){const{location:{state:e},farm:t,handleSubmit:a,submitting:n,submitFailed:s,error:o,submitSucceeded:c,curve:l,t:u}=this.props;if(!e)return null;const{animals:p,stand:g,show:E,foundDevice:D,fittingCurves:A}=this.state,T=[{name:u("transfer"),link:"/".concat(t,"/mobile/events/transfer")},{name:u("standing")}];if(!D){const{status:a,location:n}=e;return i.a.createElement(O.a,{breadcrumbs:T,text:i.a.createElement(m.a,{i18nKey:"rfidApp.transferStandText",values:{AnmNo1:p[0].AnmNo1,location:n.CName+"-"+(g?g.BoxesName:null)},components:{bold:i.a.createElement("strong",null)}}),animals:p,eventType:"transfer",status:a,additionalState:{animalScannerNextPath:"/".concat(t,"/mobile/locationScanner"),onlyLocationScanner:!0,standsChooser:!0,onlyAnimalScanner:!0},onSubmit:this.onSubmit,counterName:"transfer",error:o,showError:E,closeError:this.onCloseClick})}let N=Object(y.f)(A[l]);const C=r()(A[l],"SetData.Type");return i.a.createElement(d.a,{breadcrumbs:T,handleSubmit:a,submitting:n,submitFailed:s,error:o,submitSucceeded:c,formName:"transfer",status:e.status,eventType:e.eventType,counterName:"transfer",additionalState:{animalScannerNextPath:"/".concat(t,"/mobile/locationScanner"),onlyLocationScanner:!0,standsChooser:!0,onlyAnimalScanner:!0}},i.a.createElement(f.a,{className:"justify-content-center h-100"},i.a.createElement(b.a,{xs:10,className:"d-flex flex-column justify-content-center"},i.a.createElement(h.a,{name:"curve",component:v.a,label:u("feedingCurve"),min:0,max:A.length-1,valueFormatter:this.curveValueFormatter}),i.a.createElement(h.a,{name:N===P.a.NORMAL?"curveDay":"repetitionDate",component:v.a,label:N===P.a.NORMAL?u("curveDay"):N===P.a.BEFORE?P.c.includes(C)?u("modals.feedingManageFeedingModal.plannedInseminationDate"):u("rfidApp.plannedParturition"):P.c.includes(C)?u("modals.feedingManageFeedingModal.inseminationDate"):u("rfidApp.plannedParturition"),date:N!==P.a.NORMAL,max:this.getMaxDate(N,A[l]),min:N===P.a.NORMAL?1:null}))))}}G=Object(g.a)({form:"transfer",onSubmit:w})(G),G=Object(u.a)()(G);t.a=Object(o.connect)((function(e){let t=Object(E.c)(e).slice(0).sort((e,t)=>e.SetData.Index-t.SetData.Index);return{farm:e.location.farm,curves:t,curve:L(e,"curve")}}))(G)},QlZX:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("MAs2"),o=a("44Gh"),c=a("tkTQ"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(o.a,{breadcrumbs:[{name:t("insemination")}]},r.a.createElement(i.a,{name:t("check"),href:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("insemination"),link:"/".concat(e,"/mobile/events/insemination")},{name:t("check")}],eventType:"insemination",status:"status",animalType:[c.a.SOW,c.a.RENOVATION_SOW],singleSelect:!0}}),r.a.createElement(i.a,{name:t("inseminate"),href:"/".concat(e,"/mobile/events/insemination/end")}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},Qn1X:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s),o=(a("j+hm"),a("yLV6")),c=a.n(o);class l extends n.Component{constructor(...e){super(...e),this.drawer=r.a.createRef(),this.handleSwipe=e=>{if("panend"===e.type)this.drawer.current.classList.add("animate-transform-x"),"-18px"!==this.drawer.current.style.left&&this.props.onCloseClick(),this.drawer.current.style.left=null;else{this.drawer.current.classList.remove("animate-transform-x");let t=Math.abs(e.angle);(t>135||t<45)&&(this.drawer.current.style.left=(e.deltaX>-18?-18:e.deltaX)+"px")}},this.onOutsideClick=e=>{const{show:t,onCloseClick:a}=this.props;t&&!this.drawer.current.contains(e.target)&&a()}}componentDidMount(){document.addEventListener("mousedown",this.onOutsideClick),new c.a(this.drawer.current).on("panleft panend panright",this.handleSwipe)}componentWillUnmount(){document.removeEventListener("mousedown",this.onOutsideClick)}render(){const{show:e,children:t,onCloseClick:a}=this.props;return r.a.createElement("div",{className:"drawer animate-transform-x ".concat(e?" show":""),ref:this.drawer},r.a.createElement("div",{className:"chooser-search-close",onClick:a},r.a.createElement("i",{className:"far fa-chevron-left"})),t)}}l.propTypes={show:i.a.bool,onCloseClick:i.a.func.isRequired},t.a=l},R02O:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("r8wt"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("dosatron")}],additionalData:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{name:t("rfidApp.start"),href:"/".concat(e,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(c.b.DOSATRON,"/add"),breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("dosatron")}],medicineType:c.b.DOSATRON,locationNextPath:"/".concat(e,"/mobile/medicineChooser"),locationScannerOnlyChambers:!0}}),r.a.createElement(o.a,{name:t("rfidApp.end"),href:"/".concat(e,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(c.b.DOSATRON,"/end"),breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("dosatron")}],medicineType:c.b.DOSATRON,locationScannerOnlyChambers:!0}}))},r.a.createElement(o.a,{name:t("dosatron"),href:"/".concat(e,"/mobile/events/grafting/dosatron"),selected:!0}),r.a.createElement(o.a,{name:t("grafting"),href:"/".concat(e,"/mobile/events/grafting/vaccine")}),r.a.createElement(o.a,{name:t("medicalFeed"),href:"/".concat(e,"/mobile/events/grafting/forage")}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},"R9/J":function(e,t,a){},"S+6W":function(e,t,a){},TfRj:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("JPoY"),c=a("vzZS"),l=a("PkbN"),m=a("MAs2"),u=a("tkTQ"),d=(a("pUGO"),a("ANjH")),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={page:0},this.onPageChange=e=>{this.setState({page:e})}}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(o.a,{page:e,onPageChange:this.onPageChange,title:n("rfidApp.chooseReason")+":"},this.splitReasons(t).map((e,t)=>r.a.createElement(l.a,{key:t},e.map((e,t)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(a,"/mobile/scanner"),key:t,state:{eventType:"noPregnancy",status:e.ID,breadcrumbs:[{name:n("noPregnancy"),link:"/".concat(a,"/mobile/events/noPregnancy")},{name:e.Value}],animalType:[u.a.SOW]}}))))))}}t.a=Object(d.d)(Object(s.connect)((function(e){return{farm:e.location.farm,noPregnancyReasons:e.dictionary.noPreganancy.WData[e.language.lang.lang]}})),Object(p.a)())(h)},U7xw:function(e,t,a){},UNta:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s),o=(a("R9/J"),a("55Ip")),c=a("Ty5D"),l=a("/MKj");class m extends n.Component{constructor(e){super(e),this.headerRef=r.a.createRef(),this.breadcrumbRefs=[],this.state={shouldTrim:[]},this.onBackClick=()=>{const{history:e,backPathname:t}=this.props;t?e.push(t):e.goBack()};const{breadcrumbs:t}=this.props;let a=[];for(let n=0;ne+t.current.scrollWidth,0);if(t>e){let a=this.state.shouldTrim.slice(0),n=t-e;for(let e=0;e100)break}this.setState({shouldTrim:a})}}renderBreadcrumb(e,t){const{shouldTrim:a}=this.state;return r.a.createElement("span",{key:t,ref:this.breadcrumbRefs[t],className:a[t]?"trim":""},0!==t&&r.a.createElement("i",{className:"far fa-chevron-right"}),e.name)}render(){const{breadcrumbs:e,back:t,home:a,farm:n}=this.props;return r.a.createElement(r.a.Fragment,null,r.a.createElement("h5",{className:"rfid-header-title",ref:this.headerRef},e.map((t,a)=>a!==e.length-1?t.onClick?r.a.createElement("span",{onClick:t.onClick},this.renderBreadcrumb(t,a)):r.a.createElement(o.Link,{to:t.link},this.renderBreadcrumb(t,a)):this.renderBreadcrumb(t,a))),t&&r.a.createElement("a",{className:"rfid-header-icon",onClick:this.onBackClick},r.a.createElement("i",{className:"far fa-arrow-circle-left"})),a&&r.a.createElement(o.Link,{className:"rfid-header-icon home",to:"/".concat(n,"/mobile")},r.a.createElement("i",{className:"far fa-home"})))}}m.propTypes={breadcrumbs:i.a.arrayOf(i.a.shape({name:i.a.string.isRequired,link:i.a.oneOfType([i.a.object,i.a.string])})).isRequired,back:i.a.bool,home:i.a.bool},m=Object(c.o)(m),t.a=Object(l.connect)((function(e){return{farm:e.location.farm}}))(m)},UQiH:function(e,t,a){},VesG:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("LCzB"),o=a("ANjH"),c=a("MAs2"),l=a("tkTQ"),m=a("44Gh");function u(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){for(var t=1;t{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidMount(){const{location:{state:e},history:t,farm:a}=this.props;e||t.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){if(this.props.tagReader.notFoundAnimal||this.props.tagReader.wrongAnimalKind){let e={tag:this.props.tagReader.tag,show:!0};if(this.props.tagReader.wrongAnimalKind)e.error=0;else if(this.props.tagReader.notFoundAnimal)if(this.props.tagReader.notFoundLocation)e.error=1;else{const{location:{state:{onlyAnimalScanner:t}}}=this.props;e.error=t?1:2}this.setState(e)}if(this.props.tagReader.manyAnimalsInLocation){const{farm:e,location:{state:t}}=this.props;this.props.history.push({pathname:"/".concat(e,"/mobile/animalChooser"),state:v({},t,{location:this.props.tagReader.location})})}}if(!r()(this.props.tagReader.animal,e.tagReader.animal)){const{farm:e,tagReader:{animal:t},location:{state:a}}=this.props,{eventType:n,status:r,animalScannerNextPath:s}=a;this.props.history.push({pathname:s||"/".concat(e,"/mobile/events/").concat(n,"/").concat(r),state:v({},a,{animals:[t]})})}}getError(){const{error:e,tag:t}=this.state,{tagReader:{location:a},t:n}=this.props;switch(e){case 0:return n("rfidApp.wrongAnimalType");case 1:return n("rfidApp.animalWithNumberNotFound",{errorTag:t});case 2:if(a){return n("rfidApp.animalsNotFoundInLocation",{location:Object(h.k)(a)})}return"";default:return""}}render(){let{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{eventType:n,breadcrumbs:r,onlyAnimalScanner:s}=e,{show:o,error:d}=this.state;return i.a.createElement("div",{className:"rfid-scanner"},i.a.createElement(u.a,{breadcrumbs:r,back:!0,backPathname:"/".concat(t,"/mobile/events/").concat(n)}),i.a.createElement(l.a,{className:"h-100"},i.a.createElement(m.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement(c.Link,{to:{pathname:"/".concat(t,"/mobile/animalChooser"),state:e},className:"rfid-animal-chooser"},i.a.createElement("h4",null,a("rfidApp.chooseAnimalFromList")),i.a.createElement("div",{className:"rfid-animal-chooser-button"},i.a.createElement("div",null,i.a.createElement("i",{className:"far fa-list-ul fa-fw"}),i.a.createElement("i",{className:"far fa-slash"}),i.a.createElement("i",{className:"far fa-search fa-fw"}))))),i.a.createElement(m.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement("div",{className:"rfid-scanner-sensor-info"},i.a.createElement("i",{className:"far fa-wifi"}),s&&i.a.createElement("h4",null,a("rfidApp.scanAnimal")),!s&&i.a.createElement("h4",null,a("rfidApp.scanAnimalOrStand")),i.a.createElement("div",null,a("rfidApp.readerToTag"))))),i.a.createElement(p.a,{show:o,error:this.getError(),onCloseClick:this.onCloseClick,capitalizeFirstLetter:!1,type:0===d?"error":"warning"}))}}y=Object(d.a)(e=>{const{location:{state:t}}=e;if(!t)return{};let a=t.animalType||null;return{findAnimalInLocation:!t.onlyAnimalScanner,animalKind:a}})(y),t.a=Object(g.d)(Object(f.a)(),Object(o.connect)((function(e){return{farm:e.location.farm}})))(y)},WaAb:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=(a("2Qla"),a("uSQv")),l=a("r8wt"),m=a("55Ip"),u=a("tkTQ"),d=a("ANjH"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={selected:[]}}onTypeClick(e){let t=this.state.selected.slice(0);t.includes(e)?t=t.filter(t=>t!==e):t.push(e),this.setState({selected:t})}getName(e){const{t:t}=this.props;switch(e){case l.a.CASTRATE:return t("castrate");case l.a.TAILS:return t("tails");case l.a.TEETH:return t("teeth");case l.a.WEIGHTING:return t("weighting");default:return""}}render(){const{farm:e,t:t}=this.props,{selected:a}=this.state;return r.a.createElement(i.a,{breadcrumbs:[{name:t("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:t("castration")}],additionalData:r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"medicine-list"},r.a.createElement("div",{className:"fetura-mobile-link".concat(a.includes(l.a.CASTRATE)?" selected active":""),onClick:()=>this.onTypeClick(l.a.CASTRATE)},this.getName(l.a.CASTRATE)),r.a.createElement("div",{className:"fetura-mobile-link".concat(a.includes(l.a.TAILS)?" selected active":""),onClick:()=>this.onTypeClick(l.a.TAILS)},this.getName(l.a.TAILS)),r.a.createElement("div",{className:"fetura-mobile-link".concat(a.includes(l.a.TEETH)?" selected active":""),onClick:()=>this.onTypeClick(l.a.TEETH)},this.getName(l.a.TEETH)),r.a.createElement("div",{className:"fetura-mobile-link".concat(a.includes(l.a.WEIGHTING)?" selected active":""),onClick:()=>this.onTypeClick(l.a.WEIGHTING)},this.getName(l.a.WEIGHTING))),r.a.createElement(m.Link,{to:{pathname:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:t("castration"),link:"/".concat(e,"/mobile/events/graftingPiglets/castration")},{name:1===a.length?this.getName(a[0]):t("many")}],eventType:"graftingPiglets",status:"castration/add",advancedAnimalScanner:!0,selectedTypes:a,animalType:[u.a.SOW]}},disabled:0===a.length,className:"submit-grafting"},r.a.createElement(c.a,{buttonStyle:"text",disabled:0===a.length},r.a.createElement("span",{className:"fa-stack"},r.a.createElement("i",{className:"far fa-chevron-circle-right fa-stack-2x"})))))},r.a.createElement(o.a,{name:t("castration"),href:"/".concat(e,"/mobile/events/graftingPiglets/castration"),selected:!0}),r.a.createElement(o.a,{name:t("grafting"),href:"/".concat(e,"/mobile/events/graftingPiglets/vaccine")}),r.a.createElement(o.a,{name:t("medicalFeed"),href:"/".concat(e,"/mobile/events/graftingPiglets/forage")}))}}t.a=Object(d.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(p.a)())(h)},Wgxh:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=(a("Q+eR"),a("ANjH")),o=a("3k8n"),c=a("LCzB"),l=a("E0aH"),m=a("i8MS"),u=a("I8zd"),d=a("kCVf"),p=a("PRyg"),h=a("WlsQ");function g(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{const{farm:a,history:n}=this.props,{animals:r}=this.state,{location:{state:{group:s,locationTo:i,groupNumber:o,animalNumber:c}}}=this.props;let l=r.map(e=>{let t=Object(p.getPigBalance)(e.events),a={AnmID:e.AnmID,piglets:t,EvTime:(new Date).getTime(),weight:0,separateTo:i.CID};if(s){a=f({},a,{addToAnimal:s.AnmIDs.map(e=>m.a.getAnimalById(e)).filter(e=>!!e&&(!e.DtaDthTime&&(Array.isArray(e.PlcmntID)?!!e.PlcmntID.find(e=>e.PlcmntID===i.CID):e.PlcmntID===i.CID)))[0].AnmID,addToGroup:s.AnmGrp})}else a=f({},a,{newGroupNumber:o+"",newAnimalNumber:c+""});return a});return Object(h.a)(l).then(e=>{setTimeout(()=>{n.push("/".concat(a,"/mobile/events/separationToPigletHouse"))},1500),this.props.dispatch({type:"ADD_SEPARATION_TO_PIGLETHOUSE",payload:l})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})};const{location:{state:t},farm:a}=this.props;if(t){const{location:e}=t;let a=m.a.getAllAnimalsForLocation(e,u.a.CHAMBER),n=a.reduce((e,t)=>e+Object(p.getPigBalance)(t.events),0);this.state={animals:a,piglets:n}}else this.props.history.push("/".concat(a,"/mobile"))}getError(){const{t:e}=this.props,{error:t}=this.state;switch(t){case 0:return e("rfidApp.separationGeneralError");default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props,{animals:n,piglets:s,show:i}=this.state;if(!e)return null;const{locationTo:c}=e,m={name:a("rfidApp.separation"),link:"/".concat(t,"/mobile/events/separationToPigletHouse")},u={name:a("grid.chamber"),link:{pathname:"/".concat(t,"/mobile/locationScanner"),state:f({},e,{breadcrumbs:[m,{name:a("grid.chamber")}],locations:null,locationNextPath:"/".concat(t,"/mobile/groupScanner")})}};return r.a.createElement(l.a,{breadcrumbs:[m,u,{name:a("group"),link:{pathname:"/".concat(t,"/mobile/groupScanner"),state:f({},e,{breadcrumbs:[m,u]})}},{name:a("rfidApp.toPlace"),link:{pathname:"/".concat(t,"/mobile/events/separationToPigletHouse/location"),state:e}},{name:Object(d.k)(c)}],animals:n,text:0===s?a("rfidApp.separationToPigletHouseNoPiglets"):r.a.createElement(o.a,{i18nKey:"rfidApp.separationToPigletHouseText",count:s,values:{location:Object(d.k)(c)},components:{bold:r.a.createElement("strong",null)}}),eventType:"separationToPigletHouse",status:"location",onSubmit:this.onSubmit,counterName:"separationToPigletHouse",error:this.getError(),showError:i,closeError:this.onCloseClick,errorType:"error",closePath:"/".concat(t,"/mobile/events/separationToPigletHouse"),submitPath:"/".concat(t,"/mobile/events/separationToPigletHouse"),disableSubmit:0===s})}}t.a=Object(i.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(c.a)())(v)},"WtK+":function(e,t,a){},X73m:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("UNta"),l=a("3Z9Z"),m=a("JI6e"),u=a("55Ip"),d=a("eAv4"),p=a("aIXM"),h=a("hGE3"),g=a("ANjH"),f=a("LCzB");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 v(e){for(var t=1;t{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidMount(){const{location:{state:e},history:t,farm:a}=this.props;e||t.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){if(this.props.tagReader.tag!==e.tagReader.tag&&this.props.tagReader.tag&&(this.props.tagReader.notFoundAnimal&&!this.state.show&&this.setState({tag:this.props.tagReader.tag,show:!0,error:1}),this.props.tagReader.animal&&!r()(this.props.tagReader.animal,e.tagReader.animal))){const{farm:e,tagReader:{animal:t},location:{state:a}}=this.props;let n=p.a.getGroupWithAnimal(t.AnmID,t.FarmID)[0];if(n){const{eventType:t,status:r,groupsNextPath:s}=a;this.props.history.push({pathname:s||"/".concat(e,"/mobile/events/").concat(t,"/").concat(r),state:v({},a,{group:n})})}else this.setState({animalError:t,show:!0,error:2})}}getError(){const{t:e}=this.props,{error:t,tag:a,animalError:n}=this.state;switch(t){case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.animalIsNotInGroup",{number:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{breadcrumbs:n,groupsBackPath:r}=e,{show:s}=this.state;return i.a.createElement("div",{className:"rfid-scanner"},i.a.createElement(c.a,{breadcrumbs:[...n.map(t=>v({},t,{link:"string"===typeof t.link?t.link:v({},t.link,{state:v({},t.state,{},e)})})),{name:"Grupa"}],back:!0,backPathname:r}),i.a.createElement(l.a,{className:"h-100"},i.a.createElement(m.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement(u.Link,{to:{pathname:"/".concat(t,"/mobile/groupChooser"),state:e},className:"rfid-animal-chooser"},i.a.createElement("h4",null,a("rfidApp.chooseGroupFromList")),i.a.createElement("div",{className:"rfid-animal-chooser-button"},i.a.createElement("div",null,i.a.createElement("i",{className:"far fa-list-ul fa-fw"}),i.a.createElement("i",{className:"far fa-slash"}),i.a.createElement("i",{className:"far fa-search fa-fw"}))))),i.a.createElement(m.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement("div",{className:"rfid-scanner-sensor-info"},i.a.createElement("i",{className:"far fa-wifi"}),i.a.createElement("h4",null,a("rfidApp.scanAnimalFromGroup")),i.a.createElement("div",null,a("rfidApp.readerToTag"))))),i.a.createElement(h.a,{show:s,error:this.getError(),onCloseClick:this.onCloseClick,capitalizeFirstLetter:!1}))}}y=Object(d.a)()(y),t.a=Object(g.d)(Object(f.a)(),Object(o.connect)((function(e){return{farm:e.location.farm}})))(y)},XO5I:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=(a("x2Ff"),a("lQXj"),a("MAs2")),u=a("ANjH"),d=a("LCzB");function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function h(e){for(var t=1;t{this.setState({page:e})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(c.a,{page:s,onPageChange:this.onPageChange,title:n("rfidApp.chooseReason")+":"},this.splitReasons(e).map((e,n)=>r.a.createElement(l.a,{key:n},e.map((e,n)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(t,"/mobile/events/treatment/add"),key:n,state:h({},a,{reason:e.ID})}))))))}}t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,graftingReasons:e.dictionary.graftingReason.WData[e.language.lang.lang]}})),Object(d.a)())(f)},XwIL:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("ANjH"),l=a("LCzB");class m extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("transfer")}]},r.a.createElement(o.a,{name:t("pigPen"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"transfer",status:"chamber",breadcrumbs:[{name:t("transfer"),link:"/".concat(e,"/mobile/events/transfer")},{name:t("pigPen")}],onlyLocationScanner:!0,advancedAnimalScanner:!0,animalScannerNextPath:"/".concat(e,"/mobile/locationScanner"),chamberChooser:!0,onlyAnimalScanner:!0}}),r.a.createElement(o.a,{name:t("standing"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"transfer",status:"stand",breadcrumbs:[{name:t("transfer"),link:"/".concat(e,"/mobile/events/transfer")},{name:t("standing")}],animalScannerNextPath:"/".concat(e,"/mobile/locationScanner"),onlyAnimalScanner:!0,onlyLocationScanner:!0,standsChooser:!0,blockLocationFromScannedAnimal:!0,singleSelect:!0}}))}}t.a=Object(c.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(l.a)())(m)},Yp4W:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("r8wt"),l=a("tDQA"),m=a("d/v1"),u=a("pJVQ"),d=a("eXa9"),p=a("i8MS"),h=a("I8zd"),g=a("jjk5"),f=a("uZGJ");var b=a("5Z9N"),v=a("udB/"),E=a("10H7"),y=a("PFzG"),D=a("wd/R"),O=a.n(D),A=a("vzZS"),T=a("ANjH"),N=a("LCzB");const C=Object(l.a)("graftingEnd");class I extends s.Component{constructor(e){super(e),this.state={loading:!0,graftings:[]};const{location:{state:t},farm:a}=this.props;if(t){let{location:e,animals:a}=t;console.log(t),e&&(a=p.a.getAllAnimalsForLocation(e,h.a.CHAMBER,{joinEvents:!1})),this.props.dispatch(Object(b.d)(a.map(e=>e.AnmID))),this.props.initialize({animals:a})}else this.props.history.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){if(!r()(this.props.eventsLoading,e.eventsLoading)){const{animals:e,eventsLoading:t,events:a,match:{params:{medicineType:n}},medicines:r}=this.props;let s=!1;for(let i of e){t.get(i.AnmID)&&(s=!0)}if(!s){let t=new Map;for(let r of e){let e=a.get(r.AnmID).filter(e=>e.EvCode===E.b.GRAFTING&&e.EvData.TreatmentType===+n&&e.EvData.StartTime&&!e.EvData.EndTime);for(let a of e){console.log(a);let e=t.get(a.EvData.Medicine+a.EvData.StartTime)||{EvID:[],StartTime:a.EvData.StartTime,Medicine:a.EvData.Medicine};e.EvID.push(a.EvID),t.set(a.EvData.Medicine+a.EvData.StartTime,e)}}let i=[],o=[...t.values()];for(let e=0;e{let t=r.find(t=>t.WordID===e.Medicine);return{name:"".concat(t?t.WData.Name:"?"," - ").concat(O()(e.StartTime).format("DD.MM.YYYY")),value:e}}));this.setState({loading:s,graftings:i})}}}getName(){const{match:{params:{medicineType:e}},t:t}=this.props;switch(+e){case c.b.DOSATRON:return t("dosatron");case c.b.FORAGE:return t("medicalFeed");default:return""}}getLink(){const{match:{params:{medicineType:e}}}=this.props;switch(+e){case c.b.DOSATRON:return"dosatron";case c.b.FORAGE:return"forage";default:return""}}getBreadcrumbs(){const{location:{state:e},farm:t,t:a}=this.props,{location:n}=e;return[{name:a("treatment"),link:"/".concat(t,"/mobile/events/grafting")},{name:this.getName(),link:"/".concat(t,"/mobile/events/grafting/").concat(this.getLink())},{name:n.CName}]}render(){const{handleSubmit:e,location:{state:t},submitting:a,submitFailed:n,error:r,farm:s,match:{params:{medicineType:o}},submitSucceeded:c,t:l}=this.props;if(!t)return null;const{loading:u,graftings:p}=this.state;return i.a.createElement(d.a,{handleSubmit:e,breadcrumbs:this.getBreadcrumbs(),submitting:a,status:t.status,eventType:t.eventType,counterName:"grafting",submitFailed:n,error:r,formName:"graftingEnd",additionalState:{breadcrumbs:[{name:l("treatment"),link:"/".concat(s,"/mobile/events/grafting")},{name:this.getName()}],medicineType:+o},timesPath:"/".concat(s,"/mobile/locationScanner"),submitSucceeded:c,disabledSubmit:0===p.length},i.a.createElement(v.a,{isLoading:u}),0===p.length&&i.a.createElement(A.a,{boxColor:"warning"},l("rfidApp.noStartedTreatments")),p.length>0&&i.a.createElement(m.a,{name:"grafting",component:y.a,data:p}))}}t.a=Object(T.d)(Object(o.connect)((function(e){return{farm:e.location.farm,events:e.events.eventsForAnimals,eventsLoading:e.events.eventsForAnimalsLoading,animals:C(e,"animals"),medicines:e.dictionary.medicine}})),Object(N.a)(),Object(u.a)({form:"graftingEnd",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{t:n}=t;e.grafting||(a._error=n("rfidApp.treatmentError",{error:n("required")}));return a}(e,a);if(n._error)throw new g.a(n);const{history:r,farm:s,location:{state:{breadcrumbs:i}},match:{params:{medicineType:o}},t:c}=a;return Object(f.d)(e.grafting.EvID.map(e=>({EvID:e,EndTime:(new Date).getTime()}))).then(e=>{setTimeout(()=>{r.replace({pathname:"/".concat(s,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(o,"/add"),breadcrumbs:i,medicineType:+o}})},1500)}).catch(e=>{throw new g.a({_error:c("rfidApp.endGraftingGeneralError")})})}}))(I)},Yt9o:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("UNta"),l=a("wd/R"),m=a.n(l),u=(a("Q+eR"),a("/Har")),d=a("5Z9N"),p=a("udB/"),h=a("10H7"),g=a("ANjH"),f=a("eAv4"),b=a("tkTQ"),v=a("i8MS"),E=a("LCzB");class y extends s.Component{constructor(e){super(e),this.state={loading:!0,insemination:null,heat:null,loadingState:this.props.loading,toInsemination:!1,animal:this.props.location.state?this.props.location.state.animals[0]:null};const{location:{state:t},farm:a}=this.props;t?this.props.dispatch(Object(d.d)([this.state.animal.AnmID],{FarmID:a})):this.props.history.push("/".concat(a,"/mobile"))}static getDerivedStateFromProps(e,t){const{location:{state:a},loading:n,events:s}=e;if(a&&!r()(t.loadingState,e.loadingState)){let e=null,a=null,r=!1,o=t.animal,c=n.get(o.AnmID);if(console.log(c),void 0!==c&&!c){let t=s.get(o.AnmID).slice(0).sort((e,t)=>t.EvTime-e.EvTime);console.log(t),e=t.find(e=>e.EvCode===h.b.INSEMINATION&&!e.DtaDelTime),a=t.find(e=>e.EvCode===h.b.HEAT&&!e.DtaDelTime);try{let e=t.filter(e=>(e.EvCode===h.b.INSEMINATION||e.EvCode===h.b.TO_INSEMINATION)&&e.EvTime<(new Date).getTime()&&!e.DtaDelTime);e.sort((e,t)=>t.EvTime-e.EvTime),r=e[0].EvCode===h.b.TO_INSEMINATION}catch(i){r=!1}}return{loading:c,insemination:e,heat:a,loadingState:n,toInsemination:r}}return{loadingState:n}}componentDidUpdate(e,t,a){if(!r()(this.props.tagReader.animal,e.tagReader.animal)&&this.props.tagReader.animal){const{farm:e}=this.props;this.setState({animal:this.props.tagReader.animal}),this.props.dispatch(Object(d.d)([this.props.tagReader.animal.AnmID],{FarmID:e}))}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{loading:n,insemination:r,heat:s,toInsemination:o,animal:l}=this.state;let d=v.a.getAnimalLocationsByPlcmntID(l.PlcmntID,{nameDeep:2});return i.a.createElement("div",{className:"check"},i.a.createElement(p.a,{isLoading:n}),i.a.createElement(c.a,{breadcrumbs:[{name:a("insemination"),link:"/".concat(t,"/mobile/events/insemination")},{name:a("check")}],back:!0}),i.a.createElement(u.a,{data:[{label:a("animalNumber"),value:l.AnmNo1},{label:a("location"),value:d[0]?d[0].name:"-"},{label:a("toInsemination"),value:a(o?"yes":"no"),valueClassName:o?"success":"error"},{label:a("dateOfLastHeat"),value:s?m()(s.EvTime).format("DD.MM.YYYY"):"-"},{label:a("lastInseminationDate"),value:r?m()(r.EvTime).format("DD.MM.YYYY"):"-"}]}))}}t.a=Object(g.d)(Object(f.a)({animalKind:[b.a.SOW,b.a.RENOVATION_SOW],findAnimalInLocation:!0}),Object(o.connect)((function(e){return{farm:e.location.farm,events:e.events.eventsForAnimals,loading:e.events.eventsForAnimalsLoading}})),Object(E.a)())(y)},ZGuV:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("3Z9Z"),c=a("JI6e"),l=a("d/v1"),m=a("pJVQ"),u=a("hQYu"),d=a("jjk5"),p=a("PRyg"),h=a("E66K"),g=a("tkTQ");var f=a("ANjH"),b=a("LCzB");class v extends n.Component{constructor(e){super(e);const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.initialize({amount:0,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}render(){const{handleSubmit:e,submitting:t,location:{state:a},submitFailed:n,error:s,farm:m,submitSucceeded:d,t:p}=this.props;if(!a)return null;const{animals:h}=a;return r.a.createElement(i.a,{breadcrumbs:[{name:p("mommy"),link:"/".concat(m,"/mobile/events/mommy")},{name:p("rfidApp.addToMommy")}],handleSubmit:e,submitting:t,submitFailed:n,error:s,formName:"mommyAdd",status:a.status,eventType:a.eventType,counterName:"mommyAdd",submitSucceeded:d},1===h.length&&r.a.createElement("div",{className:"animal-info"},p("rfidApp.animalNumber"),": ",r.a.createElement("span",null,h[0].AnmNo1)),r.a.createElement(o.a,{className:"justify-content-center h-100"},r.a.createElement(c.a,{xs:8,className:"d-flex flex-column justify-content-center"},r.a.createElement("div",{className:"text-center"},p("rfidApp.pigletsAddedToChamber"),":"),r.a.createElement(l.a,{name:"amount",component:u.a,label:p("rfidApp.amount")}))))}}t.a=Object(f.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(b.a)(),Object(m.a)({form:"mommyAdd",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{t:n}=t;0===e.amount&&(a._error=n("rfidApp.amountError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new d.a(n);const{animals:r,amount:s}=e,{history:i,farm:o,t:c}=a;let l={maxPiglets:0,EvTime:(new Date).getTime(),animals:r.map(e=>({AnmID:e.AnmID,Piglets:s,GrID:Object(p.getGrIDByAnimal)(e,(new Date).getTime())}))};return Object(h.a)(l).then(e=>{setTimeout(()=>{i.push({pathname:"/".concat(o,"/mobile/scanner"),state:{eventType:"mommy",status:"add",breadcrumbs:[{name:c("mommy"),link:"/".concat(o,"/mobile/events/mommy")},{name:c("rfidApp.addToMommy")}],animalType:[g.a.SOW]}})},1500),t({type:"ADD_MOMMY_ADD",payload:l})}).catch(e=>{throw new d.a({_error:c("rfidApp.mommyGeneralError")})})}}))(v)},"ZeZ+":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("r8wt"),l=(a("2Qla"),a("ANjH")),m=a("LCzB");class u extends n.Component{render(){const{farm:e,medicines:t,t:a}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("grafting")}],additionalData:r.a.createElement("div",{className:"medicine-list"},t.slice(0,4).map((t,n)=>r.a.createElement(o.a,{key:n,name:t.WData.Name,href:"/".concat(e,"/mobile/scanner"),state:{medicine:t,breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("grafting")}],eventType:"graftingPiglets",status:"".concat(c.b.VACCINE,"/add"),advancedAnimalScanner:!0}},r.a.createElement("div",{className:"color",style:{background:t.WData.Color||"#FFFFFF"}}))),t.length>4&&r.a.createElement(o.a,{name:a("other"),href:"/".concat(e,"/mobile/medicineChooser"),state:{breadcrumbs:[{name:a("pigletsTreatment"),link:"/".concat(e,"/mobile/events/graftingPiglets")},{name:a("grafting")}],eventType:"graftingPiglets",status:"".concat(c.b.VACCINE,"/add"),medicineType:c.b.VACCINE}}))},r.a.createElement(o.a,{name:a("castration"),href:"/".concat(e,"/mobile/events/graftingPiglets/castration")}),r.a.createElement(o.a,{name:a("grafting"),href:"/".concat(e,"/mobile/events/graftingPiglets/vaccine"),selected:!0}),r.a.createElement(o.a,{name:a("medicalFeed"),href:"/".concat(e,"/mobile/events/graftingPiglets/forage")}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm,medicines:e.dictionary.medicine.filter(e=>e.WData.Type===c.b.VACCINE)}})),Object(m.a)())(u)},bmmJ:function(e,t,a){},cIZt:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("tkTQ"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){console.log(this.props);const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("parturition")}]},r.a.createElement(o.a,{name:t("rfidApp.start"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"parturition",status:"start",breadcrumbs:[{name:t("parturition"),link:"/".concat(e,"/mobile/events/parturition")},{name:t("rfidApp.start")}],animalType:[c.a.SOW]}}),r.a.createElement(o.a,{name:t("rfidApp.status"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"parturition",status:"status",breadcrumbs:[{name:t("parturition"),link:"/".concat(e,"/mobile/events/parturition")},{name:t("rfidApp.status")}],animalType:[c.a.SOW],singleSelect:!0}}),r.a.createElement(o.a,{name:t("rfidApp.end"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"parturition",status:"end",breadcrumbs:[{name:t("parturition"),link:"/".concat(e,"/mobile/events/parturition")},{name:t("rfidApp.end")}],animalType:[c.a.SOW]}}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},coZU:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("E0aH"),i=a("/MKj"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("NOo4"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{console.log("timerEnd");const{location:{state:a}}=this.props,{boar:n}=a,{animalsToSave:r,animals:s}=this.state;let i=(t?s:r).map(t=>({EvTime:e.getTime(),AnmID:t.AnmID,boarID:n.AnmID,GrID:Object(l.getGrIDByAnimal)(t,e.getTime())}));return Object(m.a)(i).then(()=>{this.props.dispatch({type:"ADD_INSEMINATION",payload:i})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.inseminationGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(console.log(e),!e)return null;const{animals:n,show:i}=this.state,{status:o,boar:l,error:m}=e;return r.a.createElement(s.a,{breadcrumbs:[{name:a("insemination"),link:"/".concat(t,"/mobile/events/insemination")},{name:a("inseminate"),link:"/".concat(t,"/mobile/events/insemination/end")},{name:"".concat(a("boar")," ").concat(l.AnmNo1)}],text:r.a.createElement(d.a,{i18nKey:"rfidApp.inseminationText",count:n.length,values:{AnmNo1:n[0].AnmNo1,boar:l.AnmNo1},components:{bold:r.a.createElement("strong",null)}}),additionalText:a("rfidApp.inseminationAdditionalText",{count:n.length}),animals:n,eventType:"insemination",status:o,additionalState:{boar:l,animalType:[c.a.SOW,c.a.RENOVATION_SOW]},showDate:!0,onSubmit:this.onSubmit,counterName:"insemination",showError:i,error:this.getError(),closeError:this.onCloseClick,errorType:0===m?"error":"warning"})}}h=Object(o.a)({animalKind:[c.a.SOW,c.a.RENOVATION_SOW],findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(i.connect)((function(e){return{farm:e.location.farm,user:e.user.user}})),Object(p.a)())(h)},eAv4:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a("J2iB"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("7e/R"),c=a("/MKj"),l=a("i8MS"),m=a("n7pt");function u(){return(u=Object.assign||function(e){for(var t=1;tt=>{class a extends s.Component{constructor(...t){super(...t),this.state={tag:"",animal:null,location:null,notFoundAnimal:!1,notFoundLocation:!1,wrongAnimalKind:!1,manyAnimalsInLocation:!1},this.tag="",this.timeout=null,this.additionalProps="function"===typeof e?e(this.props):e,this.tagReaderListener=e=>{const{key:t}=e;if(isNaN(+t)||(clearTimeout(this.timeout),this.tag+=t,this.timeout=setTimeout(()=>{this.tag=""},500)),"Enter"===t&&15===this.tag.length){const{farm:t}=this.props;let a=Object(o.a)(this.tag),n=l.a.getAnimalByRfid(a,t,{findDead:this.additionalProps.getDeadAnimals})||null,s=m.a.getLocationByRFID(a,t)||null,i=!1;if(s&&this.additionalProps.findAnimalInLocation){let e=l.a.getAllAnimalsByPlcmntID(s.FarmID||s.BgID||s.SID||s.CID||s.BID,{joinEvents:!1});1===e.length?n=e[0]:e.length>0&&(n=null,i=!0)}n&&!this.additionalProps.getDeadAnimals&&n.DtaDthTime&&(n=null);let c=!1;!r()(this.additionalProps.animalKind)&&n&&(Array.isArray(this.additionalProps.animalKind)?this.additionalProps.animalKind.includes(n.AnimalKind)||(n=null,c=!0):n.AnimalKind!==this.additionalProps.animalKind&&(n=null,c=!0)),clearTimeout(this.timeout),this.setState({tag:a,animal:n,location:s,notFoundAnimal:!n,notFoundLocation:!s,wrongAnimalKind:c,manyAnimalsInLocation:i}),this.tag="",e.preventDefault()}},this.clearTag=()=>{this.setState({tag:"",animal:null,location:null,notFoundAnimal:!1,notFoundLocation:!1,wrongAnimalKind:!1,manyAnimalsInLocation:!1})}}componentDidMount(){document.addEventListener("keydown",this.tagReaderListener)}componentWillUnmount(){document.removeEventListener("keydown",this.tagReaderListener)}render(){return i.a.createElement(t,u({},this.props,{tagReader:p({},this.state,{clearTag:this.clearTag})}))}}return a.displayName="WithTagReader(".concat(t.displayName||t.name||"Component",")"),Object(c.connect)(e=>({farm:e.location.farm}))(a)}},eXa9:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s),o=a("UNta"),c=a("uSQv"),l=(a("Q+eR"),a("wQmL")),m=a("/MKj"),u=a("hGE3"),d=a("55Ip"),p=a("vmgh");function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function g(e){for(var t=1;t{this.props.dispatch(Object(l.b)(this.props.formName))}}render(){const{handleSubmit:e,breadcrumbs:t,additionalData:a,children:n,submitting:s,error:i,submitFailed:l,className:m,farm:h,eventType:f,status:b,additionalState:v,timesPath:E,counterName:y,counters:D,disabledSubmit:O,submitSucceeded:A}=this.props;return r.a.createElement("div",{className:"event-status-view".concat(m?" "+m:"")},r.a.createElement(o.a,{breadcrumbs:t}),a&&r.a.createElement("div",{className:"additional-data"},a),y&&r.a.createElement("div",{className:"event-status-view-counter"},r.a.createElement("i",{className:"fa fa-wifi fa-fw"})," ",D[y]),r.a.createElement("form",{onSubmit:e},r.a.createElement("div",{className:"submit"},r.a.createElement(c.a,{buttonStyle:"text",disabled:s||O||A},r.a.createElement(p.a,{loading:s,success:A}))),n,r.a.createElement(d.Link,{className:"close",to:{pathname:E||"/".concat(h,"/mobile/scanner"),state:g({breadcrumbs:t,eventType:f,status:b},v)},replace:!0},r.a.createElement("i",{className:"far fa-times-circle"}))),r.a.createElement(u.a,{error:i,show:l&&!s,onCloseClick:this.onCloseClick}))}}b.propTypes={handleSubmit:i.a.func.isRequired,breadcrumbs:i.a.arrayOf(i.a.shape({name:i.a.string.isRequired,link:i.a.oneOfType([i.a.object,i.a.string])})).isRequired,additionalData:i.a.node,submitting:i.a.bool,error:i.a.string,submitFailed:i.a.bool,formName:i.a.string,className:i.a.string,eventType:i.a.string.isRequired,status:i.a.string.isRequired,additionalState:i.a.object,timesPath:i.a.string,counterName:i.a.string,disabledSubmit:i.a.bool,submitSucceeded:i.a.bool},t.a=Object(m.connect)((function(e){return{farm:e.location.farm,counters:e.eventCounter}}))(b)},"g9M/":function(e,t,a){},ghmW:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=a("MAs2"),u=(a("pUGO"),a("ANjH")),d=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.state={page:0},this.onPageChange=e=>{this.setState({page:e})}}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(c.a,{page:n,onPageChange:this.onPageChange,title:a("rfidApp.chooseReason")+":"},this.splitReasons(e).map((e,n)=>r.a.createElement(l.a,{key:n},e.map((e,n)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(t,"/mobile/scanner"),key:n,state:{eventType:"fall",status:e.ID,breadcrumbs:[{name:a("fall"),link:"/".concat(t,"/mobile/events/fall")},{name:e.Value}]}}))))))}}t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang]}})),Object(d.a)())(p)},hGE3:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("17x9"),i=a.n(s);a("g9M/");class o extends n.Component{render(){const{error:e,show:t,onCloseClick:a,capitalizeFirstLetter:n,type:s}=this.props;return r.a.createElement("div",{className:"submit-error".concat(n?" capitalize":"").concat(e&&t?" in":""," ").concat(s)},r.a.createElement("div",{className:"text-container"},e),r.a.createElement("i",{className:"far fa-times",onClick:a}))}}o.propTypes={show:i.a.bool,error:i.a.string.isRequired,onCloseClick:i.a.func.isRequired,capitalizeFirstLetter:i.a.bool,type:i.a.oneOf(["success","warning","error","info"])},o.defaultProps={capitalizeFirstLetter:!0,type:"error"},t.a=o},hJU4:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("ANjH"),l=a("LCzB"),m=a("msTn");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("sale")}]},r.a.createElement(o.a,{name:t("animal"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"sell",status:"animal",breadcrumbs:[{name:t("sale"),link:"/".concat(e,"/mobile/events/sell")},{name:t("animal")}]}}),r.a.createElement(o.a,{name:t("rfidApp.room"),href:"/".concat(e,"/mobile/locationScanner"),state:{eventType:"sell",status:"location",breadcrumbs:[{name:t("sale"),link:"/".concat(e,"/mobile/events/sell")},{name:t("rfidApp.room")}],sectorTypes:[m.a.PIGLET_HOUSE,m.a.PORK_HOUSE]}}))}}t.a=Object(c.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(l.a)())(u)},hTRX:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("LCzB"),o=a("ANjH"),c=a("UNta"),l=a("3Z9Z"),m=a("JI6e"),u=a("uSQv"),d=a("vmgh"),p=a("eAv4"),h=a("hGE3"),g=a("NZSv");class f extends n.Component{constructor(e){super(e),this.state={show:!1,error:null,tag:null,submitting:!1,submitted:!1},this.onCloseClick=()=>{this.setState({show:!1})},this.onSaveClick=()=>{this.setState({submitting:!0,submitted:!1});const{location:{state:{animals:e}},farm:t}=this.props;let a=e[0];Object(g.a)(a.AnmID,this.state.tag).then(e=>{this.setState({submitted:!0,submitting:!1},()=>{setTimeout(()=>{this.props.history.replace("/".concat(t,"/mobile"))},1500)})}).catch(e=>{this.setState({submitting:!1,show:!0,error:0})})},this.onBackClick=()=>{this.props.history.goBack()};const{location:{state:t},farm:a}=this.props;t||this.props.history.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){this.props.tagReader.tag!==e.tagReader.tag&&(this.props.tagReader.animal?this.setState({show:!0,error:1,tag:null}):this.props.tagReader.location?this.setState({show:!0,error:2,tag:null}):this.setState({tag:this.props.tagReader.tag,show:!1}))}getError(){const{t:e}=this.props,{error:t}=this.state;switch(t){case 0:return e("rfidApp.changeRFIDGeneralError");case 1:return e("rfidApp.rfidAlreadyAssignedToAnimal");case 2:return e("rfidApp.rfidAlreadyAssignedToLocation");default:return""}}render(){const{location:{state:e},t:t}=this.props;if(!e)return null;const{show:a,tag:n,submitting:s,submitted:i,error:o}=this.state,{animals:p}=e;let g=p[0];return r.a.createElement("div",{className:"last-view"},r.a.createElement(c.a,{breadcrumbs:[{name:t("rfidApp.lostEarringTitle"),onClick:this.onBackClick},{name:g.AnmNo1}]}),r.a.createElement(l.a,{className:"justify-content-center h-100"},r.a.createElement(m.a,{md:10,className:"d-flex flex-column justify-content-center"},r.a.createElement("h4",{className:"main-text"},!n&&t("rfidApp.lostEarringScanAnimal"),n&&t("rfidApp.lostEarring",{tag:n})))),r.a.createElement("div",{className:"last-view-close",onClick:this.onBackClick},r.a.createElement("i",{className:"far fa-times-circle"})),r.a.createElement(u.a,{className:"last-view-save",buttonStyle:"text",disabled:!n||s||i,onClick:this.onSaveClick},r.a.createElement(d.a,{loading:s,success:i})),r.a.createElement(h.a,{onCloseClick:this.onCloseClick,error:this.getError(),show:a,type:0===o?"error":"warning"}))}}t.a=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(p.a)())(f)},hnqp:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("UNta"),l=a("i8MS"),m=a("kYAI"),u=a("5Z9N"),d=a("udB/"),p=a("wd/R"),h=a.n(p),g=a("T826"),f=a("3Z9Z"),b=a("JI6e"),v=a("7xGa"),E=a("uSQv"),y=(a("qYYQ"),a("JPoY")),D=a("PkbN"),O=a("uUZO"),A=a("q17X"),T=a("10H7"),N=a("tkTQ"),C=a("CuyV"),I=a("AF5L"),j=a("zDJl"),S=a("eAv4"),w=a("17x9"),P=a.n(w),k=(a("UQiH"),a("3xDe"));class R extends s.Component{render(){const{usage:e,max:t,text:a}=this.props;let n=null!==e?+(e/t*100).toFixed(0):"-";return i.a.createElement("div",{className:"feeding-history"},i.a.createElement("div",{className:"feeding-history-indicator ".concat(Object(k.e)(n))},n,"%"),i.a.createElement("div",{className:"feeding-history-text"},a))}}R.propTypes={usage:P.a.number.isRequired,max:P.a.number.isRequired,text:P.a.string.isRequired};var F=R,x=a("pxzG"),M=a("eASP"),L=a("15cA"),G=a("mwIZ"),B=a.n(G),H=(a("+Hr+"),a("vmgh"));class W extends s.Component{constructor(...e){super(...e),this.state={submitting:!1,submitted:!1},this.onSubmit=()=>{const{onSubmit:e,onCloseClick:t,onSuccess:a}=this.props;this.setState({submitting:!0,submitted:!1});let n=e();Promise.resolve(n).then(()=>{this.setState({submitted:!0,submitting:!1},()=>{setTimeout(()=>{t(),Object(A.isUsingFakeData)()||a()},1500)})}).catch(e=>{this.setState({submitting:!1})})}}render(){const{breadcrumbs:e,children:t,onCloseClick:a,className:n,disableSubmit:r}=this.props,{submitted:s,submitting:o}=this.state;return i.a.createElement("div",{className:"rfid-feeding-modal".concat(n?" "+n:"")},i.a.createElement(c.a,{breadcrumbs:e}),t,i.a.createElement(E.a,{className:"close",buttonStyle:"text",onClick:a},i.a.createElement("i",{className:"far fa-times-circle"})),i.a.createElement(E.a,{className:"submit",buttonStyle:"text",onClick:this.onSubmit,disabled:r},i.a.createElement(H.a,{loading:o,success:s})))}}W.propTypes={breadcrumbs:P.a.arrayOf(P.a.shape({name:P.a.string.isRequired,pathname:P.a.oneOfType([P.a.string,P.a.object])})).isRequired,onCloseClick:P.a.func.isRequired,onSubmit:P.a.func.isRequired,onSuccess:P.a.func.isRequired,className:P.a.string,disableSubmit:P.a.bool};var V=W,U=a("LCzB"),K=a("ANjH"),z=a("Ogml"),_=(a("5mIH"),a("CX8Q")),q=a("qzmO"),Q=a("hQYu"),Y=a("6/k7"),Z=a("mr+a");function J(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function X(e){for(var t=1;t{const{curves:e,curve:t}=this.state,{devices:a,workType:n,animal:r,locationID:s}=this.props;let i=a[0],o=e[t];console.log(o);let c=Object(L.m)(X({},this.state,{curve:o}),j.d.DISPENSER_NRF);const l={AnmNo1:r.AnmNo1,RFID:r.RFID,AnmID:r.AnmID,PlcmntID:s,feeding:{curveNr:+c.curveNr,startTime:+c.startTime,number:i.DevType===j.d.DISPENSER&&B()(i.PlcmntID.find(e=>e.PlcmntID===s),"Adr",-1)+1||void 0}};return console.log(l),Object(A.isUsingFakeData)()?new Promise(e=>{setTimeout(()=>{e(),this.props.onSuccess({curve:o.SetData.Index+1,curveDay:h()().startOf("day").diff(i.DevType===j.d.DISPENSER?l[0].curveStart:"R"===n?l.animals[0].curveCfg.startTime:l.startTime,"days")+1,startTime:i.DevType===j.d.DISPENSER?l[0].curveStart:"R"===n?l.animals[0].curveCfg.startTime:l.startTime})},1500)}):this.sendData(i.GatewayID,l)},this.onChange=e=>{const{curves:t,curve:a}=this.state;let n=t[a];Object(L.f)(n)===Y.a.NORMAL?this.setState({curveDay:e}):this.setState({repetitionDate:e})},this.onChangeCurve=e=>{this.setState({curve:e})},this.curveValueFormatter=e=>{const{curves:t}=this.state;return t[e]?t[e].SetData.Name:"-"};const{curves:t,sectorType:a,devices:n,animal:r,fakeData:s}=this.props;let i=t.filter(e=>Object(L.e)({sectorType:a}).includes(e.SetData.Type)&&Object(L.l)({curve:e,devType:n[0]?n[0].DevType:null})),o=Object(L.k)({animal:r,sectorType:a,curves:i,initializeIndex:!0});console.log(o,s),Object(A.isUsingFakeData)()&&(o=Object(L.k)({animal:{feedParam:{curveNr:s.curve.number,startTime:s.curve.start}},sectorType:a,curves:i,initializeIndex:!0})),this.state=X({},this.state,{curves:i},o)}sendData(e,t){return new Promise((a,n)=>{Object(q.l)(e,[t],{onSuccess:a,onFailure:n,showNotification:!1})})}getMaxDate(e,t){const a=h()().startOf("day"),n=B()(t,"SetData.Days.length",0),r=B()(t,"SetData.InseminationJumpTo",0);switch(e){case Y.a.BEFORE:return a.clone().add(n,"days").toDate().getTime();case Y.a.AFTER:return a.clone().toDate().getTime();case Y.a.BOTH:return a.clone().add(r-1,"days").toDate().getTime();case Y.a.NORMAL:return n}}render(){const{onCloseClick:e,onSuccess:t,t:a}=this.props,{curves:n,curve:r,curveDay:s,repetitionDate:o}=this.state;let c=n[r],l=Object(L.f)(c);const m=B()(c,"SetData.Type");return i.a.createElement(V,{breadcrumbs:[{name:a("eventTypes.C")}],onCloseClick:e,onSubmit:this.onSubmitClick,onSuccess:t,disableSubmit:!c},i.a.createElement(f.a,{className:"justify-content-center h-100"},i.a.createElement(b.a,{xs:10,className:"d-flex flex-column justify-content-center"},i.a.createElement(Q.a,{label:a("feedingCurve"),min:0,max:n.length-1,valueFormatter:this.curveValueFormatter,input:{onChange:this.onChangeCurve,value:r}}),i.a.createElement(Q.a,{label:l===Y.a.NORMAL?a("curveDay"):l===Y.a.BEFORE?Y.c.includes(m)?a("modals.feedingManageFeedingModal.plannedInseminationDate"):a("rfidApp.plannedParturition"):Y.c.includes(m)?a("modals.feedingManageFeedingModal.inseminationDate"):a("rfidApp.plannedParturition"),date:l!==Y.a.NORMAL,max:this.getMaxDate(l,c),min:l===Y.a.NORMAL?1:null,input:{onChange:this.onChange,value:l===Y.a.NORMAL?s:o}}))))}}ee.propTypes={sectorType:P.a.number.isRequired,devices:P.a.arrayOf(P.a.instanceOf(z.a)),curve:P.a.object,onCloseClick:P.a.func.isRequired,workType:P.a.string,animal:P.a.instanceOf(_.a),locationID:P.a.string,onSuccess:P.a.func,fakeData:P.a.object};var te=Object(K.d)(Object(U.a)(),Object(o.connect)((function(e){return{curves:Object(Z.c)(e).slice(0).sort((e,t)=>e.SetData.Index-t.SetData.Index)}})))(ee),ae=a("kCmh"),ne=a("kCVf");class re extends s.Component{getMaxDate(e,t){const a=h()().startOf("day"),n=B()(t,"SetData.Days.length",0),r=B()(t,"SetData.InseminationJumpTo",0);switch(e){case Y.a.BEFORE:return a.clone().add(n+1,"days").toDate().getTime();case Y.a.AFTER:return a.clone().add(1,"days").toDate().getTime();case Y.a.BOTH:return a.clone().add(r,"days").toDate().getTime();case Y.a.NORMAL:return n}}render(){const{curve:e,t:t,onChange:a,value:n}=this.props;let r=Object(L.f)(e);const s=B()(e,"SetData.Type");return i.a.createElement(Q.a,{label:r===Y.a.NORMAL?t("curveDay"):r===Y.a.BEFORE?Y.c.includes(s)?t("modals.feedingManageFeedingModal.plannedInseminationDate"):t("modals.feedingManageFeedingModal.plannedParturitionDate"):Y.c.includes(s)?t("modals.feedingManageFeedingModal.inseminationDate"):t("modals.feedingManageFeedingModal.parturitionDate"),input:{onChange:a,value:n},date:r!==Y.a.NORMAL,min:r===Y.a.NORMAL?1:void 0,max:this.getMaxDate(r,e)})}}re.propTypes={curve:P.a.object.isRequired,onChange:P.a.func.isRequired,value:P.a.any};var se=Object(U.a)()(re);class ie extends s.Component{constructor(e){super(e),this.onChangeDay=e=>{this.setState({value:e})},this.onSubmitClick=()=>{const{value:e}=this.state,{devices:t,workType:a,animal:n,locationID:r,curve:s}=this.props;let i=t[0];const o=Object(L.m)({repetitionDate:e,curve:s,curveDay:e}),c={PlcmntID:r,AnmID:n.AnmID,AnmNo1:n.AnmNo1,RFID:n.RFID,feeding:{startTime:+o.startTime,number:i.DevType===j.d.DISPENSER&&B()(i.PlcmntID.find(e=>e.PlcmntID===r),"Adr",-1)+1||void 0}};return Object(A.isUsingFakeData)()?new Promise(e=>{setTimeout(()=>{e(),this.props.onSuccess({curveDay:h()().startOf("day").diff(i.DevType===j.d.DISPENSER?c[0].curveStart:"R"===a?c.animals[0].curveCfg.startTime:c.startTime,"days")+1,startTime:i.DevType===j.d.DISPENSER?c[0].curveStart:"R"===a?c.animals[0].curveCfg.startTime:c.startTime})},1500)}):this.sendData(i.GatewayID,c)};const{curve:t,stage:a}=this.props;let n=h()(this.props.curveStart);const r=!!a,s=B()(t,"SetData.Days.length",0),i=B()(t,"SetData.InseminationJumpTp",0);let o;switch(Object(L.f)(t)){case Y.a.BEFORE:o=n.clone().add(s,"days");break;case Y.a.AFTER:o=n;break;case Y.a.BOTH:o=n.clone().subtract(r?0:Math.max(i-1,0),"day");break;case Y.a.NORMAL:default:o=Math.min(s,Math.max(1,h()().startOf("day").diff(n.clone().startOf("day"),"days")+1))}this.state={value:o}}sendData(e,t){return new Promise((a,n)=>{Object(q.l)(e,[t],{onSuccess:a,onFailure:n,showNotification:!1})})}render(){const{onCloseClick:e,onSuccess:t,curve:a,t:n}=this.props,{value:r}=this.state;return i.a.createElement(V,{breadcrumbs:[{name:n("rfidApp.changeCurveDay")}],onCloseClick:e,onSubmit:this.onSubmitClick,onSuccess:t},i.a.createElement(f.a,{className:"justify-content-center h-100"},i.a.createElement(b.a,{xs:8,className:"d-flex flex-column justify-content-center"},i.a.createElement(se,{curve:a,onChange:this.onChangeDay,value:r}))))}}ie.propTypes={devices:P.a.arrayOf(P.a.instanceOf(z.a)),onCloseClick:P.a.func.isRequired,workType:P.a.string,animal:P.a.instanceOf(_.a),locationID:P.a.string,onSuccess:P.a.func,curve:P.a.object,stage:P.a.number,curveStart:P.a.number};var oe=Object(K.d)(Object(U.a)())(ie);class ce extends s.Component{constructor(...e){super(...e),this.state={value:this.props.offset||0},this.onChangeCorrection=e=>{this.setState({value:e})},this.onSubmitClick=()=>{const{value:e}=this.state,{devices:t,animal:a,locationID:n}=this.props,r=t[0],s={AnmNo1:a.AnmNo1,RFID:a.RFID,AnmID:a.AnmID,PlcmntID:n,feeding:{percentCorrection:+e,number:r.DevType===j.d.DISPENSER&&B()(r.PlcmntID.find(e=>e.PlcmntID===n),"Adr",-1)+1||void 0}};return Object(A.isUsingFakeData)()?new Promise(t=>{setTimeout(()=>{t(),this.props.onSuccess({correction:e})},1500)}):this.sendData(r.GatewayID,s)}}sendData(e,t){return new Promise((a,n)=>{Object(q.l)(e,[t],{onSuccess:a,onFailure:n,showNotification:!1})})}render(){const{onCloseClick:e,onSuccess:t,t:a}=this.props,{value:n}=this.state;return i.a.createElement(V,{breadcrumbs:[{name:a("rfidApp.changeDoseCorrection")}],onCloseClick:e,onSubmit:this.onSubmitClick,onSuccess:t},i.a.createElement(f.a,{className:"justify-content-center h-100"},i.a.createElement(b.a,{xs:8,className:"d-flex flex-column justify-content-center"},i.a.createElement(Q.a,{label:a("doseCorrection"),input:{onChange:this.onChangeCorrection,value:n},max:25,min:-25,step:5,valueFormatter:e=>e+"%"}))))}}ce.propTypes={devices:P.a.arrayOf(P.a.instanceOf(z.a)),onCloseClick:P.a.func.isRequired,workType:P.a.string,animal:P.a.instanceOf(_.a),locationID:P.a.string,onSuccess:P.a.func,curve:P.a.object,offset:P.a.number};var le=Object(K.d)(Object(U.a)(),Object(o.connect)((function(e){return{}})))(ce),me=a("r3a2"),ue=a("S8cm");class de extends s.Component{constructor(...e){super(...e),this.state={value:this.props.skipDoses},this.onSubmitClick=()=>{const{value:e}=this.state,{devices:t,locationID:a}=this.props;let n,r=t[0];if(r.DevType===j.d.DISPENSER){let t=r.PlcmntID.find(e=>e.PlcmntID===a);n=[{dosesToSkip:e,number:t.Adr+1}]}else n={dosesToSkip:e};return Object(A.isUsingFakeData)()?new Promise(t=>{setTimeout(()=>{t(),this.props.onSuccess({skipDoses:e})},1500)}):this.sendData(n,r)}}sendData(e,t){return new Promise((a,n)=>{t.DevType===j.d.DISPENSER?Object(me.j)(t,e,a,n,!0):Object(q.y)(t,e,a,n,!0)})}formatDose(e){return h()(e.Start).format("HH:mm")+" - "+h()(e.Stop).format("HH:mm")}onCheckboxClick(e,t){const a=this.state.value.slice(0);a[e]=+t,this.setState({value:a})}render(){const{onCloseClick:e,onSuccess:t,schedule:a,t:n}=this.props,{value:r}=this.state;return i.a.createElement(V,{breadcrumbs:[{name:n("modals.feedingSkipDosesModal.titleSkipDoses")}],onCloseClick:e,onSubmit:this.onSubmitClick,onSuccess:t},i.a.createElement("div",{className:"d-flex h-100 align-items-center skip-doses"},i.a.createElement(f.a,{className:"justify-content-center w-100"},a.SetData.Doses.map((e,t)=>i.a.createElement(b.a,{xs:4,key:t},i.a.createElement(ue.a,{label:this.formatDose(e),id:t,checked:!!r[t],onChange:e=>this.onCheckboxClick(t,e)}))))))}}de.propTypes={devices:P.a.arrayOf(P.a.instanceOf(z.a)),onCloseClick:P.a.func.isRequired,onSuccess:P.a.func,schedule:P.a.object,locationID:P.a.string,skipDoses:P.a.arrayOf(P.a.number)};var pe=Object(K.d)(Object(U.a)(),Object(o.connect)((function(e){return{}})))(de),he=a("vSUv"),ge=a.n(he),fe=a("/kok"),be=a("c5t2");function ve(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ee(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class ye extends s.Component{constructor(e){super(e),this.state={value:100},this.onChange=e=>{this.setState({value:e})},this.onSubmitClick=()=>{const{value:e}=this.state,{devices:t,locationID:a}=this.props;let n={dose:e,type:0},r=t[0];if(r.DevType===j.d.DISPENSER){n=function(e){for(var t=1;te.PlcmntID===a).Adr+1})}return this.sendData(n,r)},Object(A.isUsingFakeData)()&&ge.a.stub(fe.a,"createAndSendMessageObject").callsFake(be.a)}componentWillUnmount(){Object(A.isUsingFakeData)()&&ge.a.restore()}sendData(e,t){return new Promise((a,n)=>{t.DevType===j.d.DISPENSER?Object(me.h)(t,e,a,n,!0):Object(q.t)(t,e,a,n,!0)})}render(){const{onCloseClick:e,onSuccess:t,t:a}=this.props,{value:n}=this.state;return i.a.createElement(V,{breadcrumbs:[{name:a("extraFeeding")}],onCloseClick:e,onSubmit:this.onSubmitClick,onSuccess:t},i.a.createElement(f.a,{className:"justify-content-center h-100"},i.a.createElement(b.a,{xs:8,className:"d-flex flex-column justify-content-center"},i.a.createElement(Q.a,{label:a("forageAmount"),input:{onChange:this.onChange,value:n},min:100,max:2500,step:100,valueFormatter:e=>Object(x.j)(e,{unit:M.a.MEDIUM,showUnit:!0,fixed:1})}))))}}var De=Object(U.a)()(ye),Oe=a("xqDj"),Ae=a("hGE3"),Te=a("n7pt");function Ne(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ce(e){for(var t=1;t{console.log(e);let t=e.CAnsw[0];this.sentMessages[e.MsgId]=!1,this.setState({feeding:Object.keys(t).length>1?t:null,loadingUsage:!1})},this.onGetUsageFailure=(e,t)=>{this.sentMessages[t.MsgId]=!1;let a=!1;for(let n in this.sentMessages)this.sentMessages[n]&&(a=!0);a||this.state.feeding||this.setState(e=>({loadingUsage:!1,page:0===e.page?1:e.page}))},this.onPageChange=e=>{this.setState({page:e})},this.onChangeCurveClick=()=>{this.setState({show:"curve"})},this.onChangeDayClick=()=>{this.setState({show:"day"})},this.onChangeCorrectionClick=()=>{this.setState({show:"correction"})},this.onSkipDosesClick=()=>{this.setState({show:"skip"})},this.onAdditionalFeedingClick=()=>{this.setState({show:"additionalFeeding"})},this.onCloseClick=()=>{this.setState({show:null})},this.onChangeSuccess=e=>{const{animal:t}=this.state,{gateways:a}=this.props;this.getUsage(t,a,e)},this.onCloseErrorClick=()=>{this.setState({showError:!1})};let t=l.a.getAnimalById(this.props.match.params.AnmID);if(this.fetchData(t,this.props.gateways),t){let e=this.props.events.get(t.AnmID),a=this.getData(e,t),n=this.createToDoAndDone(this.props.graftingPrograms,t,e),r=l.a.getAnimalLocationsByPlcmntID(t.PlcmntID,{nameDeep:2})[0],s=[];r&&(s=ae.a.getDevicesInPlcmnt(r.location,{showDevicesInChildren:!1}).filter(e=>e.DevType===j.d.DISPENSER_NRF||e.DevType===j.d.DISPENSER)),this.state=Ce({},this.state,{animal:t,events:e,location:r,devices:s},a,{},n)}}static getDerivedStateFromProps(e,t){if(t.animal){const{AnmID:a}=t.animal;let n=e.loadingEvents.get(a),r=e.events.get(a);if(n!==t.loadingEvents&&r)return{loadingEvents:n,events:r}}return null}componentDidUpdate(e,t,a){if(!r()(this.state.events,t.events)){let e=this.getData(this.state.events,this.state.animal),t=this.createToDoAndDone(this.props.graftingPrograms,this.state.animal,this.state.events);this.setState(Ce({},e,{},t))}if(!r()(this.props.graftingPrograms,e.graftingPrograms)||!r()(this.state.lastInsemination,t.lastInsemination)){let e=this.createToDoAndDone(this.props.graftingPrograms,this.state.animal,this.state.events);this.setState(e)}this.props.tagReader.tag!==e.tagReader.tag&&(this.props.tagReader.animal!==e.tagReader.animal&&this.props.tagReader.animal&&this.props.tagReader.animal.AnmID!==this.state.animal.AnmID?this.props.history.push("/".concat(this.props.farm,"/mobile/information/").concat(this.props.tagReader.animal.AnmID)):this.props.tagReader.manyAnimalsInLocation?this.props.history.push("/".concat(this.props.farm,"/mobile/locationInformation/").concat(Object(ne.j)(this.props.tagReader.location))):this.props.tagReader.animal||(this.props.tagReader.location?this.setState({showError:!0,error:2,errorLocation:this.props.tagReader.location}):this.setState({showError:!0,error:1,errorTag:this.props.tagReader.tag})))}fetchData(e,t){this.props.dispatch(Object(u.c)(e)),this.getUsage(e,t)}getUsage(e,t,a={}){this.sentMessages={},this.setState({loadingUsages:!0});for(let n of t)if(Object(A.isUsingFakeData)()){let t=Te.a.getTreeByLocationID(e.PlcmntID);setTimeout(()=>{if(console.log(a),t.chamber){let e=Oe;e.AnmID=this.state.animal.AnmID,t.chamber.IndividualFeeding||0!==Object.keys(a).length||(e.workType="R",e.curve.number=0,e.curve.correction=0,e.lastWeekHistory[0].plannedUsage=3e3),a.curve&&(e.curve.number=a.curve),a.curveDay&&(e.curve.day=a.curveDay),void 0!==a.correction&&(e.curve.correction=a.correction),a.skipDoses&&(e.skipDoses=a.skipDoses),a.startTime&&(e.curve.start=a.startTime),console.log(e),this.onGetUsageSuccess({CAnsw:[e]})}else this.setState({feeding:null,loadingUsage:!1})},1e3)}else{let t=Object(I.f)(n,[{AnmID:e.AnmID,PlcmntID:Array.isArray(e.PlcmntID)?e.PlcmntID[0].PlcmntID:e.PlcmntID,RFID:e.RFID}],this.onGetUsageSuccess,this.onGetUsageFailure);this.sentMessages[t]=!0}}getData(e,t){let a=Object(O.d)(e,t),n=a.cycleTable[a.cycleTable.length-1],r={averageBreak:Object(O.b)(a.cycleTable)};if(n&&(r=Ce({},r,{cycle:n.cycle,lastInsemination:n[T.b.INSEMINATION][0],parturition:n[T.b.PARTURITION][0]}),r.lastInsemination)){let e=Object(A.getTimeFromInseminationToPartuition)();r.plannedParturitionTime=h()(r.lastInsemination.EvTime).add(e,"days")}return r}createToDoAndDone(e,t,a){let n={todo:[],done:[]},r=Object(O.d)(a,t),s=r.cycleTable[r.cycleTable.length-1],i=t.AnimalKind===N.a.SOW||t.AnimalKind===N.a.RENOVATION_SOW?s?s.StartTime:null:t.DtaBrthTime;if(i){let r=e.find(e=>e.WData.AnimalKind===t.AnimalKind);if(r)for(let e of r.WData.MedicineList){let t=this.props.medicines.find(t=>t.WordID===e.Medicine);n.todo.push({date:h()(i).add(e.Age,"days"),text:t?t.WData.Name:"-",medicine:t})}let s=a.filter(e=>e.EvCode===T.b.TREATMENT);for(let e of s)for(let t of e.EvData.Treatment){let e=t.Dates.filter(e=>e>i);for(let a of e)for(let e of t.Medicine){let t=this.props.medicines.find(t=>t.WordID===e);n.todo.push({date:h()(a),text:t?t.WData.Name:"-",medicine:t})}}let o=a.filter(e=>e.EvCode===T.b.GRAFTING&&e.EvTime>i);for(let e of o){let t=this.props.medicines.find(t=>t.WordID===e.EvData.Medicine);n.done.push({date:h()(e.EvTime),text:t?t.WData.Name:"-",medicine:t}),n.todo=n.todo.filter(a=>a.medicine&&t&&(a.medicine.WordID!==t.WordID||!a.date.isSame(e.EvTime,"day")))}}return n.todo.sort((e,t)=>e.date.toDate().getTime()-t.date.toDate().getTime()),n.todo=n.todo.slice(0,8),n.done.sort((e,t)=>t.date.toDate().getTime()-e.date.toDate().getTime()),n.done=n.done.slice(0,8),n}getCurveObject(){const{curves:e}=this.props,{feeding:t}=this.state;return t&&t.curve?Object(A.isUsingFakeData)()?e.find(e=>e.SetData.Index===t.curve.number-1):e.find(e=>e.SetID===t.curve.id)||null:null}getCurve(){const{t:e}=this.props,{feeding:t}=this.state;if(t&&t.curve&&0===t.curve.number&&"R"===t.workType)return e("deviceRows.feeding.dispenserRow.defaultCurve");let a=this.getCurveObject();return a?a.SetData.Name:"-"}getCorrection(){const{feeding:e}=this.state;return e?e.curve.correction:"-"}getHistory(){let e=[];try{const{feeding:{lastWeekHistory:t}}=this.state;if(t)for(let a=1;a<7;a++)t[a]&&t[a].plannedUsage?e.push(i.a.createElement(F,{usage:t[a].usage,max:t[a].plannedUsage,text:"-"+a,key:a})):e.push(i.a.createElement(F,{usage:0,max:100,key:a,text:"-"+a}));return e}catch(t){for(let a=0;a<6;a++)e.push(i.a.createElement(F,{usage:0,max:100,key:a,text:"-"+(a+1)}))}return e}getUsageForToday(){const{t:e}=this.props,{feeding:t}=this.state;if(!t)return i.a.createElement("div",{className:"big-history"},i.a.createElement("div",{className:"big-history-indicator error"},"- / -"),i.a.createElement("div",{className:"big-history-text"},e("today")));{const{lastWeekHistory:a}=t;if(a&&a[0]){let{usage:t,plannedUsage:n}=a[0],r=t/n*100;return i.a.createElement("div",{className:"big-history"},i.a.createElement("div",{className:"big-history-indicator ".concat(Object(k.e)(r))},Object(x.j)(t,{unit:M.a.MEDIUM,showUnit:!0,fixed:1}),"\xa0/\xa0",Object(x.j)(n,{unit:M.a.MEDIUM,showUnit:!0,fixed:1})),i.a.createElement("div",{className:"big-history-text"},e("today")))}}}getCurveDay(){const{feeding:e}=this.state;if(!e)return"-";let t=this.getCurveObject();if(t){const{day:a}=e.curve;return Object(L.d)(a,t)}return"-"}getSchedule(){const{feeding:e}=this.state,{schedules:t}=this.props;try{if(Object(A.isUsingFakeData)()){const{schedule:{number:a}}=e;return t[a-1]}const{schedule:{id:a}}=e;return t.find(e=>e.SetID===a)}catch(a){return null}}getNextFeeding(){const{feeding:e}=this.state;if(!e)return"-";const{skipDoses:t}=e;let a=this.getSchedule();if(a&&t){let e=a.SetData.Doses.filter((e,a)=>{let n=h()(e.Start);return h()().hour(n.hour()).minute(n.minute()).toDate().getTime()>(new Date).getTime()&&!t[a]})[0];if(e)return h()(e.Start).format("HH:mm")}return"-"}getStage(){const{feeding:e}=this.state;try{return e.curve.eventStage}catch(t){return 0}}getCurveStart(){const{feeding:e}=this.state;try{return e.curve.start}catch(t){return 0}}getSkipDoses(){const{feeding:e}=this.state;try{return e.skipDoses}catch(t){return[0,0,0,0,0,0]}}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorLocation:n}=this.state;switch(t){case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.animalsNotFoundInLocation",{location:Object(ne.k)(n)});default:return""}}showCurveDayAndCorrection(){const{feeding:e}=this.state;return!(e&&e.curve&&0===e.curve.number&&"R"===e.workType)}render(){const{animal:e,loadingEvents:t,lastInsemination:a,plannedParturitionTime:n,page:r,cycle:s,parturition:o,averageBreak:l,todo:u,done:p,loadingUsage:O,show:A,location:T,devices:I,feeding:j,showError:S}=this.state,{location:{state:w},t:P}=this.props;if(!e)return i.a.createElement(m.default,null);let k=this.getCurveDay(),R=this.getCorrection(),F=this.getSchedule(),x=!j||j&&!j.feeding;return i.a.createElement("div",{className:"animal-information"},i.a.createElement(c.a,{breadcrumbs:[{name:"".concat(e.AnmNo1," ").concat(e.RFID?"(".concat(e.RFID,")"):"")}],home:!w||!w.back,back:w&&w.back}),i.a.createElement("div",{className:"h-100"},i.a.createElement(y.a,{page:r,onPageChange:this.onPageChange},i.a.createElement(D.a,null,i.a.createElement(d.a,{isLoading:O}),i.a.createElement(f.a,{className:x?"blur":null},i.a.createElement(b.a,{xs:5},P("feedingCurve"),":"),i.a.createElement(b.a,{xs:5},i.a.createElement("div",null,this.getCurve())),i.a.createElement(b.a,{xs:2},i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-cog fa-fw"}),onClick:this.onChangeCurveClick,disabled:!j}))),i.a.createElement(f.a,{className:x?"blur":null},i.a.createElement(b.a,{xs:5},P("curveDay"),":"),i.a.createElement(b.a,{xs:5},i.a.createElement("div",null,k)),i.a.createElement(b.a,{xs:2},this.showCurveDayAndCorrection()&&i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-cog fa-fw"}),onClick:this.onChangeDayClick,disabled:!j}))),i.a.createElement(f.a,{className:x?"blur":null},i.a.createElement(b.a,{xs:5},P("modals.feedingManageFeedingModal.doseCorrection"),":"),i.a.createElement(b.a,{xs:5},i.a.createElement("div",null,R,"%")),i.a.createElement(b.a,{xs:2},this.showCurveDayAndCorrection()&&i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-cog fa-fw"}),onClick:this.onChangeCorrectionClick,disabled:!j}))),j&&j.workType&&"R"!==j.workType&&i.a.createElement(f.a,{className:x?"blur":null},i.a.createElement(b.a,{xs:5},P("nextFeeding"),":"),i.a.createElement(b.a,{xs:5},i.a.createElement("div",null,this.getNextFeeding())),i.a.createElement(b.a,{xs:2},i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-cog fa-fw"}),onClick:this.onSkipDosesClick,disabled:!j||!F}))),i.a.createElement(f.a,{className:x?"blur":null},i.a.createElement(b.a,{xs:10},i.a.createElement("div",{className:"feeding"},i.a.createElement("div",{className:"feeding-today"},this.getUsageForToday()),this.getHistory())),i.a.createElement(b.a,{xs:2},j&&j.workType&&"R"!==j.workType&&i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-utensils fa-fw"}),onClick:this.onAdditionalFeedingClick,disabled:!1}))),!j&&i.a.createElement("div",{className:"no-feeding"},i.a.createElement("div",null,P("noFeeding"))),j&&!j.feeding&&i.a.createElement("div",{className:"no-feeding"},i.a.createElement("div",null,j.workType&&"R"===j.workType&&i.a.createElement("div",null,P("feedingNotConfigured")),j.workType&&"R"!==j.workType&&i.a.createElement("div",null,P("deviceRows.feeding.dispenserRow.stop")),i.a.createElement(E.a,{icon:i.a.createElement("i",{className:"far fa-cog fa-fw"}),onClick:this.onChangeCurveClick,disabled:!1})))),i.a.createElement(D.a,null,i.a.createElement(d.a,{isLoading:t}),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("location"),":"),i.a.createElement(b.a,{xs:6},T?T.name:"-")),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("age"),":"),i.a.createElement(b.a,{xs:6},i.a.createElement(g.a,{start:e.DtaBrthTime,stop:e.DtaDthTime||(new Date).getTime()}))),e.AnimalKind===N.a.SOW&&i.a.createElement(i.a.Fragment,null,i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("cycle"),":"),i.a.createElement(b.a,{xs:6},null!==s?s:"-")),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("lastInseminationDate"),":"),i.a.createElement(b.a,{xs:6},a?h()(a.EvTime).format("DD.MM.YYYY"):"-")),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("modals.feedingSowInfoModal.plannedParturitionDate"),":"),i.a.createElement(b.a,{xs:6},n?n.format("DD.MM.YYYY"):"-")),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("rfidApp.parturitionHistoryShort"),":"),i.a.createElement(b.a,{xs:6},o?"".concat(o.EvData.HealthyCnt," / ").concat(o.EvData.DeadCnt," / ").concat(o.EvData.MummyCnt):"- / - / -")),i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:6},P("rfidApp.sowIdleDays"),":"),i.a.createElement(b.a,{xs:6},l)))),i.a.createElement(D.a,null,i.a.createElement(d.a,{isLoading:t}),i.a.createElement(f.a,{className:"h-100"},i.a.createElement(b.a,{xs:6},i.a.createElement("h5",{className:"justify-content-center"},P("toDo")),i.a.createElement("ul",null,u.map((e,t)=>i.a.createElement("li",{key:t},i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:3},e.date.format("DD.MM")),i.a.createElement(C.a,{tooltipContent:e.text},i.a.createElement(b.a,{xs:9,className:"todo-text"},e.text))))))),i.a.createElement(b.a,{xs:6},i.a.createElement("h5",{className:"justify-content-center"},P("done")),i.a.createElement("ul",null,p.map((e,t)=>i.a.createElement("li",{key:t},i.a.createElement(f.a,null,i.a.createElement(b.a,{xs:3},e.date.format("DD.MM")),i.a.createElement(C.a,{tooltipContent:e.text},i.a.createElement(b.a,{xs:9,className:"todo-text"},e.text)))))))))),i.a.createElement(v.a,{in:"curve"===A,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(te,{sectorType:T?T.sectorType:null,devices:I,curve:this.getCurveObject(),onCloseClick:this.onCloseClick,workType:j?j.workType:null,animal:e,locationID:Object(ne.j)(T.location),onSuccess:this.onChangeSuccess,fakeData:j}))),i.a.createElement(v.a,{in:"day"===A,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(oe,{devices:I,curve:this.getCurveObject(),onCloseClick:this.onCloseClick,workType:j?j.workType:null,animal:e,locationID:Object(ne.j)(T.location),onSuccess:this.onChangeSuccess,stage:this.getStage(),curveStart:this.getCurveStart()}))),i.a.createElement(v.a,{in:"correction"===A,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(le,{devices:I,onCloseClick:this.onCloseClick,workType:j?j.workType:null,animal:e,locationID:Object(ne.j)(T.location),onSuccess:this.onChangeSuccess,offset:"string"===typeof R?0:R}))),i.a.createElement(v.a,{in:"skip"===A,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(pe,{devices:I,onCloseClick:this.onCloseClick,onSuccess:this.onChangeSuccess,locationID:Object(ne.j)(T.location),skipDoses:this.getSkipDoses(),schedule:F}))),i.a.createElement(v.a,{in:"additionalFeeding"===A,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(De,{devices:I,onCloseClick:this.onCloseClick,onSuccess:this.onChangeSuccess,locationID:Object(ne.j)(T.location)})))),i.a.createElement(Ae.a,{onCloseClick:this.onCloseErrorClick,error:this.getError(),show:S,type:"warning"}))}}je=Object(S.a)({findAnimalInLocation:!0})(je);t.a=Object(K.d)(Object(U.a)(),Object(o.connect)((function(e){return{farm:e.location.farm,loadingEvents:e.events.eventsForAnimalsLoading,events:e.events.eventsForAnimals,graftingPrograms:e.dictionary.graftingPrograms,medicines:e.dictionary.medicine,gateways:e.farmDevices.devices.filter(e=>e.DevType===j.d.GATEWAY),curves:Object(Z.c)(e).slice(0).sort((e,t)=>e.SetData.Index-t.SetData.Index),schedules:e.settings.feedingSchedules}})))(je)},i2bF:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("eXa9"),l=a("d/v1"),m=a("pJVQ"),u=a("hQYu"),d=a("3Z9Z"),p=a("JI6e"),h=a("pxzG"),g=a("eASP"),f=a("jjk5"),b=a("PRyg"),v=a("u5mR"),E=a("tkTQ");var y=a("5Z9N"),D=a("udB/"),O=a("10H7"),A=a("ANjH"),T=a("LCzB");class N extends s.Component{constructor(e){super(e),this.state={loading:this.props.location.state&&this.props.location.state.animals&&1===this.props.location.state.animals.length||!1,loadingState:this.props.loading};const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;1===e.length&&this.props.dispatch(Object(y.d)(e.map(e=>e.AnmID),{FarmID:a})),this.props.initialize({weight:0,amount:0,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}static getDerivedStateFromProps(e,t){const{location:{state:a},loading:n}=e;if(a&&1===a.animals.length&&!r()(t.loadingState,e.loadingState)){const{animals:e}=a;let t=e[0],r=e.length,s=n.get(t.AnmID);return void 0===s||s||r--,{loading:0!==r,loadingState:n}}return{loadingState:n}}componentDidUpdate(e,t,a){if(t.loading&&!this.state.loading){const{location:{state:e}}=this.props,{events:t}=this.props;let a=e.animals[0],n=(t.get(a.AnmID)||[]).sort((e,t)=>t.EvTime-e.EvTime),r=n.find(e=>e.EvCode===O.b.ACTIVE_NIPPLES);if(r){let e=n.find(e=>e.EvCode===O.b.PARTURITION);e&&+e.EvData.HealthyCnt>r.EvData.Nipples&&this.props.change("amount",+e.EvData.HealthyCnt-r.EvData.Nipples)}}}render(){const{handleSubmit:e,submitting:t,location:{state:a},error:n,submitFailed:r,farm:s,submitSucceeded:o,t:m}=this.props;if(!a)return null;const{animals:f}=a,{loading:b}=this.state;return i.a.createElement(c.a,{breadcrumbs:[{name:m("mommy"),link:"/".concat(s,"/mobile/events/mommy")},{name:m("rfidApp.getFromMommy")}],handleSubmit:e,submitting:t,submitFailed:r,error:n,formName:"mommyGet",status:a.status,eventType:a.eventType,counterName:"mommyGet",submitSucceeded:o},i.a.createElement(D.a,{isLoading:b}),1===f.length&&i.a.createElement("div",{className:"animal-info"},m("rfidApp.animalNumber"),": ",i.a.createElement("span",null,f[0].AnmNo1)),i.a.createElement(d.a,{className:"justify-content-center h-100"},i.a.createElement(p.a,{xs:8,className:"d-flex flex-column justify-content-center"},i.a.createElement("div",{className:"text-center"},m("rfidApp.pigletsTakenFromChamber"),":"),i.a.createElement(l.a,{name:"weight",component:u.a,label:m("weightWithUnit",{unit:Object(h.l)("weight",g.a.MEDIUM)})}),i.a.createElement(l.a,{name:"amount",component:u.a,label:m("rfidApp.amount")}))))}}t.a=Object(A.d)(Object(o.connect)((function(e){return{farm:e.location.farm,events:e.events.eventsForAnimals,loading:e.events.eventsForAnimalsLoading}})),Object(T.a)(),Object(m.a)({form:"mommyGet",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{t:n}=t;if(0===e.amount)a._error=n("rfidApp.amountError",{error:n("errors.lessVal",{count:1})});else for(let r of e.animals){let t=Object(b.getPigBalanceForSowFromState)(r,(new Date).getTime());e.amount>t&&(a._error=n("rfidApp.amountNotEnoughPiglets",{AnmNo1:r.AnmNo1}))}0===e.weight&&(a._error=n("rfidApp.weightError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new f.a(n);const{animals:r,amount:s,weight:i}=e,{history:o,farm:c,t:l}=a;console.log(r);let m=r.map(e=>({AnmID:e.AnmID,EvTime:(new Date).getTime(),GrID:Object(b.getGrIDByAnimal)(e,(new Date).getTime()),Piglets:s,Weight:Object(h.i)(i,{fromUnit:g.a.MEDIUM})}));return Object(v.a)(m).then(e=>{setTimeout(()=>{o.push({pathname:"/".concat(c,"/mobile/scanner"),state:{eventType:"mommy",status:"add",breadcrumbs:[{name:l("mommy"),link:"/".concat(c,"/mobile/events/mommy")},{name:l("rfidApp.getFromMommy")}],animalType:[E.a.SOW]}})},1500),t({type:"ADD_MOMMY_GET",payload:m})}).catch(e=>{throw new f.a({_error:l("rfidApp.mommyGeneralError")})})}}))(N)},"j+hm":function(e,t,a){},jC1x:function(e,t,a){},jGfq:function(e,t,a){"use strict";var n=a("UfWW"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("LCzB"),l=a("ANjH"),m=a("UNta"),u=a("n7pt"),d=a("kYAI"),p=a("kCVf"),h=a("AAik"),g=a("i8MS"),f=a("JUMO"),b=a("7xGa"),v=a("3xDe"),E=(a("tYrZ"),a("AF5L")),y=a("zDJl"),D=a("udB/"),O=(a("bmmJ"),a("uSQv")),A=(a("0sq6"),a("KYPV")),T=a("hQYu"),N=a("3Z9Z"),C=a("JI6e"),I=a("vmgh"),j=a("17x9"),S=a.n(j),w=a("n2uv"),P=a("Yh51");class k extends s.Component{constructor(...e){super(...e),this.onChangeExpectedTemperature=e=>{const{setFieldValue:t}=this.props;t("expectedTemperature",e)},this.onChangeMinAlarm=e=>{const{setFieldValue:t}=this.props;t("alarmMin",e)},this.onChangeMaxAlarm=e=>{const{setFieldValue:t}=this.props;t("alarmMax",e)},this.expectedTemperatureValueFormatter=e=>i.a.createElement(i.a.Fragment,null,e.toFixed(1),"\xb0C"),this.maxAlarmValueFormatter=e=>{const{values:t}=this.props;return i.a.createElement(i.a.Fragment,null,(e+t.expectedTemperature).toFixed(1),"\xb0C")}}render(){const{values:e,onCloseClick:t,handleSubmit:a,isSubmitting:n,status:r,t:s}=this.props;return i.a.createElement("div",{className:"rfid-location-climate-changes-modal"},i.a.createElement(m.a,{breadcrumbs:[{name:s("rfidApp.climateSettings")}]}),i.a.createElement(N.a,{className:"justify-content-center h-100"},i.a.createElement(C.a,{xs:8,className:"d-flex flex-column justify-content-center"},i.a.createElement(T.a,{label:s("chamber.chart.temperatureDesired"),input:{value:e.expectedTemperature,onChange:this.onChangeExpectedTemperature},valueFormatter:this.expectedTemperatureValueFormatter,step:.2,min:10,max:50}),i.a.createElement(T.a,{label:s("chamber.chart.minTemp"),input:{value:e.alarmMin,onChange:this.onChangeMinAlarm},valueFormatter:this.maxAlarmValueFormatter,step:.2,min:-4,max:-.2}),i.a.createElement(T.a,{label:s("chamber.chart.maxTemp"),input:{value:e.alarmMax,onChange:this.onChangeMaxAlarm},min:2,max:20,step:.2,valueFormatter:this.maxAlarmValueFormatter}))),i.a.createElement(O.a,{buttonStyle:"text",type:"button",className:"close",onClick:t},i.a.createElement("i",{className:"far fa-times-circle"})),i.a.createElement(O.a,{buttonStyle:"text",type:"button",className:"submit",onClick:a},i.a.createElement(I.a,{loading:n,success:"success"===r})))}}k.propTypes={onCloseClick:S.a.func.isRequired,climate:S.a.instanceOf(w.a)};var R=Object(l.d)(Object(c.a)(),Object(o.connect)((function(e,t){return{shadow:e.shadows.shadows.get(t.climate.DevID)}})),Object(A.c)({displayName:"rfidClimateChange",mapPropsToValues:e=>{try{return{expectedTemperature:e.shadow.configuration.requestedAirTemperature,alarmMin:-e.shadow.configuration.alarms.minimumTemperatureAlarmDeviation,alarmMax:e.shadow.configuration.alarms.maximumTemperatureAlarmDeviation}}catch(t){return{expectedTemperature:0,alarmMin:0,alarmMax:0}}},handleSubmit:function(e,t){return console.log(t),function(e,t){const{expectedTemperature:a,alarmMin:n,alarmMax:r}=e;return new Promise((e,s)=>{Object(P.c)(t.props.climate,{requestedAirTemperature:a,alarms:{minimumTemperatureAlarmDeviation:-n,maximumTemperatureAlarmDeviation:r}},e,s,!0)})}(e,t).then(e=>{setTimeout(()=>{t.setStatus("success"),t.props.onCloseClick()},1500)})}}))(k),F=a("kCmh"),x=a("/kok"),M=a("q17X"),L=a("zSa2"),G=a("vSUv"),B=a.n(G),H=a("KWeU");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 V(e){for(var t=1;t({animal:e})),loading:!0,show:!1,climate:null},this.messages={},this.onGetUsageForPigSuccess=e=>{console.log(e);const{CAnsw:t}=e,a=this.state.animals.slice(0);for(let n of t){let e=r()(a,e=>e.animal.AnmID===n.AnmID);a[e]=V({},a[e],{feeding:n.feeding})}this.messages[e.MsgId]=!1,this.setState({animals:this.sortArray(a),loading:!1})},this.onGetUsageForPigFailure=(e,t)=>{this.messages[t.MsgId]=!1;let a=!1;for(let n in this.messages)this.messages[n]&&(a=!0);a||this.setState({loading:!1})},this.feedingFormatter=e=>{if(!e||!e.amount)return"-";let t=e.got/e.amount*100;return i.a.createElement(f.a,{now:t},i.a.createElement("div",{role:"progressbar",className:"progress-bar ".concat(Object(v.e)(t)),"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,style:{width:"".concat(t,"%")}}),i.a.createElement("span",null,t.toFixed(1),"%"))},this.onRowClick=e=>{const{farm:t}=this.props;this.props.history.push({pathname:"/".concat(t,"/mobile/information/").concat(e.animal.AnmID),state:{back:!0}})},this.onTemperatureClick=()=>{this.setState({show:!0})},this.onCloseClick=()=>{this.setState({show:!1})};const{match:{params:{locationID:t}}}=this.props,{animals:a}=this.state;let n=a.map(e=>{const{animal:t}=e;return{AnmID:t.AnmID,PlcmntID:Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,RFID:t.RFID}});if(console.log(n),Object(M.isUsingFakeData)())this.messages.fake=!0,setTimeout(()=>{let e=[];for(let t=0;te.DevType===y.d.CLIMATE)||null;s&&(Object(M.isUsingFakeData)()&&(B.a.restore(),B.a.stub(x.a,"startSendingDeviceState").callsFake(H.b),B.a.stub(x.a,"createAndSendMessageObject").callsFake(H.a),this.timer=setInterval(()=>{Object(H.c)([s])},7e3)),x.a.startSendingDeviceState([s])),this.state=V({},this.state,{climate:s})}sortFunction(e,t){if(!e.feeding)return 1;if(!t.feeding)return-1;return e.feeding.got/e.feeding.amount-t.feeding.got/t.feeding.amount}sortArray(e){return e.sort((e,t)=>this.sortFunction(e,t))}getTemperature(){const{climate:e}=this.state,{shadows:t}=this.props;try{let a=t.get(e.DevID);return i.a.createElement(i.a.Fragment,null,a.ambientConditions.averageCurrentAirTemperature,"\xb0C")}catch(a){return i.a.createElement(i.a.Fragment,null,"-\xb0C")}}render(){const{shadows:e,t:t}=this.props,{location:a,animals:n,loading:r,show:s,climate:o}=this.state;if(!a)return i.a.createElement(d.default,null);let c=e.get(o?o.DevID:"");const l=[{name:t("animalNumber"),field:"animal.AnmNo1"},{name:t("today"),field:"feeding[0]",valueFormatter:this.feedingFormatter,itemClassName:"d-flex"},{name:"-1",field:"feeding[1]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-2",field:"feeding[2]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-3",field:"feeding[3]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-4",field:"feeding[4]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-5",field:"feeding[5]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"},{name:"-6",field:"feeding[6]",valueFormatter:this.feedingFormatter,itemClassName:"feeding",headerClassName:"feeding"}];return i.a.createElement("div",{className:"search location"},i.a.createElement(D.a,{isLoading:r}),i.a.createElement(m.a,{breadcrumbs:[{name:Object(p.k)(a)}],home:!0}),i.a.createElement(h.a,{data:n,headers:l,onRowClick:this.onRowClick}),o&&i.a.createElement(O.a,{className:"climate-info",onClick:this.onTemperatureClick,buttonStyle:"text",disabled:!c},i.a.createElement("i",{className:"far fa-thermometer-half"}),i.a.createElement("span",null,this.getTemperature())),i.a.createElement(b.a,{in:s,unmountOnExit:!0,mountOnEnter:!0},i.a.createElement("div",null,i.a.createElement(R,{onCloseClick:this.onCloseClick,climate:o}))))}}t.a=Object(l.d)(Object(c.a)(),Object(o.connect)((function(e){return{farm:e.location.farm,gateways:e.farmDevices.devices.filter(e=>e.DevType===y.d.GATEWAY),shadows:e.shadows.shadows}})))(K)},jcAX:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eAv4"),o=a("E0aH"),c=a("tkTQ"),l=a("PRyg"),m=a("U62w"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{match:{params:{status:a}}}=this.props,{animalsToSave:n,animals:r}=this.state;let s=(t?r:n).map(t=>({AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime()),Pregnant:"positive"===a}));return Object(m.a)(s).then(e=>{this.props.dispatch({type:"ADD_USG",payload:s})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return"Nie uda\u0142o si\u0119 zg\u0142osi\u0107 badania USG";case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},match:{params:t},farm:a,t:n}=this.props;if(!e)return null;const{status:s}=e,{animals:i,show:l,error:m}=this.state;let u="positive"===t.status;return r.a.createElement(o.a,{breadcrumbs:[{name:n("usg"),link:"/".concat(a,"/mobile/events/usg")},{name:n("testResult")}],eventType:"usg",text:r.a.createElement(d.a,{i18nKey:"rfidApp.usgText",count:i.length,values:{result:n(u?"events.usgEvent.positive":"events.usgEvent.negative"),AnmNo1:i[0].AnmNo1},components:{b:r.a.createElement("strong",null)}}),status:s,additionalText:n("rfidApp.usgAdditionalText",{count:i.length}),animals:i,onSubmit:this.onSubmit,additionalState:{animalType:[c.a.SOW]},counterName:"usg",error:this.getError(),showError:l,closeError:this.onCloseClick,errorType:0===m?"error":"warning"})}}h=Object(i.a)({findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,user:e.user.user}})),Object(p.a)())(h)},jfHD:function(e,t,a){},kfzW:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=(a("WtK+"),a("17x9")),o=a.n(i),c=a("uSQv"),l=a("Ty5D"),m=a("ANjH"),u=a("LCzB");class d extends n.Component{constructor(...e){super(...e),this.state={opened:!1},this.container=r.a.createRef(),this.onOutsideClick=e=>{const{opened:t}=this.state;t&&!this.container.current.contains(e.target)&&this.onOpenMenuClick()},this.onOpenMenuClick=()=>{this.setState(e=>({opened:!e.opened}),()=>{this.props.onOpenedChange(this.state.opened)})},this.onLogoutClick=()=>{const{farm:e,history:t,dispatch:a}=this.props;a({type:"SHOW_NAVIGATION"}),t.push("/".concat(e,"/farm/general")),document.getElementsByTagName("body")[0].classList.remove("rfid-app")},this.onHistoryClick=()=>{const{farm:e,history:t}=this.props;t.push("/".concat(e,"/mobile/history"))}}componentDidMount(){document.addEventListener("mousedown",this.onOutsideClick)}componentWillUnmount(){document.removeEventListener("mousedown",this.onOutsideClick)}render(){const{opened:e}=this.state,{onEditClick:t,t:a}=this.props;return r.a.createElement("div",{className:e?"rfid-scanner-left-bar opened":"rfid-scanner-left-bar",ref:this.container},r.a.createElement("div",{className:"left-bar-header"},r.a.createElement("i",{className:"far fa-bars",onClick:this.onOpenMenuClick})),r.a.createElement("div",{className:"left-bar-container"},r.a.createElement("div",{className:"left-bar-icons"},r.a.createElement("div",{className:"left-bar-item",onClick:this.onHistoryClick},r.a.createElement("i",{className:"far fa-history fa-fw"})),r.a.createElement("div",{className:"left-bar-item",onClick:t},r.a.createElement("i",{className:"far fa-cog fa-fw"}))),r.a.createElement("div",{className:"left-bar-opened-info"},r.a.createElement(c.a,{buttonStyle:"text",className:"logout",icon:r.a.createElement("i",{className:"far fa-power-off"}),onClick:this.onLogoutClick}),r.a.createElement("div",{className:"left-bar-item",onClick:this.onHistoryClick},r.a.createElement("div",null,a("history"))),r.a.createElement("div",{className:"left-bar-item",onClick:t},r.a.createElement("div",null,a("rfidApp.editMainView"))))))}}d.propTypes={onOpenedChange:o.a.func.isRequired,onEditClick:o.a.func.isRequired};var p=Object(m.d)(Object(s.connect)((function(e){return{farm:e.location.farm,hasAccess:e.view.showBreeding}})),l.o,Object(u.a)())(d),h=(a("HMXA"),a("5tiW")),g=a("hN/4"),f=a("FlbQ"),b=a("gxzs"),v=a("lXf0"),E=a("4wAs"),y=a("Lqnr"),D=a("o7nW"),O=a("Urc6"),A=a("ZdXc"),T=a("O9J6"),N=a("i0N+"),C=a("lHhd"),I=a("2HEh"),j=(a("ml0E"),a("B5br"),a("S8cm")),S=a("7xGa"),w=a("wd/R"),P=a.n(w),k=a("55Ip");class R extends n.Component{constructor(e){super(e),this.state={width:0,show:!0},this.icon=r.a.createRef(),this.onWindowResize=()=>{console.log("resize"),this.setState({width:this.getHeightOfIcon()})},this.onClick=e=>{this.setState(e=>({show:!e.show}),()=>{const{cookies:e,eventName:t}=this.props;let a=e.get("eventItems")||{};a[t]=this.state.show,e.set("eventItems",a,{path:"/",expires:P()().add(1,"year").toDate()})}),e.preventDefault()};const{cookies:t,eventName:a}=this.props;let n=t.get("eventItems");n&&(this.state={width:0,show:void 0===n[a]||n[a]})}componentDidMount(){this.setState({width:this.getHeightOfIcon()}),window.addEventListener("resize",this.onWindowResize)}componentDidUpdate(e,t,a){e.edit===this.props.edit||this.state.show||this.setState({width:this.getHeightOfIcon()})}componentWillUnmount(){window.removeEventListener("resize",this.onWindowResize)}getHeightOfIcon(){return this.icon.current?this.icon.current.clientHeight:0}getClassName(){const{disablePointerEvents:e,edit:t}=this.props,{show:a}=this.state;let n="event-item";return e&&(n+=" no-pointer-events"),t&&!a&&(n+=" opacity-50"),n}renderData(e){const{name:t,icon:a,edit:n}=this.props,{width:s,show:i}=this.state;return r.a.createElement("div",{className:this.getClassName(),onClick:e?this.onClick:null},r.a.createElement("div",{className:"event-item-icon"},r.a.createElement("div",{className:"event-item-icon-container",ref:this.icon,style:{width:s}},r.a.createElement("img",{src:a,alt:t}),r.a.createElement(S.a,{in:n,unmountOnExit:!0},r.a.createElement("div",{className:"event-item-icon-container-checkbox"},r.a.createElement(j.a,{label:"",checked:i}))))),r.a.createElement("div",{className:"event-item-title"},t))}render(){const{edit:e,farm:t,eventName:a,path:n,state:s,disablePointerEvents:i}=this.props,{show:o}=this.state;return e||o?e?this.renderData(!0):r.a.createElement(k.Link,{to:{pathname:n||"/".concat(t,"/mobile/events/").concat(a),state:s},className:"event-link".concat(i?" no-pointer-events":"")},this.renderData(!1)):null}}R.propTypes={name:o.a.string.isRequired,icon:o.a.node.isRequired,eventName:o.a.string.isRequired,disablePointerEvents:o.a.bool,edit:o.a.bool,path:o.a.string},R=Object(I.a)(R);var F=Object(s.connect)((function(e){return{farm:e.location.farm}}))(R),x=a("VyNe");class M extends n.Component{getColumnsNumber(){const{cookies:e,items:t,edit:a}=this.props;if(a)return Math.ceil(t.length/2);let n=e.get("eventItems")||{},r={};for(let i of t){let e=n[i.eventName];void 0===e&&(e=!0),r[i.eventName]=e}let s=Object.keys(r).reduce((e,t)=>e+ +!r[t],0);return Math.ceil((t.length-s)/2)}render(){const{name:e,items:t,menuOpened:a,edit:n}=this.props;let s=this.getColumnsNumber();return 0===s?null:r.a.createElement(x.a,{className:"group-events"},r.a.createElement("div",{className:"group-events-name"},e),r.a.createElement("div",{className:"group-events-icons",style:{gridTemplateColumns:"repeat(".concat(s,", 10rem")}},t.map((e,t)=>r.a.createElement(F,{eventName:e.eventName,name:e.name,icon:e.icon,key:t,disablePointerEvents:a,edit:n,path:e.path,state:e.state}))))}}M.propTypes={name:o.a.string.isRequired,items:o.a.array.isRequired,menuOpened:o.a.bool,edit:o.a.bool};var L=Object(I.a)(M),G=a("cufz"),B=a("eAv4"),H=a("LfcS"),W=a("ydgf"),V=a("tkTQ"),U=a("Iugh"),K=a("5/vq"),z=a("H+s/"),_=a("hGE3"),q=a("RutU"),Q=a("UltZ"),Y=a("kCVf");class Z extends n.Component{constructor(...e){super(...e),this.state={menuOpened:!1,edit:!1,show:!1,error:null,errorTag:null,errorLocation:null},this.onMenuOpenedChange=e=>{this.setState({menuOpened:e})},this.onEditClick=()=>{this.setState(e=>({edit:!e.edit}))},this.onCloseClick=()=>{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidUpdate(e,t,a){this.props.tagReader.tag!==e.tagReader.tag&&this.props.tagReader.tag&&(this.props.tagReader.animal||this.props.tagReader.location?this.props.tagReader.animal?this.props.history.push("/".concat(this.props.farm,"/mobile/information/").concat(this.props.tagReader.animal.AnmID)):this.props.tagReader.location&&(this.props.tagReader.manyAnimalsInLocation?this.props.history.push("/".concat(this.props.farm,"/mobile/locationInformation/").concat(Object(Y.j)(this.props.tagReader.location))):this.setState({show:!0,error:1,errorLocation:this.props.tagReader.location})):this.setState({show:!0,error:0,errorTag:this.props.tagReader.tag}))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorLocation:n}=this.state;switch(t){case 0:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 1:return e("rfidApp.noAnimalsFound",{location:Object(Y.k)(n)});default:return""}}render(){const{farm:e,hasAccess:t,t:a}=this.props,{menuOpened:n,edit:s,show:i}=this.state,o=[{name:a("insertion"),icon:H.a,eventName:"insertion",show:!0},{name:a("transfer"),icon:D.a,eventName:"transfer",show:!0},{name:a("weighting"),icon:N.a,eventName:"weighting",show:t},{name:a("reclassify"),icon:W.a,eventName:"reclassify",path:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:a("reclassify")}],animalType:V.a.PORKER,eventType:"reclassify",status:"add"},show:t},{name:a("searching"),icon:q.a,eventName:"search",show:!0},{name:a("rfidApp.lostEarringTitle"),icon:Q.a,eventName:"change",path:"/".concat(e,"/mobile/animalChooser"),state:{breadcrumbs:[{name:a("rfidApp.lostEarringTitle")}],eventType:"change",status:"rfid",singleSelect:!0},show:!0}];let c=[{name:a("treatment"),icon:E.a,eventName:"grafting"},{name:a("scheduleOfTreatment"),icon:U.default,eventName:"treatment",path:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:a("scheduleOfTreatment")}],eventType:"treatment",status:"medicine"}},{name:a("pigletsTreatment"),icon:K.a,eventName:"graftingPiglets"},{name:a("rfidApp.checkGrafting"),icon:K.a,eventName:"checkGrafting",path:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:a("rfidApp.checkGrafting")}],eventType:"checkGrafting",status:"animal"}}];const l=[{name:a("insemination"),icon:h.default,eventName:"insemination"},{name:a("usg"),icon:f.a,eventName:"usg"},{name:a("noPregnancy"),icon:b.a,eventName:"noPregnancy"},{name:a("heat"),icon:z.a,eventName:"heat"}],m=[{name:a("parturition"),icon:g.default,eventName:"parturition"},{name:a("rfidApp.separation"),icon:v.default,eventName:"separationToPigletHouse"},{name:a("mommy"),icon:T.default,eventName:"mommy"},{name:a("activeNipples"),icon:C.a,eventName:"activeNipples",path:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:a("activeNipples")}],eventType:"activeNipples",status:"add",animalType:[V.a.SOW,V.a.RENOVATION_SOW]}}],u=[{name:a("fallPiglets"),icon:y.default,eventName:"fallPiglets"},{name:a("fall"),icon:O.a,eventName:"fall"}],d=[{name:a("sale"),icon:G.a,eventName:"sell"},{name:a("selection"),icon:A.a,eventName:"selection"}];return r.a.createElement("div",{className:"mobile-rfid-scanner"},r.a.createElement(p,{onOpenedChange:this.onMenuOpenedChange,onEditClick:this.onEditClick}),r.a.createElement("div",{className:"mobile-rfid-scanner-container"},r.a.createElement("div",{className:"mobile-rfid-scanner-grid"},r.a.createElement(L,{name:a("general"),items:o,menuOpened:n,edit:s}),r.a.createElement(L,{name:a("treatment"),items:c,menuOpened:n,edit:s}),r.a.createElement(L,{name:a("menu.procreation"),items:l,menuOpened:n,edit:s}),r.a.createElement(L,{name:a("menu.parturition"),items:m,menuOpened:n,edit:s}),r.a.createElement(L,{name:a("falls"),items:u,menuOpened:n,edit:s}),r.a.createElement(L,{name:a("sale"),items:d,menuOpened:n,edit:s}))),r.a.createElement(_.a,{onCloseClick:this.onCloseClick,error:this.getError(),show:i}))}}Z=Object(I.a)(Z),Z=Object(B.a)({findAnimalInLocation:!0})(Z);t.a=Object(m.d)(Object(s.connect)((function(e){return{farm:e.location.farm,hasAccess:e.view.showBreeding}})),Object(u.a)())(Z)},lQXj:function(e,t,a){},ml0E:function(e,t,a){},nA2k:function(e,t,a){},nBOt:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("eXa9"),o=a("d/v1"),c=a("pJVQ"),l=a("SobL"),m=a("3Z9Z"),u=a("JI6e"),d=a("uSQv"),p=a("jjk5"),h=a("i8MS");a("jC1x");var g=a("ANjH"),f=a("LCzB");class b extends n.Component{constructor(e){super(e),this.props.initialize({number:this.props.number})}render(){const{submitting:e,error:t,submitFailed:a,handleSubmit:n,onClose:s,isTaken:c,number:p,t:h}=this.props;return r.a.createElement(i.a,{breadcrumbs:[],formName:"changeNumber",submitting:e,error:t,submitFailed:a,handleSubmit:n},r.a.createElement(m.a,{className:"justify-content-center h-100"},r.a.createElement(u.a,{xs:8},r.a.createElement(o.a,{name:"number",component:l.a,label:c?h("rfidApp.takenNumber",{number:p}):h("animalNumber")}))),!c&&r.a.createElement(d.a,{buttonStyle:"text",type:"button",className:"custom-close",onClick:s},r.a.createElement("i",{className:"far fa-times-circle"})))}}b=Object(c.a)({form:"changeNumber",onSubmit:function(e,t,a){const n=function(e,t){const a={},{t:n}=t;e.number?(h.a.checkIfAnimalExistOnFarm(e.number+"",t.farm)||h.a.checkIfAnimalExistOnFarm((e.number+"").padStart(4,"0"),t.farm))&&(a._error=n("rfidApp.animalNumberError",{error:(e.number+"").padStart(4,"0")+" "+n("errors.exist")})):a._error=n("rfidApp.animalNumberError",{error:n("required")});return a}(e,a);if(n._error)throw new p.a(n);a.onSubmitDone(e.number,a),a.onClose()}})(b);t.a=Object(g.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(f.a)())(b)},nvgG:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("JPoY"),l=a("PkbN"),m=a("hQYu"),u=a("d/v1"),d=a("pJVQ"),p=a("wd/R"),h=a.n(p),g=a("eXa9"),f=a("jjk5"),b=a("PRyg"),v=a("pKOT"),E=a("tkTQ");a("tLZU");var y=a("5Z9N"),D=a("udB/"),O=a("10H7"),A=a("ANjH"),T=a("LCzB");class N extends s.Component{constructor(e){super(e),this.state={page:0,loading:!0},this.onPageChange=e=>{this.setState({page:e})},this.typeFormatter=e=>{const{t:t}=this.props;switch(e){case O.c.LOW:return t("low");case O.c.MEDIUM:return t("medium");case O.c.HARD:return t("hard");default:return""}};const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.dispatch(Object(y.c)(e[0])),this.props.initialize({alive:14,dead:0,mummy:0,temperature:37.2,falls:0,type:0,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){if(!r()(this.props.loadingEvents,e.loadingEvents)){const{location:{state:{animals:e}}}=this.props;if(!this.props.loadingEvents.get(e[0].AnmID)){let t=this.props.events.get(e[0].AnmID).filter(e=>(e.EvCode===O.b.PARTURITION||e.EvCode===O.b.SEPARATION)&&e.EvTime<(new Date).getTime());if(t.sort((e,t)=>t.EvTime-e.EvTime),t.length>0&&t[0].EvCode===O.b.PARTURITION){let a=t[0];this.props.initialize({alive:a.EvData.HealthyCnt||14,dead:a.EvData.DeadCnt||0,mummy:a.EvData.MummyCnt||0,temperature:37.2,falls:0,type:0,animals:e})}this.setState({loading:!1})}}}render(){const{page:e,loading:t}=this.state,{handleSubmit:a,submitting:n,location:{state:r},submitFailed:s,error:o,farm:d,submitSucceeded:p,t:f}=this.props;if(!r)return null;const{animals:b}=r;return console.log(this.props),i.a.createElement(g.a,{breadcrumbs:[{name:f("parturition"),link:"/".concat(d,"/mobile/events/parturition")},{name:f("rfidApp.status")}],handleSubmit:a,additionalData:i.a.createElement("small",null,f("rfidApp.parturitionStart",{date:h()().format("DD.MM.YYYY HH:mm")})),submitting:n,className:"parturition",submitFailed:s,error:o,formName:"parturition-status",status:r.status,eventType:r.eventType,counterName:"parturition",submitSucceeded:p,additionalState:{animalType:[E.a.SOW]}},i.a.createElement(D.a,{isLoading:t}),1===b.length&&i.a.createElement("div",{className:"animal-info"},"zwierz\u0119 nr: ",i.a.createElement("span",null,b[0].AnmNo1)),i.a.createElement(c.a,{page:e,onPageChange:this.onPageChange},i.a.createElement(l.a,null,i.a.createElement(u.a,{name:"alive",component:m.a,label:f("alive")}),i.a.createElement(u.a,{name:"dead",component:m.a,label:f("dead")}),i.a.createElement(u.a,{name:"mummy",component:m.a,label:f("mummies")})),i.a.createElement(l.a,null,i.a.createElement(u.a,{name:"temperature",component:m.a,label:f("temperatureShort"),step:.1}),i.a.createElement(u.a,{name:"falls",component:m.a,label:f("menu.fall")}),i.a.createElement(u.a,{name:"type",component:m.a,label:f("difficulty"),min:0,max:2,valueFormatter:this.typeFormatter}))))}}t.a=Object(A.d)(Object(o.connect)((function(e){return{farm:e.location.farm,events:e.events.eventsForAnimals,loadingEvents:e.events.eventsForAnimalsLoading}})),Object(T.a)(),Object(d.a)({form:"parturition-status",onSubmit:function(e,t,a){console.log(e);let n=function(e,t){const a={},{t:n}=t;0===e.alive&&(a._error=n("rfidApp.aliveError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new f.a(n);const{animals:r,alive:s,dead:i,mummy:o,temperature:c,falls:l,type:m}=e,{history:u,farm:d,t:p}=a;let h=r.map(e=>({AnmID:e.AnmID,EvTime:(new Date).getTime(),GrID:Object(b.getGrIDByAnimal)(e,(new Date).getTime()),DeadCnt:i,HealthyCnt:s,MummyCnt:o,Weight:0,Temperature:c,Falls:l,Type:m}));return Object(v.a)(h).then(e=>{setTimeout(()=>{u.push({pathname:"/".concat(d,"/mobile/scanner"),state:{eventType:"parturition",status:"status",breadcrumbs:[{name:p("parturition"),link:"/".concat(d,"/mobile/events/parturition")},{name:p("rfidApp.status")}],animalType:[E.a.SOW],singleSelect:!0}})},1500),t({type:"ADD_PARTURITION",payload:h})}).catch(e=>{throw new f.a({_errors:p("rfidApp.parturitionGeneralError")})})}}))(N)},pIGC:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=a("MAs2"),u=(a("pUGO"),a("ANjH")),d=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.state={page:0},this.onPageChange=e=>{this.setState({page:e})}}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(c.a,{page:n,onPageChange:this.onPageChange,title:a("rfidApp.chooseReason")+":"},this.splitReasons(e).map((e,n)=>r.a.createElement(l.a,{key:n},e.map((e,n)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(t,"/mobile/scanner"),key:n,state:{eventType:"weighting",status:e.ID,breadcrumbs:[{name:a("weighting"),link:"/".concat(t,"/mobile/events/weighting")},{name:e.Value}]}}))))))}}t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm,weightingReasons:e.dictionary.weighting.WData[e.language.lang.lang]}})),Object(d.a)())(p)},pUGO:function(e,t,a){},q3Os:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("NOo4"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>({AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime())}));return Object(m.e)(r).then(e=>{this.props.dispatch({type:"ADD_TO_REPEAT_INSEMINATION",payload:r})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.toRepeatGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{status:n}=e,{animals:s,show:o,error:l}=this.state;return r.a.createElement(i.a,{breadcrumbs:[{name:a("usg"),link:"/".concat(t,"/mobile/events/usg")},{name:a("events.usgEvent.toRepeat")}],eventType:"usg",text:r.a.createElement(d.a,{i18nKey:"rfidApp.toRepeatText",count:s.length,values:{AnmNo1:s[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),status:n,additionalText:a("rfidApp.toRepeatAdditionalText",{count:s.length}),animals:s,onSubmit:this.onSubmit,additionalState:{animalType:[c.a.SOW]},counterName:"toRepeat",closeError:this.onCloseClick,showError:o,error:this.getError(),errorType:0===l?"error":"warning"})}}h=Object(o.a)({findAnimalInLocation:!0})(h),t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(p.a)())(h)},q4jl:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("r8wt"),l=(a("2Qla"),a("ANjH")),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("medicalFeed")}],additionalData:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{name:t("rfidApp.start"),href:"/".concat(e,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(c.b.FORAGE,"/add"),breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("medicalFeed")}],medicineType:c.b.FORAGE,locationNextPath:"/".concat(e,"/mobile/medicineChooser"),locationScannerOnlyChambers:!0}}),r.a.createElement(o.a,{name:t("rfidApp.end"),href:"/".concat(e,"/mobile/locationScanner"),state:{eventType:"grafting",status:"".concat(c.b.FORAGE,"/end"),breadcrumbs:[{name:t("treatment"),link:"/".concat(e,"/mobile/events/grafting")},{name:t("medicalFeed")}],medicineType:c.b.FORAGE,locationScannerOnlyChambers:!0}}))},r.a.createElement(o.a,{name:t("dosatron"),href:"/".concat(e,"/mobile/events/grafting/dosatron")}),r.a.createElement(o.a,{name:t("grafting"),href:"/".concat(e,"/mobile/events/grafting/vaccine")}),r.a.createElement(o.a,{name:t("medicalFeed"),href:"/".concat(e,"/mobile/events/grafting/forage"),selected:!0}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},qNCt:function(e,t,a){},qYYQ:function(e,t,a){},qrsb:function(e,t,a){},r183:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("i8MS"),o=a("n7pt"),c=a("msTn"),l=a("I8zd"),m=a("w8T5"),u=a("ANjH"),d=a("LCzB");function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function h(e){for(var t=1;ti.a.getAnimalById(e)).filter(e=>!!e&&!e.DtaDthTime);for(let e of t)if(Array.isArray(e.PlcmntID))for(let t of e.PlcmntID){let e=o.a.getTreeByLocationID(t.PlcmntID);e&&e.chamber&&n.set(e.chamber.CID,{value:e.chamber,name:e.chamber.CName,type:e.sector.SType})}else{let t=o.a.getTreeByLocationID(e.PlcmntID);t&&t.chamber&&n.set(t.chamber.CID,{value:t.chamber,name:t.chamber.CName,type:t.sector.SType})}}else{let e=o.a.getAllChambersForSTypeWithLocation(c.a.PIGLET_HOUSE,a).filter(e=>0===i.a.getAllAnimalsForLocation(e,l.a.CHAMBER).length);for(let t of e)n.set(t.CID,{value:t,name:t.CName,type:c.a.PIGLET_HOUSE})}this.state=h({},this.state,{locations:[...n.values()]})}else this.props.history.push("/".concat(a,"/mobile"))}getClassName(e){switch(e){case c.a.DELIVERY:return"birth";case c.a.MATING:return"mating";case c.a.SOWS:return"sows";case c.a.PIGLET_HOUSE:return"piglets";default:return"other"}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{locations:n}=this.state,{group:s}=e;return r.a.createElement(m.a,{location:{state:h({},e,{locationNextPath:s?null:"/".concat(t,"/mobile/animalChooser/newAnimal"),breadcrumbs:[{name:a("rfidApp.separation"),link:"/".concat(t,"/mobile/events/separationToPigletHouse")},{name:"Komora",link:{pathname:"/".concat(t,"/mobile/locationScanner"),state:e}},{name:a("group"),link:{pathname:"/".concat(t,"/mobile/groupScanner"),state:e}},{name:a("rfidApp.toPlace")}],locations:n,saveName:"locationTo"})}})}}t.a=Object(u.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(d.a)())(f)},rNy8:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("tkTQ"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("testResult")}],additionalData:r.a.createElement(r.a.Fragment,null,r.a.createElement(o.a,{name:t("events.usgEvent.positive"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"result/positive",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("testResult")}],animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}),r.a.createElement(o.a,{name:t("events.usgEvent.negative"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"result/negative",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("testResult")}],animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}))},r.a.createElement(o.a,{name:t("check"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"check",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("check")}],animalType:[c.a.SOW,c.a.RENOVATION_SOW],singleSelect:!0}}),r.a.createElement(o.a,{name:t("testResult"),href:"/".concat(e,"/mobile/events/usg/result"),selected:!0}),r.a.createElement(o.a,{name:t("events.usgEvent.toRepeat"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"usg",status:"repeat",breadcrumbs:[{name:t("usg"),link:"/".concat(e,"/mobile/events/usg")},{name:t("events.usgEvent.toRepeat")}],animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},tLZU:function(e,t,a){},tP7z:function(e,t,a){},tYrZ:function(e,t,a){},u07V:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=(a("Q+eR"),a("3Z9Z")),o=a("JI6e"),c=a("d/v1"),l=a("pJVQ"),m=a("hQYu"),u=a("eXa9"),d=a("jjk5"),p=a("PRyg"),h=a("VVij");var g=a("ANjH"),f=a("LCzB");class b extends n.Component{constructor(e){super(e);const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=t;this.props.initialize({amount:14,animals:e})}else this.props.history.push("/".concat(a,"/mobile"))}render(){const{location:{state:e},handleSubmit:t,submitting:a,submitFailed:n,error:s,submitSucceeded:l,t:d}=this.props;if(!e)return null;const{animals:p}=e;return r.a.createElement(u.a,{breadcrumbs:[{name:d("activeNipples")}],handleSubmit:t,submitting:a,submitFailed:n,error:s,formName:"activeNipples",status:e.status,eventType:e.eventType,counterName:"activeNipples",submitSucceeded:l},r.a.createElement(i.a,{className:"justify-content-center h-100"},r.a.createElement(o.a,{xs:8,className:"d-flex flex-column justify-content-center align-items-center w-100"},r.a.createElement("div",null,d("rfidApp.amountOfActiveNipples"),":"),r.a.createElement(c.a,{name:"amount",component:m.a,label:d("rfidApp.amount")}))),1===p.length&&r.a.createElement("div",{className:"animal-info"},d("rfidApp.animalNumber"),": ",r.a.createElement("span",null,p[0].AnmNo1)))}}t.a=Object(g.d)(Object(s.connect)((function(e){return{farm:e.location.farm,fallReasons:e.dictionary.fallReasons.WData[e.language.lang.lang],user:e.user.user}})),Object(f.a)(),Object(l.a)({form:"activeNipples",onSubmit:function(e,t,a){let n=function(e,t){const a={},{t:n}=t;0===e.amount&&(a._error=n("rfidApp.amountOfActiveNipplesError",{error:n("errors.lessVal",{count:1})}));return a}(e,a);if(n._error)throw new d.a(n);const{animals:r,amount:s}=e,{farm:i,history:o,t:c}=a;let l=r.map(e=>({AnmID:e.AnmID,EvTime:(new Date).getTime(),GrID:Object(p.getGrIDByAnimal)(e,(new Date).getTime()),Nipples:s}));return Object(h.a)(l).then(e=>{setTimeout(()=>{o.push({pathname:"/".concat(i,"/mobile/scanner"),state:{breadcrumbs:[{name:c("activeNipples")}],eventType:"activeNipples",status:"add"}})},1500),t({type:"ADD_ACTIVE_NIPPLES",payload:l})}).catch(e=>{throw new d.a({_error:c("rfidApp.activeNipplesGeneralError")})})}}))(b)},vmgh:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("LCzB"),o=a("ANjH"),c=(a("tP7z"),a("17x9")),l=a.n(c);class m extends n.Component{constructor(...e){super(...e),this.state={endAnimation:!1}}componentDidUpdate(e,t,a){this.props.loading!==e.loading&&this.props.loading&&this.setState({endAnimation:!1}),this.props.success!==e.success&&this.props.success&&setTimeout(()=>{this.setState({endAnimation:!0})},1e3)}getClassName(){const{loading:e,success:t}=this.props,{endAnimation:a}=this.state;return a?"loader success end":e?"loader spin":t?"loader success":"loader"}render(){return r.a.createElement("div",{className:this.getClassName()},r.a.createElement("svg",{viewBox:"0 0 200 200",xmlns:"http://www.w3.org/2000/svg"},r.a.createElement("circle",{cx:"100",cy:"100",r:"88",stroke:"currentColor",strokeWidth:"20",fill:"none",className:"path",shapeRendering:"geometricPrecision"}),r.a.createElement("circle",{className:"fill",fill:"none",stroke:"currentColor",strokeWidth:"20",strokeMiterlimit:"10",cx:"100",cy:"100",r:"88",shapeRendering:"geometricPrecision"}),r.a.createElement("polyline",{className:"check",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeMiterlimit:"10",points:"150,70 86,132 50,100 ",shapeRendering:"geometricPrecision"})))}}m.propTypes={loading:l.a.bool,success:l.a.bool},m.defaultProps={loading:!1},t.a=Object(o.d)(Object(i.a)(),Object(s.connect)((function(e){return{farm:e.location.farm}})))(m)},"wb+A":function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("ANjH"),l=a("LCzB");class m extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("treatment")}]},r.a.createElement(o.a,{name:t("dosatron"),href:"/".concat(e,"/mobile/events/grafting/dosatron")}),r.a.createElement(o.a,{name:t("grafting"),href:"/".concat(e,"/mobile/events/grafting/vaccine")}),r.a.createElement(o.a,{name:t("medicalFeed"),href:"/".concat(e,"/mobile/events/grafting/forage")}))}}t.a=Object(c.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(l.a)())(m)},x6gN:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("MAs2"),o=a("44Gh"),c=a("tkTQ"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(o.a,{breadcrumbs:[{name:t("heat")}]},r.a.createElement(i.a,{name:t("toInsemination"),href:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("heat"),link:"/".concat(e,"/mobile/events/heat")},{name:t("toInsemination")}],eventType:"heat",status:"toInsemination",animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}),r.a.createElement(i.a,{name:t("heatExamination"),href:"/".concat(e,"/mobile/scanner"),state:{breadcrumbs:[{name:t("heat"),link:"/".concat(e,"/mobile/events/heat")},{name:t("heatExamination")}],eventType:"heat",status:"heatExamination",animalType:[c.a.SOW,c.a.RENOVATION_SOW]}}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},xKf4:function(e,t,a){"use strict";var n=a("Y+p1"),r=a.n(n),s=a("q1tI"),i=a.n(s),o=a("/MKj"),c=a("eAv4"),l=(a("LGmO"),a("UNta")),m=a("3Z9Z"),u=a("JI6e"),d=a("55Ip"),p=a("i8MS"),h=a("hGE3"),g=a("ANjH"),f=a("LCzB"),b=a("kCVf"),v=a("n7pt");function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function y(e){for(var t=1;t{this.setState({show:!1}),this.props.tagReader.clearTag()}}componentDidMount(){const{location:{state:e},history:t,farm:a}=this.props;e||t.push("/".concat(a,"/mobile"))}checkAnimalsLocation(e,t){let a=Object(b.j)(e);for(let n of t){if(Array.isArray(n.PlcmntID)&&n.PlcmntID.find(e=>e.PlcmntID===a))return!0;if(a===n.PlcmntID)return!0}return!1}componentDidUpdate(e,t,a){if(!r()(this.props.tagReader,e.tagReader)&&this.props.tagReader.tag){const{farm:e,tagReader:{location:t,animal:a},location:{state:r}}=this.props,{onlyLocationScanner:s}=r;let i=t;if(!s&&!i&&a){let e=p.a.getAnimalLocationsByPlcmntID(a.PlcmntID);if(console.log(e),e.length>0)try{i=e[0].location}catch(n){i=null}}if(console.log(i),i){const{eventType:a,status:n,locationNextPath:s,standsChooser:o,chamberChooser:c,locationScannerOnlyChambers:l,blockLocationFromScannedAnimal:m,animals:u,sectorTypes:d}=r;let p=!1;if(console.log(d),!l||i.CID||i.BID){if(o&&!i.BID)p=!0,this.setState({tag:this.props.tagReader.tag,show:!0,error:2});else if(c&&!i.CID)p=!0,this.setState({tag:this.props.tagReader.tag,show:!0,error:3});else if(m&&this.checkAnimalsLocation(t,u))p=!0,this.setState({tag:this.props.tagReader.tag,show:!0,error:5});else if(d&&t){let e=v.a.getTreeByLocationID(Object(b.j)(t));e.sector&&d.includes(e.sector.SType)||(p=!0,this.setState({tag:this.props.tagReader.tag,show:!0,error:6}))}}else p=!0,this.setState({tag:this.props.tagReader.tag,show:!0,error:4});p||this.props.history.push({pathname:s||"/".concat(e,"/mobile/events/").concat(a,"/").concat(n),state:y({},r,{location:i,stand:i})})}else this.setState({tag:this.props.tagReader.tag,show:!0,error:1})}}getError(){const{t:e}=this.props,{error:t,tag:a}=this.state;switch(t){case 1:return e("rfidApp.locationNotFound",{errorTag:a});case 2:return e("rfidApp.isNotStand");case 3:return e("rfidApp.isNotChamber");case 4:return e("rfidApp.isNotStandOrChamber");case 5:return e("rfidApp.scannedAnimalInScannedLocation");case 6:const{location:{state:{sectorTypes:t}}}=this.props;return e("rfidApp.wrongSectorType",{sectors:t.map(t=>e("SType."+(t-1))).join(", ")});default:return""}}render(){const{farm:e,location:{state:t},onChange:a,t:n}=this.props;if(!t)return null;let{breadcrumbs:r,onlyLocationScanner:s,locationBackPath:o}=t;const{show:c}=this.state;return i.a.createElement("div",{className:"rfid-scanner location"},i.a.createElement(l.a,{breadcrumbs:r,back:!0,backPathname:o}),i.a.createElement(m.a,{className:"h-100"},i.a.createElement(u.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement(d.Link,{to:{pathname:"/".concat(e,"/mobile/locationChooser"),state:y({},t,{onChange:a})},className:"rfid-animal-chooser"},i.a.createElement("h4",null,n("rfidApp.chooseLocationFromList")),i.a.createElement("div",{className:"rfid-animal-chooser-button"},i.a.createElement("div",null,i.a.createElement("i",{className:"far fa-list-ul fa-fw"}),i.a.createElement("i",{className:"far fa-slash"}),i.a.createElement("i",{className:"far fa-search fa-fw"}))))),i.a.createElement(u.a,{xs:6,className:"d-flex align-items-center"},i.a.createElement("div",{className:"rfid-scanner-sensor-info"},i.a.createElement("div",{className:"location-icon"},i.a.createElement("i",{className:"far fa-map-marked-alt"}),i.a.createElement("i",{className:"far fa-wifi"})),s&&i.a.createElement("h4",null,n("rfidApp.scanLocation")),!s&&i.a.createElement("h4",null,n("rfidApp.scanAnimalOrLocation")),i.a.createElement("div",null,n("rfidApp.readerToTag"))))),i.a.createElement(h.a,{show:c,error:this.getError(),onCloseClick:this.onCloseClick,capitalizeFirstLetter:!1,type:"warning"}))}}O=Object(c.a)()(O),t.a=Object(g.d)(Object(f.a)(),Object(o.connect)((function(e){return{farm:e.location.farm}})))(O)},xYWq:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("44Gh"),o=a("MAs2"),c=a("tkTQ"),l=a("ANjH"),m=a("LCzB");class u extends n.Component{render(){const{farm:e,t:t}=this.props;return r.a.createElement(i.a,{breadcrumbs:[{name:t("mommy")}]},r.a.createElement(o.a,{name:t("rfidApp.getFromMommy"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"mommy",status:"get",breadcrumbs:[{name:t("mommy"),link:"/".concat(e,"/mobile/events/mommy")},{name:t("rfidApp.getFromMommy")}],animalType:[c.a.SOW]}}),r.a.createElement(o.a,{name:t("rfidApp.addToMommy"),href:"/".concat(e,"/mobile/scanner"),state:{eventType:"mommy",status:"add",breadcrumbs:[{name:t("mommy"),link:"/".concat(e,"/mobile/events/mommy")},{name:t("rfidApp.addToMommy")}],animalType:[c.a.SOW]}}))}}t.a=Object(l.d)(Object(s.connect)((function(e){return{farm:e.location.farm}})),Object(m.a)())(u)},xsWg:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("PRyg"),l=a("4Rw3"),m=a("ANjH"),u=a("3k8n"),d=a("LCzB");class p extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{match:{params:{reasonID:a}}}=this.props,{animalsToSave:n,animals:r}=this.state;let s=(t?r:n).map(t=>({AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(c.getGrIDByAnimal)(t,e.getTime()),Reason:a,PlcmntID:Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID}));return Object(l.a)(s).then(e=>{this.props.dispatch({type:"ADD_SELECTION",payload:s})}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.selectionGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},match:{params:{reasonID:t}},selectionReason:a,farm:n,t:s}=this.props;let o=a.find(e=>e.ID===t);if(!e||!o)return null;const{animals:c,show:l,error:m}=this.state,{status:d}=e;return r.a.createElement(i.a,{breadcrumbs:[{name:s("selection"),link:"/".concat(n,"/mobile/events/selection")},{name:o.Value}],text:r.a.createElement(u.a,{i18nKey:"rfidApp.selectionText",count:c.length,values:{AnmNo1:c[0].AnmNo1,reason:o.Value},components:{bold:r.a.createElement("strong",null)}}),additionalText:s("rfidApp.selectionAdditionalText",{count:c.length,reason:o.Value}),animals:c,eventType:"selection",status:d,onSubmit:this.onSubmit,counterName:"selection",closeError:this.onCloseClick,error:this.getError(),showError:l,errorType:0===m?"error":"warning"})}}p=Object(o.a)({findAnimalInLocation:!0})(p),t.a=Object(m.d)(Object(s.connect)((function(e){return{farm:e.location.farm,selectionReason:e.dictionary.selectionReason.WData[e.language.lang.lang]}})),Object(d.a)())(p)},y1NX:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("UNta"),o=a("vzZS"),c=a("JPoY"),l=a("PkbN"),m=a("MAs2"),u=a("tkTQ"),d=(a("pUGO"),a("ANjH")),p=a("LCzB");class h extends n.Component{constructor(...e){super(...e),this.state={page:0},this.onPageChange=e=>{this.setState({page:e})}}splitReasons(e){let t=[];for(let a=0;a0&&r.a.createElement(c.a,{page:n,onPageChange:this.onPageChange,title:a("rfidApp.chooseReason")+":"},this.splitReasons(e).map((e,n)=>r.a.createElement(l.a,{key:n},e.map((e,n)=>r.a.createElement(m.a,{name:e.Value,href:"/".concat(t,"/mobile/scanner"),key:n,state:{eventType:"selection",status:e.ID,breadcrumbs:[{name:a("selection"),link:"/".concat(t,"/mobile/events/selection")},{name:e.Value}],animalType:[u.a.SOW,u.a.RENOVATION_SOW]}}))))))}}t.a=Object(d.d)(Object(s.connect)((function(e){return{farm:e.location.farm,selectionReason:e.dictionary.selectionReason.WData[e.language.lang.lang]}})),Object(p.a)())(h)},y56K:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("pKOT"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB"),h=a("kCmh"),g=a("zDJl"),f=a("5Z9N"),b=a("udB/"),v=a("10H7"),E=a("wd/R"),y=a.n(E);class D extends n.Component{constructor(e){super(e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],show:!1,error:null,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>{let a=h.a.getDevicesInPlcmntID(Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,{showDevicesInChildren:!1}).find(e=>e.DevType===g.d.DISPENSER_NRF);return{AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime()),device:a?{DevID:a.DevID,GwID:a.GatewayID}:void 0}});return Object(m.e)(r).then(e=>{}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})};const{location:{state:t},farm:a}=this.props;if(t){const{animals:e}=this.state;this.props.dispatch(Object(f.c)(e[0]))}else this.props.history.push("/".concat(a,"/mobile"))}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):(this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}),this.props.dispatch(Object(f.c)(e))):this.setState({show:!0,error:1,errorTag:t})}}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.startParturitionGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}checkStarts(){const{events:e}=this.props;let t=+y()().subtract(24,"hours"),a=e.filter(e=>(e.EvCode===v.b.PARTURITION_START||e.EvCode===v.b.PARTURITION_END)&&e.EvTime>=t&&e.EvTime<=+new Date);return 0!==a.length&&a[a.length-1].EvCode===v.b.PARTURITION_START}render(){const{location:{state:e},farm:t,t:a,loading:n}=this.props;if(!e)return null;const{animals:s,show:o,error:l}=this.state,{status:m}=e;let u=this.checkStarts();return r.a.createElement(r.a.Fragment,null,r.a.createElement(b.a,{isLoading:n}),r.a.createElement(i.a,{breadcrumbs:[{name:a("parturition"),link:"/".concat(t,"/mobile/events/parturition")},{name:a("rfidApp.start")}],text:u?r.a.createElement(d.a,{i18nKey:"rfidApp.startParturitionFound",values:{AnmNo1:s[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}):r.a.createElement(d.a,{i18nKey:"rfidApp.startParturitionText",values:{AnmNo1:s[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),additionalText:a("rfidApp.startParturitionAdditionalText",{count:s.length}),animals:s,eventType:"parturition",status:m,showDate:!u,additionalState:{animalType:[c.a.SOW]},onSubmit:this.onSubmit,closeError:this.onCloseClick,error:this.getError(),showError:o,errorType:0===l?"error":"warning",disableSubmit:u}))}}D=Object(o.a)({findAnimalInLocation:!0})(D),t.a=Object(u.d)(Object(s.connect)((function(e,t){if(t.location.state){const{location:{state:{animals:a}}}=t;return{farm:e.location.farm,events:e.events.eventsForAnimals.get(a[0].AnmID)||[],loading:e.events.eventsForAnimalsLoading.get(a[0].AnmID)}}return{farm:e.location.farm,events:[],loading:!1}})),Object(p.a)())(D)},z8nH:function(e,t,a){"use strict";var n=a("q1tI"),r=a.n(n),s=a("/MKj"),i=a("E0aH"),o=a("eAv4"),c=a("tkTQ"),l=a("PRyg"),m=a("pKOT"),u=a("ANjH"),d=a("3k8n"),p=a("LCzB"),h=a("kCmh"),g=a("zDJl");class f extends n.Component{constructor(...e){super(...e),this.state={animals:this.props.location.state?this.props.location.state.animals:[],animalsToSave:[],error:null,show:!1,errorTag:null,errorAnimal:null},this.onSubmit=(e,t)=>{const{animalsToSave:a,animals:n}=this.state;let r=(t?n:a).map(t=>{let a=h.a.getDevicesInPlcmntID(Array.isArray(t.PlcmntID)?t.PlcmntID[0].PlcmntID:t.PlcmntID,{showDevicesInChildren:!1}).find(e=>e.DevType===g.d.DISPENSER_NRF);return{AnmID:t.AnmID,EvTime:e.getTime(),GrID:Object(l.getGrIDByAnimal)(t,e.getTime()),device:a?{DevID:a.DevID,GwID:a.GatewayID}:void 0}});return Object(m.d)(r).then(e=>{}).catch(e=>{throw this.setState({show:!0,error:0}),e})},this.onCloseClick=()=>{this.setState({show:!1})}}componentDidUpdate(e,t,a){if(this.props.tagReader.tag&&this.props.tagReader.tag!==e.tagReader.tag){const{tagReader:{animal:e,tag:t}}=this.props;e?this.state.animals.find(t=>t.AnmID===e.AnmID)?this.setState({show:!0,error:2,errorAnimal:e}):this.setState({animals:[e],animalsToSave:this.state.animals,show:!1}):this.setState({show:!0,error:1,errorTag:t})}}componentDidMount(){const{location:{state:e},farm:t}=this.props;e||this.props.history.push("/".concat(t,"/mobile"))}getError(){const{t:e}=this.props,{error:t,errorTag:a,errorAnimal:n}=this.state;switch(t){case 0:return e("rfidApp.endParturitionGeneralError");case 1:return e("rfidApp.animalWithNumberNotFound",{errorTag:a});case 2:return e("rfidApp.scannedCurrentlySelected",{AnmNo1:n.AnmNo1});default:return""}}render(){const{location:{state:e},farm:t,t:a}=this.props;if(!e)return null;const{status:n}=e,{animals:s,show:o,error:l}=this.state;return r.a.createElement(i.a,{breadcrumbs:[{name:a("parturition"),link:"/".concat(t,"/mobile/events/parturition")},{name:a("rfidApp.end")}],eventType:"parturition",text:r.a.createElement(d.a,{i18nKey:"rfidApp.endParturitionText",count:s.length,values:{AnmNo1:s[0].AnmNo1},components:{bold:r.a.createElement("strong",null)}}),status:n,additionalText:a("rfidApp.endParturitionAdditionalText"),animals:s,showDate:!0,additionalState:{animalType:[c.a.SOW]},onSubmit:this.onSubmit,showError:o,error:this.getError(),closeError:this.onCloseClick,errorType:0===l?"error":"warning"})}}f=Object(o.a)({findAnimalInLocation:!0})(f),t.a=Object(u.d)(Object(s.connect)((function(e){return{}})),Object(p.a)())(f)}}]); //# sourceMappingURL=main~da9df9a7.c5b753b4.chunk.js.map