@extends('layouts.masterHome2')

@section('content')

    <br/>
    @if( auth()->user()->create_ )
    <a href="{{ url('/trust/create') }}"  class="btn" style="background-color:#2C4E71;color:#FFF;margin-left:10px">Create New trust </a><br/><br/>
    @else
	    <span>&nbsp;&nbsp;</span>
    @endif

 
    
    <div class="card">
               
              <!-- /.card-header -->
              <div class="card-body">
                <table id="example1" class="table table-bordered table-striped">
                  <thead>
                  
                 <tr >
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> أسم العهدة    </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> نوع العهدة    </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> الحالة  </th>
                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> اجمالي الفواتير    </th>


                  <th style="text-align:center;vertical-align: middle;background-color:#2C4E71;color:#FFF;border-color:#0000003c;border-width: 2px;"> Actions  </th>

                 </tr>
                 </thead>
              <tbody>
                           
                @foreach( $trusts as $trust )   
                 
                 

                 
                <tr style="background-color:{{$trust->approve=='Approved'?'':'#'}}">
                 
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" >{{$trust->name}} </td>
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" >{{$trust->type}} </td>

                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" >{{$trust->status}} </td>
                  
                  
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" > 
                  
                  {{$trust->total_invoices ? $trust->total_invoices : '0'}}
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  
                  @if($trust->status == "Active")
                  <a   href='{{url("/trust/invoices_amount/$trust->id")}}'  style="color:red">   <i class="fa fa-pencil" style="font-size:18px"></i> </a>
                  @endif
                  
                </td>

                  
                  <td style="text-align:center; word-break: break-word; font-weight:900;border-color:#0000003c;font-size:18px" > 
                 
                  <a   href='{{url("/trust/edit/$trust->id")}}'  > <i class="fa fa-edit" style="font-size:18px"></i>  </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 
                  
                  <a   href='{{url("/trust/not_tie_details/$trust->id")}}'  style="color:green" > تفاصيل  </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                </td>

                </tr>
               @endforeach
                </tbody>
                </table>
              </div>
              <!-- /.card-body -->
            </div>  

@endsection
