<div class="card card-info card-outline">
	<div class="card-header">
		<h5 class="m-0">News:
			<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=new" class="float-right"><span
					class="btn btn-sm btn-success">New</span></a>
		</h5>
	</div>

	<div class="card-body">
		<table class="tb_datatable table table-striped table-bordered table-responsive d-md-table">
			<thead>
			<tr>
				<th width="5%">ID</th>
				<th>Date</th>
				<th>Description</th>
				<th>Type</th>
				<th>Where</th>
				<th></th>
			</tr>
			</thead>
			<tbody>
			{% if changelogs|length > 0 %}
				{% set i = 0 %}
				{% for log in changelogs %}
					<tr>
						<td>{{ log.id }}</td>
						<td>{{ log.date|date("j.m.Y") }}</td>
						<td>{{ truncate(log.body|raw,20) }}</td>
						<td><img src="{{ constant('BASE_URL') }}images/changelog/{{ log.type }}.png" alt="icon" title="{{ log.type|capitalize }}"/> {{ log.type|capitalize }}</td>
						<td><img src="{{ constant('BASE_URL') }}images/changelog/{{ log.where }}.png" alt="icon" title="{{ log.where|capitalize }}"/> {{ log.where|capitalize }}</td>
						<td>
							<div class="btn-group">
								<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=edit&id={{ log.id }}" class="btn btn-success btn-sm" title="Edit">
									<i class="fas fa-pencil-alt"></i>
								</a>
								<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=delete&id={{ log.id }}" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?');" title="Delete">
									<i class="fas fa-trash"></i>
								</a>
								<a href="{{ constant('ADMIN_URL') }}?p=changelog&action=hide&id={{ log.id }}" class="btn btn-{{ (log.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if log.hidden != 1 %}Hide{% else %}Show{% endif %}">
									<i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i>
								</a>
							</div>
						</td>
					</tr>
					{% set i = i + 1 %}
				{% endfor %}
			{% else %}
				<tr>
					<td colspan="6">There are no changelogs for the moment.</td>
				</tr>
			{% endif %}
			</tbody>
		</table>
	</div>
</div>
