@extends('layout.app')

@section('content')
    <div class="card">
        <div class="card-body">
            <div class="col-md-3">
                <a href="{{ route('tokenSource.create') }}">
                    <button class="btn btn-success ">
                        <i class="fa fa-plus"></i> Token Source
                    </button>
                </a>
            </div>
            <br>
            <div class="col-md-12">
                <div class="table-responsive">
                    <table id="dataTable" class="table table-bordered table-striped table-condensed">
                        <thead class="bg-gray-50">
                            <tr class="bg-black text-center">
                                <th>ID</th>
                                <th>Name</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($sources as $r)
                                <tr>
                                    <td>{{ $r->id }}</td>
                                    <td>{{ $r->name }}</td>
                                    <td>
                                        <div class="row float-right">
                                            <a href="{{ route('tokenSource.edit', $r->id) }}">
                                                <button class="btn btn-primary">Edit</button>
                                            </a>
                                            <a href="{{ route('editLog-history', ['id' => $r->id, 'type' => 'Token Source']) }}" target="_blank" class="btn btn-secondary">
                                                History
                                            </a>
                                            {{-- <form action="{{ route('tokenSource.destroy', $r->id) }}" method="POST" class="d-inline ml-2" onsubmit="return confirm('Are you sure you want to delete this token source?');">
                                                @method('DELETE')
                                                @csrf
                                                <button class="btn btn-danger">Delete</button>
                                            </form> --}}
                                        </div>
                                    </td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('ajax')
    <script type="text/javascript">
        $(document).ready(function() {
            $('#dataTable').DataTable();
        });
    </script>
@endsection
