
            @if (is_countable($tasks))

                <form action="{{URL::to('/') }}/print" name="form_print" method="post" target="_blank">
                    {!! Form::token() !!}
                    <input type="hidden" name="line_prod" value="{{ $line_prod }}">
                    <input type="hidden" name="name_title" value="{{ $name_title }}">
                    <input type="hidden" name="fecha_cre" value="{{ $fecha_cre }}">
                    <input type="hidden" name="fecha_end" value="{{ $fecha_end }}">
                    @foreach($select_status as $s)
                        <input type="hidden" name="select_status[]" value="{{ $s }}">
                    @endforeach
                    @foreach($select_unit as $u)
                        <input type="hidden" name="select_unit[]" value="{{ $u }}">
                    @endforeach
                    <input type="submit" value="Imprimir">

                   <div style="padding-left:20px;float:right;"> 
                    Resultados por pagina
                    <select name="select" class="limit_page">
                      <option value="10" {{($limit_page=='10')?"selected":""}} >10</option>
                      <option value="25" {{($limit_page=='25')?"selected":""}} >25</option>
                      <option value="50" {{($limit_page=='50')?"selected":""}}>50</option>
                      <option value="75" {{($limit_page=='75')?"selected":""}} >75</option>
                      <option value="100" {{($limit_page=='100')?"selected":""}} >100</option>
                    </select>
              </div>

                </form>
                    <table style="width:100%;font-size:16px;visibility: hidden" class="results results_table table table-striped table-hover" id="areaToPrint">
              <tr style="background-color: gainsboro;height: 40px !important;">
                 <th>&nbsp;Id&nbsp;</th>
                <th>Titulo</th>
                <th>Accion</th>
                <th>Pipeline</th>
                <th>Creacion</th>
                <th>Unidad Actual</th>
                <th>Estado</th>
              </tr>
              
                    <br>
            <?php 


              foreach ($tasks as $key => $value) {
                  
                echo "<tr>";
                echo "<td width='5%' style='font-size: 14px;'>".$value->id."</td>";
                echo "<td width='22%' style='padding-left: 10px;'>".$value->title;
                  $tmp = \App\Task::find($value->id);
                        if ($tmp->type == "email"){
                            if ($tmp->taskdata->email_request != null){
                                if ($tmp->taskdata->email_request == "registration"){
                                   echo " | Alta de cuenta";
                                }
                                if ($tmp->taskdata->email_request == "laundering"){
                                 echo   " | Blanqueo de contraseña";
                                }
                                if ($tmp->taskdata->email_request == "delete"){
                                 echo "   | Baja";
                                }
                            }
                        }



                echo "</td>";
                echo "<td width='14%' style='font-size: 14px;'><a target='_blank' href='".URL::to('/')."/tasks/".$value->id."/unit/".$value->unit_id."/show'>Ver Tarea</a></td>";

                foreach ($pipelines as $key6 => $value6) {
                    if($value6->id==$value->pipeline_id_data)
                        echo "<td width='12%' style='font-size: 14px;line-height: 1;'>".$value6->name."</td>";
                }

               echo "<td width='21%' style='font-size: 14px;'>".$value->created_at."</td>";
          

                foreach ($unit as $key3 => $value3) {
                    if($value3->id==$value->unit_id)
                        echo "<td width='16%' style='font-size: 14px;'>".$value3->name."</td>";
                }

                if(empty($value->unit_id))
                    echo "<td>-</td>";


                foreach ($status as $key4 => $value4) {
                    if($value4->id==$value->status_id)
                        echo "<td width='10%' style='font-size: 14px;'>".$value4->name."</td>";
                }

                echo "</tr>";
                  //$tmp = \App\Task::find($value->id);
//                  if (count($tmp->subtasks) != 0){
//                      echo "<tr><table style='width:100%;font-size:16px;visibility: hidden' class='results results_table'>";
//                      echo "<tr style='background-color: gainsboro;height: 40px !important;'>
//                            <th>&nbsp;Id&nbsp;</th>
//                            <th width='650px' style='padding-left: 10px;'>Subtareas asociadas</th>
//                            <th>Accion</th>
//                            </tr>";
//                    foreach($tmp->subtasks as $s){
//                      echo "<tr>";
//                      echo "<td>".$s->id."</td>";
//                      echo "<td width='650px' style='padding-left: 10px;'>".$s->title."</td>";
//                      echo "<td><a target='_blank'>Ver SubTarea</a></td>";
//                      echo "</tr>";
//                     }
//                      echo "</table></tr><br>";
//                  }
                  if (count($tmp->subtasks) != 0){
                      echo "<tr class='tr_subtask'><td></td><td width='22%' style='padding-left: 10px;'>Subtareas</td></tr>";
                      foreach($tmp->subtasks as $s){
                          echo "<tr class='tr_subtask'>";
                          echo "<td></td>";
                          echo "<td width='22%' style='padding-left: 10px;'".$s->title."</td>";
                          echo "<td width='14%' style='font-size: 14px;'><a target='_blank' href='".URL::to('/')."/subtasks/".$s->id."/show'>Ver Subtarea</a></td>";
                          echo "<td></td>";
                          echo "<td width='21%' style='font-size: 14px;'>".$s->created_at."</td>";
//                          echo "<td></td>";
                          echo "<td>";
                          foreach ($status as $key4 => $value4) {
                              if($value4->id==$s->status_id)
                                  echo "<td width='10%' style='font-size: 14px;'>".$value4->name."</td>";
                          }
                          echo "</td>";
                          echo "</tr>";
                      }

                  }



              }

                ?>
                </table>

            {!! $tasks->links() !!}

            @else


            <div>Sin resultados</div>

            @endif


            <script>

            $(document).ready(function(d,g){


            $(".limit_page").change(function(){

                 $(".sender_submit").trigger("click");

            });       

            verify_subtask();

            $("#not_subtask").on("click",function(){

            verify_subtask();            

            });


            })


            function verify_subtask(){

              if( $('#not_subtask').prop('checked') ) {

              $(".tr_subtask").hide()

              }else{

              $(".tr_subtask").show()

              }

            }

            </script>