@component('panel.layouts.component', ['title' => 'ویرایش دسته جدید'])

    @slot('style')
        <style>
            .card-header {
                text-align: center !important;
            }

            .form-control {

                background-color: hsl(315, 22%, 86%);
            }

            .required {
                color: red;
            }

            .py-5 {
                padding-top: 0 !important;
            }
        </style>
    @endslot
    @slot('subject')
        <h1><i class="fa fa-users"></i> ویرایش دسته بندی </h1>

    @endslot
{{--    @slot('breadcrumb')--}}
{{--        <a href=""><li class="breadcrumb-item"> دسته بندی  /  </li></a>--}}
{{--        <a href=""><li class="breadcrumb-item">&nbsp; ویرایش دسته بندی/ </li></a>--}}
{{--        <li class="breadcrumb-item">&nbsp; {{$category->title}} </li>--}}
{{--    @endslot--}}
    @slot('breadcrumb')
        <li class="breadcrumb-item"> {{$category->title}} </li>
        <li class="breadcrumb-item">&nbsp; ویرایش دسته بندی&nbsp;/ </li>
        <a href="{{ route('categories.index') }}" ><li class="breadcrumb-item"> &nbsp;دسته بندی </li></a>
    @endslot

    @slot('content')
        <div class="auth-background h-auto py-5">
            @component('product::components.message')
            @endcomponent
            <div class="container py-5">
                <div class="row align-items-center">

                    <div class="col-lg-12 col-md-12 mx-auto">
                        <div class="card">

                            <div class="card-header"><strong>{{ __('ویرایش دسته بندی ') }}</strong></div>

                            <div class="card-body mx-lg-5 px-lg-3">
                                <form method="POST" action="{{ route('categories.update',$category->id) }}">
                                    @csrf
                                    @if ($category)
                                        @method('PUT')
                                    @endif
                                    <div class="form-group">
                                        <label for="title">{{ __('category.title') }}</label><i class="required">&nbsp; *</i>
                                        <input id="title" type="text"
                                               class="form-control @error('title') is-invalid @enderror" name="title"
                                               value="{{$category->title}}"  autocomplete="title" autofocus>

                                        @error('title')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                        @enderror

                                    </div>

                                    <div class="form-row">
                                    <div class="form-group col-lg-4">
                                        <label for="slug">{{ __('category.slug') }}</label>
                                        <input id="slug" type="text"
                                               class="form-control @error('slug') is-invalid @enderror"
                                               name="slug" value="{{$category->slug}}"
                                               autocomplete="slug" autofocus>

                                        @error('slug')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                        @enderror

                                    </div>
                                    <div class="col-lg-4">
                                        <label>دسته بندی والد:</label>
                                        <select name="parent_id"
                                                class="form-control select2 @error('parent_id') is-invalid @enderror" >
                                            <option value="0">--</option>
                                            {!! category_select_options( $categories,  $category->parent_id  ) !!}

                                        </select>
                                        @error('parent_id')
                                        <span class="invalid-feedback" role="alert">
                                                      <strong>{{ $message }}</strong>
                                                 </span>
                                        @enderror
                                    </div>

                                    <div class="form-group col-lg-4">
                                        <label for="category_type">{{ __('category.category_type') }}</label><i class="required">&nbsp; *</i>
                                        <select id="category_type" type="text"
                                                class="form-control @error('category_type') is-invalid @enderror"
                                                name="category_type"
                                                 autocomplete="category_type">
                                            <option value="">انتخاب کنید</option>
                                            <option value="0"  @if ($category->category_type === 'محصولات')  selected='selected'@endif>محصولات</option>
                                            <option value="1"  @if ($category->category_type === 'اخبار')  selected='selected'@endif>اخبار</option>
                                            <option value="2"  @if ($category->category_type === 'مطالب')  selected='selected'@endif>مطالب</option>
                                        </select>

                                        @error('category_type')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                        @enderror
                                    </div>
                                    </div>

                                    <div class="form-group">
                                        <label for="discription">{{ __('category.discription') }}</label><i class="required">&nbsp; *</i>
                                        <textarea id="editor" type="text"
                                                  class="form-control @error('discription') is-invalid @enderror"
                                                  name="discription"

                                                  autocomplete="discription">{{$category->discription}}</textarea>

                                        @error('discription')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                        @enderror
                                    </div>
                                    <div class="form-group mb-0">
                                        <div class="">
                                            <button type="submit" class="btn btn-primary">
                                                {{ __('ویرایش دسته بندی') }}
                                            </button>

                                            <a href={{ route('categories.index') }} type="button"
                                               class="btn btn-warning">
                                                انصراف</a>

                                        </div>
                                    </div>
                                </form>
                            </div>

                            <div class="card-footer">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    @endslot

    @slot('script')

    @endslot

@endcomponent

