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 : 18.223.195.30
{"version":3,"sources":["pages/duringexam/bundleRecv/bundrecvReport.js","pages/duringexam/bundleRecv/index.js","actions/during-exam/bundrecv.js"],"names":["ReportBundleRecv","state","fdate","rtype","frtypes","handleDate","e","_this","setState","Object","defineProperty","target","name","value","handleChange","data","type","generateReport","_this$state","console","log","props","univcode","window","open","ReportAPI","_this$state2","this","reprt_options","map","el","i","key","text","react_default","a","createElement","Modal","style","height","dimmer","dim","onClose","close","closeOnDimmerClick","Header","display","className","Button","basic","color","content","onClick","icon","Content","overflowY","Form","error","Field","width","react_input_mask_default","formatChars","n","m","d","z","y","mask","onChange","Dropdown","placeholder","search","selection","options","Component","connect","univ","funivcode","BundleRecv","barcode","detBC","displyBC","fdeleted","handleClick","item","fcollcode","substring","fqpcode","fbundno","fttlscrpt","length","dupBC","j","showError","header","concat","toConsumableArray","show","handleSubmit","_callee","bcarr","regenerator_default","wrap","_context","prev","next","abrupt","filter","BundleRec","resErr","stop","deleteRow","objectSpread","checked","msg","head","bundleRecv","join","handleCancel","CardHeader","Link","to","_this2","Card","fluid","CardContent","renderHeader","Divider","CardDescription","Grid","columns","GridColumn","Input","label","maxLength","vlaue","marginTop","size","maxHeight","Table","celled","tableLayout","marginLeft","marginRight","Row","textAlign","HeaderCell","singleLine","Body","Cell","position","bundrecvReport","_ref","asyncToGenerator","mark","dispatch","getState","response","univadmin","post","sent","payload","error_code","status","_x","_x2","apply","arguments","changeDetBC"],"mappings":"4YAaMA,6MACJC,MAAQ,CACNC,MAAO,GACPC,MAAO,GACPC,QAAS,CAAC,yBAA0B,iCAGtCC,WAAa,SAAAC,GACXC,EAAKC,SAALC,OAAAC,EAAA,EAAAD,CAAA,GAAiBH,EAAEK,OAAOC,KAAON,EAAEK,OAAOE,WAG5CC,aAAe,SAACR,EAAGS,GACjB,OAAQA,EAAKC,MACX,IAAK,OA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AEgH,SAAU,oBASjC,KACJpH,EAAAC,EAAAC,cAACmH,EAAD,CAAkB/H,KAAMA,EAAMiB,IAAKD,EAAQG,MAAOhB,KAAKgB,mBA9P5C+B,aA4QVC,sBANS,SAAA1E,GAEtB,OADAkB,QAAQC,IAAI,QAASnB,EAAMmH,YACpB,CACLA,WAAYnH,EAAMmH,aAKpB,CACEvB,cACAe,UClSqB,SAAA5B,GACvB,sBAAAwE,EAAA/I,OAAAgJ,EAAA,EAAAhJ,CAAA4F,EAAAlE,EAAAuH,KAAO,SAAAvD,EAAOwD,EAAUC,GAAjB,IAAA3J,EAAA4J,EAAA,OAAAxD,EAAAlE,EAAAmE,KAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,cACCxG,EAAQ2J,IADTrD,EAAAE,KAAA,EAEkBqD,IAAUC,KAC/B,iCAAmC9J,EAAM2E,KAAKC,UAC9C,CACE9D,KAAMiE,IALL,OASwB,kBAPvB6E,EAFDtD,EAAAyD,MASejJ,KAMlB4I,EAAS,CACP3I,KAAM,YACNiJ,QAPW,CACXC,YAAa,EACbnJ,KAAM,CAAEmG,IAAK,wBACbiD,OAAQ,aAM4B,IAA7BN,EAAS9I,KAAKmJ,WACvBP,EAAS,CACP3I,KAAM,YACNiJ,QAASJ,EAAS9I,OAGpB4I,EAAS,CACP3I,KAAM,YACNiJ,QAASJ,EAAS9I,OA3BjB,wBAAAwF,EAAAO,SAAAX,MAAP,gBAAAiE,EAAAC,GAAA,OAAAb,EAAAc,MAAA3I,KAAA4I,YAAA,IDkSEC,YCjQuB,SAAC1I,EAAIC,GAE9B,OADAZ,QAAQC,IAAI,UACL,CACLJ,KAAM,qBACNiJ,QAAS,CAAEnI,KAAIC,QDwPJ4C,CAObG","file":"static/js/178.3b8231e1.chunk.js","sourcesContent":["import React, { Component } from \"react\";\nimport {\n Button,\n Modal,\n Form,\n Message,\n Dropdown,\n Grid\n} from \"semantic-ui-react\";\nimport InputMask from \"react-input-mask\";\nimport { ReportAPI } from \"../../../apis/consts\";\nimport { connect } from \"react-redux\";\n\nclass ReportBundleRecv extends Component {\n state = {\n fdate: \"\",\n rtype: \"\",\n frtypes: [\"Received Bundle Report\", \"Not Received Bundle Report\"]\n };\n\n handleDate = e => {\n this.setState({ [e.target.name]: e.target.value });\n };\n\n handleChange = (e, data) => {\n switch (data.type) {\n case \"text\":\n this.setState({ [data.name]: data.value });\n return;\n default:\n this.setState({ [data.name]: data.value });\n return;\n }\n };\n\n generateReport = () => {\n const { fdate, rtype, frtypes } = this.state;\n console.log(\"rept\", fdate, rtype, this.props.univcode);\n\n if (rtype === \"Received Bundle Report\")\n window.open(\n ReportAPI +\n \"generateBundRecvRprt&univcode=\" +\n this.props.univcode +\n \"&fdate=\" +\n fdate,\n \"_blank\"\n );\n else if (rtype === \"Not Received Bundle Report\")\n window.open(\n ReportAPI +\n \"generateBundNotRecvRprt&univcode=\" +\n this.props.univcode +\n \"&fdate=\" +\n fdate,\n \"_blank\"\n );\n };\n\n render() {\n const { fdate, rtype, frtypes } = this.state;\n\n const reprt_options = frtypes.map((el, i) => {\n return { key: i, value: el, text: el };\n });\n\n const formatChars = {\n n: \"[0-1]\",\n m: \"[0-9]\",\n e: \"[0-3]\",\n d: \"[0-9]\",\n z: \"[1-2]\",\n y: \"[0-9]\"\n };\n return (\n <div>\n <Modal\n style={{ height: \"50vh\" }}\n dimmer={this.props.dim}\n open={this.props.open}\n onClose={this.props.close}\n closeOnDimmerClick={false}\n >\n <Modal.Header style={{ display: \"flex\" }}>\n Bundle Receive Report\n <div className=\"ml-auto\">\n <Button\n basic\n color=\"blue\"\n content=\"Generate\"\n onClick={this.generateReport}\n icon=\"file pdf outline\"\n />\n <Button\n basic\n color=\"black\"\n icon=\"ban\"\n onClick={this.props.close}\n content=\"Cancel\"\n />\n </div>\n </Modal.Header>\n\n <Modal.Content style={{ height: \"50vh\", overflowY: \"auto\" }}>\n <Form error>\n {/* {ferror ? <Message\n error\n content={ferrorm}\n /> : null} */}\n <Form.Field width={6}>\n <label>Date</label>\n <InputMask\n formatChars={formatChars}\n type=\"text\"\n value={fdate}\n mask=\"ed/nm/zyyy\"\n name=\"fdate\"\n onChange={this.handleDate}\n />\n </Form.Field>\n <Form.Field width={6}>\n <label>Report Type</label>\n <Dropdown\n placeholder=\"Report\"\n search\n selection\n name=\"rtype\"\n value={rtype}\n options={reprt_options}\n onChange={this.handleChange}\n />\n </Form.Field>\n </Form>\n </Modal.Content>\n </Modal>\n </div>\n );\n }\n}\n\nconst mapStateToProps = state => {\n return {\n univcode: state.univ.funivcode\n };\n};\n\nexport default connect(\n mapStateToProps,\n {}\n)(ReportBundleRecv);\n","import React, { Component } from \"react\";\nimport {\n Card,\n CardHeader,\n Button,\n CardDescription,\n Divider,\n CardContent,\n Form,\n GridColumn,\n Grid,\n Table\n} from \"semantic-ui-react\";\nimport { Link } from \"react-router-dom\";\nimport { showError } from \"../../../actions\";\nimport { connect } from \"react-redux\";\nimport { BundleRec, changeDetBC } from \"../../../actions/during-exam/bundrecv\";\nimport \"../../../index.css\";\nimport ReportBundleRecv from \"./bundrecvReport\";\n\nclass BundleRecv extends Component {\n state = {\n barcode: \"\",\n detBC: [],\n displyBC: false,\n open: false,\n fdeleted: false\n };\n\n handleChange = (e, data) => {\n switch (data.type) {\n case \"text\":\n this.setState({ [data.name]: data.value });\n return;\n default:\n this.setState({ [data.name]: data.value });\n return;\n }\n };\n\n handleClick = () => {\n if (!this.state.barcode) {\n const error = {\n header: \"Error\",\n content: \"Barcode length should be minimum 17\"\n };\n this.props.showError(error);\n } else {\n const fcollcode = this.state.barcode.substring(0, 4);\n const fqpcode = this.state.barcode.substring(4, 9);\n const fbundno = this.state.barcode.substring(9, 14);\n const fttlscrpt = this.state.barcode.substring(14, 17);\n\n const item = {\n fcollcode: fcollcode,\n fqpcode: fqpcode,\n fbundno: fbundno,\n fttlscrpt: fttlscrpt,\n fdeleted: false\n };\n\n let i = this.state.barcode.length - 1;\n const el = item;\n var dupBC = false;\n\n this.state.detBC.map((item, j) => {\n if (item.fbundno === el.fbundno && i !== j) dupBC = true;\n });\n\n if (dupBC) {\n const error = {\n header: \"Error\",\n content: \"Duplicate entry is not allowed.\"\n };\n this.props.showError(error);\n return;\n }\n this.setState({ displyBC: true, detBC: [...this.state.detBC, item] });\n }\n };\n\n show = dimmer => () => this.setState({ dimmer, open: true });\n\n handleSubmit = async () => {\n if (!this.state.detBC) {\n const error = { header: \"Error\", content: \"Scan Barcode\" };\n this.props.showError(error);\n return;\n }\n\n const bcarr = this.state.detBC.filter((el, i) => {\n if (el.fdeleted !== true) {\n return el;\n }\n });\n\n // console.log('bcarr', bcarr);\n await this.props.BundleRec(bcarr);\n this.resErr();\n };\n\n deleteRow = (e, el, i) => {\n let data = { ...el, [e.target.name]: e.target.checked };\n\n const bcarr = this.state.detBC.map((el, j) => {\n if (j === i) {\n return data;\n } else return el;\n });\n\n this.setState({ detBC: bcarr });\n };\n\n resErr = () => {\n var msg;\n var data = [];\n var head = \"Success\";\n\n if (this.props.bundleRecv.length == 0) {\n msg = [\"Bundle Received\"];\n } else {\n this.props.bundleRecv.map((el, i) => {\n head = \"Error, Below bundle No. are not received\";\n data = [...data, el];\n msg = data.join(\",\");\n return msg;\n });\n\n const error = { header: head, content: msg };\n this.props.showError(error);\n }\n };\n\n handleCancel = () => {\n //set all state variables to its initial state\n this.setState({\n barcode: \"\",\n displyBC: false,\n detBC: []\n });\n };\n\n close = (e, data) => {\n if (e.type == \"keydown\") return;\n this.setState({ open: false });\n };\n\n renderHeader() {\n return (\n <CardHeader style={{ display: \"flex\" }}>\n <h3>Bundle Receive</h3>\n <div className=\"ml-auto\">\n <Button\n basic\n color=\"blue\"\n icon=\"file\"\n onClick={this.show(\"blurring\")}\n content=\"Report\"\n />\n <Button\n basic\n color=\"violet\"\n icon=\"upload\"\n onClick={this.handleSubmit}\n content=\"Submit\"\n />\n <Button\n basic\n color=\"black\"\n icon=\"ban\"\n onClick={this.handleCancel}\n content=\"Cancel\"\n />\n <Link to=\"/dashboard\">\n <Button content=\"Exit\" icon=\"home\" basic color=\"red\" />\n </Link>\n </div>\n </CardHeader>\n );\n }\n render() {\n const { barcode, displyBC, detBC, dimmer, open, fdeleted } = this.state;\n\n return (\n <div className=\"animated fadeIn\">\n <Card fluid>\n <CardContent>\n {this.renderHeader()}\n <Divider />\n <CardDescription style={{ height: \"72vh\" }}>\n <Form>\n <Grid columns={2}>\n <GridColumn width={5} style={{ display: \"flex\" }}>\n <Form.Input\n width=\"16\"\n label=\"Barcode\"\n placeholder=\"Enter barcode here...\"\n maxLength=\"17\"\n name=\"barcode\"\n vlaue={barcode}\n onChange={this.handleChange}\n />\n </GridColumn>\n <GridColumn width={6}>\n <Button\n style={{ marginTop: \"25px\" }}\n content=\"GO\"\n size=\"mini\"\n color=\"facebook\"\n onClick={this.handleClick}\n />\n </GridColumn>\n </Grid>\n </Form>\n {displyBC ? (\n <div\n className=\"ui form\"\n style={{\n maxHeight: \"60vh\",\n overflowY: \"scroll\",\n marginTop: \"1rem\"\n }}\n >\n <Table\n celled\n style={{\n width: \"auto\",\n tableLayout: \"auto\",\n marginLeft: \"auto\",\n marginRight: \"auto\"\n }}\n className=\"stick\"\n >\n <Table.Header>\n <Table.Row textAlign=\"center\">\n <Table.HeaderCell singleLine>Sl. No.</Table.HeaderCell>\n <Table.HeaderCell>College Code</Table.HeaderCell>\n <Table.HeaderCell>QP Code</Table.HeaderCell>\n <Table.HeaderCell>Bundle No.</Table.HeaderCell>\n <Table.HeaderCell>Ttl. Script Count</Table.HeaderCell>\n <Table.HeaderCell>Delete</Table.HeaderCell>\n </Table.Row>\n </Table.Header>\n <Table.Body>\n {detBC.map((el, i) => {\n return (\n <Table.Row key={i} textAlign=\"center\">\n <Table.Cell>{i + 1}</Table.Cell>\n <Table.Cell>{el.fcollcode}</Table.Cell>\n <Table.Cell>{el.fqpcode}</Table.Cell>\n <Table.Cell>{el.fbundno}</Table.Cell>\n <Table.Cell>{el.fttlscrpt}</Table.Cell>\n <Table.Cell>\n <input\n className=\"ui checkbox\"\n type=\"checkbox\"\n name=\"fdeleted\"\n // @ts-ignore\n value={fdeleted}\n onChange={e => this.deleteRow(e, el, i)}\n // @ts-ignore\n checked={\n el.fdeleted == \"true\" ? \"checked\" : null\n }\n style={{ position: \"inherit\" }}\n />\n </Table.Cell>\n </Table.Row>\n );\n })}\n </Table.Body>\n </Table>\n </div>\n ) : null}\n <ReportBundleRecv open={open} dim={dimmer} close={this.close} />\n </CardDescription>\n </CardContent>\n </Card>\n </div>\n );\n }\n}\nconst mapStateToProps = state => {\n console.log(\"state\", state.bundleRecv);\n return {\n bundleRecv: state.bundleRecv\n };\n};\nexport default connect(\n mapStateToProps,\n {\n showError,\n BundleRec,\n changeDetBC\n }\n)(BundleRecv);\n","import univadmin from \"../../apis/univadmin\";\n\nexport const BundleRec = detBC => {\n return async (dispatch, getState) => {\n const state = getState();\n const response = await univadmin.post(\n \"app.php?a=bundleRecv&univcode=\" + state.univ.funivcode,\n {\n data: detBC\n }\n );\n\n if (typeof response.data !== \"object\") {\n const data = {\n error_code: -1,\n data: { msg: \"Something went wrong\" },\n status: \"failure\"\n };\n dispatch({\n type: \"SET_ERROR\",\n payload: data\n });\n } else if (response.data.error_code === 0) {\n dispatch({\n type: \"BUND_RECV\",\n payload: response.data\n });\n } else {\n dispatch({\n type: \"SET_ERROR\",\n payload: response.data\n });\n }\n };\n};\n\nexport const changeDetBC = (el, i) => {\n console.log(\"action\");\n return {\n type: \"CHANGE_DET_BARCODE\",\n payload: { el, i }\n };\n};\n"],"sourceRoot":""}
|