


                        @if (is_countable($task->attachments) )


                            <h5 style="font-weight: 600">Archivos Adjuntos:</h5>

                            @foreach($task->attachments as $attach)

                                <?php

                                  $desdesub  = null;
                                  $isdeliver = "";

                                  if($attach->pivot->active == "1"){

                                    $desdesub  = ($attach->delivered)?"desdesub":"";

                                    if($attach->delivered){

                                        $isdeliver = '<i title="Archivo entregado desde subtarea" alt="Archivo entregado desde subtarea" class="fa fa-arrow-up delivered stack_newed elementTheTask nowdeliver_'.$attach->id.'" aria-hidden="true"></i>';

                                    }
                                        /* Archivo activo  */

                                        $attaoriginal_name = "'".$attach->original_name."'";

                                   ?>

                                    <div class="bdn subattachtask_element {{ $desdesub }} subattachtask_{{$attach->id}}" data-fileatta="{{$attach->filename}}" data-dateatta="{{ date('d/m/Y', strtotime($attach->created_at))}}" data-nameatta='{{ $attach->original_name }}' >
                                        <a href='{{URL::to('/')}}/download/{{$attach->id}}' target='_blank'>{{ $attach->original_name}}<span class='minidatetask_{{$attach->id}} minifecha' style='margin-left: 6px;font-size: 14px;font-style: inherit;'>{{ date('d/m/Y', strtotime($attach->created_at))}}</span></a>

                                        <button type='button' title="Eliminar Archivo" onclick='deleteAttach({{ $attach->id}},false,{{ $attaoriginal_name}})' class='btn btn-danger btn-xs stack_deleted elementTheTask'>x</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <?php if($attach->pivot->delivered_final == 0){ ?>
                                        <button style='font-size: 8px !important;padding-left: 0.5px !important' type='button' title="Entregar Archivo" onclick='deliverAttach({{ $attach->id}})' class='btn btn-success btn-xs stack_deleted elementTheTask'><i class="fa fa-check"></i></button>
                                        <?php } else {
                                            echo "Entregado";
                                        }?>
                                    <?php echo $isdeliver; ?>
                                    </div>


                                <?php

                                }else{  /* archivo eliminado */

                                    // if($notActive){

                                        $activatebn = "";

                                        if (!in_array($attach->id, $notActive)) {


                                            $attaname = '"'.$attach->original_name.'"';

                                            $activatebn = "<button style='font-size: 8px !important;padding-left: 0.5px !important' type='button' onclick='deleteAttach($attach->id,true,$attaname)' class='btn btn-success btn-xs stack_deleted elementTheTask'><i class='fa fa-check'></i></button>";
                                        }else{
                                             $activatebn = "<button style='font-size: 8px !important;padding-left: 0.5px !important' type='button' onclick='notactive()' class='btn btn-success btn-xs stack_deleted elementTheTask'><i class='fa fa-check'></i></button>";
                                        }
                                    //}

                                 ?>
                                     <div class="bdn subattachtask_element subattachtask_{{$attach->id}}" data-fileatta="{{$attach->filename}}" data-dateatta="{{ date('d/m/Y', strtotime($attach->created_at))}}" data-nameatta='{{ $attach->original_name }}' style="color: #979797"><span class="datin">{{ $attach->original_name}}</span><span class="datin" style='margin-left: 6px;font-size: 11px;font-style: inherit;color: #979797;'>{{ date('d/m/Y', strtotime($attach->created_at))}}</span>{!! $activatebn !!}</div>

                                <?php
                                }
                                ?>


                            @endforeach
                        @else
                          <div class="task_text_borrador">No se encontraron archivos Adjuntos</div>
                        @endif


