{% extends "layouts/base.html" %} {% load i18n %} {% block title %}{% trans "Import Staff" %} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{% trans "Staff" %} {% trans "Import" %}

{% trans "Import Staff" %}

{% trans "Upload a CSV file to bulk-import staff into" %} {{ hospital.name }}

{% trans "Sample CSV" %}
{% csrf_token %}

{% trans "Upload CSV File" %}

{% trans "Click to upload or drag and drop" %}

{% trans "CSV files only. UTF-8 encoding recommended." %}

{% trans "Import Options" %}

{% trans "Cancel" %}

{% trans "Expected Columns" %}

Required Staff ID, Name
Optional Name_ar
Optional Manager, Manager_ar
Optional Civil Identity Number
Optional Location, Location_ar
Optional Department, Department_ar
Optional Section, Section_ar
Optional Subsection, Subsection_ar
Optional AlHammadi Job Title, ..._ar
Optional Country, Country_ar

{% trans "Download the sample CSV for the exact format with an example row." %}

{% trans "Tips" %}

  • {% trans "Start with a dry run to preview results before importing." %}
  • {% trans "Staff ID must be unique within the hospital." %}
  • {% trans "Manager format: \"EMP001 - Name\" (ID dash Name)." %}
  • {% trans "Save your CSV as UTF-8 for Arabic text support." %}
  • {% trans "Use 'Deactivate missing' to sync: staff not in the CSV will be set to inactive." %}
{% if results %}

{% if results.dry_run %}{% trans "Preview Results" %}{% else %}{% trans "Import Results" %}{% endif %}

{% trans "Total Rows" %}

{{ results.total_rows }}

{% trans "Created" %}

{{ results.created_count }}

{% trans "Updated" %}

{{ results.updated_count }}

{% trans "Skipped" %}

{{ results.skipped_count }}

{% trans "Deactivated" %}

{{ results.deactivated_count }}

{% trans "Errors" %}

{{ results.error_count }}

{% for r in results.created %} {% endfor %} {% for r in results.updated %} {% endfor %} {% for r in results.skipped %} {% endfor %} {% for r in results.errors %} {% endfor %} {% for r in results.deactivated %} {% endfor %} {% if results.total_rows == 0 %} {% endif %}
{% trans "Row" %} {% trans "Staff ID" %} {% trans "Name" %} {% trans "Status" %}
{{ r.row }} {{ r.id }} {{ r.name }} {{ r.message }}
{{ r.row }} {{ r.id }} {{ r.name }} {{ r.message }}
{{ r.row }} {{ r.id }} {{ r.name }} {{ r.message }}
{{ r.row }} {{ r.id }} {{ r.name }} {{ r.message }}
{{ r.row }} {{ r.id }} {{ r.name }} {{ r.message }}
{% trans "No rows found in the CSV file." %}
{% if results.dry_run and results.error_count == 0 and results.total_rows > 0 %}

{% trans "Preview looks good! Uncheck 'Dry run' and submit again to apply the import." %} {% if results.deactivated_count > 0 %} ({{ results.deactivated_count }} {% trans "staff would be deactivated" %}) {% endif %}

{% endif %}
{% endif %}
{% endblock %}