@php use Carbon\Carbon; @endphp
@extends('adminlte::page')


@section('title', 'IPRS | Payment')

@section('content_header')
    <div class="col-10 offset-1 d-flex justify-content-between align-items-center">
        <div class="row">
            <div class="col-sm-8">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
                    <li class="breadcrumb-item active">Payments Received</li>
                </ol>
            </div>
            <div class="col-sm-12">
                <h1 class="m-0">Payments Received</h1>
            </div>
        </div>
        <div>
            <div class="d-flex justify-content-end align-content-end">
                <a href="" class="btn btn-primary">Download report</a>
            </div>
        </div>
    </div>
@stop

@section('plugins.Datatables', true)

@section('content')
    <div class="col-10 offset-1">
        {{-- Setup data for datatables --}}
        @php
            $headings = [
                'ID',
                'Customer',
                'Reference',
                'Invoice No.',
                'Mode',
                'Amount',
                'Tokens',
                ['label' => 'Status'],
                'Date',
            ];
        @endphp

        <x-adminlte-card>
            {{-- Minimal example / fill data using the component slot --}}
            <x-adminlte-datatable id="payments-table" :heads="$headings" striped hoverable bordered>
                @foreach($payments as $payment)

                    <tr>
                        <td>{{ $payment->id }}</td>
                        <td>{{ $payment->name }} {{ $payment->contract_id }}</td>
                        <td>{{ $payment->payment_ref }}</td>
                        <td class="text-primary">INW23943V </td>
                        <td>MPESA -STK</td>
                        <td>{{ $payment->amount }}</td>
                        <td>{{ $payment->tokens }}</td>
                        <td><div class="badge badge-success">Active</div></td>
                        <td>{{ Carbon::parse($payment->created_at)->format("d-m-Y") }}</td>
                        <td>
                            <nobr>
                                <a href=""
                                class="btn btn-xs btn-default text-teal mx-1 shadow" title="Details">
                                    <i class="fa fa-lg fa-fw fa-eye"></i>
                                </a>
                            </nobr>

                        </td>
                    </tr>
                @endforeach
            </x-adminlte-datatable>
        </x-adminlte-card>
    </div>
@stop
