@extends('admin.layout.main')
@section('content')
<div class="row">
    <div class="col-lg-12" style="padding-left: 4px;padding-right: 4px;">
        <div class="card m-b-30" style="border-radius: 5px;">
            <div class="card-header">
                <h5 class="card-title" style="font-weight: bold; padding-top: 15px; font-size: 20px;">Post Edit</h5>
            </div>

            <div class="card-body" style="padding-bottom: 50px;">
                <form action="{{url('admin/postedit')}}" method="post" enctype="multipart/form-data">@csrf
                <div class="row">
                    <div class="col-md-6">
                        <input type="hidden" name="post_id" value="{{$post_data->id}}">
                    
                        <div class="row">
                            <div class="col-12">
                                <label style="color:#fff" class="form-label">Post Title:</label>
                                <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="text" name="title" value="{{$post_data->title}}" required>
                            </div>


                            <div class="col-12">
                                <label style="color:#fff" class="form-label">Status:</label>
                                <select style="margin-bottom: 10px;height: 38px;" name="type" class="form-control" required>
                                    @if($post_data->status == 0)
                                    <option value="0">Public</option>
                                    <option value="1">Unpublic</option>
                                    @else
                                    <option value="1">Unpublic</option>
                                    <option value="0">Public</option>
                                    @endif
                                </select>
                            </div>
                            

                            <div class="col-12" style="margin-bottom: 10px;">
                                <textarea style="width: 100%;padding-left: 10px;margin-bottom: 10px;" class="form-control" rows="3" name="details" id="summernote" placeholder="Post Details..." required>{!! $post_data->details !!}</textarea>
                            </div> 
                        </div>
                    </div>

                    <div class="col-md-6">                    
                        <div class="row">
                            <div class="col-12">
                                <label style="color:#fff" class="form-label">Post Summery:</label>
                                <textarea rows="3" style="margin-bottom: 10px;width: 100%;background: transparent;border: 1px solid #41b985;border-radius: 4px;padding-left: 10px;color: #fff;" name="summary" placeholder="Post Summery" required>{!! $post_data->summary !!}</textarea>
                            </div>

                            <div class="col-12" style="margin-bottom: 10px;">
                                <label style="color:#fff;" class="form-label">Image:</label><br>
                                <input style="margin-bottom: 10px;" type="file" name="image" class="file">
                                <a style="color:white" href="">[image Size: 720x320 px]</a><br>

                                <img style="width:120px; height:auto;margin-bottom: 10px;" src="{{URL::to($post_data->image)}}"><br>
                                <span>[Old Image]</span>
                            </div> 

                            <div class="col-12">
                                <button style="height: 38px;background: #ec1666;color: #fff;margin-top: 10px;" type="submit" class="btn">Confirm Now</button>
                            </div>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>      
</div>
@endsection