import moment from "moment";
import { Button, Table } from "reactstrap";
import Link from "next/link";

function TableSanksi({ listData, to, linkName }) {
	return (
		<div className="card b">
			<div className="card-body">
				<Table className="table w-100">
					<thead>
						<tr>
							<th>Nomor Sanksi</th>
							<th>Keterangan Sanksi</th>
							<th>Created</th>
							<th>Status</th>
						</tr>
					</thead>
					<tbody>
						{listData.map((data) => {
							return (
								<tr key={data._id}>
									<td>{data.sanksi.no_sanksi}</td>
									<td className="text-nowrap">
										<div className="media align-items-center">
											{/* <img className="img-fluid rounded thumb64" src="/static/img/dummy-search.png" alt="Dummy" /> */}
											<div className="media-body d-flex">
												<div>
													<h4 className="m-0">Universitas Satyagama</h4>
													{/* <small className="text-muted">0742/O/1990 - www.satyagama.ac.id - info@satyagama.ac.id</small> */}
													<p>{data.sanksi.description}</p>
												</div>
											</div>
										</div>
									</td>
									<td>{moment(data.sanksi.createAt).format("DD MMMM YYYY")}</td>
									<td>
										<Link href={{ pathname: to, query: { noSanksi: data.sanksi.no_sanksi } }}>
											<Button color="primary">{linkName}</Button>
										</Link>
									</td>
								</tr>
							);
						})}
					</tbody>
				</Table>
			</div>
		</div>
	);
}

export default TableSanksi;
