<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 ($concepto)
        <h5 class="modal-title">Modificación de concepto</h5>
        @else
        <h5 class="modal-title">Creación de concepto</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 ($concepto)

        <form action="{{route('concepto.update',$concepto->id)}}" method="POST">
            @csrf
            @method('PUT')
            <div class="mb-3">
                <label for="tipo">Seleccionar concepto</label>
                 <select class="form-control" name="name" id="name">
                    @foreach($conceptos as $concept)
                        <option value="{{ $concept->id }}" {{ $concepto->name==$concept->id ? 'selected' : '' }}>{{ $concept->name }}</option>
                    @endforeach
                </select>
            </div>

            <div class="mb-3">
                <label class=" mb-1">Fecha de pago</label>
                <input type="date" class="form-control" name="fecha_pago" wire:model="fecha_pago">
            </div>

            <div class="mb-3">
                <label class=" mb-1">monto</label>
                <input type="number" class="form-control" name="monto" value="{{$concepto->monto}}">
            </div>

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

            <div class="mb-3">
                <label for="tipo">Seleccionar tipo</label>

                 <select class="form-control" name="tipo" id="tipo">
                    @foreach($tipos as $tipo)
                        <option value="{{ $tipo->id }}"  {{ $concepto->tipo == $tipo->id ? 'selected' : ''}}>{{ $tipo->name }}</option>
                    @endforeach
                </select>

            </div>



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

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

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

            <div class="mb-3">
                <label for="tipo">Seleccionar concepto</label>
                 <select class="form-control" name="name" id="name">
                    @foreach($conceptos as $concepto)
                        <option value="{{ $concepto->id }}" >{{ $concepto->name }}</option>
                    @endforeach
                </select>
            </div>

            <div class="mb-3">
                <label class=" mb-1">Fecha de pago</label>
                <input type="date" class="form-control" name="fecha_pago" >
            </div>

            <div class="mb-3">
                <label class=" mb-1">Monto</label>
                <input type="number" class="form-control" name="monto" >
            </div>


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

            <div class="mb-3">
                <label for="tipo">Seleccionar tipo</label>

                 <select class="form-control" name="tipo" id="tipo">
                    @foreach($tipos as $tipo)
                        <option value="{{ $tipo->id }}" >{{ $tipo->name }}</option>
                    @endforeach
                </select>
            </div>

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

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


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