@extends('layouts.admin_master')
@section('page-title') 
    Admin | {{ $page_title }}
@endsection
@section('page-content')

<div class="row">
<div class="col-md-12">
        <div class="hpanel">
            <div class="panel-heading">List of Merchants <br>
            <!-- <a class="btn btn-info btn-sm pull-right" href="{{ url('admin/merchants/create') }}"><i class="fa fa-plus-circle"></i> New Merchant</a> -->
            <div class="clearfix"></div>
                @include('commons.notifications')                    
            </div>
            <div class="panel-body">
                   

                <div class="table-responsive">
                <table cellpadding="1" cellspacing="1" class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>Name</th>
                        <th>Balance (MWK)</th>
                        <!-- <th>Email</th> -->
                        <th>Phone</th>
                        <th>Status</th>
                        <th>Date Created</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    @forelse ($merchants as $row)
                    <tr>
                        <td>{{ $row->fullname }}</td>
                        <td>{{ number_format($row->balance) }}</td>
                        <td>@if($row->phone) {{ $row->phone }} @else {{ 'N/A' }} @endif</td>
                        <td class="@if($row->status == 'active') {{ 'bg-success' }} @else {{ 'bg-danger' }} @endif">{{ ucfirst($row->status) }}</td>
                        <td>{{ Carbon\Carbon::parse($row->created_at)->format('F d, Y') }}</td>
                        <td>
                            <input type="hidden" class='merchRowId' name="merchant_id" value="{{ $row->id }}">
                            <input type="hidden" class='merchRowName' name="merch_name" value="{{ $row->name }}">
                            <a class="btn btn-info btn-sm" title="Edit this entry" href="{{ url('admin/merchants/edit', $row->id) }}" ><i class="fa fa-pencil"></i></a>
                            <!-- <button class="btn btn-success btn-sm merchTopUpBtn" title="Click to Top Up Balance" type="button"><i class="fa fa-plus"></i> <span class="bold"></span> Top Up</button> -->
                        </td>
                    </tr>
                    @empty
                        <tr>                      
                            <td colspan="8">No Data</td>
                        </tr>
                    @endforelse
                    </tbody>
                </table>
                </div>
                {{ $merchants->links() }}
            </div>
            <div class="panel-footer">
            Page : {{ $merchants->currentPage() }} of {{ $merchants->lastPage() }} |
            Total Records : <span id="totalRecords">{{ $merchants->total() }}</span>
            </div>
        </div>
    </div>
</div>
@endsection


@section('page-js')
<script>
$(document).ready(function() {
    

});
</script>
@endsection