| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import Datatable from "@/components/Tables/Datatable";
- import moment from "moment";
- import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
- import Swal from "sweetalert2";
- function RiwayatPerbaikan({ data, role }) {
- const handleOpenAlert = () => {
- Swal.fire({
- icon: 'error',
- title: 'Oops...',
- html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
- confirmButtonColor: "#3e3a8e",
- confirmButtonText: 'Oke'
- })
- };
- console.log(data.map((e)=> e.dokumen))
- return (
- <Card className="card-default">
- <CardHeader>
- <CardTitle>Riwayat Dokumen Perbaikan</CardTitle>
- </CardHeader>
- <CardBody>
- <Datatable options={{ responsive: true }}>
- <table className="table table-striped my-4 w-100">
- <thead>
- <tr>
- <th>Tanggal</th>
- <th>Keterangan</th>
- <th>Dokumen</th>
- <th>Tahap</th>
- </tr>
- </thead>
- <tbody>
- {data.length
- ? data.map((value, i) => (
- <tr>
- <td>{moment(value.createdAt).format("DD MMMM YYYY")}</td>
- <td>{value.keterangan}</td>
- <td>
- {value.dokumen.map((e) => (
- <>
- <em className="fa-lg far fa-file-code"></em>
- {role === 2024 ?
- <a className="text-muted" onClick={handleOpenAlert}>
- {e.judul}
- </a>
- :
- <a className="text-muted" href={e.path} target="_blank" download={e.judul}>
- {e.judul}
- </a>
- }
- </>
- ))}
- </td>
- <td>{value.index+1}</td>
- </tr>
- ))
- : ""}
- </tbody>
- </table>
- </Datatable>
- </CardBody>
- </Card>
- );
- }
- export default RiwayatPerbaikan;
|