@extends('web.layouts.layout')

@section('container_content')
<section class="box valign">
    <div class="container-fluid">
        <div class="content">
            <h3 class="title wow fadeInUp">E-Wallet</h3>
            <div class="row">
                <div class="col-lg-5">
                    <div class="text-error mt-5">
                        check your E-wallet balance
                    </div>
                    <div class="text-error mt-3">
                        <h5>last transection {{-- <a href="#" class="side-link"><small>show full</small></a> --}} </h5>
                    </div>
                    @if($latestInvoice)
                    <div class="card-details main-back mt-3">
                        <div class="info row">
                            <div class="col-8">
                                <h6>{{ date('F Y', strtotime($latestInvoice['created_at'])) }}</h6>
                                <p>invioce number #{{$latestInvoice['code']}}</p>
                            </div>
                            <div class="col-4 text-right">
                                <h6>{{ $latestInvoice['meta']['total'] }} SAR</h6>
                                <p>
                                    {{ date('d / m / y', strtotime($latestInvoice['created_at'])) }}
                                    <span>{{ date('H:i', strtotime($latestInvoice['created_at'])) }}</span>
                                </p>
                            </div>
                        </div>
                        <div class="content">
                            <div class="row justify-content-between">
                                @if($latestInvoice['meta']['remainingAmount'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.remaining') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['remainingAmount'] }} SAR</small></span>
                                </div>
                                @endif

                                @if($latestInvoice['meta']['managment_fees'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.managment_fees') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['managment_fees'] }} SAR</small></span>
                                </div>
                                @endif

                                @if($latestInvoice['meta']['government_fees'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.government_fees') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['government_fees'] }} SAR</small></span>
                                </div>
                                @endif

                                @if($latestInvoice['meta']['vat_fees'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.vat_fees') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['vat_fees'] }} SAR</small></span>
                                </div>
                                @endif

                                @if($latestInvoice['meta']['withdraw_fees'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.withdraw_fees') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['withdraw_fees'] }} SAR</small></span>
                                </div>
                                @endif

                                @if($latestInvoice['meta']['delay_fees'] ?? '')
                                <div class="bxsh text-center">
                                    <p>{{ __('loops.delay_fees') }}</p>
                                    <span><small>{{ $latestInvoice['meta']['delay_fees'] }} SAR</small></span>
                                </div>
                                @endif

                            </div>
                        </div>
                    </div>
                    @endif
                </div>
                <div class="col-lg-4">
                    <div class="card-img">
                        <h2 class="sub-color">{{ $totalBalance }} SAR <small>Available Balance</small></h2>
                        <div class="img visa-img">
                            <!-- <img src="{{asset('assets/web/images/gr-visa.png')}}" alt=""> -->
                            <img src="{{asset('assets/web/images/credit-card.jpeg')}}" alt="">
                            <span class="visa-number">
                                {{ $card_number }}
                            </span>
                            <span class="ex-date">
                                {{ $card['exp_year'] ?? '' }}
                                <!-- 12 / 20 -->
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3">
                    <div class="card-btns">
                        <div class="row">
                            @if($totalBalance > 0)
                            <div class="col-12">
                                <div class="bxsh">
                                    <a href="#">Withdraw Amount</a>
                                </div>
                            </div>
                            @endif

                            @if($totalBalance < 0)
                            <div class="col-12">
                                <div class="bxsh">
                                    <a href="#">Add Amount</a>
                                </div>
                            </div>
                            @endif

                            <!-- <div class="col-6">
                                <div class="bxsh">
                                    <a href="#">send amount</a>
                                </div>
                            </div> -->

                            <div class="col-12">
                                <div class="bxsh">
                                    <a href="#">Edit Card</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
@endsection

<!-- Modals -->
@section('container_modals')

@if(($success_notes ?? '' ) || ($invoice['code'] ?? '' ))
    @include('web.loops.invoice')
@endif

@endsection

