@extends('backend.dashboard')

@section('content')

<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">

                <div class="card card-primary">

                    {{-- Header --}}
                    <div class="card-header position-relative">
                        <div class="w-100 text-center p-4">
                            <h3 style="display:inline-block;font-weight:700;font-size:30px;
                                padding-bottom:6px;border-bottom:3px solid #a74a28;margin:0;">
                                Update About
                            </h3>
                        </div>


                    </div>

                    {{-- SINGLE FORM --}}
                    <form action="{{ route('about.update', $about->id) }}"
                          method="POST"
                          enctype="multipart/form-data">

                        @csrf
                        @method('PUT')

                        <div class="card-body">

                            {{-- ================= BESTSELLER ================= --}}

                            <div class="row">

                                <div class="col-md-6">
                                    <label><h5>Image</h5></label>
                                    <input type="file" name="image" class="form-control" accept="image/*">
                                    @error('image') <span class="text-danger">{{ $message }}</span> @enderror

                                    @if(!empty($about->image))
                                        <img src="{{ asset($about->image) }}"
                                             width="120" class="mt-2">
                                    @endif
                                </div>

                                <div class="col-md-6">
                                    <label><h5>Alt Text</h5></label>
                                    <input type="text" name="alt_text"
                                           value="{{ old('alt_text', $about->alt_text ?? '') }}"
                                           class="form-control">
                                    @error('alt_text') <span class="text-danger">{{ $message }}</span> @enderror
                                </div>



                            </div>

                            <div class="row mt-3">

                                <div class="col-md-6">
                                    <label><h5>Title</h5></label>
                                    <input type="text" name="title"
                                           value="{{ old('title', $about->title ?? '') }}"
                                           class="form-control">
                                    @error('title') <span class="text-danger">{{ $message }}</span> @enderror
                                </div>

                                <div class="col-md-6">
                                    <label><h5>Author</h5></label>
                                    <input type="text" name="author"
                                           value="{{ old('author', $about->author ?? '') }}"
                                           class="form-control">
                                    @error('author') <span class="text-danger">{{ $message }}</span> @enderror
                                </div>

                            </div>



                            <div class="row mt-3">
                                <div class="col-md-12">
                                    <label><h5>Description</h5></label>
                                    <textarea name="description"
                                              class="form-control"
                                              rows="4">{{ old('description', $about->description ?? '') }}</textarea>
                                    @error('description') <span class="text-danger">{{ $message }}</span> @enderror
                                </div>
                            </div>

                             <div class="row">
                                  <div class="col-md-12">
                                            <div class="form-group">
                                                <label style="font-size:20px; font-weight:600;">Book Link</label>
                                                <input type="text" name="amazon_link" value="{{ old('amazon_link', $about->amazon_link) }}" class="form-control" placeholder="Enter Amazon Link">
                                                @error('amazon_link') <span class="text-danger">{{ $message }}</span> @enderror
                                            </div>
                                        </div>
                            </div>


                        </div>

                        {{-- Footer --}}
                       <div class="card-footer d-flex justify-content-end">
                            <button type="submit" class="btn btn-primary">
                               <i class="fas fa-edit"></i> Update
                            </button>
                        </div>

                    </form>

                </div>

            </div>
        </div>
    </div>
</section>

@endsection
