@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;">Product Edit</h5>
            </div>

            <div class="card-body" style="padding-bottom: 50px;">
                <form action="{{url('admin/proedit')}}" method="post" enctype="multipart/form-data">@csrf

                    <input type="hidden" name="pro_id" value="{{$pro_data->id}}">
                
                    <div class="row">
                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Product Title:</label>
                            <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="text" name="title" value="{{$pro_data->title}}" required>
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Category:</label>
                            <select style="margin-bottom: 10px;height: 38px;" name="cat_id" class="form-control" required>
                                <option value="{{$cat_data->id}}">{{$cat_data->cat_name}}</option>
                                @foreach($category as $cat)
                                <option value="{{$cat->id}}">{{$cat->cat_name}}</option>
                                @endforeach
                            </select>
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Buying Price:</label>
                            <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="number" name="buying_price" id="buying_price" value="{{$pro_data->buy_price}}" required>
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Selling Price:</label>
                            <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="number" name="selling_price" id="selling_price" value="{{$pro_data->price}}" required>
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Regular Price:</label>
                            <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="number" name="regular_price" id="regular_price" value="{{$pro_data->regu_price}}">
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">PV:</label>
                            <input style="margin-bottom: 10px;height: 38px;background: transparent;" class="form-control" type="number" name="pv" id="pv" value="{{$pro_data->point}}" readonly>
                        </div>

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">Stock:</label>
                            <input style="margin-bottom: 10px;height: 38px;" class="form-control" type="number" name="stock" value="{{$pro_data->stock}}" required>
                        </div>


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

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

                        <div class="col-md-6">
                            <label style="color:#fff" class="form-label">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="Product Summery" required>{!! $pro_data->summary !!}</textarea>
                        </div>

                        <div class="col-md-6" style="margin-top: 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: 800x800 px]</a><br>

                            <img style="width:120px; height:auto;margin-bottom: 10px;" src="{{URL::to($pro_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>

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