Riwayat.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import Datatable from "@/components/Tables/Datatable";
  2. import moment from "moment";
  3. import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
  4. function Riwayat({ data }) {
  5. const { jawaban } = data.sanksi.cabut_sanksi;
  6. return (
  7. <Card className="card-default">
  8. <CardHeader>
  9. <CardTitle>Riwayat</CardTitle>
  10. </CardHeader>
  11. <CardBody>
  12. <Datatable options={{ responsive: true }}>
  13. <table className="table table-striped my-4 w-100">
  14. <thead>
  15. <tr>
  16. <th>Tanggal</th>
  17. <th>Status</th>
  18. <th>Keterangan</th>
  19. <th>Dokumen</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {jawaban ? (
  24. <tr>
  25. <td>{moment(jawaban.createAt).format("DD MMMM YYYY")}</td>
  26. <td>{jawaban.status}</td>
  27. <td>{jawaban.description}</td>
  28. <td>
  29. {jawaban.files.map((e) => (
  30. <>
  31. <em className="fa-lg far fa-file-code"></em>
  32. <a className="text-muted" href={`data:${e.type};base64, ${Buffer.from(e.data).toString("base64")}`} download={e.name}>
  33. {e.name}
  34. </a>
  35. </>
  36. ))}
  37. </td>
  38. </tr>
  39. ) : (
  40. ""
  41. )}
  42. </tbody>
  43. </table>
  44. </Datatable>
  45. </CardBody>
  46. </Card>
  47. );
  48. }
  49. export default Riwayat;