187 lines
10 KiB
HTML
187 lines
10 KiB
HTML
{% extends "base.html" %}
|
|
{% load widget_tweaks %}
|
|
{% block title %}Settings{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3 mb-0 text-primary-theme">
|
|
<i class="fas fa-cog me-2"></i>
|
|
Settings Management
|
|
</h1>
|
|
<a href="{% url 'settings_create' %}" class="btn btn-main-action">
|
|
<i class="fas fa-plus me-2"></i>
|
|
Create New Setting
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Search and Filters -->
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<form method="get" class="row g-3">
|
|
<div class="col-md-8">
|
|
<div class="input-group">
|
|
<span class="input-group-text">
|
|
<i class="fas fa-search"></i>
|
|
</span>
|
|
<input type="text" class="form-control" name="q"
|
|
placeholder="Search settings..." value="{{ search_query }}">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<button type="submit" class="btn btn-outline-primary">
|
|
<i class="fas fa-search"></i> Search
|
|
</button>
|
|
{% if search_query %}
|
|
<a href="{% url 'settings_list' %}" class="btn btn-outline-secondary">
|
|
<i class="fas fa-times"></i> Clear
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Results Summary -->
|
|
{% if search_query %}
|
|
<div class="alert alert-info">
|
|
Found {{ page_obj.paginator.count }} setting{{ page_obj.paginator.count|pluralize }} matching "{{ search_query }}"
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Settings Table -->
|
|
<div class="card">
|
|
<div class="card-body">
|
|
{% if messages %}
|
|
{% for message in messages %}
|
|
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
|
|
{{ message }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if page_obj %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th style="width: 45%;">Key</th>
|
|
<th style="width: 45%;">Value</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for setting in page_obj %}
|
|
<tr>
|
|
<td>
|
|
<code class="text-primary-theme">{{ setting.key }}</code>
|
|
</td>
|
|
<td>{{ setting.value|truncatechars:50 }}</td>
|
|
<td>
|
|
<div class="btn-group" role="group">
|
|
<a href="{% url 'settings_detail' pk=setting.pk %}"
|
|
class="btn btn-sm btn-outline-primary" title="View Details">
|
|
<i class="fas fa-eye"></i>
|
|
</a>
|
|
<a href="{% url 'settings_update' pk=setting.pk %}"
|
|
class="btn btn-sm btn-outline-secondary" title="Edit Setting">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<form method="post" action="{% url 'settings_delete' pk=setting.pk %}"
|
|
onsubmit="return confirm('Are you sure you want to delete this setting?');"
|
|
style="display: inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete Setting">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if page_obj.has_other_pages %}
|
|
<nav aria-label="Settings pagination">
|
|
<ul class="pagination justify-content-center">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page=1{% if search_query %}&q={{ search_query }}{% endif %}">
|
|
<i class="fas fa-angle-double-left"></i>
|
|
</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if search_query %}&q={{ search_query }}{% endif %}">
|
|
<i class="fas fa-angle-left"></i>
|
|
</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 }}{% if search_query %}&q={{ search_query }}{% endif %}">{{ 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 }}{% if search_query %}&q={{ search_query }}{% endif %}">
|
|
<i class="fas fa-angle-right"></i>
|
|
</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if search_query %}&q={{ search_query }}{% endif %}">
|
|
<i class="fas fa-angle-double-right"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
{% else %}
|
|
<div class="text-center py-5">
|
|
<i class="fas fa-cog fa-3x text-muted mb-3"></i>
|
|
<h5 class="text-muted">No settings found</h5>
|
|
<p class="text-muted">
|
|
{% if search_query %}
|
|
No settings match your search criteria "{{ search_query }}".
|
|
{% else %}
|
|
Get started by creating your first setting.
|
|
{% endif %}
|
|
</p>
|
|
<a href="{% url 'settings_create' %}" class="btn btn-main-action">
|
|
<i class="fas fa-plus"></i> Create Setting
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="text-center mt-3">
|
|
<small class="text-muted">
|
|
{% if page_obj %}
|
|
Showing {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} settings
|
|
{% if search_query %}
|
|
(filtered by: "{{ search_query }}")
|
|
{% endif %}
|
|
{% endif %}
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|