{% extends 'base.html' %} {% block content %}

Import Employees

Upload CSV/XLSX, review issues, and confirm insert.
{# Flash messages #} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} {% endfor %} {% endif %} {% endwith %} {% set step = step or 'form' %} {# -------------------------- STEP: FORM -------------------------- #} {% if step == 'form' %}
Use the template for correct columns & formats.

Required columns
employee_code, full_name, email, phone, department, designation, reporting_manager_code, date_of_joining(YYYY-MM-DD), status(active|notice_period|resigned), work_mode(WFO|WFH|Hybrid), location
{% endif %} {# -------------------------- STEP: PREVIEW -------------------------- #} {% if step == 'preview' %}
Preview
Review any errors before confirming import.
{% if rows and rows|length %}
{% set error_count = 0 %} {% for r in rows %} {% set has_err = (r.status != 'OK') %} {% if has_err %}{% set error_count = error_count + 1 %}{% endif %} {% endfor %}
# Status Emp Code Full Name Email Phone Department Designation RM Code DOJ Work Mode Location Errors
{{ r.idx }} {% if has_err %} ERROR {% else %} OK {% endif %} {{ r.data.employee_code }} {{ r.data.full_name }} {{ r.data.email }} {{ r.data.phone }} {{ r.data.department }} {{ r.data.designation }} {{ r.data.reporting_manager_code }} {{ r.data.date_of_joining }} {{ r.data.work_mode }} {{ r.data.location }} {% if r.errors and r.errors|length %}
    {% for e in r.errors %}
  • {{ e }}
  • {% endfor %}
{% else %} — {% endif %}
{% if error_count %} {{ error_count }} row(s) have issues. Fix your file or enable auto-create and re-upload if missing masters. {% else %} All rows look good. You can proceed to confirm. {% endif %}
Upload Another
{% else %}
No rows found in the uploaded file.
{% endif %}
{% endif %} {# -------------------------- STEP: CONFIRM (post-redirect flashes show result) -------------------------- #} {% if step == 'confirm' %}
Processing import…
{% endif %}
{% endblock %}