@extends('layouts.app')

@section('content')
<div class="bg-body-light">
  <div class="content content-full">
    <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center py-2">
      <div class="flex-grow-1">
        <h1 class="h3 fw-bold mb-2">
          Nuevo Distrito
        </h1>
        <h2 class="fs-base lh-base fw-medium text-muted mb-0">
          Registre un nuevo distrito en el sistema de gestión.
        </h2>
      </div>
      <nav class="flex-shrink-0 mt-3 mt-sm-0 ms-sm-3" aria-label="breadcrumb">
        <ol class="breadcrumb breadcrumb-alt">
          <li class="breadcrumb-item">
            <a class="link-fx" href="{{ route('distritos.index') }}">Distritos</a>
          </li>
          <li class="breadcrumb-item" aria-current="page">
            Nuevo
          </li>
        </ol>
      </nav>
    </div>
  </div>
</div>
<div class="content">
  <div class="row justify-content-center">
    <div class="col-md-14 col-lg-18">
      
      <div class="block block-rounded">
        <div class="block-header block-header-default">
          <h3 class="block-title">
            <i class="fa fa-map-marker-alt me-1 text-muted"></i> Información del Distrito
          </h3>
        </div>
        <div class="block-content">
          {{-- Manejo de Errores nativo de OneUI --}}
          @if($errors->any())
            <div class="alert alert-danger alert-dismissible" role="alert">
              <p class="mb-0 fs-sm fw-medium">Corrija los siguientes campos:</p>
              <ul class="mb-0 fs-sm">
                @foreach($errors->all() as $e) <li>{{ $e }}</li> @endforeach
              </ul>
              <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
          @endif

          <form method="POST" action="{{ route('distritos.store') }}">
            @csrf
            
            {{-- Campos del formulario (Se asume que en _form usas clases de OneUI o form-control) --}}
            <div class="row push">
              <div class="col-12">
                @include('distritos._form', ['distrito' => null])
              </div>
            </div>

            <input type="hidden" name="accion" value="alta">

            {{-- Sección de Acciones --}}
            <div class="block-content block-content-full block-content-sm bg-body-light text-end rounded-bottom mb-4">
              <a href="{{ route('distritos.index') }}" class="btn btn-alt-secondary me-1">
                <i class="fa fa-times me-1"></i> Cancelar
              </a>
              <button type="submit" class="btn btn-alt-primary"
                      onclick="return confirm('¿Está seguro de guardar?')">
                <i class="fa fa-save me-1"></i> Guardar Distrito
              </button>
            </div>
          </form>
        </div>
      </div>
      </div>
  </div>
</div>
@endsection