@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')
        <li class="breadcrumb-item">ویرایش دسته بندی محصولات</li>
    @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-group">
                                        <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="form-group">
                                        <label for="parent">{{ __('category.parent') }}</label><i class="required">&nbsp; *</i>
                                        <input id="parent" type="text"
                                               class="form-control @error('parent') is-invalid @enderror"
                                               name="parent" value="{{$category->parent}}"
                                               autocomplete="parent" autofocus>

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

                                    </div>

                                    <div class="form-group">
                                        <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 class="form-group">
                                        <label for="discription">{{ __('category.discription') }}</label><i class="required">&nbsp; *</i>
                                        <textarea id="discription" 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