{% extends "modern/base.html" %}

{% block title %}New Configuration - Zebra Day{% endblock %}

{% block content %}
<div class="page-header">
    <h1 class="page-title">Build New Configuration</h1>
    <div class="header-actions">
        <a href="/config" class="btn btn-outline"><i class="fas fa-arrow-left"></i> Back</a>
    </div>
</div>

<div class="grid grid-2">
    <!-- Network Scan -->
    <div class="card">
        <div class="card-header">
            <h3 class="card-title"><i class="fas fa-wifi"></i> Scan Network for Printers</h3>
        </div>
        <form action="/config/scan" method="get">
            <div class="form-group">
                <label class="form-label">IP Range Prefix</label>
                <input type="text" name="ip_stub" class="form-control" value="{{ ip_root }}" placeholder="192.168.1">
                <small class="text-muted">Enter the first three octets of your network</small>
            </div>
            <div class="form-group">
                <label class="form-label">Lab Name</label>
                <input type="text" name="lab" class="form-control" value="scan-results" placeholder="Enter lab name">
                <small class="text-muted">Printers found will be added to this lab</small>
            </div>
            <div class="form-group">
                <label class="form-label">Scan Wait Time</label>
                <select name="scan_wait" class="form-control">
                    <option value="0.15">Fast (0.15s)</option>
                    <option value="0.25" selected>Normal (0.25s)</option>
                    <option value="0.5">Slow (0.5s)</option>
                    <option value="1.0">Very Slow (1.0s)</option>
                </select>
                <small class="text-muted">Longer wait times find more printers on slow networks</small>
            </div>
            <button type="submit" class="btn btn-primary" onclick="showLoading('Scanning network for Zebra printers...')">
                <i class="fas fa-search"></i> Start Network Scan
            </button>
        </form>
    </div>

    <!-- Quick Actions -->
    <div class="card">
        <div class="card-header">
            <h3 class="card-title"><i class="fas fa-bolt"></i> Quick Actions</h3>
        </div>
        <div class="quick-actions">
            <a href="/config/reset" class="action-card" onclick="return confirm('Reset config to template defaults?')">
                <i class="fas fa-undo"></i>
                <div>
                    <strong>Reset to Template</strong>
                    <small class="text-muted d-block">Restore default configuration</small>
                </div>
            </a>
            <a href="/config/clear" class="action-card" onclick="return confirm('Clear all printer configuration?')">
                <i class="fas fa-trash"></i>
                <div>
                    <strong>Clear Configuration</strong>
                    <small class="text-muted d-block">Remove all printers</small>
                </div>
            </a>
            <a href="/config/edit" class="action-card">
                <i class="fas fa-edit"></i>
                <div>
                    <strong>Manual Edit</strong>
                    <small class="text-muted d-block">Edit JSON directly</small>
                </div>
            </a>
        </div>
        
        <hr class="my-md">
        
        <h4 class="mb-md">Existing Labs</h4>
        {% if labs %}
        <div class="grid grid-3">
            {% for lab in labs %}
            <a href="/printers/{{ lab }}" class="action-card">
                <i class="fas fa-building"></i>
                <strong>{{ lab }}</strong>
            </a>
            {% endfor %}
        </div>
        {% else %}
        <p class="text-muted">No labs configured yet. Run a network scan to discover printers.</p>
        {% endif %}
    </div>
</div>
{% endblock %}

