<div class="row mt-2 mb-4">
	<div class="col">
		<h3>Browse</h3>
		<div class="row mt-4">
			<div class="col">
				<table id="table_reports" class="table table-striped table-bordered table-hover nowrap">
					<thead class="thead-light">
						<tr>
							<th>Type</th>
							<th>Creation date</th>
							<th>Name</th>
							<th>Details</th>
						</tr>
					</thead>
					<tbody class="tbody">
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(document).ready(function(){
		$("#table_reports").DataTable({
			searching: false,
			ordering:  false,
			responsive: true,
			serverSide: true,
			ajax: {
				url: "/api/reports/get_reports",
				type: "GET",
				data: {}
			},
			columnDefs: [
				{
					"targets": 3, // details
					render: function(data, type, row, meta) {
						return "<a href='/reports/view/" + row[0] + "/" + data + "'><button type='button' class='btn btn-sm btn-info'>view</button></a>";
					},
					"className": "text-center"
				}
			]
		});
	});
</script>