CaseProgress.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import React, { Component, useState, useEffect } from "react";
  2. import { Progress } from "reactstrap";
  3. import Sparkline from "@/components/Common/Sparklines";
  4. import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
  5. import FlotChart from "@/components/Charts/Flot.js";
  6. import { ChartSpline, ChartArea, ChartBarStacked, ChartDonut, ChartLine } from "@/components/Config/flot.setup.js";
  7. import Datatable from "@/components/Tables/Datatable";
  8. import MorrisChart from "@/components/Charts//Morris";
  9. import { Button } from "reactstrap";
  10. function CaseProgress({ data, nextButton, prevButton, tahun }) {
  11. const ChartBar = {
  12. data: [
  13. {
  14. // "label": "Complete",
  15. color: "#5ab1ef",
  16. data: [["Sudah diperiksa", data.evaluasi.hasEvaluasi]],
  17. },
  18. {
  19. // "label": "In Progress",
  20. color: "#52D489",
  21. data: [["Belum diperiksa", data.evaluasi.notHasEvaluasi]],
  22. },
  23. ],
  24. options: {
  25. series: {
  26. bars: {
  27. align: "center",
  28. lineWidth: 0,
  29. show: true,
  30. barWidth: 0.2,
  31. fill: 0.9,
  32. },
  33. },
  34. grid: {
  35. borderColor: "#eee",
  36. borderWidth: 1,
  37. hoverable: true,
  38. backgroundColor: "#fcfcfc",
  39. },
  40. tooltip: true,
  41. tooltipOpts: {
  42. content: (label, x, y) => x + " : " + y,
  43. },
  44. xaxis: {
  45. tickColor: "#fcfcfc",
  46. mode: "categories",
  47. },
  48. yaxis: {
  49. // position: 'right' or 'left'
  50. tickColor: "#eee",
  51. },
  52. shadowSize: 0,
  53. },
  54. };
  55. const ChartPie = {
  56. data: [
  57. {
  58. label: "Sudah diperiksa",
  59. color: "#287DAD",
  60. data: [data.evaluasi.hasEvaluasi],
  61. },
  62. {
  63. label: "Belum diperiksa",
  64. color: "#52D489",
  65. data: [data.evaluasi.notHasEvaluasi],
  66. },
  67. ],
  68. options: {
  69. series: {
  70. pie: {
  71. show: true,
  72. innerRadius: 0,
  73. label: {
  74. show: true,
  75. radius: 0.8,
  76. formatter: function (label, series) {
  77. return (
  78. '<div class="flot-pie-label">' +
  79. //label + ' : ' +
  80. Math.round(series.percent) +
  81. "%</div>"
  82. );
  83. },
  84. background: {
  85. opacity: 0.8,
  86. color: "#222",
  87. },
  88. },
  89. },
  90. },
  91. },
  92. };
  93. return (
  94. <div className="card b">
  95. <div className="card-body bb">
  96. <div className="margin-botton-20 text-tahun">
  97. <Button className="float-left button-hidden icon-next" onClick={prevButton}>
  98. <img src="/static/img/previous.png"></img>
  99. </Button>
  100. <Button className="float-left button-hidden icon-next" onClick={nextButton}>
  101. <img src="/static/img/next.png"></img>
  102. </Button>
  103. <b className="text-tahun">Tahun {tahun} </b>
  104. <Button className="float-right button-hidden icon-eksport">
  105. <img src="/static/img/eksport.png"></img>
  106. </Button>
  107. </div>
  108. <div className="header-1">
  109. <h2 className="card-title-1">Perkembangan</h2>
  110. </div>
  111. <div className="w-401">
  112. <FlotChart options={ChartBar.options} data={ChartBar.data} className="flot-chart" height="200px" />
  113. </div>
  114. </div>
  115. <div className="card-body">
  116. <div className="header-1">
  117. <h2 className="card-title-1">Rekapitulasi</h2>
  118. </div>
  119. <FlotChart options={ChartPie.options} data={ChartPie.data} className="flot-chart" height="250px" />
  120. </div>
  121. </div>
  122. );
  123. }
  124. export default CaseProgress;