<div class="card card-info card-outline">
	<div class="card-header">
		<h5 class="m-0">Installed plugins<span class="float-right"><a class="" data-toggle="collapse" href="#install_plugin">Install Plugin</a></span></h5>
	</div>
	<div class="card-body">
		<table class="table table-striped table-bordered table-responsive d-md-table" id="tb_plugins">
			<thead>
			<tr>
				<th>Enabled</th>
				<th>Name</th>
				<th>Version</th>
				<th>Author</th>
				<th>Filename</th>
				<th style="width: 55px;">Options</th>
			</tr>
			</thead>
			<tbody>
			{% for plugin in plugins %}
				<tr>
					<td>
						{% if plugin.enabled %}
							<form method="post">
								{{ csrf() }}
								<input type="hidden" name="disable" value="{{ plugin.file }}" />
								<button type="submit" class="btn btn-success" onclick="return confirm('Are you sure you want to disable plugin {{ plugin.name }}?');" title="Disable"><i class="fas fa-check"></i> Enabled</button>
							</form>
						{% else %}
							<form method="post">
								{{ csrf() }}
								<input type="hidden" name="enable" value="{{ plugin.file }}" />
								<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to enable plugin {{ plugin.name }}?');" title="Enable"><i class="fas fa-ban"></i> Disabled</button>
							</form>
						{% endif %}
					</td>
					<td><b>{{ plugin.name }}</b><br>
						<small>{{ plugin.description|raw }}</small>
					</td>
					<td>{{ plugin.version }}</td>
					<td><b>{{ plugin.author }}</b><br>
						<small>{{ plugin.contact }}</small>
					</td>
					<td>{{ plugin.file }}.json</td>
					<td>
						{% if plugin.uninstall %}
							<form method="post">
								{{ csrf() }}
								<input type="hidden" name="uninstall" value="{{ plugin.file }}" />
								<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to uninstall {{ plugin.name }}?');" title="Uninstall"><i class="fas fa-trash"></i></button>
							</form>
						{% endif %}
					</td>
				</tr>
			{% endfor %}
			</tbody>
		</table>
	</div>
</div>

<script>
	$(function () {
		$('#tb_plugins').DataTable();
	})
</script>