@extends('admin.layouts.app')

@push('styles_top')
    <link href="/assets/default/vendors/sortable/jquery-ui.min.css"/>
@endpush

@section('content')
    <section class="section">
        <div class="section-header">
            <h1>{{!empty($stat) ?trans('/admin/main.edit'): trans('admin/main.new') }}</h1>
            <div class="section-header-breadcrumb">
                <div class="breadcrumb-item active"><a href="/admin/">{{ trans('admin/main.dashboard') }}</a>
                </div>
                <div class="breadcrumb-item active">
                    <a href="/admin/forums">البطاقات</a>
                </div>
                <div class="breadcrumb-item">{{!empty($stat) ?trans('/admin/main.edit'): trans('admin/main.new') }}</div>
            </div>
        </div>

        <div class="section-body">

            <div class="row">
                <div class="col-12 col-md-6 col-lg-6">
                    <div class="card">
                        <div class="card-body">
                            <form action="/admin/stats/{{ !empty($stat) ? $stat->id.'/update' : 'store' }}"
                                  method="Post" enctype="multipart/form-data">
                                {{ csrf_field() }}



                                <div class="form-group">
                                    <label>{{ trans('/admin/main.title') }}</label>
                                    <input type="text" name="title"
                                           class="form-control  @error('title') is-invalid @enderror"
                                           value="{{ !empty($stat) ? $stat->title : old('title') }}"
                                           placeholder="{{ trans('admin/main.choose_title') }}"/>
                                    @error('title')
                                    <div class="invalid-feedback">
                                        {{ $message }}
                                    </div>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label>{{ trans('/admin/main.description') }}</label>
                                    <input type="text" name="description"
                                           class="form-control  @error('description') is-invalid @enderror"
                                           value="{{ !empty($stat) ? $stat->description : old('description') }}"
                                           placeholder="{{ trans('admin/main.description') }}"/>
                                    @error('description')
                                    <div class="invalid-feedback">
                                        {{ $message }}
                                    </div>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label class="input-label d-block">الإحصاء</label>
                                    <input type="number" name="subtitle"
                                           class="form-control  @error('subtitle') is-invalid @enderror"
                                           value="{{ !empty($stat) ? $stat->subtitle : old('subtitle') }}"
                                           placeholder=""/>
                                    @error('subtitle')
                                    <div class="invalid-feedback">
                                        {{ $message }}
                                    </div>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label class="input-label d-block">URL</label>
                                    <input type="url" name="url"
                                           class="form-control  @error('url') is-invalid @enderror"
                                           value="{{ !empty($stat) ? $stat->url : old('url') }}"
                                           placeholder=""/>
                                    @error('url')
                                    <div class="invalid-feedback">
                                        {{ $message }}
                                    </div>
                                    @enderror
                                </div>
                                <div class="form-group">
                                    <label>{{ trans('/admin/main.image') }}</label>
                                    <input type="file" name="image"
                                           class="form-control  @error('image') is-invalid @enderror"
                                           value="{{ !empty($stat) ? $stat->image : old('image') }}"
                                           placeholder="{{ trans('admin/main.image') }}"/>
                                    @error('image')
                                    <div class="invalid-feedback">
                                        {{ $message }}
                                    </div>
                                    @enderror
                                </div>



                                <div class="text-right mt-4">
                                    <button class="btn btn-primary">{{ trans('admin/main.submit') }}</button>
                                </div>
                            </form>


                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
@endsection

@push('scripts_bottom')
    <script src="/assets/default/vendors/sortable/jquery-ui.min.js"></script>

    <script src="/assets/default/js/admin/categories.min.js"></script>
@endpush
