{% extends "base.html" %}

{% block title %}Add Device - SW Labs Management{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8 col-lg-6">
        <div class="card shadow">
            <div class="card-header bg-success text-white">
                <h4 class="mb-0">
                    <i class="fas fa-server"></i> Add New Device
                </h4>
            </div>
            <div class="card-body">
                <form method="POST">
                    <div class="mb-3">
                        <label for="name" class="form-label">
                            <i class="fas fa-tag"></i> Device Name *
                        </label>
                        <input type="text" class="form-control" id="name" name="name" required>
                        <div class="form-text">Enter a unique name for the device</div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="device_type" class="form-label">
                            <i class="fas fa-desktop"></i> Device Type *
                        </label>
                        <select class="form-select" id="device_type" name="device_type" required>
                            <option value="">Select device type...</option>
                            <option value="PC">PC (Personal Computer)</option>
                            <option value="Server">Server</option>
                        </select>
                        <div class="form-text">Choose the type of device</div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="ip_address" class="form-label">
                            <i class="fas fa-network-wired"></i> IP Address *
                        </label>
                        <input type="text" class="form-control" id="ip_address" name="ip_address" 
                               pattern="^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" 
                               placeholder="192.168.1.100" required>
                        <div class="form-text">Enter the device's IP address (e.g., 192.168.1.100)</div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="station_id" class="form-label">
                            <i class="fas fa-desktop"></i> Station *
                        </label>
                        <select class="form-select" id="station_id" name="station_id" required>
                            <option value="">Select a station...</option>
                            {% for station in stations %}
                            <option value="{{ station.id }}">{{ station.name }} ({{ station.lab.name }})</option>
                            {% endfor %}
                        </select>
                        <div class="form-text">Choose which station this device belongs to</div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="os_info" class="form-label">
                            <i class="fas fa-laptop-code"></i> Operating System
                        </label>
                        <input type="text" class="form-control" id="os_info" name="os_info" 
                               placeholder="Windows 10, Ubuntu 20.04, etc.">
                        <div class="form-text">Enter the operating system information</div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="special_apps" class="form-label">
                            <i class="fas fa-cogs"></i> Special Applications
                        </label>
                        <textarea class="form-control" id="special_apps" name="special_apps" rows="3" 
                                  placeholder="List any special software or applications installed on this device"></textarea>
                        <div class="form-text">Optional list of special applications or software</div>
                    </div>
                    
                    <div class="d-flex justify-content-between">
                        <a href="{{ url_for('admin_panel') }}" class="btn btn-secondary">
                            <i class="fas fa-arrow-left"></i> Cancel
                        </a>
                        <button type="submit" class="btn btn-success">
                            <i class="fas fa-plus"></i> Add Device
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}