@extends('layouts.app')
@section('title','Author')
@section('pages')


<!--breadcrumb-->
<div class="page-breadcrumb d-flex align-items-center mb-3 px-3 px-md-0">
    <div class="breadcrumb-title pe-3"><i class="bi bi-list"></i>Library Author</div>
    <div class="ps-3">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0 p-0">

                <li class="breadcrumb-item active" aria-current="page">Edit Author</li>
            </ol>
        </nav>
    </div>
    <div class="ms-auto">
        <div class="btn-group">
            <a href="{{route('authors.index')}}" class="btn btn-outline-secondary"><i class="bx bx-arrow-back ms-0 me-1"></i>Back</a>
        </div>
    </div>
</div>
<!--end breadcrumb-->


<div class="row auto">
  <div class="col-xl-12 mx-auto">
    <div class=" shadow-none radius-5 min-height">
      <div class="">
        <div class="">
          <form class="g-3 row auto-width" action="{{route('authors.update',$authors->id)}}" class="ajaxformfileupload" method="POST" enctype='multipart/form-data'>
            <!-- For validation comment on -->
            @csrf
            @method('PUT')
            <div class="col-md-6 col-sm-12">
              <div class="card">
                <div class="card-body">
                  <div class="g-3 row">
                    <h5 class="mb-0">Authors</h5>
                    <hr class="mb-0">
                    <div class="col-md-12">
                     <label for="fname" class="form-label">Full Name <span class="text-danger"><b>*</b></span></label>
                     <div class="input-group has-validation"> <span class="input-group-text" id="inputGroupPrepend"><i class="bi bi-people"></i></span>
                      <input type="text" class="form-control" name="first_name" id="fname" placeholder="Full Name" value="{{$authors->first_name}}" required="">
                      @if ($errors->has('first_name'))
                      <span class="text-danger">{{ $errors->first('first_name') }}</span>
                      @endif
                    </div>
                  </div>
                  <div class="col-md-12">
                    <label for="lname" class="form-label">Profile Image</label>
                    <input type="file" class="form-control" name="authors_prfile_picture" id="lname" placeholder="Last Name" >
                    @if ($errors->has('authors_prfile_picture'))
                    <span class="text-danger">{{ $errors->first('authors_prfile_picture') }}</span>
                    @endif
                  </div>
                  <div class="col-md-12">
                    <label for="name" class="form-label">Description</label>
                    <textarea class="form-control" name="descriptions">{{$authors->descriptions}}</textarea>
                  </div>
                  <div class="col-12" align="center">
                  <div class="d-grid gap-2">
                <button class="btn btn-primary"  type="submit"><i class="bx bx-save"></i> Update Author</button>
                </div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="col-md-6 col-sm-12">
            <div class="card">
              <div class="card-body">
                <div class="g-3 row">
                  <h5 class="mb-0">Author</h5>
                  <hr class="mb-0">
                  <div class="col-md-12">
                    <label for="name" class="form-label">Cover Small Image (Size 200 KB)</label>
                    <input type="file" class="form-control" name="cover_image_large" id="name" placeholder="Name">
                    @if ($errors->has('cover_image_large'))
                    <span class="text-danger">{{ $errors->first('cover_image_large') }}</span>
                    @endif
                  </div>
                  <div class="col-md-12">
                    <label for="name" class="form-label">Cover Large Image (Size 200 KB)</label>
                    <input type="file" class="form-control" name="cover_image_small" id="name" placeholder="Name">
                    @if ($errors->has('cover_image_small'))
                    <span class="text-danger">{{ $errors->first('cover_image_small') }}</span>
                    @endif
                  </div>
                  <div class="col-md-6">
                    <div class="form-check form-switch form-switch-lg">
                      <input class="btn-lg form-check-input" type="checkbox" id="flexSwitchCheckDefault" name="isfeatured"  @if($authors->isfeatured=='1'){{'checked'}}@endif>
                      Is Featured
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-check form-switch form-switch-lg">
                      <input class="btn-lg form-check-input" type="checkbox" id="flexSwitchCheckDefault" name="website_view"  @if($authors->website_view=='1'){{'checked'}}@endif> Website View
                    </div>
                  </div>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>

    </div>
  </div>
  <!--end row-->
  @endsection
