@extends('backend.layouts.app')
@section('content')
<div class="content-wrapper">
  <section class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6 pb-2 pb-sm-0">
          <h1>Series List</h1>
        </div>
        <div class="col-sm-6 text-sm-right">
          <a href="{{ url('admin/series/add') }}" class="btn btn-primary">Add New Series</a>
        </div>
      </div>
    </div>
  </section>

  <section class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <div class="card">
            <div class="card-body table-responsive p-3">
              <table id="seriesTable" style="width:100%;" class="table table-striped">
                <thead>
                  <tr>
                    <th style="width:60px">S.No.</th>
                    <th>Title</th>
                    <th>Category</th>
                    <th>Thumbnail</th>
                    <th>Seasons</th>
                    <th>Status</th>
                    <th>Actions</th>
                  </tr>
                </thead>
                <tbody></tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
</div>
@endsection

@push('scripts')
<script>
$(document).ready(function () {
  $('#seriesTable').DataTable({
    processing: true,
    serverSide: true,
    ajax: { url: '{{ route('admin.series.index') }}' },
    columns: [
      { data: null, orderable: false, searchable: false, render: (d, t, r, m) => m.row + 1 },
      { data: 'title', name: 'title' },
      { data: 'category_name', name: 'category_name', orderable: false, searchable: false },
      { data: 'thumbnail_image', name: 'thumbnail_image', orderable: false, searchable: false },
      { data: 'seasons_count', name: 'seasons_count', orderable: false, searchable: false },
      { data: 'status', name: 'status' },
      { data: 'actions', name: 'actions', orderable: false, searchable: false },
    ],
    responsive: true,
  });
});
</script>
@endpush
