Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.144.6.85
(window.webpackJsonp=window.webpackJsonp||[]).push([[183],{1149:function(e,t,n){"use strict";n.r(t);var a=n(2),r=n(41),s=n.n(r),c=n(68),o=n(99),u=n(100),i=n(102),p=n(101),l=n(103),d=n(1),h=n.n(d),m=n(1139),f=n(1106),b=n(272),y=n(1098),v=n(1100),E=n(858),w=n(104),k=n(266),j=n(269),g=n(981),S=n.n(g),O=(n(377),n(270)),x=function(e){function t(){var e,n;Object(o.a)(this,t);for(var r=arguments.length,u=new Array(r),l=0;l<r;l++)u[l]=arguments[l];return(n=Object(i.a)(this,(e=Object(p.a)(t)).call.apply(e,[this].concat(u)))).state={checked:[],expanded:[],parents:[],userType:"",submit:!1},n.handleSubmit=function(){if(""!=n.state.userType)n.props.getMenuList(n.state.userType),n.setState({submit:!0});else{n.props.showError({header:"Error",content:"Select User Type.!"})}},n.handleChange=function(){var e=Object(c.a)(s.a.mark(function e(t,a){var r;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a.name,r=a.value,n.setState({userType:r});case 2:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),n.handleCreate=Object(c.a)(s.a.mark(function e(){var t,a,r,c,o,u,i,p;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.state,a=t.checked,t.expanded,r=t.userType,c=t.parents,o=c.join("*"),u=a.join("*"),i=o.concat("*",u),p={fpermissions:i,usertype:r},console.log("CREATE",p),e.next=8,n.props.updateUserMenus(p);case 8:n.setState({userType:"",parents:[],checked:[],expanded:[],submit:!1});case 9:case"end":return e.stop()}},e)})),n.onCheck=function(e,t){console.log(e,t),t.isParent&&t.checked?(n.setState({parents:[].concat(Object(a.a)(n.state.parents),[t.value])}),n.setState({checked:e})):t.isParent&&0==t.checked?(n.setState({parents:Object(a.a)(n.state.parents.filter(function(e,n){return e!=t.value}))}),n.setState({checked:e})):n.setState({checked:e})},n}return Object(l.a)(t,e),Object(u.a)(t,[{key:"componentDidMount",value:function(){var e=Object(c.a)(s.a.mark(function e(){return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.props.getUserTypeList();case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"componentDidUpdate",value:function(e){this.props.menuList.permission!==e.menuList.permission&&this.setState({checked:this.props.menuList.permission})}},{key:"render",value:function(){var e=this,t=this.props.userTypeList;console.log(this.props.menuList.permission);var n=void 0==this.props.menuList.tree?[]:this.props.menuList.tree,a=void 0==this.props.menuList.icons?[]:this.props.menuList.icons,r=Object.keys(n).map(function(e,t){return n[e]}),s=(Object.keys(a).map(function(e,t){return a[e].icon}),t.map(function(e,t){return{key:t,value:e.FUSERTYPE,text:"".concat(e.FUSERTYPE," - ").concat(e.FTYPEDESC)}})),c=Object(O.i)();return h.a.createElement(h.a.Fragment,null,h.a.createElement(m.a,{fluid:!0},h.a.createElement(m.a.Content,null,h.a.createElement(m.a.Header,{style:{display:"flex"}},h.a.createElement("h3",null,"Assign Menus"),h.a.createElement("div",{className:"ml-auto"},h.a.createElement(f.a,{basic:!0,color:"blue",content:"Update",onClick:this.handleCreate,icon:"upload"}),h.a.createElement(E.a,{to:"/dashboard"},h.a.createElement(f.a,{basic:!0,color:"red",content:"Exit",icon:"home"})))),h.a.createElement(b.a,null),h.a.createElement(m.a.Description,{style:{height:"".concat(c,"px"),overflowY:"auto"}},h.a.createElement(y.a,null,h.a.createElement(y.a.Field,{width:8},h.a.createElement("label",null,"Select User Type"),h.a.createElement(v.a,{search:!0,selection:!0,id:"fusertype",name:"fusertype",options:s,onChange:this.handleChange,value:this.state.userType})),h.a.createElement(y.a.Field,null,h.a.createElement(f.a,{content:"Submit",color:"blue",onClick:this.handleSubmit})),this.state.submit?h.a.createElement(y.a.Field,null,h.a.createElement("label",null,"Menus"),h.a.createElement(S.a,{nodes:r,checked:this.state.checked,expanded:this.state.expanded,onCheck:this.onCheck,onExpand:function(t){return e.setState({expanded:t})}})):null)))))}}]),t}(d.Component);t.default=Object(w.b)(function(e){return{userTypeList:e.userTypeList,menuList:e.menuList}},{showError:k.w,getUserTypeList:function(){return function(){var e=Object(c.a)(s.a.mark(function e(t,n){var a,r,c,o;return s.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=n(),e.next=3,j.a.get("/app.php",{params:{a:"getUserTypeList",univcode:a.univ.funivcode,usertype:a.user.fcurtype}});case 3:"object"!==typeof(r=e.sent).data?(c={header:"Error",content:"Something went wrong"},t(Object(k.w)(c))):-1===r.data.error_code?(o={header:"Error",content:r.data.data.msg},t(Object(k.w)(o))):t({type:"USER_TYPE_LIST",payload:r.data});case 5:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()},getMenuList:function(e){return function(){var t=Object(c.a)(s.a.mark(function t(n,a){var r,c,o,u;return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=a(),t.next=3,j.a.get("/app.php",{params:{a:"getMenuList",univcode:r.univ.funivcode,fusertype:e}});case 3:"object"!==typeof(c=t.sent).data?(o={header:"Error",content:"Something went wrong"},n(Object(k.w)(o))):-1===c.data.error_code?(u={header:"Error",content:c.data.data.msg},n(Object(k.w)(u))):n({type:"MENU_LIST",payload:c.data});case 5:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()},updateUserMenus:function(e){return function(){var t=Object(c.a)(s.a.mark(function t(n,a){var r,c,o,u,i;return s.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=a(),t.next=3,j.a.post("/app.php?a=updateUserMenus&univcode="+r.univ.funivcode,{data:e});case 3:"object"!==typeof(c=t.sent).data?(o={header:"Error",content:"Something went wrong"},n(Object(k.w)(o))):-1===c.data.error_code?(u={header:"Error",content:c.data.data.msg},n(Object(k.w)(u))):(i={header:"Success",content:c.data.data.msg},n(Object(k.w)(i)));case 5:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()}})(x)}}]);
//# sourceMappingURL=183.36f77731.chunk.js.map
|