133 lines
7.0 KiB
HTML
133 lines
7.0 KiB
HTML
{% extends "layouts/base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% if action == 'create' %}{% trans "New Acknowledgement" %}{% else %}{% trans "Edit Acknowledgement" %}{% endif %} - PX360{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-6 md:p-8 bg-gradient-to-br from-light to-blue-50 min-h-screen">
|
|
<!-- Header -->
|
|
<div class="flex items-center gap-3 mb-8">
|
|
<div class="flex items-center justify-center w-12 h-12 bg-gradient-to-br from-blue to-navy rounded-2xl shadow-lg shadow-blue-200">
|
|
<i data-lucide="{% if action == 'create' %}plus{% else %}edit{% endif %}" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-navy">
|
|
{% if action == 'create' %}{% trans "New Acknowledgement" %}{% else %}{% trans "Edit Acknowledgement" %}{% endif %}
|
|
</h1>
|
|
<p class="text-slate text-sm">
|
|
{% if action == 'create' %}{% trans "Create a new acknowledgement for employees" %}{% else %}{% trans "Update acknowledgement details" %}{% endif %}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="max-w-3xl">
|
|
<div class="bg-white rounded-2xl shadow-sm border border-slate-200 overflow-hidden">
|
|
<form method="post" enctype="multipart/form-data" class="p-6 space-y-6">
|
|
{% csrf_token %}
|
|
|
|
<!-- Title -->
|
|
<div>
|
|
<label class="block text-sm font-bold text-navy mb-2">
|
|
{% trans "Title" %} <span class="text-red-500">*</span>
|
|
</label>
|
|
<input type="text" name="title" required
|
|
value="{{ acknowledgement.title|default:'' }}"
|
|
class="w-full px-4 py-3 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue focus:border-transparent transition"
|
|
placeholder="{% trans 'Enter acknowledgement title' %}">
|
|
</div>
|
|
|
|
<!-- Description -->
|
|
<div>
|
|
<label class="block text-sm font-bold text-navy mb-2">
|
|
{% trans "Description" %}
|
|
</label>
|
|
<textarea name="description" rows="5"
|
|
class="w-full px-4 py-3 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue focus:border-transparent transition"
|
|
placeholder="{% trans 'Enter detailed description of the acknowledgement' %}">{{ acknowledgement.description|default:'' }}</textarea>
|
|
</div>
|
|
|
|
<!-- PDF Document -->
|
|
<div>
|
|
<label class="block text-sm font-bold text-navy mb-2">
|
|
{% trans "PDF Document" %}
|
|
</label>
|
|
<div class="border-2 border-dashed border-slate-300 rounded-xl p-6 text-center hover:border-blue transition">
|
|
<input type="file" name="pdf_document" accept=".pdf"
|
|
class="w-full"
|
|
onchange="updateFileName(this)">
|
|
{% if acknowledgement.pdf_document %}
|
|
<p class="text-sm text-slate mt-2">
|
|
{% trans "Current:" %} <a href="{{ acknowledgement.pdf_document.url }}" target="_blank" class="text-blue hover:underline">{{ acknowledgement.pdf_document.name }}</a>
|
|
</p>
|
|
{% endif %}
|
|
</div>
|
|
<p class="text-xs text-slate mt-2">{% trans "Upload a PDF document for employees to review (optional)" %}</p>
|
|
</div>
|
|
|
|
<!-- Settings -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div class="bg-slate-50 rounded-xl p-4">
|
|
<label class="flex items-center gap-3 cursor-pointer">
|
|
<input type="checkbox" name="is_active"
|
|
{% if acknowledgement.is_active|default:True %}checked{% endif %}
|
|
class="w-5 h-5 text-blue rounded focus:ring-blue">
|
|
<div>
|
|
<span class="font-semibold text-navy">{% trans "Active" %}</span>
|
|
<p class="text-xs text-slate">{% trans "Show in employee checklist" %}</p>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
<div class="bg-slate-50 rounded-xl p-4">
|
|
<label class="flex items-center gap-3 cursor-pointer">
|
|
<input type="checkbox" name="is_required"
|
|
{% if acknowledgement.is_required|default:True %}checked{% endif %}
|
|
class="w-5 h-5 text-blue rounded focus:ring-blue">
|
|
<div>
|
|
<span class="font-semibold text-navy">{% trans "Required" %}</span>
|
|
<p class="text-xs text-slate">{% trans "Must be signed by all employees" %}</p>
|
|
</div>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Order -->
|
|
<div>
|
|
<label class="block text-sm font-bold text-navy mb-2">
|
|
{% trans "Display Order" %}
|
|
</label>
|
|
<input type="number" name="order"
|
|
value="{{ acknowledgement.order|default:0 }}"
|
|
class="w-32 px-4 py-3 border border-slate-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue focus:border-transparent transition">
|
|
<p class="text-xs text-slate mt-2">{% trans "Lower numbers appear first" %}</p>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex gap-3 pt-4 border-t border-slate-100">
|
|
<a href="{% url 'accounts:simple_acknowledgements:admin_list' %}"
|
|
class="inline-flex items-center justify-center gap-2 px-6 py-3 bg-slate-100 text-slate-700 rounded-xl font-semibold hover:bg-slate-200 transition">
|
|
{% trans "Cancel" %}
|
|
</a>
|
|
<button type="submit"
|
|
class="inline-flex items-center justify-center gap-2 px-6 py-3 bg-gradient-to-r from-blue to-navy text-white rounded-xl font-semibold hover:shadow-lg transition">
|
|
<i data-lucide="save" class="w-5 h-5"></i>
|
|
{% if action == 'create' %}{% trans "Create Acknowledgement" %}{% else %}{% trans "Save Changes" %}{% endif %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function updateFileName(input) {
|
|
if (input.files && input.files[0]) {
|
|
// File selected - you can add visual feedback here
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
lucide.createIcons();
|
|
});
|
|
</script>
|
|
{% endblock %}
|