{% extends 'base.html' %}
{% load i18n %}

{% block content %}
<div class="container-fluid">
    <div class="d-sm-flex align-items-center justify-content-between mb-4">
        <h1 class="h3 mb-0 text-gray-800">{% trans "Employees" %}</h1>
        <a href="{% url 'hr:employee_add' %}" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm">
            <i class="fas fa-plus fa-sm text-white-50"></i> {% trans "Add Employee" %}
        </a>
    </div>

    <div class="card shadow mb-4">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>{% trans "Name" %}</th>
                            <th>{% trans "Biometric ID" %}</th>
                            <th>{% trans "Department" %}</th>
                            <th>{% trans "Position" %}</th>
                            <th>{% trans "Email" %}</th>
                            <th>{% trans "Phone" %}</th>
                            <th>{% trans "Status" %}</th>
                            <th>{% trans "Actions" %}</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for employee in employees %}
                        <tr>
                            <td>
                                <a href="{% url 'hr:employee_detail' employee.pk %}">
                                    {{ employee.first_name }} {{ employee.last_name }}
                                </a>
                            </td>
                            <td>{{ employee.biometric_id|default:"-" }}</td>
                            <td>{{ employee.department.name_en }} / {{ employee.department.name_ar }}</td>
                            <td>{{ employee.job_position.title_en }} / {{ employee.job_position.title_ar }}</td>
                            <td>{{ employee.email }}</td>
                            <td>{{ employee.phone }}</td>
                            <td>
                                <span class="badge badge-{% if employee.status == 'active' %}success{% elif employee.status == 'terminated' %}danger{% else %}warning{% endif %}">
                                    {{ employee.get_status_display }}
                                </span>
                            </td>
                            <td>
                                <a href="{% url 'hr:employee_edit' employee.pk %}" class="btn btn-sm btn-info">
                                    <i class="fas fa-edit"></i>
                                </a>
                            </td>
                        </tr>
                        {% empty %}
                        <tr>
                            <td colspan="8" class="text-center">{% trans "No employees found." %}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}