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


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

@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">Tokens</li>
                </ol>
            </div>
            <div class="col-sm-12">
                <h1 class="m-0">Tokens</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 = [
                'Contract_id',
                'Consumer',
                'Total Tokens',
                'Used Tokens',
                'Updated',
            ];
        @endphp

        <x-adminlte-card>
            {{-- Minimal example / fill data using the component slot --}}
            <x-adminlte-datatable id="payments-table" :heads="$headings" striped hoverable bordered>
                @foreach($tokens as $token)
                    <tr>
                        <td>{{ $token->contract_id }}</td>
                        <td>{{ $token->contract->client->name_sh }}</td>
                        <td>{{ $token->total_tokens }}</td>
                        <td class="text-primary">{{ $token->used_tokens }}</td>
                        <td>{{ Carbon::parse($token->updated_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
