{% extends "layouts/base.html" %}
{% load i18n %}

{% block title %}Departments - PX360{% endblock %}

{% block content %}
<div class="container-fluid">
    <h2 class="mb-4"><i class="bi bi-building me-2"></i>{% trans "Departments" %}</h2>
    
    <div class="card">
        <div class="card-body p-0">
            <table class="table table-hover mb-0">
                <thead class="table-light">
                    <tr>
                        <th>{% trans "Name" %}</th>
                        <th>{% trans "Code" %}</th>
                        <th>{% trans "Hospital" %}</th>
                        <th>{% trans "Manager" %}</th>
                        <th>{% trans "Status" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for dept in departments %}
                    <tr>
                        <td><strong>{{ dept.name }}</strong></td>
                        <td><small>{{ dept.code }}</small></td>
                        <td><small>{{ dept.hospital.name }}</small></td>
                        <td>
                            {% if dept.manager %}
                            <small>{{ dept.manager.get_full_name }}</small>
                            {% else %}
                            <span class="text-muted">-</span>
                            {% endif %}
                        </td>
                        <td><span class="badge bg-success">{{ dept.get_status_display }}</span></td>
                    </tr>
                    {% empty %}
                    <tr>
                        <td colspan="5" class="text-center py-5">No departments found</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}
