(this["webpackJsonpqq-delivery-ui"]=this["webpackJsonpqq-delivery-ui"]||[]).push([[157],{1505:function(e,t,a){"use strict";a.r(t);var s=a(0),r=a.n(s),i=a(287),o=a(355),n=a(371),l=a(300),c=a(367),g=a(1452),h=(a(509),a(36)),d=a(41),m=a(48);class u extends s.Component{constructor(e){super(e),this.addCategory=e=>{this.state.productInfo.categoryGuid.push(e)},this.saveProduct=()=>{this.setState({}),this.dataService.retrievePOST(this.state.categoryInfo,this.config.SERVICE_NAME_CATEGORY+this.config.SERVICE_ACTION_CATEGORY_CREATE).then(e=>{e&&(console.log(e.data),e.success&&(window.location="/pos_categorylist/Successfully Adding Category!",this.setState({})))})},this.editCategory=e=>{this.state.editCategory.guid=e,this.dataService.retrievePOST(this.state.editCategory,this.config.SERVICE_NAME_CATEGORY+this.config.SERVICE_ACTION_CATEGORY_GET).then(e=>{e&&e.success&&(console.log("Message"+e.message),this.setState({categoryInfo:e.data}))})},this.state={errors:{errorMessage:"",error:!1},message:!1,msg:"",tabValue:1,Chooser:!1,editCategory:{guid:""},updateCatImage:{productguid:"",type:"",guid:""},categoryInfo:{id:0,categoryName:"",displayName:"",guid:""},imageDirectoryPath:"",pimg:"",productImage:"",categoryList:[]},this.config=new d.a,this.dataService=new m.a,this.resources=new h.a,this.userData=this.dataService.getCurrentUserData(),this.textVlaue=this.textVlaue.bind(this)}render(){return r.a.createElement("div",null,r.a.createElement(i.a,{container:!0,direction:"row"},r.a.createElement(i.a,{item:!0,md:1,lg:1,xs:12}),r.a.createElement(i.a,{item:!0,md:10,lg:10,xs:12},r.a.createElement(o.a,{style:{padding:20}},r.a.createElement(i.a,{container:!0,direction:"column",spacing:3},r.a.createElement(i.a,{item:!0},r.a.createElement(n.a,{size:"small",fullWidth:!0,name:"categoryName",label:"Category Name",value:this.state.categoryInfo.categoryName,onChange:e=>{this.textVlaue(e)}})),r.a.createElement(i.a,{item:!0},r.a.createElement(n.a,{size:"small",fullWidth:!0,label:"Display Name",name:"displayName",value:this.state.categoryInfo.displayName,onChange:e=>this.textVlaue(e)})),r.a.createElement(i.a,{item:!0},r.a.createElement(l.a,{variant:"contained",disabled:this.state.loading,color:"primary",onClick:this.saveProduct},"Save Category"))))),r.a.createElement(i.a,{item:!0,md:1,lg:1,xs:1})),r.a.createElement(c.a,{open:this.state.message,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},onClose:e=>{this.setState({message:!1})}},r.a.createElement(g.a,{severity:"success",elevation:6,variant:"filled",onClose:e=>{this.setState({message:!1})}},this.state.msg)),r.a.createElement(c.a,{open:this.state.errors.error,autoHideDuration:6e3,anchorOrigin:{vertical:"top",horizontal:"center"},onClose:e=>{this.state.errors.error=!1,this.state.errors.errorMessage=null,this.setState({loading:!1})}},r.a.createElement(g.a,{severity:"error",elevation:6,variant:"filled",onClose:e=>{this.state.errors.error=!1,this.state.errors.errorMessage=null,this.setState({loading:!1})}},this.state.errors.errorMessage)))}textVlaue(e){this.setState(Object.assign(this.state.categoryInfo,{[e.target.name]:e.target.value}))}componentDidMount(){const e=this.props.match.params.id;""!=e&&null!=e&&this.editCategory(e)}}t.default=u}}]);
//# sourceMappingURL=157.c510af9f.chunk.js.map