0xV3NOMx
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.142.199.54


Current Path : /var/www/egov/build/static/js/
Upload File :
Current File : /var/www/egov/build/static/js/183.36f77731.chunk.js.map

{"version":3,"sources":["pages/utils/assignMenus/index.js","actions/utils/assignMenus.js"],"names":["AssignMenus","state","checked","expanded","parents","userType","submit","handleSubmit","_this","props","getMenuList","setState","showError","header","content","handleChange","_callee","e","_ref","value","regenerator_default","a","wrap","_context","prev","next","name","stop","handleCreate","_callee2","_this$state","parent","fpermissions","permissions","data","_context2","join","concat","usertype","console","log","updateUserMenus","onCheck","node","isParent","Object","toConsumableArray","filter","el","i","this","getUserTypeList","prevProps","menuList","permission","_this2","userTypeList","undefined","tree","menuIcons","icons","nodes","keys","map","userTypeOpt","key","FUSERTYPE","text","FTYPEDESC","wheight","wHeight","react_default","createElement","Fragment","Card","fluid","Content","Header","style","display","className","Button","basic","color","onClick","icon","Link","to","Divider","Description","height","overflowY","Form","Field","width","Dropdown","search","selection","id","options","onChange","index_browser_default","onExpand","Component","connect","asyncToGenerator","mark","dispatch","getState","response","error","_error","univadmin","get","params","univcode","univ","funivcode","user","fcurtype","sent","error_code","msg","type","payload","_x","_x2","apply","arguments","_ref2","_error2","fusertype","_x3","_x4","_ref3","_callee3","_error3","success","_context3","post","_x5","_x6"],"mappings":"6TAcMA,6MACJC,MAAQ,CACNC,QAAS,GACTC,SAAU,GACVC,QAAS,GACTC,SAAU,GACVC,QAAQ,KAOVC,aAAe,WAEb,GAA2B,IAAvBC,EAAKP,MAAMI,SAQfG,EAAKC,MAAMC,YAAYF,EAAKP,MAAMI,UAClCG,EAAKG,SAAS,CAAEL,QAAQ,QATxB,CAKEE,EAAKC,MAAMG,UAJG,CACZC,OAAQ,QACRC,QAAS,2BAefC,mDAAe,SAAAC,EAAOC,EAAPC,GAAA,IAAAC,EAAA,OAAAC,EAAAC,EAAAC,KAAA,SA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,EAAQ,CAAEjG,OAAQ,QAASC,QAAS+F,EAAS3E,KAAKA,KAAKwF,KAC7Df,EAAS/F,YAAUkG,KAEnBH,EAAS,CACPgB,KAAM,YACNC,QAASf,EAAS3E,OAnBjB,wBAAAC,EAAAR,SAAAE,MAAP,gBAAAuG,EAAAC,GAAA,OAAAJ,EAAAF,MAAA7E,KAAA8E,YAAA,ID4JAvF,gBCnI6B,SAACP,GAC9B,sBAAAoG,EAAAzF,OAAA4D,EAAA,EAAA5D,CAAAzB,EAAAC,EAAAqF,KAAO,SAAA6B,EAAO5B,EAAUC,GAAjB,IAAA3G,EAAA4G,EAAAC,EAAA0B,EAAAC,EAAA,OAAArH,EAAAC,EAAAC,KAAA,SAAAoH,GAAA,cAAAA,EAAAlH,KAAAkH,EAAAjH,MAAA,cACCxB,EAAQ2G,IADT8B,EAAAjH,KAAA,EAEkBuF,IAAU2B,KAC/B,uCAAyC1I,EAAMmH,KAAKC,UACpD,CACEnF,KAAMA,IALL,OASwB,kBAPvB2E,EAFD6B,EAAAlB,MASetF,MACZ4E,EAAQ,CAAEjG,OAAQ,QAASC,QAAS,wBAC1C6F,EAAS/F,YAAUkG,MACoB,IAA9BD,EAAS3E,KAAKuF,YACjBX,EAAQ,CAAEjG,OAAQ,QAASC,QAAS+F,EAAS3E,KAAKA,KAAKwF,KAC7Df,EAAS/F,YAAUkG,MAEb2B,EAAU,CAAE5H,OAAQ,UAAWC,QAAS+F,EAAS3E,KAAKA,KAAKwF,KACjEf,EAAS/F,YAAU6H,KAjBhB,wBAAAC,EAAA/G,SAAA4G,MAAP,gBAAAK,EAAAC,GAAA,OAAAP,EAAAP,MAAA7E,KAAA8E,YAAA,KD8HaxB,CAKZxG","file":"static/js/183.36f77731.chunk.js","sourcesContent":["import React, { Component } from \"react\";\nimport { Card, Button, Dropdown, Divider, Form, Icon } from \"semantic-ui-react\";\nimport { Link } from \"react-router-dom\";\nimport { connect } from \"react-redux\";\nimport { showError } from \"../../../actions\";\nimport {\n  getUserTypeList,\n  getMenuList,\n  updateUserMenus,\n} from \"../../../actions/utils/assignMenus\";\nimport CheckboxTree from \"react-checkbox-tree\";\nimport \"react-checkbox-tree/lib/react-checkbox-tree.css\";\nimport { wHeight } from \"../../parms\";\n\nclass AssignMenus extends Component {\n  state = {\n    checked: [],\n    expanded: [],\n    parents: [],\n    userType: \"\",\n    submit: false,\n  };\n\n  async componentDidMount() {\n    await this.props.getUserTypeList();\n  }\n\n  handleSubmit = () => {\n    // console.log(this.props);\n    if (this.state.userType == \"\") {\n      const error = {\n        header: \"Error\",\n        content: \"Select User Type.!\",\n      };\n      this.props.showError(error);\n      return;\n    }\n    this.props.getMenuList(this.state.userType);\n    this.setState({ submit: true });\n  };\n\n  componentDidUpdate(prevProps) {\n    if (this.props.menuList.permission !== prevProps.menuList.permission) {\n      this.setState({ checked: this.props.menuList.permission });\n    }\n  }\n\n  handleChange = async (e, { name, value }) => {\n    this.setState({ userType: value });\n  };\n\n  handleCreate = async () => {\n    const { checked, expanded, userType, parents } = this.state;\n\n    var parent = parents.join(\"*\");\n    var fpermissions = checked.join(\"*\");\n    const permissions = parent.concat(\"*\", fpermissions);\n\n    const data = { fpermissions: permissions, usertype: userType };\n    console.log(\"CREATE\", data);\n    await this.props.updateUserMenus(data);\n    this.setState({\n      userType: \"\",\n      parents: [],\n      checked: [],\n      expanded: [],\n      submit: false,\n    });\n  };\n\n  onCheck = (checked, node) => {\n    console.log(checked, node);\n    if (node.isParent && node.checked) {\n      this.setState({ parents: [...this.state.parents, node.value] });\n      this.setState({ checked });\n    } else if (node.isParent && node.checked == false) {\n      this.setState({\n        parents: [...this.state.parents.filter((el, i) => el != node.value)],\n      });\n      this.setState({ checked });\n    } else {\n      this.setState({ checked });\n    }\n  };\n\n  render() {\n    const userTypeList = this.props.userTypeList;\n    console.log(this.props.menuList.permission);\n    const menuList =\n      this.props.menuList.tree == undefined ? [] : this.props.menuList.tree;\n    const menuIcons =\n      this.props.menuList.icons == undefined ? [] : this.props.menuList.icons;\n\n    const nodes = Object.keys(menuList).map((el, i) => menuList[el]);\n\n    const icons = Object.keys(menuIcons).map((el, i) => menuIcons[el][\"icon\"]);\n\n    const userTypeOpt = userTypeList.map((el, i) => {\n      return {\n        key: i,\n        value: el.FUSERTYPE,\n        text: `${el.FUSERTYPE} - ${el.FTYPEDESC}`,\n      };\n    });\n    const wheight = wHeight();\n\n    return (\n      <>\n        <Card fluid>\n          <Card.Content>\n            <Card.Header style={{ display: \"flex\" }}>\n              <h3>Assign Menus</h3>\n              <div className=\"ml-auto\">\n                <Button\n                  basic\n                  color=\"blue\"\n                  content=\"Update\"\n                  onClick={this.handleCreate}\n                  icon=\"upload\"\n                />\n                <Link to=\"/dashboard\">\n                  <Button basic color=\"red\" content=\"Exit\" icon=\"home\" />\n                </Link>\n              </div>\n            </Card.Header>\n            <Divider />\n            <Card.Description\n              style={{ height: `${wheight}px`, overflowY: \"auto\" }}\n            >\n              <Form>\n                <Form.Field width={8}>\n                  <label>Select User Type</label>\n                  <Dropdown\n                    search\n                    selection\n                    id=\"fusertype\"\n                    name=\"fusertype\"\n                    options={userTypeOpt}\n                    onChange={this.handleChange}\n                    value={this.state.userType}\n                  />\n                </Form.Field>\n                <Form.Field>\n                  <Button\n                    content=\"Submit\"\n                    color=\"blue\"\n                    onClick={this.handleSubmit}\n                  />\n                </Form.Field>\n\n                {this.state.submit ? (\n                  <Form.Field>\n                    <label>Menus</label>\n                    <CheckboxTree\n                      nodes={nodes}\n                      checked={this.state.checked}\n                      expanded={this.state.expanded}\n                      onCheck={this.onCheck}\n                      // icons={{\n                      //   leaf: <Icon name={icons} />\n                      // }}\n                      onExpand={(expanded) => this.setState({ expanded })}\n                      // onlyLeafCheckboxes\n                    />\n                  </Form.Field>\n                ) : null}\n              </Form>\n            </Card.Description>\n          </Card.Content>\n        </Card>\n      </>\n    );\n  }\n}\n\nconst mapStateToProps = (state) => {\n  return {\n    userTypeList: state.userTypeList,\n    menuList: state.menuList,\n  };\n};\n\nexport default connect(mapStateToProps, {\n  showError,\n  getUserTypeList,\n  getMenuList,\n  updateUserMenus,\n})(AssignMenus);\n","import univadmin from \"../../apis/univadmin\";\nimport { showError } from \"../index\";\n\nexport const getUserTypeList = () => {\n  return async (dispatch, getState) => {\n    const state = getState();\n    const response = await univadmin.get(\"/app.php\", {\n      params: {\n        a: \"getUserTypeList\",\n        univcode: state.univ.funivcode,\n        usertype: state.user.fcurtype,\n      },\n    });\n\n    if (typeof response.data !== \"object\") {\n      const error = { header: \"Error\", content: \"Something went wrong\" };\n      dispatch(showError(error));\n    } else if (response.data.error_code === -1) {\n      const error = { header: \"Error\", content: response.data.data.msg };\n      dispatch(showError(error));\n    } else {\n      dispatch({\n        type: \"USER_TYPE_LIST\",\n        payload: response.data,\n      });\n    }\n  };\n};\n\nexport const getMenuList = (userType) => {\n  return async (dispatch, getState) => {\n    const state = getState();\n    const response = await univadmin.get(\"/app.php\", {\n      params: {\n        a: \"getMenuList\",\n        univcode: state.univ.funivcode,\n        fusertype: userType,\n      },\n    });\n\n    if (typeof response.data !== \"object\") {\n      const error = { header: \"Error\", content: \"Something went wrong\" };\n      dispatch(showError(error));\n    } else if (response.data.error_code === -1) {\n      const error = { header: \"Error\", content: response.data.data.msg };\n      dispatch(showError(error));\n    } else {\n      dispatch({\n        type: \"MENU_LIST\",\n        payload: response.data,\n      });\n    }\n  };\n};\n\nexport const updateUserMenus = (data) => {\n  return async (dispatch, getState) => {\n    const state = getState();\n    const response = await univadmin.post(\n      \"/app.php?a=updateUserMenus&univcode=\" + state.univ.funivcode,\n      {\n        data: data,\n      }\n    );\n\n    if (typeof response.data !== \"object\") {\n      const error = { header: \"Error\", content: \"Something went wrong\" };\n      dispatch(showError(error));\n    } else if (response.data.error_code === -1) {\n      const error = { header: \"Error\", content: response.data.data.msg };\n      dispatch(showError(error));\n    } else {\n      const success = { header: \"Success\", content: response.data.data.msg };\n      dispatch(showError(success));\n    }\n  };\n};\n"],"sourceRoot":""}