text: (window.webpackJsonp=window.webpackJsonp||[]).push([[103],{1611:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),o=t(24),i=t.n(o),s=t(25),c=t.n(s),l=t(22),u=t.n(l),m=t(26),d=t.n(m),p=t(27),g=t.n(p),f=t(16),h=t.n(f),v=t(6),y=t.n(v),b=t(4),E=t(706),N=t.n(E),C=t(702),O=t(701),I=t(699),q=t(698),j=t(81),w=t(31),P=t(705),k=(t(222),t(725));function A(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 T(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?A(Object(t),!0).forEach((function(a){y()(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):A(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}function x(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=h()(e);if(a){var r=h()(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return g()(this,t)}}var S=function(e){d()(t,e);var a=x(t);function t(e){var n;return i()(this,t),n=a.call(this,e),y()(u()(n),"handleInputChange",(function(e){var a=e.target,t="checkbox"===a.type?a.checked:a.value,r=a.name;n.setState(T(T({},n.state),{},{product:T(T({},n.state.product),{},y()({},r,t))}))})),y()(u()(n),"handleInputChangeDuration",(function(e){var a,t=e.target,r="checkbox"===t.type?t.checked:t.value,o=t.name,i=n.state.product.invoiceFrequencyId,s=n.state.invoiceFrequencies;switch(r){case"none":s=[{id:"once",name:"Eenmalig"}],i="once";break;case"month":s=[{id:"once",name:"Eenmalig"},{id:"monthly",name:"Maand"}],"quarterly"!==i&&"yearly"!==i&&"half-year"!==i||(i="monthly");break;case"quarter":s=[{id:"once",name:"Eenmalig"},{id:"monthly",name:"Maand"},{id:"quarterly",name:"Kwartaal"}],"yearly"!==i&&"half-year"!==i||(i="quarterly");break;case"half_year":s=[{id:"once",name:"Eenmalig"},{id:"monthly",name:"Maand"},{id:"quarterly",name:"Kwartaal"},{id:"half-year",name:"Half jaar"}],"yearly"===i&&(i="half-year");break;default:s=[{id:"once",name:"Eenmalig"},{id:"monthly",name:"Maand"},{id:"quarterly",name:"Kwartaal"},{id:"half-year",name:"Half jaar"},{id:"yearly",name:"Jaar"}]}n.setState(T(T({},n.state),{},{invoiceFrequencies:s,product:T(T({},n.state.product),{},(a={},y()(a,o,r),y()(a,"invoiceFrequencyId",i),a))}))})),y()(u()(n),"handleSubmit",(function(e){e.preventDefault();var a=n.state.product,t={},r=!1,o=!1,i=!1;n.props.products.map((function(e){return e.code==a.code&&(i=!0)})),i&&(r="Productcode moet uniek zijn.",t.code=!0,o=!0),N.a.isEmpty(a.code+"")&&(t.code=!0,o=!0),n.props.usesTwinfield&&N.a.isEmpty(String(a.ledgerId))&&(t.ledgerId=!0,o=!0);var s=!1;n.props.products.map((function(e){return e.name==a.name&&(s=!0)})),s&&(r="Productnaam moet uniek zijn.",t.name=!0,o=!0),i&&s&&(r="Productcode en productnaam moeten uniek zijn."),N.a.isEmpty(a.name+"")&&(t.name=!0,o=!0),N.a.isEmpty(a.administrationId+"")&&(t.administrationId=!0,o=!0),n.setState(T(T({},n.state),{},{errors:t,errorMessage:r})),o||j.a.newProduct(a).then((function(e){b.f.push("/product/".concat(e.data.id))})).catch((function(e){console.log(e)}))})),n.state={errorMessage:!1,invoiceFrequencies:[{id:"once",name:"Eenmalig"}],product:{code:"",name:"",invoiceText:"",durationId:"none",invoiceFrequencyId:"once",paymentTypeId:"",administrationId:"",ledgerId:"",costCenterId:""},errors:{code:!1,name:!1,administrationId:!1,ledgerId:!1,costCenterId:!1}},n.handleReactSelectChange=n.handleReactSelectChange.bind(u()(n)),n}return c()(t,[{key:"handleReactSelectChange",value:function(e,a){this.setState(T(T({},this.state),{},{product:T(T({},this.state.product),{},y()({},a,e))}))}},{key:"render",value:function(){var e=this.state.product,a=e.code,t=e.name,n=e.invoiceText,o=e.durationId,i=e.invoiceFrequencyId,s=e.paymentTypeId,c=e.administrationId,l=e.ledgerId,u=e.costCenterId;return r.a.createElement("form",{className:"form-horizontal",onSubmit:this.handleSubmit},r.a.createElement(q.a,null,r.a.createElement(I.a,null,r.a.createElement("div",{className:"row"},r.a.createElement(C.a,{label:"Productcode",name:"code",value:a,onChangeAction:this.handleInputChange,required:"required",error:this.state.errors.code}),r.a.createElement(C.a,{label:"Naam",name:"name",value:t,onChangeAction:this.handleInputChange,required:"required",error:this.state.errors.name})),r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"form-group col-sm-12"},r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"col-sm-3"},r.a.createElement("label",{htmlFor:"invoiceText",className:"col-sm-12"},"Omschrijving")),r.a.createElement("div",{className:"col-sm-8"},r.a.createElement("textarea",{name:"invoiceText",value:n,onChange:this.handleInputChange,className:"form-control input-sm",maxLength:"1000"}))))),r.a.createElement("div",{className:"row"},r.a.createElement(P.a,{label:"Looptijd",id:"durationId",name:"durationId",options:this.props.productDurations,value:o,onChangeAction:this.handleInputChangeDuration,emptyOption:!1}),r.a.createElement(P.a,{label:"Prijs per",id:"invoiceFrequencyId",name:"invoiceFrequencyId",options:this.state.invoiceFrequencies,value:i,onChangeAction:this.handleInputChange,emptyOption:!1})),r.a.createElement("div",{className:"row"},r.a.createElement(P.a,{label:"Betaalwijze",id:"paymentTypeId",name:"paymentTypeId",options:this.props.productPaymentTypes,value:s,onChangeAction:this.handleInputChange}),r.a.createElement(P.a,{label:"Administratie",id:"administrationId",name:"administrationId",options:this.props.administrations,value:c,onChangeAction:this.handleInputChange,required:"required",error:this.state.errors.administrationId})),r.a.createElement("div",{className:"row"},r.a.createElement(k.a,{label:"Grootboek",name:"ledgerId",options:this.props.ledgers,optionName:"description",value:l,onChangeAction:this.handleReactSelectChange,multi:!1,required:this.props.usesTwinfield?"required":"",error:this.state.errors.ledgerId}),r.a.createElement(k.a,{label:"Kostenplaats",name:"costCenterId",options:this.props.costCenters,optionName:"description",value:u,onChangeAction:this.handleReactSelectChange,multi:!1})),this.state.errorMessage&&r.a.createElement("div",{className:"col-sm-10 col-md-offset-1 alert alert-danger"},this.state.errorMessage)),r.a.createElement(I.a,null,r.a.createElement("div",{className:"pull-right btn-group",role:"group"},r.a.createElement(O.a,{buttonText:"Opslaan",onClickAction:this.handleSubmit,type:"submit",value:"Submit"})))))}}]),t}(n.Component),M=Object(w.b)((function(e){return{productDurations:e.systemData.productDurations,productPaymentTypes:e.systemData.productPaymentTypes,administrations:e.meDetails.administrations,products:e.systemData.products,ledgers:e.systemData.ledgers,costCenters:e.systemData.costCenters,usesTwinfield:e.systemData.usesTwinfield}}))(S),D=t(700),z=function(){return r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"col-md-4"},r.a.createElement("div",{className:"btn-group btn-group-flex margin-small",role:"group"},r.a.createElement(D.a,{iconName:"glyphicon-arrow-left",onClickAction:b.e.goBack}))),r.a.createElement("div",{className:"col-md-4"},r.a.createElement("h4",{className:"text-center margin-small"},"Nieuw product")),r.a.createElement("div",{className:"col-md-4"}))};a.default=function(){return r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"col-md-9"},r.a.createElement("div",{className:"col-md-12 margin-10-top"},r.a.createElement(q.a,null,r.a.createElement(I.a,{className:"panel-small"},r.a.createElement(z,null)))),r.a.createElement("div",{className:"col-md-12 margin-10-top"},r.a.createElement(M,null))),r.a.createElement("div",{className:"col-md-3"}))}},698:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=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)};s.defaultProps={className:"",onMouseEnter:function(){},onMouseLeave:function(){}},s.propTypes={className:i.a.string,onMouseEnter:i.a.func,onMouseLeave:i.a.func},a.a=s},699:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=function(e){var a=e.className,t=e.children;return r.a.createElement("div",{className:"panel-body ".concat(a)},t)};s.defaultProps={className:""},s.propTypes={className:i.a.string},a.a=s},700:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=function(e){var a=e.buttonClassName,t=e.iconName,n=e.onClickAction,o=e.title,i=e.disabled;return r.a.createElement("button",{type:"button",className:"btn ".concat(a),onClick:n,disabled:i,title:o},r.a.createElement("span",{className:"glyphicon ".concat(t)}))};s.defaultProps={buttonClassName:"btn-success btn-sm",title:"",disabled:!1},s.propTypes={buttonClassName:i.a.string,iconName:i.a.string.isRequired,onClickAction:i.a.func,title:i.a.string,disabled:i.a.bool},a.a=s},701:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=function(e){var a=e.buttonClassName,t=e.buttonText,n=e.onClickAction,o=e.type,i=e.value,s=e.loading,c=e.loadText,l=e.disabled;return s?r.a.createElement("button",{type:o,className:"btn btn-sm btn-loading ".concat(a),value:i,disabled:s},r.a.createElement("span",{className:"glyphicon glyphicon-refresh glyphicon-refresh-animate"})," ",c):r.a.createElement("button",{type:o,className:"btn btn-sm ".concat(a),onClick:n,value:i,disabled:l},t)};s.defaultProps={buttonClassName:"btn-success",type:"button",value:"",loading:!1,loadText:"Aan het laden",disabled:!1},s.propTypes={buttonClassName:i.a.string,buttonText:i.a.string.isRequired,onClickAction:i.a.func,type:i.a.string,value:i.a.string,loading:i.a.bool,loadText:i.a.string,disabled:i.a.bool},a.a=s},702:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=function(e){var a=e.label,t=e.type,n=e.className,o=e.size,i=e.id,s=e.placeholder,c=e.name,l=e.value,u=e.onClickAction,m=e.onChangeAction,d=e.onBlurAction,p=e.required,g=e.readOnly,f=e.maxLength,h=e.error,v=e.min,y=e.max,b=e.step,E=e.errorMessage,N=e.divSize,C=e.divClassName,O=e.autoComplete;return r.a.createElement("div",{className:"form-group ".concat(N," ").concat(C)},r.a.createElement("label",{htmlFor:i,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)+(h?"has-error":""),id:i,placeholder:s,name:c,value:l||"",onClick:u,onChange:m,onBlur:d,readOnly:g,maxLength:f,min:v,max:y,autoComplete:O,step:b})),h&&r.a.createElement("div",{className:"col-sm-offset-6 col-sm-6"},r.a.createElement("span",{className:"has-error-message"}," ",E)))};s.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(){}},s.propTypes={label:i.a.oneOfType([i.a.string,i.a.object]).isRequired,type:i.a.string,className:i.a.string,divClassName:i.a.string,size:i.a.string,divSize:i.a.string,id:i.a.string,placeholder:i.a.string,name:i.a.string.isRequired,value:i.a.oneOfType([i.a.string,i.a.number]),onClickAction:i.a.func,onChangeAction:i.a.func,onBlurAction:i.a.func,required:i.a.string,readOnly:i.a.bool,maxLength:i.a.string,error:i.a.bool,min:i.a.string,max:i.a.string,step:i.a.string,errorMessage:i.a.string,autoComplete:i.a.string},a.a=s},705:function(e,a,t){"use strict";var n=t(0),r=t.n(n),o=t(8),i=t.n(o),s=function(e){var a=e.label,t=e.className,n=e.size,o=e.id,i=e.name,s=e.value,c=e.options,l=e.onChangeAction,u=e.onBlurAction,m=e.required,d=e.error,p=e.errorMessage,g=e.optionValue,f=e.optionName,h=e.readOnly,v=e.placeholder,y=e.divClassName,b=e.emptyOption;return r.a.createElement("div",{className:"form-group ".concat(n," ").concat(y)},r.a.createElement("label",{htmlFor:o,className:"col-sm-6 ".concat(m)},a),r.a.createElement("div",{className:"col-sm-6"},r.a.createElement("select",{className:"form-control input-sm ".concat(t)+(d&&" has-error"),id:o,name:i,value:s||"",onChange:l,onBlur:u,readOnly:h},b&&r.a.createElement("option",{value:""},v),c.map((function(e){return r.a.createElement("option",{key:e[g],value:e[g]},e[f])})))),d&&r.a.createElement("div",{className:"col-sm-offset-6 col-sm-6"},r.a.createElement("span",{className:"has-error-message"}," ",p)))};s.defaultProps={divClassName:"",className:"",size:"col-sm-6",readOnly:!1,required:"",error:!1,errorMessage:"",value:"",optionValue:"id",optionName:"name",placeholder:"",emptyOption:!0},s.propTypes={label:i.a.string.isRequired,className:i.a.string,size:i.a.string,id:i.a.string,name:i.a.string.isRequired,options:i.a.array,value:i.a.oneOfType([i.a.string,i.a.number]),onChangeAction:i.a.func,onBlurAction:i.a.func,required:i.a.string,readOnly:i.a.bool,error:i.a.bool,errorMessage:i.a.string,emptyOption:i.a.bool,optionValue:i.a.string,optionName:i.a.string,placeholder:i.a.string},a.a=s},722:function(e,a,t){"use strict";t(734),t(198),t(709),t(12),t(6);var n=t(730),r=t(726),o=(t(22),t(733)),i=t(731),s=t(732),c=t(0),l=t.n(c),u=t(728),m=t(720),d=(t(103),t(92),t(704)),p=(t(721),t(715),t(727),t(729)),g=t(746);function f(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=Object(s.a)(e);if(a){var r=Object(s.a)(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return Object(i.a)(this,t)}}c.Component;var h=Object(p.a)(d.a);a.a=h},725:function(e,a,t){"use strict";var n=t(6),r=t.n(n),o=t(0),i=t.n(o),s=t(8),c=t.n(s),l=t(722);function u(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 m(e){for(var a=1;a<arguments.length;a++){var t=null!=arguments[a]?arguments[a]:{};a%2?u(Object(t),!0).forEach((function(a){r()(e,a,t[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(t,a))}))}return e}var d=function(e){var a=e.label,t=e.divSize,n=e.size,r=e.id,o=e.name,s=e.value,c=e.options,u=e.optionId,d=e.optionName,p=e.onChangeAction,g=e.required,f=e.multi,h=e.error,v=e.errorMessage,y=e.isLoading,b=e.disabled,E=e.placeholder,N=e.clearable,C={option:function(e){return m(m({},e),{},{fontSize:"12px"})},singleValue:function(e){return m(m({},e),{},{fontSize:"12px"})},menu:function(e){return m(m({},e),{},{zIndex:20})}};return i.a.createElement("div",{className:"form-group ".concat(t)},i.a.createElement("label",{htmlFor:r,className:"col-sm-6 ".concat(g)},a),i.a.createElement("div",{className:"".concat(n)},i.a.createElement(l.a,{id:r,name:o,value:c&&s?f?c.map((function(e){if(s.includes(e[u]))return e})):c.find((function(e){return e[u]===s})):"",onChange:f?function(e){return p(e?e.map((function(e){return e[u]})).join():"")}:function(e){return p(e?e[u]:"",o)},options:c,getOptionLabel:function(e){return e[d]},getOptionValue:function(e){return e[u]},placeholder:E,noOptionsMessage:function(){return"Geen opties gevonden"},loadingMessage:function(){return"Laden"},isMulti:f,simpleValue:!0,removeSelected:!0,className:h?" has-error":"",isLoading:y,isDisabled:b,styles:C,isClearable:N,theme:function(e){return m(m({},e),{},{colors:m({},e.colors),spacing:m(m({},e.spacing),{},{baseUnit:2,controlHeight:24,menuGutter:4})})}})),h&&i.a.createElement("div",{className:"col-sm-offset-3 col-sm-8"},i.a.createElement("span",{className:"has-error-message"}," ",v)))};d.defaultProps={size:"col-sm-6",divSize:"col-sm-6",optionId:"id",optionName:"name",disabled:!1,required:"",error:!1,errorMessage:"",value:"",multi:!0,isLoading:!1,placeholder:"",clearable:!1},d.propTypes={label:c.a.string.isRequired,size:c.a.string,divSize:c.a.string,id:c.a.string,name:c.a.string.isRequired,options:c.a.array,optionId:c.a.string,optionName:c.a.string,value:c.a.oneOfType([c.a.string,c.a.number]),onChangeAction:c.a.func,onBlurAction:c.a.func,required:c.a.string,disabled:c.a.bool,error:c.a.bool,errorMessage:c.a.string,multi:c.a.bool,isLoading:c.a.bool,placeholder:c.a.string,clearable:c.a.bool},a.a=d}}]);