<x-app-layout>
    @section('title')
        Pages Management
    @endsection
    <!-- Page Heading -->
    {{-- <h1 class="h3 mb-2 text-gray-800">
        @can('Page create')
            <a href="{{ route('admin.pages.create') }}" class="btn btn-primary"><i
                    class="fas fa-plus" aria-hidden="true"></i>
                Add New company image
            </a>
        @endcan
    </h1> --}}
    <!-- DataTales Example -->
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary">
                Create Blog
            </h6>
        </div>
        <div class="card-body">
            <form action="{{ route('admin.blog.update',$data->id) }}" method="POST" enctype="multipart/form-data">
                @csrf
                @method('put')
                <div class="row">
                    <div class="col-12">
                        <label for="">Title</label>
                        <input type="text" class="form-control summernote" value="{{ $data->title }}" name="title"
                            placeholder="Title" required>
                    </div>
                    <div class="col-12">
                        <label for="">Image</label>
                        @if ($data->image != '')
                            <img style="width: 80px" src="{{ asset($data->image) }}" alt="">
                        @endif
                        <input type="file" class="form-control" name="image" >
                    </div>

                    <div class="col-12">
                        <label for="">Select category </label>
                        <select name="category_id" id="" class="form-control" required>
                            @foreach ($categories as $category)
                                <option {{ $data->category_id == $category->id ? 'selected':'' }}  value="{{ $category->id }}">{{ $category->name }} </option>
                            @endforeach
                        </select>
                    </div>
                    <div class="col-12">
                        <label for="">Sort Description </label>
                        <textarea name="sort_description" rows="4" class="form-control summernote" required>{{ $data->sort_description }}</textarea>
                    </div>

                    <div class="col-12">
                        <label for="">Long Description </label>
                        <textarea name="long_description" rows="4" class="form-control summernote" required>{{ $data->long_description }}</textarea>
                    </div>

                    <div class="col-12">
                        <div class="mt-3">
                            <button type="submit" class="btn btn-primary">Update</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

</x-app-layout>
