
@extends('layouts.dashboard')

@section('content')
<h2>Crear Usuario</h2>

<form action="{{ route('superadmin.usuarios.store') }}" method="POST">
    @csrf

    <div class="mb-3">
        <label class="form-label">Nombre</label>
        <input type="text" name="name" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Correo Electrónico</label>
        <input type="email" name="email" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Contraseña</label>
        <input type="password" name="password" class="form-control" required>
    </div>

    <div class="mb-3">
        <label class="form-label">Rol</label>
        <select name="role" class="form-select" required>
            <option value="">Seleccione un rol</option>
            <option value="empresa">Empresa</option>
            <option value="empleado">Empleado</option>
            <option value="usuario_final">Usuario Final</option>
            <option value="operador">Operador</option>
            <option value="seguridad">Seguridad</option>
        </select>
    </div>

    <div class="mb-3">
        <label class="form-label">Empresa (opcional)</label>
        <select name="empresa_id" class="form-select">
            <option value="">Sin empresa</option>
            @foreach ($empresas as $empresa)
                <option value="{{ $empresa->id }}">{{ $empresa->nombre }}</option>
            @endforeach
        </select>
    </div>

    <button type="submit" class="btn btn-primary">Guardar</button>
    <a href="{{ route('superadmin.usuarios.index') }}" class="btn btn-secondary">Cancelar</a>
</form>
@endsection
