text: (window.webpackJsonp=window.webpackJsonp||[]).push([[124],{1534:function(e,t,n){"use strict";n.r(t);var r=n(24),a=n.n(r),o=n(25),s=n.n(o),c=n(22),i=n.n(c),l=n(26),u=n.n(l),f=n(27),p=n.n(f),m=n(16),d=n.n(m),h=n(6),C=n.n(h),v=n(0),y=n.n(v),g=n(200),E=n.n(g),b=n(148),w=n(149),D=n(201),N=n(102),R=n(4),j=n(32);function k(e){var t=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 n,r=d()(e);if(t){var a=d()(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return p()(this,n)}}var O=function(e){u()(n,e);var t=k(n);function n(e){var r;return a()(this,n),(r=t.call(this,e)).state={showActionButtons:!1,highlightRow:""},r}return s()(n,[{key:"onRowEnter",value:function(){this.setState({showActionButtons:!0,highlightRow:"highlight-row"})}},{key:"onRowLeave",value:function(){this.setState({showActionButtons:!1,highlightRow:""})}},{key:"openItem",value:function(e){R.f.push("/kostenplaats/".concat(e))}},{key:"render",value:function(){var e=this,t=this.props,n=t.id,r=t.description,a=t.twinfieldCostCenterCode,o=t.permissions;return y.a.createElement("tr",{className:this.state.highlightRow,onDoubleClick:o.manageFinancial?function(){return e.openItem(n)}:null,onMouseEnter:function(){return e.onRowEnter()},onMouseLeave:function(){return e.onRowLeave()}},y.a.createElement("td",null,r),y.a.createElement("td",null,a),y.a.createElement("td",null,this.state.showActionButtons&&o.manageFinancial?y.a.createElement("a",{role:"button",onClick:function(){return e.openItem(n)}},y.a.createElement("span",{className:"glyphicon glyphicon-pencil mybtn-success"})," "):"",this.state.showActionButtons&&o.manageFinancial?y.a.createElement("a",{role:"button",onClick:this.props.showDeleteItemModal.bind(this,n,r)},y.a.createElement("span",{className:"glyphicon glyphicon-trash mybtn-danger"})," "):""))}}]),n}(v.Component),I=Object(j.b)((function(e){return{permissions:e.meDetails.permissions}}))(O),M=n(101),S=function(e){var t=e.deleteCostCenter,n=e.closeDeleteItemModal,r=e.description,a=e.id;return y.a.createElement(M.a,{buttonConfirmText:"Verwijder",buttonClassName:"btn-danger",closeModal:n,confirmAction:function(){return t(a),void n()},title:"Verwijderen"},"Verwijder kostenplaats: ",y.a.createElement("strong",null,r),"?")},L=n(8);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){C()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function F(e){var t=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 n,r=d()(e);if(t){var a=d()(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return p()(this,n)}}var x=function(e){u()(n,e);var t=F(n);function n(e){var r;return a()(this,n),r=t.call(this,e),C()(i()(r),"showDeleteItemModal",(function(e,t){r.setState(A(A({},r.state),{},{showDeleteItem:!0,deleteItem:A(A({},r.state.deleteItem),{},{id:e,description:t})}))})),C()(i()(r),"closeDeleteItemModal",(function(){r.setState(A(A({},r.state),{},{showDeleteItem:!1,deleteItem:A(A({},r.state.deleteItem),{},{id:"",description:""})}))})),r.state={showDeleteItem:!1,deleteItem:{id:"",description:""}},r}return s()(n,[{key:"render",value:function(){var e=this,t=this.props,n=t.costCenters,r=t.hasError,a=t.isLoading,o="",s=!0;return r?o="Fout bij het ophalen van kostenplaatsen.":a?o="Gegevens aan het laden.":0===n.length?o="Geen kostenplaatsen gevonden!":s=!1,y.a.createElement("div",null,y.a.createElement(b.a,null,y.a.createElement(w.a,null,y.a.createElement("tr",{className:"thead-title"},y.a.createElement(N.a,{title:"Omschrijving",width:"60%"}),y.a.createElement(N.a,{title:"Nummer",width:"30%"}),y.a.createElement(N.a,{title:"",width:"10%"}))),y.a.createElement(D.a,null,s?y.a.createElement("tr",null,y.a.createElement("td",{colSpan:5},o)):n.map((function(t){return y.a.createElement(I,E()({key:t.id,showDeleteItemModal:e.showDeleteItemModal},t))})))),this.state.showDeleteItem&&y.a.createElement(S,E()({closeDeleteItemModal:this.closeDeleteItemModal},this.state.deleteItem,{deleteCostCenter:this.props.deleteCostCenter})))}}]),n}(v.Component);x.propTypes={costCenters:L.any,hasError:L.any,isLoading:L.any};var T=x,B=n(701);function J(e){var t=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 n,r=d()(e);if(t){var a=d()(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return p()(this,n)}}var V=function(e){u()(n,e);var t=J(n);function n(){return a()(this,n),t.apply(this,arguments)}return s()(n,[{key:"render",value:function(){var e=this.props,t=e.costCentersCount,n=e.refreshCostCentersData,r=e.permissions;return y.a.createElement("div",{className:"row"},y.a.createElement("div",{className:"col-md-4"},y.a.createElement("div",{className:"btn-group",role:"group"},y.a.createElement(B.a,{iconName:"glyphicon-refresh",onClickAction:n}),r.manageFinancial&&y.a.createElement(B.a,{iconName:"glyphicon-plus",onClickAction:function(){R.f.push("/kostenplaats/nieuw")}}))),y.a.createElement("div",{className:"col-md-4"},y.a.createElement("h3",{className:"text-center table-title"},"Kostenplaatsen")),y.a.createElement("div",{className:"col-md-4"},y.a.createElement("div",{className:"pull-right"},"Resultaten: ",t)))}}]),n}(v.Component);V.propTypes={costCentersCount:L.any,refreshCostCentersData:L.any,permissions:L.any};var G=Object(j.b)((function(e){return{permissions:e.meDetails.permissions}}),null)(V),q=n(699),K=n(700),z=n(12),H=function(){return z.a.get("jory/cost-center",{params:{jory:{fld:["id","description","twinfieldCostCenterCode"]}}})},Q=n(833),U=n(203);function W(e){var t=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 n,r=d()(e);if(t){var a=d()(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return p()(this,n)}}var X=function(e){u()(n,e);var t=W(n);function n(e){var r;return a()(this,n),r=t.call(this,e),C()(i()(r),"callFetchCostCentersData",(function(){r.setState({isLoading:!0,hasError:!1}),H().then((function(e){r.setState({isLoading:!1,costCenters:e.data.data})})).catch((function(e){r.setState({isLoading:!1,hasError:!0})}))})),C()(i()(r),"deleteCostCenter",(function(e){Q.a.deleteCostCenter(e).then((function(t){r.setState({costCenters:r.state.costCenters.filter((function(t){return t.id!==e}))})})).catch((function(e){r.props.setError(e.response.status,e.response.data.message)}))})),r.state={costCenters:[],isLoading:!1,hasError:!1},r}return s()(n,[{key:"componentDidMount",value:function(){this.callFetchCostCentersData()}},{key:"render",value:function(){return y.a.createElement(q.a,null,y.a.createElement(K.a,null,y.a.createElement("div",{className:"col-md-12 margin-10-top"},y.a.createElement(G,{costCentersCount:this.state.costCenters?this.state.costCenters.length:0,refreshCostCentersData:this.callFetchCostCentersData})),y.a.createElement("div",{className:"col-md-12 margin-10-top"},y.a.createElement(T,{costCenters:this.state.costCenters,isLoading:this.state.isLoading,hasError:this.state.hasError,deleteCostCenter:this.deleteCostCenter}))))}}]),n}(v.Component);t.default=Object(j.b)(null,(function(e){return{setError:function(t,n){e(Object(U.b)(t,n))}}}))(X)},699:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(8),s=n.n(o),c=function(e){var t=e.children,n=e.className,r=e.onMouseEnter,o=e.onMouseLeave;return a.a.createElement("div",{className:"panel panel-default ".concat(n),onMouseEnter:r,onMouseLeave:o},t)};c.defaultProps={className:"",onMouseEnter:function(){},onMouseLeave:function(){}},c.propTypes={className:s.a.string,onMouseEnter:s.a.func,onMouseLeave:s.a.func},t.a=c},700:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(8),s=n.n(o),c=function(e){var t=e.className,n=e.children;return a.a.createElement("div",{className:"panel-body ".concat(t)},n)};c.defaultProps={className:""},c.propTypes={className:s.a.string},t.a=c},701:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(8),s=n.n(o),c=function(e){var t=e.buttonClassName,n=e.iconName,r=e.onClickAction,o=e.title,s=e.disabled;return a.a.createElement("button",{type:"button",className:"btn ".concat(t),onClick:r,disabled:s,title:o},a.a.createElement("span",{className:"glyphicon ".concat(n)}))};c.defaultProps={buttonClassName:"btn-success btn-sm",title:"",disabled:!1},c.propTypes={buttonClassName:s.a.string,iconName:s.a.string.isRequired,onClickAction:s.a.func,title:s.a.string,disabled:s.a.bool},t.a=c},833:function(e,t,n){"use strict";var r=n(12);n(2);t.a={fetchCostCenterDetails:function(e){var t="jory/cost-center/".concat(e);return r.a.get(t,{params:{jory:{fld:["id","description","twinfieldCostCenterCode"]}}})},newCostCenter:function(e){return e.jory=JSON.stringify({fld:["id"]}),r.a.post("cost-center",e)},updateCostCenter:function(e){var t="".concat("cost-center","/").concat(e.id);return r.a.post(t,e)},deleteCostCenter:function(e){var t="".concat("cost-center","/").concat(e,"/delete");return r.a.post(t)}}}}]);