{% import 'utility/_macros.twig' as macros %}
{% extends 'layout/_base.twig' %}
{% block head %}
{% include 'layout/_head.twig' %}
{{ macros.styleNscript('admin/info') }}
{% endblock %}
{% block main %}
<section class="grid grid--main">
{% include 'admin/layout/_aside.twig' %}
<main class="main">
<ul class="breadcrumb breadcrumb--dashboard">
<li class="breadcrumb--li">
<a class="breadcrumb--li-a" href="{{ path('admin_dashboard') }}">Dashboard</a>
</li>
<li class="breadcrumb--li">
<a class="breadcrumb--li-a current">Home Page Banner</a>
</li>
</ul>
<div class="workarea workarea--1x2">
<div class="formholder">
{% for message in app.flashes('success') %}
<div class="alert alert-success">
{{ message }}
</div>
{% endfor %}
{% for message in app.flashes('error') %}
<div class="alert alert-danger">
{{ message }}
</div>
{% endfor %}
<div class="formholder--heading">Create Banner</div>
<form class="form" id="createIssueTheme" method="POST" enctype="multipart/form-data">
<div class="input--group" style="margin: 0;">
<input class="input" type="file" name="cover" accept=".jpg,.jpeg,.png" required />
<div class="progress">Upload Cover</div>
</div>
<div class="image--preview"></div>
<div class="input--group">
<input class="input" type="text" name="title" placeholder="Enter Title" required />
</div>
<div class="input--group">
<textarea name="description" placeholder="Enter Description" ></textarea>
</div>
<input type="hidden" name="locale" value="{{ app.request.locale }}" />
<button class="btn--primary-solid btn--100" type="submit">Create</button>
</form>
</div>
<table class="table">
<thead>
<tr>
<th>Cover</th>
<th>Title</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for banner in banners %}
<tr>
<td>
{% if banner.cover %}
<img src="{{ asset('uploads/banners/' ~ banner.cover) }}" alt="{{ banner.title }}" style="width: 100px;" />
{% else %}
No Cover Image
{% endif %}
</td>
<td>{{ banner.title }}</td>
<td>{{ banner.description }}</td>
<td class="btn--group">
<a href="{{ path('admin_banner_edit', { 'id': banner.id }) }}" class="btn--icon btn--edit"><i class="btn--icon-i ri-quill-pen-fill"></i></a>
<form method="POST" action="{{ path('admin_banner_delete', { 'id': banner.id }) }}" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this banner?');">
<button type="submit" class="btn--icon btn--delete"><i class="btn--icon-i ri-delete-bin-2-fill"></i></button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">No banners found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</main>
</section>
{% endblock %}