@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"><h1>Add New Series</h1></div>
      </div>
    </div>
  </section>

  <section class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <div class="card">
            <form action="{{ route('admin.series.insert') }}" method="post" enctype="multipart/form-data">
              @csrf
              <div class="card-body">
                @if($errors->any())
                  <div class="alert alert-danger">
                    <ul class="mb-0">@foreach($errors->all() as $e)<li>{{ $e }}</li>@endforeach</ul>
                  </div>
                @endif

                <div class="form-group">
                  <label>Title <span class="text-danger">*</span></label>
                  <input type="text" class="form-control" name="title" value="{{ old('title') }}" placeholder="Series Title">
                </div>

                <div class="form-group">
                  <label>Category <span class="text-danger">*</span></label>
                  <select name="category_id" class="form-control select2" style="width:100%">
                    <option selected disabled>Select Category</option>
                    @foreach($categories as $cat)
                      <option value="{{ $cat->id }}" {{ old('category_id') == $cat->id ? 'selected' : '' }}>{{ $cat->name }}</option>
                    @endforeach
                  </select>
                </div>

                <div class="form-group">
                  <label>Thumbnail Image <span class="text-danger">*</span></label>
                  <input type="file" class="form-control" name="thumbnail_image">
                </div>

                <div class="form-group">
                  <label>Description</label>
                  <textarea name="description" class="form-control" rows="5">{{ old('description') }}</textarea>
                </div>
              </div>
              <div class="card-footer">
                <button type="submit" class="btn btn-primary">Save Series</button>
                <a href="{{ url('admin/series') }}" class="btn btn-secondary ml-2">Cancel</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </section>
</div>
@endsection
