<style>
  .table-transaksi tbody tr td {
    font-size: 10px;
  }
  .table-transaksi thead tr th {
    font-size: 9px;
  }
</style>
{{-- {{ dd ->$dataTransaksi }} --}}

{{-- {{ dd($dataTransaksi) }} --}}
<table class="table table-hover table-transaksi">
    <thead>
      <span class="text-xs" style="text-align: center; color:white; background-color: {{ $firstStatusBayar == 'On Process' ? 'red' : ($firstStatusBayar == 'Lunas' ? 'green' : 'black') }}"> {{ $firstStatusBayar }} </span>
        <tr>
          <th scope="col">No</th>
          <th scope="col">Pesanan</th>
          <th scope="col">Qty</th>
          <th scope="col">Request Customer</th>
          <th scope="col">Harga</th>
          <th scope="col">Total Per item</th>
          <th class="text-center" scope="col">Action</th>
        </tr>
      </thead>
      @php $grandTotal = 0; @endphp
      <tbody>
        @foreach ($dataTransaksi as $dT )
        @php 
        $total = $dT->qty * $dT->harga_pesanan; 
        $grandTotal += $total; // Tambahkan nilai total ke grandTotal 
        $HargaPPN = $grandTotal * 1.10;
        @endphp
        <tr>
          <td>{{ $loop -> iteration }}</td>
          <td>{{ $dT -> pesanan }}</td>
          <td>{{ $dT -> qty }}</td>
          <td>{{ $dT -> request_customer }}</td>
          <td>{{ number_format ($dT -> harga_pesanan, 2, ',','.') }}</td>
          <td>{{ number_format ($total, 2,',','.') }}</td>
          <td class="text-center" >
            <button>
              <a class="" href="{{ route('hapus-pesanan', ['id' => $dT->id], ['pesanan' => $dT->pesanan]) }}"><i class="fa-solid fa-x fa-sm" style="color: #d91c1c;"></i></a>
            </button>
          </td>
        </tr>
        @endforeach
        {{-- <span class="text-xs" style="font-size: 10px;"> <tr> <td colspan="5" class="text-right"><strong>PPN 10%:</strong></td> <td>{{number_format ($HargaPPN, 2,',','.') }}</td> <td></td> </tr> </span> --}}
        </tbody>
        <tfoot class="text-xs" style="font-size: 10px;"> <tr> <td colspan="5" class="text-right"><strong>Grand Total:</strong></td> <td>{{number_format ($grandTotal, 2,',','.') }}</td> <td></td> </tr> </tfoot>
      
</table>