<input type="hidden" id="token" name="_token" value="{{ csrf_token() }}">
<input type="hidden" id="formulario" name="formulario" value="{{ $tipo }}">
@if($tipo=="R") 
    <table id="tabla_alta" class="table text-left">
    <tbody>
        <tr>
        <td width="100%"><label>Alta Nuevo Grupo</label><input name="descripcion_new" id="descripcion_new" class="form-control"></td>
        <td style="vertical-align:bottom;"><button class="btn_alta btn btn-fidelitas" name="btn_alta" type="button">Agregar</button></td>
        </tr>
    </tbody>
    </table>
@endif 
<table id="tabla_ciuu" class="table table-bordered text-right table-hover">
    <thead>
    <tr class="text-center" style="background-color:#eeeeee;">
    @if($tipo=="R") 
    <th></th>
    <th class="text-left">Grupo</th>
    @else
     <th>CIUU</th>
     <th class="text-left">Descripción</th>
     <th class="text-left">Grupo</th>
    @endif
    <th class="no-sort"></th>
    </tr>
    </thead>
    <tbody>


        
    @foreach ($ciuu as $ciu)
        <tr>
        @if($tipo=="R")
        <td class="cod_ramo text-left">{{$ciu->cod_ramo}}</td>
        <td width="90%" class="nom_ramo text-left"><input name="descripcion" id="descripcion" class="form-control" value="{{$ciu->ramo}}"</td>
        <td>
            <button class="btn_ramo btn btn-fidelitas" name="btn_ramo" type="button">Grabar</button>
        </td>
        @else 
        <td class="cod_subramo1 text-left">{{$ciu->cod_subramo}}</td>
        <td width="50%" class="nom_subramo  text-left"><textarea name="descripcion1" rows="2" id="descripcion1" class="form-control">{{$ciu->descripcion}}</textarea></td>
        <td width="50%">
        <select name="cod_ramo1" id="cod_ramo1" required class="form-control">
                <option value=''>Seleccione Grupo... </option>
                @foreach ($ramos as $mon)
                  <option @if($ciu->cod_ramo==$mon->cod_ramo) selected=true @endif value="{{$mon->cod_ramo}}">{{$mon->cod_ramo}} - {{$mon->ramo}}</option>
                @endforeach
        </select>
        </td>  
        <td>
            <button class="btn_asigna btn btn-fidelitas" name="btn_asigna" type="button">Grabar</button>
        </td>  
        @endif 
        </tr>

    @endforeach
    </tbody>
    
    <tfoot>
    @if($tipo=="R") 
    <th></th>
    <th class="text-left">Grupo</th>
    @else
     <th>CIUU</th>
     <th class="text-left">Descripción</th>
     <th class="text-left">Grupo</th>
    @endif
    <th class="no-sort"></th>
    </tr>
    </tfoot>


</table>
<script>
    crearDataTableTodos("#tabla_ciuu");
</script>