text: (window.webpackJsonp=window.webpackJsonp||[]).push([[93],{1585:function(e,a,t){"use strict";t.r(a);var n=t(24),r=t.n(n),o=t(25),l=t.n(o),i=t(22),s=t.n(i),d=t(26),c=t.n(d),u=t(27),m=t.n(u),p=t(16),g=t.n(p),h=t(6),f=t.n(h),y=t(0),E=t.n(y),v=t(706),w=t.n(v),b=t(4),k=t(699),C=t(700),N=t(701);function j(e){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=g()(e);if(a){var r=g()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return m()(this,t)}}var A,R=function(e){c()(t,e);var a=j(t);function t(e){return r()(this,t),a.call(this,e)}return l()(t,[{key:"render",value:function(){return E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"col-sm-12"},E.a.createElement(k.a,null,E.a.createElement(C.a,{className:"panel-small"},E.a.createElement("div",{className:"col-md-4"},E.a.createElement("div",{className:"btn-group btn-group-flex margin-small",role:"group"},E.a.createElement(N.a,{iconName:"glyphicon-arrow-left",onClickAction:b.e.goBack}))),E.a.createElement("div",{className:"col-md-4"},E.a.createElement("h3",{className:"text-center table-title"},"Nieuwe opbrengst")),E.a.createElement("div",{className:"col-md-4"})))))}}]),t}(y.Component),P=t(770),I=t.n(P),D=t(32),B=t(7),M=t.n(B),T=t(705),S=t(708),L=t(702),O=t(711),F=t(703),H=t(772),Y=t(704);M.a.locale("nl");var x=H.a.em(A||(A=I()(["\n    font-weight: normal;\n"]))),W=Object(D.b)((function(e){return{projectRevenueTypes:e.systemData.projectRevenueTypes,projectRevenueCategories:e.systemData.projectRevenueCategories,projectRevenueDistributionTypes:e.systemData.projectRevenueDistributionTypes,participantProjectPayoutTypes:e.systemData.participantProjectPayoutTypes}}))((function(e){var a=e.revenue,t=a.distributionTypeId,n=a.confirmed,r=a.dateBegin,o=a.dateEnd,l=a.dateReference,i=a.payoutTypeId,s=a.kwhStart,d=a.kwhEnd,c=a.kwhTotal,u=a.kwhStartHigh,m=a.kwhEndCalendarYearHigh,p=a.kwhEndHigh,g=a.kwhStartLow,h=a.kwhEndCalendarYearLow,f=a.kwhEndLow,y=a.revenue,v=a.payPercentage,w=a.payAmount,b=a.keyAmountFirstPercentage,k=a.payPercentageValidFromKeyAmount,C=a.categoryId,N=a.payoutKwh,j=e.projectRevenueCategories.find((function(e){return e.id==C})),A="";return e.project&&e.project.projectType&&e.project.projectType.codeRef&&(A=e.project.projectType.codeRef),E.a.createElement("form",{className:"form-horizontal col-md-12",onSubmit:e.handleSubmit},E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"panel-heading"},E.a.createElement("span",{className:"h5 text-bold"},"Algemeen"))),E.a.createElement("div",{className:"row"},E.a.createElement(Y.a,{label:"Soort",value:j?j.name:"",className:"form-group col-sm-6"}),E.a.createElement(Y.a,{label:"Definitief",value:n?"Ja":"Nee",className:"form-group col-sm-6"})),"revenueEuro"===j.codeRef?E.a.createElement("div",{className:"row"},"obligation"===A?E.a.createElement(T.a,{label:"Type opbrengst verdeling",name:"distributionTypeId",options:e.projectRevenueDistributionTypes,value:t,onChangeAction:e.handleInputChange,error:e.errors.distributionTypeId}):null,"inPossessionOf"===t?E.a.createElement(S.a,{label:"Peildatum",name:"dateReference",value:l,onChangeAction:e.handleInputChangeDate,required:"required",error:e.errors.dateReference}):null):null,"redemptionEuro"===j.codeRef?E.a.createElement("div",{className:"row"},"inPossessionOf"===t?E.a.createElement(S.a,{label:"Peildatum",name:"dateReference",value:l,onChangeAction:e.handleInputChangeDate,required:"required",error:e.errors.dateReference}):null):null,E.a.createElement("div",{className:"row"},E.a.createElement(S.a,{label:E.a.createElement("span",null,"Begin periode",e.project&&e.project.dateInterestBearingRedemption&&"redemptionEuro"===j.codeRef&&M()(r).format("Y-MM-DD")<M()(e.project.dateInterestBearingRedemption).format("Y-MM-DD")?E.a.createElement(E.a.Fragment,null,E.a.createElement("br",null),E.a.createElement("small",{style:{color:"red",fontWeight:"normal"}},"Let op de begin periode ligt voor de eind periode van de vorige aflossing.")):""),name:"dateBegin",value:r,onChangeAction:e.handleInputChangeDate,required:"redemptionEuro"!==j.codeRef?"required":"",error:e.errors.dateBegin,errorMessage:e.errorMessage.dateBegin,disabledBefore:"revenueEuro"!==j.codeRef||"loan"!==A&&"obligation"!==A?"redemptionEuro"===j.codeRef?M()(e.project.dateInterestBearingRedemption).add(-1,"year").format("Y-MM-DD"):"revenueKwh"===j.codeRef?e.project.dateInterestBearingKwh:"":e.project.dateInterestBearing}),E.a.createElement(S.a,{label:"Eind periode",name:"dateEnd",value:o,onChangeAction:e.handleInputChangeDate,required:"redemptionEuro"!==j.codeRef?"required":"",error:e.errors.dateEnd,errorMessage:e.errorMessage.dateEnd,disabledBefore:r,disabledAfter:"revenueKwh"===j.codeRef?M()(r).add(1,"year").add(6,"month").add(-1,"day").format("Y-MM-DD"):"redemptionEuro"===j.codeRef||"revenueEuro"===j.codeRef&&("loan"===A||"obligation"===A)?M()(r).add(1,"year").add(-1,"day").format("Y-MM-DD"):M()(r).endOf("year").format("Y-MM-DD")})),E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"form-group col-sm-6"}),"revenueEuro"!==j.codeRef||"capital"!==A&&"postalcode_link_capital"!==A?null:E.a.createElement(T.a,{label:"Uitkeren op",name:"payoutTypeId",id:"payoutTypeId",options:e.participantProjectPayoutTypes,value:i,onChangeAction:e.handleInputChange,required:"required",error:e.errors.payoutTypeId,errorMessage:e.errorMessage.payoutTypeId})),"revenueKwh"===j.codeRef?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"panel-part panel-heading"},E.a.createElement("span",{className:"h5 text-bold"},"Opbrengst kWh"))),M()(r).year()!==M()(o).year()?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},e.project.kwhStartHighNextRevenue>0?E.a.createElement(F.a,{type:"number",label:"Beginstand kWh hoog",name:"kwhStartHigh",value:u,readOnly:!0}):E.a.createElement(F.a,{type:"number",label:"Beginstand kWh hoog",name:"kwhStartHigh",value:u,onChangeAction:e.handleInputChange})),E.a.createElement("div",{className:"row"},e.project.kwhStartHighNextRevenue>0?E.a.createElement(F.a,{type:"number",label:"Beginstand kWh laag",name:"kwhStartLow",value:g,readOnly:!0}):E.a.createElement(F.a,{type:"number",label:"Beginstand kWh laag",name:"kwhStartLow",value:g,onChangeAction:e.handleInputChange})),E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Eindstand kWh op 31-12 hoog",name:"kwhEndCalendarYearHigh",value:m,onChangeAction:e.handleInputChange,error:e.errors.kwhEndCalendarYearHigh,errorMessage:e.errorMessage.kwhEndCalendarYearHigh}),E.a.createElement(F.a,{type:"number",label:"Eindstand kWh hoog",name:"kwhEndHigh",value:p,onChangeAction:e.handleInputChange,error:e.errors.kwhEndHigh,errorMessage:e.errorMessage.kwhEndHigh})),E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Eindstand kWh op 31-12 laag",name:"kwhEndCalendarYearLow",value:h,onChangeAction:e.handleInputChange,error:e.errors.kwhEndCalendarYearLow,errorMessage:e.errorMessage.kwhEndCalendarYearLow}),E.a.createElement(F.a,{type:"number",label:"Eindstand kWh laag",name:"kwhEndLow",value:f,onChangeAction:e.handleInputChange,error:e.errors.kwhEndLow,errorMessage:e.errorMessage.kwhEndLow}))):E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},e.project.kwhStartHighNextRevenue>0?E.a.createElement(F.a,{type:"number",label:"Beginstand kWh hoog",name:"kwhStartHigh",value:u,readOnly:!0}):E.a.createElement(F.a,{type:"number",label:"Beginstand kWh hoog",name:"kwhStartHigh",value:u,onChangeAction:e.handleInputChange}),E.a.createElement(F.a,{type:"number",label:"Eindstand kWh hoog",name:"kwhEndHigh",value:p,onChangeAction:e.handleInputChange,error:e.errors.kwhEndHigh,errorMessage:e.errorMessage.kwhEndHigh})),E.a.createElement("div",{className:"row"},e.project.kwhStartHighNextRevenue>0?E.a.createElement(F.a,{type:"number",label:"Beginstand kWh laag",name:"kwhStartLow",value:g,readOnly:!0}):E.a.createElement(F.a,{type:"number",label:"Beginstand kWh laag",name:"kwhStartLow",value:g,onChangeAction:e.handleInputChange}),E.a.createElement(F.a,{type:"number",label:"Eindstand kWh laag",name:"kwhEndLow",value:f,onChangeAction:e.handleInputChange,error:e.errors.kwhEndLow,errorMessage:e.errorMessage.kwhEndLow}))),E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Beginstand kWh",name:"kwhStart",value:s,readOnly:!0}),E.a.createElement(F.a,{type:"number",label:"Eindstand kWh",name:"kwhEnd",value:d,readOnly:!0})),E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Opbrengst kWh €",name:"payoutKwh",value:N&&N.toLocaleString("nl",{minimumFractionDigits:3,maximumFractionDigits:5}),onChangeAction:e.handleInputChange}),E.a.createElement(F.a,{type:"number",label:"Totaal productie kWh",name:"kwhTotal",value:c,readOnly:!0}))):null,"revenueEuro"===j.codeRef?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"panel-part panel-heading"},E.a.createElement("span",{className:"h5 text-bold"},"Opbrengst euro"))),"loan"===A||"obligation"===A?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Uitkering (rente) %",name:"payPercentage",value:v,onChangeAction:e.handleInputChange,error:e.errors.payPercentage,errorMessage:e.errorMessage.payPercentage}),E.a.createElement(F.a,{type:"number",label:"loan"===A?"of uitkeringsbedrag (per deelnemer)":"of uitkeringsbedrag (per participatie)",name:"payAmount",value:w,onChangeAction:e.handleInputChange,error:e.errors.payAmount,errorMessage:e.errorMessage.payAmount})),E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{label:E.a.createElement(E.a.Fragment,null,"Bedrag ",E.a.createElement(x,null,"(uitkering % geldig tot en met)")),name:"keyAmountFirstPercentage",value:b,onChangeAction:e.handleInputChange,error:e.errors.keyAmountFirstPercentage})),b?E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:E.a.createElement(E.a.Fragment,null,"Uitkering (rente) % vanaf bedrag"),name:"payPercentageValidFromKeyAmount",value:k,onChangeAction:e.handleInputChange,error:e.errors.payPercentageValidFromKeyAmount})):null):null,"capital"===A||"postalcode_link_capital"===A?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Resultaat",name:"revenue",value:y,onChangeAction:e.handleInputChange}))):null):null,"redemptionEuro"===j.codeRef?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"panel-part panel-heading"},E.a.createElement("span",{className:"h5 text-bold"},"Aflossing euro"))),"loan"===A||"obligation"===A?E.a.createElement(E.a.Fragment,null,E.a.createElement("div",{className:"row"},E.a.createElement(F.a,{type:"number",label:"Aflossing %",name:"payPercentage",value:v,onChangeAction:e.handleInputChange,error:e.errors.payPercentage,errorMessage:e.errorMessage.payPercentage}),E.a.createElement(F.a,{type:"number",label:"loan"===A?"of aflossingsbedrag (per deelname)":"of aflossingsbedrag (per participatie)",name:"payAmount",value:w,onChangeAction:e.handleInputChange,error:e.errors.payAmount,errorMessage:e.errorMessage.payAmount}))):null):null,E.a.createElement(O.a,null,E.a.createElement("div",{className:"pull-right btn-group",role:"group"},E.a.createElement(L.a,{buttonText:"Opslaan",onClickAction:e.handleSubmit,type:"submit",value:"Submit",loading:e.isLoading}))))})),z=t(65),q=t(154);function K(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function V(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?K(Object(t),!0).forEach((function(a){f()(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):K(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function _(e){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=g()(e);if(a){var r=g()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return m()(this,t)}}var J=function(e){c()(t,e);var a=_(t);function t(e){var n;return r()(this,t),n=a.call(this,e),f()(s()(n),"fetchProject",(function(e){q.a.fetchProject(e).then((function(e){var a=n.props.projectRevenueCategories.find((function(e){return e.id==n.state.revenue.categoryId})),t=n.state.revenue;if("redemptionEuro"===a.codeRef){var r=n.props.participantProjectPayoutTypes.find((function(e){return"account"===e.codeRef})).id;t.payoutTypeId=r,t.distributionTypeId="inPossessionOf"}else if("loan"!==e.projectType.codeRef)t.distributionTypeId="inPossessionOf";else if("obligation"===e.projectType.codeRef){var o=n.props.participantProjectPayoutTypes.find((function(e){return"account"===e.codeRef})).id;t.payoutTypeId=o}"revenueEuro"===a.codeRef&&(t.dateBegin=e.dateInterestBearing,t.dateEnd=e.dateInterestBearing?M()(e.dateInterestBearing).endOf("year").format("Y-MM-DD"):""),"redemptionEuro"===a.codeRef&&(t.dateBegin=e.dateInterestBearingRedemption,t.dateEnd=e.dateInterestBearingRedemption?M()(e.dateInterestBearingRedemption).endOf("year").format("Y-MM-DD"):""),"revenueKwh"===a.codeRef&&(t.dateBegin=e.dateInterestBearingKwh,t.dateEnd=e.dateInterestBearingKwh?M()(e.dateInterestBearingKwh).endOf("year").format("Y-MM-DD"):"",t.kwhStartHigh=e.kwhStartHighNextRevenue,t.kwhStartLow=e.kwhStartLowNextRevenue),n.setState(V(V({},n.state),{},{project:e,revenue:t}))}))})),f()(s()(n),"handleInputChange",(function(e){var a=e.target,t="checkbox"===a.type?a.checked:a.value,r=a.name;n.setState(V(V({},n.state),{},{revenue:V(V({},n.state.revenue),{},f()({},r,t))}),(function(){return n.linkedValueAdjustment(r)})),setTimeout((function(){var e=(n.state.revenue.kwhStartLow?parseFloat(n.state.revenue.kwhStartLow):0)+(n.state.revenue.kwhStartHigh?parseFloat(n.state.revenue.kwhStartHigh):0),a=(n.state.revenue.kwhEndLow?parseFloat(n.state.revenue.kwhEndLow):0)+(n.state.revenue.kwhEndHigh?parseFloat(n.state.revenue.kwhEndHigh):0),t=a-e;n.setState(V(V({},n.state),{},{revenue:V(V({},n.state.revenue),{},{kwhStart:e,kwhEnd:a,kwhTotal:t})}))}),200)})),f()(s()(n),"linkedValueAdjustment",(function(e){"keyAmountFirstPercentage"===e&&(n.state.revenue.keyAmountFirstPercentage&&0!=n.state.revenue.keyAmountFirstPercentage||n.setState(V(V({},n.state),{},{revenue:V(V({},n.state.revenue),{},{payPercentageValidFromKeyAmount:""})})))})),f()(s()(n),"handleSubmit",(function(e){e.preventDefault();var a=n.state.revenue,t=n.props.projectRevenueCategories.find((function(e){return e.id==a.categoryId})),r={},o={},l=!1;if(w.a.isEmpty(a.categoryId+"")&&(r.categoryId=!0,l=!0),"redemptionEuro"===t.codeRef||a.dateBegin||(r.dateBegin=!0,o.dateBegin="Verplicht",l=!0),"redemptionEuro"===t.codeRef||a.dateEnd||(r.dateEnd=!0,o.dateEnd="Verplicht",l=!0),"redemptionEuro"===t.codeRef&&!a.dateBegin&&a.dateEnd&&(r.dateBegin=!0,o.dateBegin="Begin periode moet ook ingevuld worden als Eind periode ingevuld is.",l=!0),"redemptionEuro"===t.codeRef&&a.dateBegin&&!a.dateEnd&&(r.dateEnd=!0,o.dateEnd="Eind periode moet ook ingevuld worden als Begin periode ingevuld is.",l=!0),!l&&a.dateEnd<a.dateBegin&&(r.dateEnd=!0,o.dateEnd="Eind periode mag niet voor Begin periode liggen.",l=!0),l||"revenueKwh"===t.codeRef||"redemptionEuro"===t.codeRef||"capital"!==n.state.project.projectType.codeRef&&"postalcode_link_capital"!==n.state.project.projectType.codeRef||M()(a.dateBegin).year()===M()(a.dateEnd).year()||(r.dateBegin=!0,o.dateBegin="Jaaroverschrijdende perioden niet toegestaan.",r.dateEnd=!0,o.dateEnd="Jaaroverschrijdende perioden niet toegestaan.",l=!0),!l&&"redemptionEuro"===t.codeRef&&M()(a.dateBegin).format("Y-MM-DD")<M()(a.dateEnd).add(-1,"year").add(1,"day").format("Y-MM-DD")&&(r.dateBegin=!0,o.dateBegin="Aflossingperiode mag maximaal 1 jaar zijn.",r.dateEnd=!0,o.dateEnd="Aflossingperiode mag maximaal 1 jaar zijn.",l=!0),!l&&"revenueEuro"===t.codeRef&&("loan"===n.state.project.projectType.codeRef||"obligation"===n.state.project.projectType.codeRef)&&M()(a.dateBegin).format("Y-MM-DD")<M()(a.dateEnd).add(-1,"year").add(1,"day").format("Y-MM-DD")&&(r.dateBegin=!0,o.dateBegin="Periode mag maximaal 1 jaar zijn.",r.dateEnd=!0,o.dateEnd="Periode mag maximaal 1 jaar zijn.",l=!0),"inPossessionOf"===a.distributionTypeId&&w.a.isEmpty(a.dateReference+"")&&(r.dateReference=!0,l=!0),w.a.isEmpty(a.payAmount+"")||("inPossessionOf"!==a.distributionTypeId&&(r.payAmount=!0,o.payAmount='Bedrag mag alleen bij type opbrengst verdeling "In bezit op" ingevuld zijn.',l=!0),a.payAmount+""<0&&(r.payAmount=!0,o.payAmount="Bedrag mag niet negatief zijn.",l=!0)),w.a.isEmpty(a.payPercentage+"")||(a.payPercentage+""<0&&(r.payPercentage=!0,o.payPercentage="Percentage mag niet negatief zijn.",l=!0),"redemptionEuro"===t.codeRef&&a.payPercentage+"">100&&(r.payPercentage=!0,o.payPercentage="Percentage mag niet meer dan 100% zijn.",l=!0)),"revenueKwh"===t.codeRef&&((a.kwhEndHigh?parseFloat(a.kwhEndHigh):0)<(a.kwhStartHigh?parseFloat(a.kwhStartHigh):0)&&(r.kwhEndHigh=!0,o.kwhEndHigh="Eindstand kWh hoog mag niet lager zijn dan Beginstand kWh hoog.",l=!0),(a.kwhEndLow?parseFloat(a.kwhEndLow):0)<(a.kwhStartLow?parseFloat(a.kwhStartLow):0)&&(r.kwhEndLow=!0,o.kwhEndLow="Eindstand kWh laag mag niet lager zijn dan Beginstand kWh laag.",l=!0),M()(a.dateBegin).year()!==M()(a.dateEnd).year()?(a.kwhEndCalendarYearHigh&&a.kwhEndCalendarYearHigh>0||a.kwhEndCalendarYearLow&&a.kwhEndCalendarYearLow>0)&&((a.kwhEndCalendarYearHigh?parseFloat(a.kwhEndCalendarYearHigh):0)<(a.kwhStartHigh?parseFloat(a.kwhStartHigh):0)&&(r.kwhEndCalendarYearHigh=!0,o.kwhEndCalendarYearHigh="Eindstand kWh 31-12 hoog mag niet lager zijn dan Beginstand kWh hoog.",l=!0),(a.kwhEndCalendarYearHigh?parseFloat(a.kwhEndCalendarYearHigh):0)>(a.kwhEndHigh?parseFloat(a.kwhEndHigh):0)&&(r.kwhEndHigh=!0,o.kwhEndHigh="Eindstand kWh 31-12 hoog mag niet hoger zijn dan Beginstand kWh hoog.",l=!0),(a.kwhEndCalendarYearLow?parseFloat(a.kwhEndCalendarYearLow):0)<(a.kwhStartLow?parseFloat(a.kwhStartLow):0)&&(r.kwhEndCalendarYearLow=!0,o.kwhEndCalendarYearLow="Eindstand kWh 31-12 laag mag niet lager zijn dan Beginstand kWh laag.",l=!0),(a.kwhEndCalendarYearLow?parseFloat(a.kwhEndCalendarYearLow):0)>(a.kwhEndLow?parseFloat(a.kwhEndLow):0)&&(r.kwhEndLow=!0,o.kwhEndLow="Eindstand kWh 31-12 laag mag niet hoger zijn dan Eindstand kWh laag.",l=!0)):(a.kwhEndCalendarYearHigh=null,a.kwhEndCalendarYearLow=null)),"revenueEuro"===t.codeRef&&("capital"===n.state.project.projectType.codeRef||"postalcode_link_capital"===n.state.project.projectType.codeRef)){w.a.isEmpty(a.payoutTypeId+"")&&(r.payoutTypeId=!0,l=!0);var i=n.props.participantProjectPayoutTypes.find((function(e){return"account"===e.codeRef})).id;a.revenue<0&&a.payoutTypeId==i&&(r.payoutTypeId=!0,o.payoutTypeId="Als je een negatief resultaat wilt verdelen dan kan dat niet uitgekeerd worden op een rekening. Kies voor bijschrijven.",l=!0)}w.a.isEmpty(a.payPercentage+"")&&0==a.keyAmountFirstPercentage&&w.a.isEmpty(a.payPercentageValidFromKeyAmount+"")||w.a.isEmpty(a.payAmount+"")||(r.payAmount=!0,r.payPercentage=!0,r.keyAmountFirstPercentage=!0,r.payPercentageValidFromKeyAmount=!0,o.payAmount="Percentage(s) en Bedrag mogen niet allebei ingevuld zijn.",l=!0),a.payoutKwh=a.payoutKwh?parseFloat(a.payoutKwh).toFixed(5):"",n.setState(V(V({},n.state),{},{errors:r,errorMessage:o})),l||(n.setState({isLoading:!0}),z.a.storeProjectRevenue(a).then((function(e){n.setState({isLoading:!1}),b.f.replace("/project/details/".concat(n.props.params.projectId)),b.f.push("/project/opbrengst/".concat(e.data.data.id))})).catch((function(e){console.log(e),alert("Er is iets misgegaan bij opslaan. Probeer nogmaals een nieuwe opbrengstverdeling te maken vanuit het project."),b.f.goBack()})))})),n.state={revenue:{projectId:e.params.projectId,categoryId:e.params.categoryId,distributionTypeId:"",confirmed:!1,dateBegin:"",dateEnd:"",dateReference:M()(),dateConfirmed:"",payoutTypeId:"",kwhStart:0,kwhEnd:0,kwhTotal:0,kwhStartHigh:"",kwhEndCalendarYearHigh:"",kwhEndHigh:"",kwhStartLow:"",kwhEndCalendarYearLow:"",kwhEndLow:"",revenue:"",datePayed:"",payPercentage:"",payAmount:"",keyAmountFirstPercentage:"",payPercentageValidFromKeyAmount:"",payoutKwh:""},errors:{categoryId:!1,dateBegin:!1,dateEnd:!1,dateReference:!1,payoutTypeId:!1,kwhEndCalendarYearHigh:!1,kwhEndCalendarYearLow:!1,kwhEndHigh:!1,kwhEndLow:!1,payAmount:!1,payPercentage:!1,keyAmountFirstPercentage:!1,payPercentageValidFromKeyAmount:!1},errorMessage:{payoutTypeId:"",dateBegin:"",dateEnd:"",kwhEndCalendarYearHigh:"",kwhEndCalendarYearLow:"",kwhEndHigh:"",kwhEndLow:"",payAmount:""},project:{},isLoading:!1},n.handleInputChangeDate=n.handleInputChangeDate.bind(s()(n)),n.handleInputChangeDateConfirmed=n.handleInputChangeDateConfirmed.bind(s()(n)),n}return l()(t,[{key:"componentDidMount",value:function(){this.fetchProject(this.props.params.projectId)}},{key:"componentDidUpdate",value:function(e){this.props.params.projectId!==e.params.projectId&&this.fetchProject(this.props.params.projectId)}},{key:"handleInputChangeDate",value:function(e,a){this.setState(V(V({},this.state),{},{revenue:V(V({},this.state.revenue),{},f()({},a,e))}))}},{key:"handleInputChangeDateConfirmed",value:function(e,a){var t,n;e?this.setState(V(V({},this.state),{},{revenue:V(V({},this.state.revenue),{},(t={},f()(t,a,e),f()(t,"confirmed",!0),t))})):this.setState(V(V({},this.state),{},{revenue:V(V({},this.state.revenue),{},(n={},f()(n,a,e),f()(n,"confirmed",!1),n))}))}},{key:"render",value:function(){return E.a.createElement("div",{className:"row"},E.a.createElement("div",{className:"col-md-9"},E.a.createElement("div",{className:"col-md-12"},E.a.createElement(R,null)),E.a.createElement("div",{className:"col-md-12"},E.a.createElement(k.a,null,E.a.createElement(C.a,null,E.a.createElement("div",{className:"col-md-12"},E.a.createElement(W,{revenue:this.state.revenue,errors:this.state.errors,errorMessage:this.state.errorMessage,handleInputChange:this.handleInputChange,handleInputChangeDate:this.handleInputChangeDate,handleInputChangeDateConfirmed:this.handleInputChangeDateConfirmed,handleSubmit:this.handleSubmit,project:this.state.project,isLoading:this.state.isLoading})))))),E.a.createElement("div",{className:"col-md-3"}))}}]),t}(y.Component);a.default=Object(D.b)((function(e){return{projectRevenueCategories:e.systemData.projectRevenueCategories,participantProjectPayoutTypes:e.systemData.participantProjectPayoutTypes}}))(J)},699:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.children,t=e.className,n=e.onMouseEnter,o=e.onMouseLeave;return r.a.createElement("div",{className:"panel panel-default ".concat(t),onMouseEnter:n,onMouseLeave:o},a)};i.defaultProps={className:"",onMouseEnter:function(){},onMouseLeave:function(){}},i.propTypes={className:l.a.string,onMouseEnter:l.a.func,onMouseLeave:l.a.func},a.a=i},700:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.className,t=e.children;return r.a.createElement("div",{className:"panel-body ".concat(a)},t)};i.defaultProps={className:""},i.propTypes={className:l.a.string},a.a=i},701:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.buttonClassName,t=e.iconName,n=e.onClickAction,o=e.title,l=e.disabled;return r.a.createElement("button",{type:"button",className:"btn ".concat(a),onClick:n,disabled:l,title:o},r.a.createElement("span",{className:"glyphicon ".concat(t)}))};i.defaultProps={buttonClassName:"btn-success btn-sm",title:"",disabled:!1},i.propTypes={buttonClassName:l.a.string,iconName:l.a.string.isRequired,onClickAction:l.a.func,title:l.a.string,disabled:l.a.bool},a.a=i},702:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.buttonClassName,t=e.buttonText,n=e.onClickAction,o=e.type,l=e.value,i=e.loading,s=e.loadText,d=e.disabled;return i?r.a.createElement("button",{type:o,className:"btn btn-sm btn-loading ".concat(a),value:l,disabled:i},r.a.createElement("span",{className:"glyphicon glyphicon-refresh glyphicon-refresh-animate"})," ",s):r.a.createElement("button",{type:o,className:"btn btn-sm ".concat(a),onClick:n,value:l,disabled:d},t)};i.defaultProps={buttonClassName:"btn-success",type:"button",value:"",loading:!1,loadText:"Aan het laden",disabled:!1},i.propTypes={buttonClassName:l.a.string,buttonText:l.a.string.isRequired,onClickAction:l.a.func,type:l.a.string,value:l.a.string,loading:l.a.bool,loadText:l.a.string,disabled:l.a.bool},a.a=i},703:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.label,t=e.type,n=e.className,o=e.size,l=e.id,i=e.placeholder,s=e.name,d=e.value,c=e.onClickAction,u=e.onChangeAction,m=e.onBlurAction,p=e.required,g=e.readOnly,h=e.maxLength,f=e.error,y=e.min,E=e.max,v=e.step,w=e.errorMessage,b=e.divSize,k=e.divClassName,C=e.autoComplete;return r.a.createElement("div",{className:"form-group ".concat(b," ").concat(k)},r.a.createElement("label",{htmlFor:l,className:"col-sm-6 ".concat(p)},a),r.a.createElement("div",{className:"".concat(o)},r.a.createElement("input",{type:t,className:"form-control input-sm ".concat(n)+(f?"has-error":""),id:l,placeholder:i,name:s,value:d||"",onClick:c,onChange:u,onBlur:m,readOnly:g,maxLength:h,min:y,max:E,autoComplete:C,step:v})),f&&r.a.createElement("div",{className:"col-sm-offset-6 col-sm-6"},r.a.createElement("span",{className:"has-error-message"}," ",w)))};i.defaultProps={divClassName:"",className:"",size:"col-sm-6",divSize:"col-sm-6",name:"",type:"text",value:"",required:"",readOnly:!1,maxLength:null,error:!1,min:"",max:"",step:"",errorMessage:"",autoComplete:"off",onBlurAction:function(){},onClickAction:function(){},onChangeAction:function(){}},i.propTypes={label:l.a.oneOfType([l.a.string,l.a.object]).isRequired,type:l.a.string,className:l.a.string,divClassName:l.a.string,size:l.a.string,divSize:l.a.string,id:l.a.string,placeholder:l.a.string,name:l.a.string.isRequired,value:l.a.oneOfType([l.a.string,l.a.number]),onClickAction:l.a.func,onChangeAction:l.a.func,onBlurAction:l.a.func,required:l.a.string,readOnly:l.a.bool,maxLength:l.a.string,error:l.a.bool,min:l.a.string,max:l.a.string,step:l.a.string,errorMessage:l.a.string,autoComplete:l.a.string},a.a=i},704:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(4),l=t(8),i=t.n(l),s=function(e){var a=e.label,t=e.className,n=e.id,l=e.value,i=e.link,s=e.hidden;return i.length>0?r.a.createElement("div",{className:t,style:s?{display:"none"}:{}},r.a.createElement("label",{htmlFor:n,className:"col-sm-6"},a),r.a.createElement("div",{className:"col-sm-6",id:n,onClick:null},r.a.createElement(o.b,{to:i,className:"link-underline"},l))):r.a.createElement("div",{className:t,style:s?{display:"none"}:{}},r.a.createElement("label",{htmlFor:n,className:"col-sm-6"},a),r.a.createElement("div",{className:"col-sm-6",id:n},l))};s.defaultProps={className:"col-sm-6",value:"",link:"",hidden:!1},s.propTypes={label:i.a.oneOfType([i.a.string,i.a.object]).isRequired,className:i.a.string,id:i.a.string,value:i.a.oneOfType([i.a.string,i.a.number]),link:i.a.string,hidden:i.a.bool},a.a=s},705:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.label,t=e.className,n=e.size,o=e.id,l=e.name,i=e.value,s=e.options,d=e.onChangeAction,c=e.onBlurAction,u=e.required,m=e.error,p=e.errorMessage,g=e.optionValue,h=e.optionName,f=e.readOnly,y=e.placeholder,E=e.divClassName,v=e.emptyOption;return r.a.createElement("div",{className:"form-group ".concat(n," ").concat(E)},r.a.createElement("label",{htmlFor:o,className:"col-sm-6 ".concat(u)},a),r.a.createElement("div",{className:"col-sm-6"},r.a.createElement("select",{className:"form-control input-sm ".concat(t)+(m&&" has-error"),id:o,name:l,value:i||"",onChange:d,onBlur:c,readOnly:f},v&&r.a.createElement("option",{value:""},y),s.map((function(e){return r.a.createElement("option",{key:e[g],value:e[g]},e[h])})))),m&&r.a.createElement("div",{className:"col-sm-offset-6 col-sm-6"},r.a.createElement("span",{className:"has-error-message"}," ",p)))};i.defaultProps={divClassName:"",className:"",size:"col-sm-6",readOnly:!1,required:"",error:!1,errorMessage:"",value:"",optionValue:"id",optionName:"name",placeholder:"",emptyOption:!0},i.propTypes={label:l.a.string.isRequired,className:l.a.string,size:l.a.string,id:l.a.string,name:l.a.string.isRequired,options:l.a.array,value:l.a.oneOfType([l.a.string,l.a.number]),onChangeAction:l.a.func,onBlurAction:l.a.func,required:l.a.string,readOnly:l.a.bool,error:l.a.bool,errorMessage:l.a.string,emptyOption:l.a.bool,optionValue:l.a.string,optionName:l.a.string,placeholder:l.a.string},a.a=i},708:function(e,a,t){"use strict";var n=t(24),r=t.n(n),o=t(25),l=t.n(o),i=t(22),s=t.n(i),d=t(26),c=t.n(d),u=t(27),m=t.n(u),p=t(16),g=t.n(p),h=t(6),f=t.n(h),y=t(0),E=t.n(y),v=t(8),w=t.n(v),b=t(717),k=t.n(b),C=t(718),N=t.n(C),j=t(7),A=t.n(j);function R(e){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,n=g()(e);if(a){var r=g()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return m()(this,t)}}A.a.locale("nl");var P=function(e){c()(t,e);var a=R(t);function t(e){var n;return r()(this,t),n=a.call(this,e),f()(s()(n),"validateDate",(function(e){var a=A()(e.target.value,"DD-MM-YYYY",!0),t=!1;a.isValid()||""===e.target.value||(t=!0),n.props.disabledBefore&&a.isBefore(n.props.disabledBefore)&&(t=!0),n.props.disabledAfter&&a.isAfter(n.props.disabledAfter)&&(t=!0),n.setState({errorDateFormat:t})})),f()(s()(n),"onDateChange",(function(e){var a=e?A()(e).format("Y-MM-DD"):"",t=!1;a&&n.props.disabledBefore&&A()(a).isBefore(n.props.disabledBefore)&&(t=!0),a&&n.props.disabledAfter&&A()(a).isAfter(n.props.disabledAfter)&&(t=!0),n.setState({errorDateFormat:t}),!t&&n.props.onChangeAction(a,n.props.name)})),n.state={errorDateFormat:!1},n}return l()(t,[{key:"render",value:function(){var e=this.props,a=e.label,t=e.className,n=e.size,r=e.divSize,o=e.id,l=e.value,i=e.required,s=e.readOnly,d=e.name,c=e.error,u=e.errorMessage,m=e.disabledBefore,p=e.disabledAfter,g=l?A()(l).format("L"):"",h={};return m&&(h.before=new Date(m)),p&&(h.after=new Date(p)),E.a.createElement("div",{className:"form-group ".concat(r)},E.a.createElement("div",null,E.a.createElement("label",{htmlFor:o,className:"col-sm-6 ".concat(i)},a)),E.a.createElement("div",{className:"".concat(n)},E.a.createElement(k.a,{id:o,value:g,formatDate:C.formatDate,parseDate:C.parseDate,onDayChange:this.onDateChange,dayPickerProps:{showWeekNumbers:!0,locale:"nl",firstDayOfWeek:1,localeUtils:N.a,disabledDays:h},inputProps:{className:"form-control input-sm ".concat(t)+(this.state.errorDateFormat||c?" has-error":""),name:d,onBlur:this.validateDate,autoComplete:"off",readOnly:s,disabled:s},required:i,readOnly:s,placeholder:""})),c&&E.a.createElement("div",{className:"col-sm-offset-6 col-sm-6"},E.a.createElement("span",{className:"has-error-message"}," ",u)))}}]),t}(y.Component);P.defaultProps={className:"",size:"col-sm-6",divSize:"col-sm-6",required:"",readOnly:!1,value:null,error:!1,errorMessage:"",disabledBefore:null,disabledAfter:null},P.propTypes={label:w.a.string.isRequired,type:w.a.string,className:w.a.string,size:w.a.string,divSize:w.a.string,id:w.a.string,name:w.a.string,value:w.a.oneOfType([w.a.string,w.a.object]),onChangeAction:w.a.func,required:w.a.string,readOnly:w.a.bool,error:w.a.bool,errorMessage:w.a.string,disabledBefore:w.a.string,disabledAfter:w.a.string},a.a=P},711:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),l=t.n(o),i=function(e){var a=e.className,t=e.children;return r.a.createElement("div",{className:"panel-footer ".concat(a)},t)};i.defaultProps={className:""},i.propTypes={className:l.a.string},a.a=i}}]);