@extends('backend.layout.master')


@section('content')
    <div class="main-content">
        <section class="section">
            <div class="section-header">
                <h1>{{ __($pageTitle) }}</h1>
            </div>
            <div class="card">
                <div class="card-body p-2">

                    <table class="table" id="myTable">
                        <thead>
                            <tr>
                                <th>{{ __('Sl') }}</th>
                                <th>{{ __('user Name') }}</th>
                                <th>{{ __('Transaction Type') }}</th>
                                <th>{{ __('Asset Name') }}</th>
                                <th>{{ __(' Amount') }}</th>
                                <th>{{ __('status') }}</th>
                                <th>{{ __('Action') }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            @forelse ($asset_transactions as  $asset_transaction)
                                <tr>
                                    <td>{{ $loop->iteration }}</td>
                                    <td>{{ @$asset_transaction->user->fname }} {{ @$asset_transaction->user->lname }}</td>
                                    <td>{{ @$asset_transaction->transaction_type }}</td>
                                    <td>
                                        {{ @$asset_transaction->asset_name }} 
                                    </td>
                                    <td>{{ number_format($asset_transaction->amount, 2) . ' ' . @$general->site_currency }}
                                    </td>
                                    
                                    <td>
                                        @if($asset_transaction->status == 'Pending')
                                        <span class="badge bg-warning text-white">{{ __('Pending') }}</span>
                                        @else
                                        <span class="badge bg-success text-white">{{ __('Approved') }}</span>
                                        @endif
                                    </td>
                                   <td>
                                @if($asset_transaction->status == 'Pending')
                                    <a href="{{ route('admin.asset.trade.approve', $asset_transaction->id) }}" 
                                       class="btn btn-md btn-success"
                                       onclick="return confirm('Are you sure you want to approve?')">
                                        {{ __('Approve') }}
                                    </a>
                                @else
                                    
                                @endif
                            </td>
                                </tr>

                            @empty

                                <tr>

                                    <td class="text-center" colspan="100%">{{ __('No Data Found') }}</td>

                                </tr>
                            @endforelse
                        </tbody>

                    </table>

                </div>

               

            </div>
        </section>
    </div>
@endsection


@push('style-plugin')
    <link rel="stylesheet" href="{{ asset('asset/admin/css/datatables.min.css') }}">
    <link rel="stylesheet" href="{{ asset('asset/admin/css/bs4-datatable.min.css') }}">
@endpush

@push('script-plugin')
    <script src="{{ asset('asset/admin/js/datatables.min.js') }}"></script>
    <script src="{{ asset('asset/admin/js/bs4-datatable.min.js') }}"></script>
@endpush

@push('style')
    <style>
        .pagination .page-item.active .pa       .pination .page-item.active .page-link {
          background-color: rgb(95, 116, 235);
          border: none;
        

        ataTables_wrapper .dataTables_paginate .paginate_button:hover {
          background: transparent;
          border-color: transparent;
        

        agination .page-item.active .page-link:hover {
          background-color: rgb(95, 116, 235);
        }

        th,
        td {
            text-align: center !important;
        }
    </style>
@endpush

@push('script')
    <script>
        $(function() {
            'use strict'
            $('#myTable').DataTable();
        })
    </script>
@endpush
