kaauh_ats/templates/recruitment/training_list.html
2025-10-05 12:19:45 +03:00

116 lines
5.7 KiB
HTML

{% extends "base.html" %}
{% load static i18n %}
{% block title %}{% trans "Training Materials" %} - {{ block.super }}{% endblock %}
{% block content %}
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h1 class="h3 mb-0">
<svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
{% trans "Training Materials" %}
</h1>
<div class="d-flex gap-2 align-items-center">
<!-- Search Form -->
{% include "includes/search_form.html" with search_query=search_query %}
{% if user.is_authenticated %}
<a href="{% url 'training_create' %}" class="btn btn-primary">
<svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 4v16m8-8H4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
{% trans "Add New Material" %}
</a>
{% endif %}
</div>
</div>
</div>
{% if materials %}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">{% trans "Title" %}</th>
<th scope="col">{% trans "Created By" %}</th>
<th scope="col">{% trans "Created" %}</th>
<th scope="col" class="text-center">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for material in materials %}
<tr>
<td><strong>{{ material.title }}</strong></td>
<td>{{ material.created_by.username|default:"Anonymous" }}</td>
<td>{{ material.created_at|date:"M d, Y" }}</td>
<td class="text-center">
<div class="btn-group" role="group">
<a href="{% url 'training_detail' material.pk %}" class="btn btn-outline-primary btn-sm" title="{% trans 'View' %}">
{% include "icons/view.html" %}
</a>
{% if user.is_authenticated and material.created_by == user %}
<a href="{% url 'training_update' material.pk %}" class="btn btn-outline-secondary btn-sm" title="{% trans 'Edit' %}">
{% include "icons/edit.html" %}
</a>
<button type="button" class="btn btn-outline-danger btn-sm" title="{% trans 'Delete' %}"
data-bs-toggle="deleteModal"
data-delete-url="{% url 'training_delete' material.pk %}"
data-item-name="{{ material.title }}">
{% include "icons/delete.html" %}
</button>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if is_paginated %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
{% endif %}
{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<li class="page-item active"><span class="page-link">{{ num }}</span></li>
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
<li class="page-item">
<a class="page-link" href="?page={{ num }}">{{ num }}</a>
</li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-4">
<p class="text-muted">{% trans "No training materials found." %}</p>
{% if user.is_authenticated %}
<a href="{% url 'training_create' %}" class="btn btn-primary">
{% trans "Create Your First Material" %}
</a>
{% endif %}
</div>
{% endif %}
</div>
{% endblock %}