@extends('layouts.master')

@section('title') @lang('translation.Customers') @endsection

@section('css')
    <!-- DataTables -->
    <link href="{{ URL::asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
    <!-- <link href="https://cdn.datatables.net/searchpanes/2.1.0/css/searchPanes.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="https://cdn.datatables.net/select/1.5.0/css/select.bootstrap4.min.css" rel="stylesheet" type="text/css" /> -->
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Ecommerce @endslot
        @slot('title') {{ $user->user_type }} @endslot
    @endcomponent

            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">Asset {{ $user->id }}</div>
                    <div class="card-body">

                        @if($user->user_type == 'Subscribers' || $user->user_type == 'Corporate')
                            <?php $link = route('admin.customers') ?>
                        @elseif($user->user_type == 'Driver')
                        <?php  $link = route('admin.angels') ?>
                        @else
                        <?php  $link = '#' ?>
                        @endif

                        <a href="{{ $link }}" title="Back"><button class="btn btn-warning btn-sm"><i class="fa fa-arrow-left" aria-hidden="true"></i> Back</button></a>
                        <a href="{{ url('/admin/assets/' . $user->id . '/edit') }}" title="Edit Asset"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button></a>

                        <form method="POST" action="{{ url('admin/assets' . '/' . $user->id) }}" accept-charset="UTF-8" style="display:inline">
                            {{ method_field('DELETE') }}
                            {{ csrf_field() }}
                            <button type="submit" class="btn btn-danger btn-sm" title="Delete Asset" onclick="return confirm(&quot;Confirm delete?&quot;)"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</button>
                        </form>
                        <br/>
                        <br/>

                        <div class="table-responsive">
                            <table class="table">
                                <tbody>
                                    <tr><th>ID</th><td>{{ $user->id }}</td></tr>
                                    <tr><th> Name </th><td> {{ $user->name }} </td></tr>
                                    <tr><th>Email</th><td> {{ $user->email }} </td></tr>
                                    <tr><th>User Country Code</th><td> {{ $user->userData->user_country_code }} </td></tr>
                                    <tr><th>Phone Number</th><td> {{ $user->phone_number }} </td></tr>
                                    <tr><th>User Type </th><td> {{ $user->user_type }} </td></tr>
                                    <tr><th>Referral Code</th><td> {{ $user->userData->referral_code }} </td></tr>
                                    <tr><th>Referred By</th><td> {{ $user->userData->referred_by }} </td></tr>
                                    <tr><th> Wallet Amount </th><td> {{ $user->userData->wallet_amount }}  </td></tr>
                                    <tr><th> Device Type </th><td> {{ $user->userData->device_type }}  </td></tr>
                                    <tr><th> Device ID </th><td> {{ $user->userData->device_id }}  </td></tr>
                                    <tr><th> Image </th><td> {{ $user->userData->image }}  </td></tr>
                                </tbody>
                            </table>
                        </div>

                        <h4>Wallet Histry</h4>
                        <?php $i=0 ?> 
                        <div class="table-responsive">
                            <table id="datatable" class="table align-middle table-nowrap">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>Transaction Type</th>
                                        <th> Purpose</th>
                                        <th> Transaction Details</th>
                                        <th>Transaction ID</th>
                                        <th>Amount</th>
                                        <th>Amount Added At</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @if($walletHistories)
                                    @foreach ($walletHistories as $walletHistory)
                                        <tr>
                                            <td>{{ ++$i }}</td>
                                            <td>{{ $walletHistory->transaction_type }}</td>
                                            <td>{{ $walletHistory->purpose }}</td>
                                            <td>{{ $walletHistory->transaction_details }}</td>
                                            <td>{{ $walletHistory->UserData }}</td>
                                            <td>{{ $walletHistory->transaction_id }}</td>
                                            <td>{{ $walletHistory->amount }}</td>
                                            <td>{{ $walletHistory->created_at }}</td>

                                        </tr>
                                    @endforeach
                                @endif
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
    <!-- end row -->
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ URL::asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ URL::asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ URL::asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->
    <script src="{{ URL::asset('/assets/js/pages/datatables.init.js') }}"></script>
    <!-- <script src="https://cdn.datatables.net/searchpanes/2.1.0/js/dataTables.searchPanes.min.js"></script>
    <script src="https://cdn.datatables.net/searchpanes/2.1.0/js/searchPanes.bootstrap4.min.js"></script>
    <script src="https://cdn.datatables.net/select/1.5.0/js/dataTables.select.min.js"></script> -->
    <script type="text/javascript">
        $(document).ready(function(){
            // var table = $('#datatable-assets').DataTable({
            //     searchPanes: true
            // });
            // table.searchPanes.container().prependTo(table.table().container());
            // table.searchPanes.resizePanes();
        });
    </script>
@endsection
