@extends('layout/master2')

@section('contentchild')
    <style>

.help-block{
  color:red;
}
.is-invalid{border:1px solid red !important;}
      </style>          
<div class="col-sm-12">
                         <a href="{{url('addamount')}}" >Add Amount+ </a>

 @foreach(["success","error"] as $status)
@if(Session::has($status))
<div class="alert alert-{{$status}} alert-dismissible">
  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
  <strong>{{$status}}!</strong> {{Session::get($status)}} action.
</div>
@endif
@endforeach
  <?php 
//$amountlist=App\Amount::select("*")->get();
//dd($catelist);

$amountlist=DB::table('amount as a')->leftJoin("users as u","a.person","=","u.id")->select('a.*','u.name','u.role','u.opening_balance')->get();

//


//dd($amountlist);

  ?>                
 <div class="card mb-4">
<div class="card-header">
<i class="fas fa-table mr-1"></i>
     Amount List
</div>  
 <div class="card-body">  
 <div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0" >
<thead>
<tr>
  
  <th>Sr No.</th><th>Project</th> <th>Person</th> <th>Amount</th> <th>Total Balance</th> <th>Created Date</th>  
</tr>
</thead>
<tbody>

<?php $i=0; ?>
@foreach($amountlist as $amount)

<tr>
  <td>{{ ++$i }}</td>
  <td>{{ App\Project::getprojectnm($amount->project_id) }}</td>
  <td>{{  $amount->name." ( ".$amount->role." ) " }}</td>
    <td>{{ $amount->amount }}</td>
    <td>{{ $amount->opening_balance }}</td>
  <td>{{ date('d/m/Y',strtotime($amount->created_at))   }}</td>
  <!--<td><a href="#" class="btn btn-success btn-sm">Edit </a>  <a href="#" class="btn btn-danger btn-sm">Delete </a></td>-->

</tr>
@endforeach
<tbody>
</table>

      </div>
</div>	  
        </div>
  </div>


     @endsection
             