@extends('admin.layouts.app')
@section('content')
<div class="row">
@include('admin.layouts.errors')

    <div class="col-lg-6">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">ویرایش قانون</h4>
                <div>
                    <form action="{{ route('law.update',$law->id) }}" method="post" enctype="multipart/form-data">
                        @csrf
                        @method('put')
                        <div class="mb-4">
                        <label for="">تایتیل را وارد کنید</label>
                            <input class="form-control" name="title" type="text" placeholder="نام" value="{{$law->title}}">
                        </div>

                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" name="is_locked" id="customCheck2" {{ $law->is_locked ? 'checked' : '' }}>
                            <label class="custom-control-label" for="customCheck2">قفل باشه؟</label>
                        </div>

                        <div class="mb-4">
                            <label for="division_id">دسته بندی</label>
                            <select class="form-control" name="category_id" id="category_id">
                            <option value="">بدون مقدار</option>
                                @foreach ($categories as $category)
                                <option value="{{$category->id}}" {{ $category->id === $law->category_id ? 'selected' : '' }}>{{$category->name}}</option>
                                @endforeach
                            </select>
                        </div>


                        <div class="mb-4">
                            <label for="">قیمت را وارد کنید</label>
                            <input class="form-control" name="price" type="text" placeholder="قیمت" value="{{ $law->price }}">
                        </div>

                        <div class="mb-4">
                            <label for="">عکس را وارد کنید</label>
                            <input class="form-control" name="image" type="file" placeholder="عکس">
                        </div>

                        <button class="btn btn-primary" type="submit">ثبت</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection