@extends('layouts.app')

@section('content')
<div class="container">
    <h2>Nuevo Cliente</h2>

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

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

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

        <div class="mb-3">
            <label>Teléfono</label>
            <input name="telefono" class="form-control">
        </div>

        <div class="mb-3">
            <label>Dirección</label>
            <input name="direccion" class="form-control">
        </div>

        <div style="display: none" class="mb-3">
            <label>Empresa</label>
            <select name="company_id" class="form-control" required>
                @foreach($companies as $company)
                    <option value="{{ $company->id }}">
                        {{ $company->nombre }}
                    </option>
                @endforeach
            </select>
        </div>

        <button class="btn btn-success">Guardar</button>
        <a href="{{ route('clients.index') }}" class="btn btn-secondary">Cancelar</a>
    </form>
</div>
@endsection
