CaseProgress.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import React, { Component, useState, useEffect } from "react";
  2. import { Button } from "reactstrap";
  3. import { Progress } from "reactstrap";
  4. import Sparkline from "@/components/Common/Sparklines";
  5. import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
  6. import FlotChart from "@/components/Charts/Flot.js";
  7. import { ChartSpline, ChartArea, ChartBarStacked, ChartDonut, ChartLine } from "@/components/Config/flot.setup.js";
  8. import Datatable from "@/components/Tables/Datatable";
  9. import MorrisChart from "@/components/Charts//Morris";
  10. import Dropdown from 'react-bootstrap/Dropdown';
  11. function CaseProgress({ data, nextButton, prevButton, tahun, excel, excelSemua, excelMenu, user }) {
  12. const ChartPie = {
  13. data: [
  14. {
  15. label: "Ditindaklanjuti DIKTI",
  16. color: "#287DAD",
  17. data: [data.jumlah_laporan.dikti],
  18. },
  19. {
  20. label: "Ditindaklanjuti LLDIKTI",
  21. color: "#1EA457",
  22. data: [data.jumlah_laporan.lldikti],
  23. },
  24. {
  25. label: "Ditutup",
  26. color: "#FD4233",
  27. data: [data.jumlah_laporan.ditutup],
  28. },
  29. ],
  30. options: {
  31. series: {
  32. pie: {
  33. show: true,
  34. innerRadius: 0,
  35. label: {
  36. show: true,
  37. radius: 0.5,
  38. formatter: function (label, series) {
  39. return (
  40. '<div class="flot-pie-label">' +
  41. //label + ' : ' +
  42. Math.round(series.percent) +
  43. "%</div>"
  44. );
  45. },
  46. background: {
  47. opacity: 0.8,
  48. color: "#222",
  49. },
  50. },
  51. },
  52. },
  53. },
  54. };
  55. const ChartBar = {
  56. data: [
  57. {
  58. // "label": "Complete",
  59. color: "#287DAD",
  60. data: [["Ditindaklanjuti DIKTI", data.jumlah_laporan.dikti]],
  61. },
  62. {
  63. // "label": "In Progress",
  64. color: "#1EA457",
  65. data: [["Ditindaklanjuti LLDIKTI", data.jumlah_laporan.lldikti]],
  66. },
  67. {
  68. // "label": "Cancelled",
  69. color: "#FD4233",
  70. data: [["Ditutup", data.jumlah_laporan.ditutup]],
  71. },
  72. ],
  73. options: {
  74. series: {
  75. bars: {
  76. align: "center",
  77. lineWidth: 0,
  78. show: true,
  79. barWidth: 0.2,
  80. fill: 0.9,
  81. },
  82. },
  83. grid: {
  84. borderColor: "#eee",
  85. borderWidth: 1,
  86. hoverable: true,
  87. backgroundColor: "#fcfcfc",
  88. },
  89. tooltip: true,
  90. tooltipOpts: {
  91. content: (label, x, y) => x + " : " + y,
  92. },
  93. xaxis: {
  94. tickColor: "#fcfcfc",
  95. mode: "categories",
  96. },
  97. yaxis: {
  98. // position: 'right' or 'left'
  99. tickColor: "#eee",
  100. },
  101. shadowSize: 0,
  102. },
  103. };
  104. return (
  105. <div className="card b">
  106. <div className="card-body bb">
  107. <div className="margin-botton-20 text-tahun">
  108. <Button className="float-left button-hidden icon-next" onClick={prevButton}>
  109. <img src="/static/img/previous.png"></img>
  110. </Button>
  111. <Button className="float-left button-hidden icon-next" onClick={nextButton}>
  112. <img src="/static/img/next.png"></img>
  113. </Button>
  114. <b className="text-tahun">Tahun {tahun} </b>
  115. {user?.role?.id !== 2071 && ( // ⬅️ sembunyikan dropdown untuk role 2071
  116. <Dropdown className="float-right">
  117. <Dropdown.Toggle variant="success" id="dropdown-basic">
  118. Unduh
  119. </Dropdown.Toggle>
  120. <Dropdown.Menu>
  121. <Dropdown.Item onClick={excelMenu}>Unduh dokumen pelaporan</Dropdown.Item>
  122. <Dropdown.Item onClick={excelSemua}>Unduh dokumen semua menu</Dropdown.Item>
  123. </Dropdown.Menu>
  124. </Dropdown>
  125. )}
  126. {/* <Button className="float-right button-hidden icon-eksport" type="submit" onClick={excel}>
  127. <img src="/static/img/eksport.png"></img>
  128. </Button> */}
  129. </div>
  130. <div className="header-1">
  131. <h2 className="card-title-1">Perkembangan</h2>
  132. </div>
  133. <div className="w-401">
  134. <FlotChart options={ChartBar.options} data={ChartBar.data} className="flot-chart" height="200px" />
  135. {/* <MorrisChart type={'Bar'} id="morris-bar" data={chartdata} options={barOptions} /> */}
  136. </div>
  137. </div>
  138. <div className="card-body">
  139. <div className="header-1">
  140. <h2 className="card-title-1">Rekapitulasi</h2>
  141. </div>
  142. <FlotChart options={ChartPie.options} data={ChartPie.data} className="flot-chart" height="250px" />
  143. </div>
  144. </div>
  145. );
  146. }
  147. export default CaseProgress;