<div wire:ignore.self class="modal fade" id="exampleModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        @if ($material)
        <h5 class="modal-title">Modificación de material</h5>
        @else
        <h5 class="modal-title">Creación de material</h5>
        @endif
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">

        @if ($material)

        <form action="{{route('material.update',$material->id)}}" method="POST">
            @csrf
            @method('PUT')
            <div class="mb-3">
                <label class="small mb-1">Nombre</label>
                <input class="form-control" name="name" value="{{$material->name}}">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Objetivo</label>
                <input class="form-control" name="objetivo" value="{{$material->objetivo}}">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Creditos</label>
                <input class="form-control" name="creditos" type="number" value="{{$material->creditos}}">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Horas Totales</label>
                <input class="form-control" name="horas" type="number" value="{{$material->horas}}">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Ciclo</label>
                <input class="form-control" name="ciclo" type="number" value="{{$material->ciclo}}">
            </div>
            <div class="mb-3 d-none">
                <label class="small mb-1">Carrera</label>
                <input class="form-control" name="carrera" value="{{ $carrera->id }}" type="number">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Clave</label>
                <input class="form-control" name="clave" value="{{$material->clave}}">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Serial</label>
                <input class="form-control" name="serial" value="{{$material->serial}}">
            </div>

            <div class="mb-3">
                <label for="status">Seleccionar status</label>
                <select class="form-control" name="status" id="status">
                    <option value="1" {{ $material->status == 1 ? 'selected' : ''}}>Activo</option>
                    <option value="0" {{ $material->status == 0 ? 'selected' : ''}}>Inactivo</option>
                </select>
            </div>

        <input class="btn btn-primary" type="submit" value="Guardar cambios">
        </form>

        @else
            <form action="{{route('material.store')}}" method="POST">
            @csrf
            <div class="mb-3">
                <label class="small mb-1">Nombre</label>
                <input class="form-control" name="name">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Objetivo</label>
                <input class="form-control" name="objetivo">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Creditos</label>
                <input class="form-control" name="creditos" type="number">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Horas Totales</label>
                <input class="form-control" name="horas" type="number">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Ciclo</label>
                <input class="form-control" name="ciclo" type="number">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Clave</label>
                <input class="form-control" name="clave">
            </div>

            <div class="mb-3">
                <label class="small mb-1">Serial</label>
                <input class="form-control" name="serial">
            </div>

            <div class="mb-3 d-none">
                <label class="small mb-1">Carrera</label>
                <input class="form-control" name="carrera" value="{{ $carrera->id }}" type="number">
            </div>

            <div class="mb-3">
                <label for="status">Seleccionar status</label>
                <select class="form-control" name="status" id="status">
                    <option value="1">Activo</option>
                    <option value="0">Inactivo</option>
                </select>
            </div>

        <input class="btn btn-primary" type="submit" value="Agregar">
        </form>
        @endif


      </div>
    </div>
  </div>
</div>
