{% extends "core/base.html" %}
{% load static %}

{% block title %}Bulk Import Products - SwiftPOS{% endblock %}

{% block topbar_title %}
Bulk Import Products
{% endblock %}

{% block content %}
<div class="swiftpos-content container-fluid py-4">
    <div class="row justify-content-center">
        <div class="col-lg-7 col-xl-6">
            <div class="card shadow-sm sp-animate-card">
                <div class="card-header border-0 d-flex justify-content-between align-items-center">
                    <div>
                        <h5 class="mb-0">Bulk Import Products</h5>
                        <p class="text-muted mb-0 small">
                            Upload a CSV file to quickly create or update products.
                        </p>
                    </div>
                    <a href="{% url 'inventory:product_list' %}" class="btn btn-sm btn-outline-secondary">
                        Back to Products
                    </a>
                </div>
                <div class="card-body">
                    <form method="post" enctype="multipart/form-data" class="vstack gap-3">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label class="form-label">CSV File</label>
                            <input type="file" name="file" accept=".csv" class="form-control" required>
                            <div class="form-text">
                                CSV headers: <code>name, sku, category, cost_price, selling_price, stock_quantity, min_stock, description</code>.
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary w-100">
                            Import Products
                        </button>
                    </form>

                    <hr class="my-4">

                    <div class="d-flex flex-wrap justify-content-between align-items-center gap-2">
                        <div>
                            <h6 class="mb-1">Need a template?</h6>
                            <p class="text-muted small mb-0">
                                Download a ready-made CSV file and just fill in your products.
                            </p>
                        </div>
                        <a href="{% url 'inventory:product_import_template' %}" class="btn btn-outline-secondary btn-sm">
                            Download CSV Template
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
