Dashboard sipadu mbip
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ReportCompound.js 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import React, { Component } from 'react';
  2. import ReactDOM from 'react-dom';
  3. import ClipLoader from 'react-spinners/ClipLoader';
  4. import {ExportCSV} from '../ExportCSV';
  5. export default class ReportCompound extends Component {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. current_id: this.props.current_id,
  10. dataReport: [],
  11. loading: true,
  12. };
  13. }
  14. componentDidMount(){
  15. fetch('/api/report/compound/list/null/null').then(response => {
  16. response.json().then(res => {
  17. this.setState({ dataReport: res.data, loading: false });
  18. const script = document.createElement("script");
  19. script.src = "/js/dashboard/datatable.js";
  20. script.async = true;
  21. document.body.appendChild(script);
  22. })
  23. })
  24. }
  25. render() {
  26. return (
  27. <div className="row">
  28. <div className="col-xl-12 col-md-12">
  29. <div className="card">
  30. <div className="card-header">
  31. <h5>Laporan Pengeluaran Kompaun Mengikut Kesalahan</h5>
  32. {/* {!this.state.loading ? <ExportCSV csvData={this.state.dataCompound} fileName="Report_saman_1" type={this.state.form.type} />: ""} */}
  33. </div>
  34. <div className="card-block">
  35. <div className="data_table_main dt-responsive table-responsive">
  36. <table id="report" className="table table-sm table-striped table-bordered nowrap datatable" style={{"width":"100%"}}>
  37. <thead>
  38. <tr>
  39. <th width="20">#</th>
  40. <th>Kesalahan</th>
  41. <th width="80">Jumlah Kompaun Keluar</th>
  42. <th width="80">Amaun Kompaun (Rm)</th>
  43. <th width="80">Jumlah Bayar</th>
  44. <th width="80">Amaun Bayar (RM)</th>
  45. <th width="80">Jumlah Kompaun Belum Bayar</th>
  46. <th width="80">Amount Tungakkan (RM)</th>
  47. <th width="80">Kompaun Batal</th>
  48. <th width="80">Amaun Batal (RM)</th>
  49. <th width="80">Kompaun Kurang</th>
  50. <th width="80">Amaun Kurang (RM)</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. {!this.state.loading ?
  55. this.state.dataReport.map((item,i) =>
  56. <tr key={i}>
  57. <td>{item.index}</td>
  58. <td>{item.kesalahan}</td>
  59. <td>{item.jumlahK}</td>
  60. <td>{item.amaunK}</td>
  61. <td>{item.jumlahB}</td>
  62. <td>{item.amaunB}</td>
  63. <td>{item.belumB}</td>
  64. <td>{item.amaunT}</td>
  65. <td>{item.kBatal}</td>
  66. <td>{item.amaunBatal}</td>
  67. <td>{item.kompaunKurang}</td>
  68. <td>{item.amaunKurang}</td>
  69. </tr>
  70. )
  71. :
  72. <tr>
  73. <td colSpan="12">
  74. <div className='sweet-loading' style={{'textAlign':'center'}}>
  75. <ClipLoader
  76. style={{'border-color': 'red'}}
  77. sizeUnit={"px"}
  78. size={50}
  79. color={'#123abc'}
  80. loading={this.state.loading}
  81. />
  82. </div>
  83. </td>
  84. </tr>
  85. }
  86. </tbody>
  87. <tfoot>
  88. <tr>
  89. <th width="20">#</th>
  90. <th>Kesalahan</th>
  91. <th width="80">Jumlah Kompaun Keluar</th>
  92. <th width="80">Amaun Kompaun (Rm)</th>
  93. <th width="80">Jumlah Bayar</th>
  94. <th width="80">Amaun Bayar (RM)</th>
  95. <th width="80">Jumlah Kompaun Belum Bayar</th>
  96. <th width="80">Amount Tungakkan (RM)</th>
  97. <th width="80">Kompaun Batal</th>
  98. <th width="80">Amaun Batal (RM)</th>
  99. <th width="80">Kompaun Kurang</th>
  100. <th width="80">Amaun Kurang (RM)</th>
  101. </tr>
  102. </tfoot>
  103. </table>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. );
  110. }
  111. }
  112. if (document.getElementById('reportcompound')) {
  113. const component = document.getElementById('reportcompound');
  114. const props = Object.assign({}, component.dataset)
  115. ReactDOM.render(<ReportCompound {...props} />, component);
  116. }