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