@extends('dealer_layouts.dealer_master')
@section('page-title') 
    Dealer | Transactions
@endsection
@section('page-content')
@include('organisation.partials.top_up_merchant')
@include('organisation.partials.top_up_merchant_by_id')
<div class="row">
    <div class="col-lg-3">
        <div class="hpanel stats hblue">
            <div class="panel-heading hbuilt">Merchant Details</div>
            <div class="panel-body list">
                <div class="stats-title pull-left">
                    <!-- <h4>Details</h4> -->
                </div>
                <!-- <div class="stats-icon pull-right text-warning">
                    <i class="pe-7s-science fa-4x"></i>
                </div> -->
                <div class="row m-t-md">
                    <div class="col-lg-12">
                        <div class="text-center bg-success p-xs"> 
                            <span class="font-extra-bold no-margins text-center">
                                <u>{{ strtoupper($merchant->fullname) }}</u>
                            </span>
                            <br/>                    
                        </div>
                    </div>
                </div>
                <div class="row m-t-md">
                    <div class="col-lg-6">
                        <h4 class="no-margins font-bold text-success">{{ $merchant->phone }}</h4>
                        <div class="font-bold">Phone <i class="fa fa-phone text-success"></i></div>
                    </div>
                    <div class="col-lg-6">
                        <h4 class="no-margins font-bold text-success">{{ ucfirst($merchant->language) }}</h4>
                        <div class="font-bold">Language</div>
                    </div>
                    
                </div>
                <div class="row m-t-md">
                    <div class="col-lg-6">
                        <h3 class="no-margins font-bold text-info ">{{ number_format($merchant->balance, 2) }}</h3>

                        <div class="font-bold">Balance <i class="fa fa-money"></i></div>
                    </div>
                    <div class="col-lg-6">
                        <h3 class="no-margins font-bold text-info">{{ ucfirst($merchant->status) }}</h3>

                        <div class="font-bold">Status <i class=""></i></div>
                    </div>

                </div>
                <div class="row m-t-md">
                    <div class="col-md-12">
                        <button class="btn btn-block btn-success topUpMerchantByIdBtn" id=""><i class="fa fa-money"></i> Top Up Balance</button>
                        <input type="hidden" class="hidden rowMerchantId" value="{{ $merchant->id }}" />
                    </div>
                </div>
                <div class="row m-t-md">
                    <div class="col-md-12">
                        <!-- <button class="btn btn-block btn-info"><i class="fa fa-edit"></i> Edit Merchant</button> -->
                        <a href="{{ route('merchant.edit', $merchant->id) }}" class="btn btn-info btn-block"><i class="fa fa-edit"></i> Edit Details</a>
                    </div>
                    
                </div>
                
            </div>
        </div>
    </div>
    <div class="col-lg-6">
        <div class="hpanel hblue">
            <div class="panel-heading hbuilt">                
                Merchant Sales to Customers
            </div>
            <div class="panel-body list">
                <div class="table-responsive project-list">
                    <table class="table table-striped">
                        <thead>
                        <tr class="bg-info">
                            <th>Recipient Phone</th>
                            <th>Amount (MWK)</th>
                            <th>Status</th>
                            <th>Date</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                        @forelse ($merchant->transactions as $row)
                            <td>{{ $row->msisdn }}
                                <!-- <br/>
                                <small><i class="fa fa-money"></i> {{ $row->amount }} </small> -->
                            </td>
                            <td>
                                <span class="pie">{{ number_format($row->amount) }}</span>
                            </td>
                            <td><strong>{{ $row->status }}</strong></td>
                            <td>{{ $row->created_at }}</td>
                        </tr>
                        @empty
                            <tr>                      
                                <td colspan="7">No Data</td>
                            </tr>
                        @endforelse
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-3">
        <div class="hpanel hblue">
            <div class="panel-heading hbuilt">                
                Merchant Balance Top Ups
            </div>
            <div class="panel-body list">
                <!-- <div class="panel-title">Last Activity</div> -->
                <!-- <small class="fo">This is simple example</small> -->
                <div class="list-item-container">
                    @forelse ($merchant_topups as $row)
                    <div class="list-item">
                        <h3 class="no-margins font-extra-bold text-success">MWK {{ number_format($row->amount) }}</h3>
                        <small>{{ $row->status }}</small> <br>
                        <div class="pull-right font-bold">{{ $row->created_at }} <i class="fa fa-calendar text-success"></i></div>
                    </div>
                    @empty
                        <tr>                      
                            <td colspan="7">No Data</td>
                        </tr>
                    @endforelse
                </div>

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

            
@endsection
@section('page-js')
<script src="{{ url('public/js/dealer_landing.js') }}"></script>


@endsection
