
@foreach($childs as $key => $child)

  <tr>
      <td style="padding-left: <?= ($child->node_name == 'leaf') ? '3rem' : '2rem'  ?>">

      <?= ($child->node_name == 'leaf') ?  '<i style="margin-right: 0.5rem;font-size: 1.1rem;" class="fa fa-arrow-right"  aria-hidden="true"></i>' : '<i class="fa fa-caret-right" style="margin-right: 0.5rem;font-size: 1.5rem;" aria-hidden="true"></i>' ?>{{ $child->text }}
       </td>

        <td class="<?php if($child->task_priority == 'high') { echo 'high_priorty'; }elseif($child->task_priority == 'low'){ echo 'low_priorty'; } else { echo 'normal_priorty';} ?>">
        {{ Ucfirst($child->task_priority) }} 
        </td>

        <td>
        {{ Ucfirst($child->task_type) }} 
        </td>
        
        <td>
        <?= ($child->node_name == 'leaf') ? Ucfirst($child->assign_to) : '-' ?> 
        </td>

        <td>
         <?= ($child->node_name == 'leaf') ? Ucfirst($child->created_by) : '-' ?>
        </td>

        <td>
        {{ number_format($child->total_cost , 2) }}  
        </td>

        <td>
        @if($child->node_name == 'leaf')
        <a  href="#"  data-bs-toggle="tooltip" data-bs-placement="top" title="BOQ"  onclick="return showBoq(this , '{{$child->id}}')">
          <button class="btn btn-link btn-s" style=" color: #4a5256;">
            <i class="fa fa-book" aria-hidden="true"></i>
          </button>
          </a>
      
         {{-- <a href="#" style="margin-right: 1rem;color: #4a5256;"  data-bs-toggle="tooltip" data-bs-placement="top" title="BOQ"  onclick="return showBoq(this , '{{$child->id}}')">
           <i class="fa fa-book" aria-hidden="true"></i>
         </a> --}}

         <a  href="{{route('work-order.edit' , [$child->id]) }}"  data-bs-toggle="tooltip" data-bs-placement="top" title="EDIT">
          <button class="btn btn-link btn-s">
              <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
          </button>
          </a>
      

        {{-- <a href="{{ route('work-order.edit' , [$child->id]) }}" style="margin-right: 1rem;"  data-bs-toggle="tooltip" data-bs-placement="top" title="EDIT">
          <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
        </a> --}}


        <form action="{{route('work-order.delete' , [$child->id])}}" method="post" style='display: inline;'>
          @method('DELETE')
          @csrf                                       
          <button class="btn btn-link btn-s" style="color:red;"  type="submit" name="action" value="delete" data-toggle="confirmation" data-title="Are you sure to delete?">
              <i class="fa fa-trash-o" aria-hidden="true"></i>
          </button>                                                  
       </form>
        {{-- <a href="{{ route('work-order.delete' , [$child->id]) }}" data-toggle="confirmation" data-title="Are you sure to delete?" >
        <i class="fa fa-trash-o" style="color:red" aria-hidden="true"></i>
        </a> --}}
        @else

        {{'-'}}

        @endif 
        </td>

  </tr>

@if(count($child->childs) )

@include('procurement.work-order.child-layout.manage-list-child',['childs' => $child->childs])

@endif

@endforeach

