| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- import Datatable from "@/components/Tables/Datatable";
 
- import moment from "moment";
 
- import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
 
- import Swal from "sweetalert2";
 
- function Riwayat({ 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'
 
- 		})
 
- 	};
 
- 	return (
 
- 		<Card className="card-default">
 
- 			<CardHeader>
 
- 				<CardTitle>Riwayat</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>
 
- 							</tr>
 
- 						</thead>
 
- 						<tbody>
 
- 							{data.length
 
- 								? data.map((value) => (
 
- 									<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>
 
- 									</tr>
 
- 								))
 
- 								: ""}
 
- 						</tbody>
 
- 					</table>
 
- 				</Datatable>
 
- 			</CardBody>
 
- 		</Card>
 
- 	);
 
- }
 
- export default Riwayat;
 
 
  |