HH/templates/px_sources/source_user_suggestion_list.html
ismail c5f76b3855
Some checks are pending
Build and Push Docker Image / build (push) Waiting to run
updates
2026-05-11 14:45:30 +03:00

252 lines
14 KiB
HTML

{% extends "layouts/source_user_base.html" %}
{% load i18n %}
{% block title %}{% trans "My Suggestions" %} - {{ source.get_localized_name }}{% endblock %}
{% block extra_css %}
<style>
.page-header-gradient {
background: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #22d3ee 100%);
color: white;
padding: 1.5rem 2rem;
border-radius: 1rem;
margin-bottom: 1.5rem;
box-shadow: 0 10px 15px -3px rgba(8, 145, 178, 0.2);
}
.section-card {
background: white;
border-radius: 1rem;
border: 2px solid #e2e8f0;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: all 0.3s ease;
}
.section-card:hover {
border-color: #0891b2;
box-shadow: 0 10px 25px -5px rgba(8, 145, 178, 0.15);
}
.section-header {
padding: 1rem 1.5rem;
border-bottom: 2px solid #e2e8f0;
background: linear-gradient(to right, #f8fafc, #f1f5f9);
display: flex;
align-items: center;
gap: 0.75rem;
}
.section-icon {
width: 40px;
height: 40px;
border-radius: 0.75rem;
display: flex;
align-items: center;
justify-content: center;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-in {
animation: fadeIn 0.5s ease-out forwards;
}
</style>
{% endblock %}
{% block content %}
<div class="p-6 md:p-8 bg-gradient-to-br from-light to-blue-50 min-h-screen">
<div class="page-header-gradient animate-in">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
<div class="flex items-center gap-3">
<div class="section-icon bg-white/20">
<i data-lucide="lightbulb" class="w-6 h-6 text-white"></i>
</div>
<div>
<h1 class="text-2xl font-bold">{% trans "My Suggestions" %}</h1>
<p class="text-white/80 text-sm">
{% trans "View all suggestions from your source" %}
<span class="inline-flex items-center px-2.5 py-0.5 bg-white/20 text-white rounded-full text-xs font-bold ml-2">{{ suggestions_count }}</span>
</p>
</div>
</div>
{% if source_user.can_create_suggestions %}
<a href="{% url 'px_sources:source_user_create_suggestion' %}"
class="inline-flex items-center gap-2 px-5 py-2.5 bg-white text-cyan-700 rounded-xl font-bold hover:bg-gray-100 transition shadow-lg">
<i data-lucide="plus-circle" class="w-4 h-4"></i>
{% trans "Create Suggestion" %}
</a>
{% endif %}
</div>
</div>
<div class="section-card mb-8 animate-in">
<div class="section-header">
<div class="section-icon bg-cyan-100">
<i data-lucide="filter" class="w-5 h-5 text-cyan-600"></i>
</div>
<h2 class="text-lg font-bold text-navy">{% trans "Filters" %}</h2>
</div>
<div class="p-6">
<form method="get" class="grid grid-cols-1 md:grid-cols-12 gap-5">
<div class="md:col-span-5">
<label class="block text-sm font-bold text-navy mb-2">{% trans "Search" %}</label>
<div class="relative">
<input type="text"
class="w-full pl-10 pr-4 py-2.5 border-2 border-cyan-100 rounded-xl text-navy focus:ring-2 focus:ring-cyan-400 focus:border-transparent transition"
name="search"
placeholder="{% trans 'Title or message...' %}"
value="{{ search|default:'' }}">
<i data-lucide="search" class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate"></i>
</div>
</div>
<div class="md:col-span-3">
<label class="block text-sm font-bold text-navy mb-2">{% trans "Status" %}</label>
<select name="status" class="w-full px-3 py-2.5 border-2 border-cyan-100 rounded-xl text-navy focus:ring-2 focus:ring-cyan-400 focus:border-transparent transition bg-white">
<option value="">{% trans "All Statuses" %}</option>
<option value="new" {% if status_filter == 'new' %}selected{% endif %}>{% trans "New" %}</option>
<option value="reviewed" {% if status_filter == 'reviewed' %}selected{% endif %}>{% trans "Reviewed" %}</option>
<option value="in_progress" {% if status_filter == 'in_progress' %}selected{% endif %}>{% trans "In Progress" %}</option>
<option value="implemented" {% if status_filter == 'implemented' %}selected{% endif %}>{% trans "Implemented" %}</option>
<option value="closed" {% if status_filter == 'closed' %}selected{% endif %}>{% trans "Closed" %}</option>
</select>
</div>
<div class="md:col-span-2">
<label class="block text-sm font-bold text-navy mb-2">{% trans "Area" %}</label>
<select name="category" class="w-full px-3 py-2.5 border-2 border-cyan-100 rounded-xl text-navy focus:ring-2 focus:ring-cyan-400 focus:border-transparent transition bg-white">
<option value="">{% trans "All Areas" %}</option>
<option value="clinical_care" {% if category_filter == 'clinical_care' %}selected{% endif %}>{% trans "Clinical Care" %}</option>
<option value="staff_service" {% if category_filter == 'staff_service' %}selected{% endif %}>{% trans "Staff Service" %}</option>
<option value="facility" {% if category_filter == 'facility' %}selected{% endif %}>{% trans "Facility" %}</option>
<option value="communication" {% if category_filter == 'communication' %}selected{% endif %}>{% trans "Communication" %}</option>
<option value="technology" {% if category_filter == 'technology' %}selected{% endif %}>{% trans "Technology" %}</option>
<option value="food_service" {% if category_filter == 'food_service' %}selected{% endif %}>{% trans "Food Service" %}</option>
<option value="other" {% if category_filter == 'other' %}selected{% endif %}>{% trans "Other" %}</option>
</select>
</div>
<div class="md:col-span-2 flex items-end">
<div class="flex gap-2 w-full">
<button type="submit"
class="inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-cyan-600 text-white rounded-xl font-bold hover:bg-cyan-700 transition flex-grow shadow-lg">
<i data-lucide="search" class="w-4 h-4"></i>
{% trans "Filter" %}
</button>
<a href="{% url 'px_sources:source_user_suggestions' %}"
class="inline-flex items-center justify-center p-2.5 border-2 border-slate-200 text-slate rounded-xl hover:bg-slate-50 transition"
title="{% trans 'Clear filters' %}">
<i data-lucide="x-circle" class="w-5 h-5"></i>
</a>
</div>
</div>
</form>
</div>
</div>
<div class="section-card animate-in">
<div class="section-header">
<div class="section-icon bg-cyan-100">
<i data-lucide="lightbulb" class="w-5 h-5 text-cyan-600"></i>
</div>
<h2 class="text-lg font-bold text-navy">
{% trans "All Suggestions" %}
<span class="inline-flex items-center px-2.5 py-0.5 bg-cyan-100 text-cyan-700 rounded-full text-xs font-bold ml-2">{{ suggestions_count }}</span>
</h2>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-cyan-50">
<tr>
<th class="px-6 py-4 text-left text-xs font-bold text-cyan-800 uppercase tracking-wider">{% trans "Title" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-cyan-800 uppercase tracking-wider">{% trans "Suggestion" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-cyan-800 uppercase tracking-wider">{% trans "Area" %}</th>
<th class="text-center py-4 px-6 text-xs font-bold text-cyan-800 uppercase tracking-wider">{% trans "Status" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-cyan-800 uppercase tracking-wider">{% trans "Created" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-cyan-50">
{% for sug in suggestions %}
<tr class="hover:bg-cyan-50/50 transition">
<td class="px-6 py-4">
<span class="text-navy font-semibold">{{ sug.title|truncatechars:35 }}</span>
</td>
<td class="px-6 py-4 text-sm text-slate">{{ sug.message|truncatechars:50 }}</td>
<td class="px-6 py-4 text-sm text-slate">{{ sug.get_category_display }}</td>
<td class="px-6 py-4 text-center">
{% if sug.status == 'new' %}
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-yellow-100 text-yellow-700">
<i data-lucide="circle" class="w-2 h-2 fill-current"></i> {% trans "New" %}
</span>
{% elif sug.status == 'reviewed' %}
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-blue-100 text-blue-700">
<i data-lucide="eye" class="w-2 h-2"></i> {% trans "Reviewed" %}
</span>
{% elif sug.status == 'in_progress' %}
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-purple-100 text-purple-700">
<i data-lucide="loader" class="w-2 h-2"></i> {% trans "In Progress" %}
</span>
{% elif sug.status == 'implemented' %}
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-emerald-100 text-emerald-700">
<i data-lucide="check-circle" class="w-2 h-2"></i> {% trans "Implemented" %}
</span>
{% else %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-slate-100 text-slate-700">{{ sug.get_status_display|default:sug.status }}</span>
{% endif %}
</td>
<td class="px-6 py-4 text-sm text-slate">{{ sug.created_at|date:"M d, Y" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="5" class="px-6 py-12 text-center">
<div class="flex flex-col items-center">
<div class="w-16 h-16 bg-gradient-to-br from-cyan-100 to-blue-100 rounded-full flex items-center justify-center mb-4">
<i data-lucide="lightbulb" class="w-8 h-8 text-cyan-500"></i>
</div>
<p class="text-slate font-medium">{% trans "No suggestions found" %}</p>
{% if source_user.can_create_suggestions %}
<a href="{% url 'px_sources:source_user_create_suggestion' %}" class="mt-3 text-cyan-600 font-semibold hover:underline">
{% trans "Submit your first suggestion" %}
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if suggestions.has_other_pages %}
<div class="px-6 py-4 border-t border-slate-100">
<div class="flex items-center justify-between">
<p class="text-sm text-slate">
{% blocktrans with start=suggestions.start_index end=suggestions.end_index total=suggestions.paginator.count %}
Showing {{ start }} to {{ end }} of {{ total }} suggestions
{% endblocktrans %}
</p>
<div class="flex gap-2">
{% if suggestions.has_previous %}
<a href="?page={{ suggestions.previous_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if search %}&search={{ search }}{% endif %}"
class="px-4 py-2 border-2 border-cyan-200 text-cyan-600 rounded-xl font-semibold hover:bg-cyan-50 transition">
{% trans "Previous" %}
</a>
{% endif %}
<span class="px-4 py-2 bg-cyan-600 text-white rounded-xl font-semibold">
{% blocktrans with num=suggestions.number total=suggestions.paginator.num_pages %}Page {{ num }} of {{ total }}{% endblocktrans %}
</span>
{% if suggestions.has_next %}
<a href="?page={{ suggestions.next_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if search %}&search={{ search }}{% endif %}"
class="px-4 py-2 border-2 border-cyan-200 text-cyan-600 rounded-xl font-semibold hover:bg-cyan-50 transition">
{% trans "Next" %}
</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
});
</script>
{% endblock %}