TableRiwayat.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Datatable from "@/components/Tables/Datatable";
  2. import Swal from "sweetalert2";
  3. function TableRiwayat({ data, role }) {
  4. const handleOpenAlert = () => {
  5. Swal.fire({
  6. icon: 'error',
  7. title: 'Oops...',
  8. html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
  9. confirmButtonColor: "#3e3a8e",
  10. confirmButtonText: 'Oke'
  11. })
  12. };
  13. return (
  14. // <Datatable options={{ responsive: true }}>
  15. <div className="card-over">
  16. <table className="table table-striped my-4 w-100">
  17. <thead>
  18. <tr>
  19. <th>Tanggal Dibuat</th>
  20. <th>Tanggal Dokumen</th>
  21. <th>Judul Dokumen</th>
  22. <th>File Pendukung</th>
  23. </tr>
  24. </thead>
  25. <tbody>
  26. {data.evaluasi.map((e, index) => (
  27. <tr key={index}>
  28. <td>{moment(e.createdAt).format("D MMMM YYYY")}</td>
  29. <td>{moment(e.tanggal).format("D MMMM YYYY")}</td>
  30. <td>{e.judul}</td>
  31. <td>
  32. {e.dokumen.map((e, index) => (
  33. <>
  34. <em key="index" className="fa-lg far fa-file-code"></em>
  35. {role === 2071 ?
  36. <a className="text-muted" onClick={handleOpenAlert} >
  37. {e.judul}
  38. </a>
  39. : <a className="text-muted" href={e.path} target="_blank" download={e.judul}>
  40. {e.judul}
  41. </a>
  42. }
  43. <a className="text-muted" href={e.path} target="_blank" download={e.judul}>
  44. {e.judul}
  45. </a>
  46. <br />
  47. </>
  48. ))}
  49. </td>
  50. </tr>
  51. ))}
  52. </tbody>
  53. </table>
  54. </div>
  55. // </Datatable>
  56. );
  57. }
  58. export default TableRiwayat;