@extends('layout.admin')
@section('title', 'Press Releases')
@section('content')

<div class="row">
    <div class="card p-4">
        <div class="d-flex justify-content-between">
            <h5 class="card-title">Press Releases</h5>
            <a href="{{ route('blogs.create') }}" class="btn btn-primary">Create</a>
        </div>
        <div class="dropdown-divider py-3"></div>
        <table id="dataTable" class="table" style="width:100%">
            <thead>
                <tr>
                    <th>Thumbnail</th>
                    <th>Publish Date</th>
                    <th>Title</th>
                    <th>Category</th>
                    <th data-orderable="false" style="max-width: 120px;">Action</th>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>
</div>
@endsection


@section('extra')
<script>
    $(function() {
        table = $('#dataTable').dataTable({
            processing: true,
            serverSide: true,
            ordering: false,
            ajax: {
                url: "{{route('blogs.list')}}",
            },
            columns: [
                {
                    data: "thumbnail",
                },
                {
                    data: "publish_date",
                },
                {
                    data: "title",
                },
                {
                    data: "category",
                },
                {
                    data: "action",
                }
            ],
        });
    });
</script>
@endsection