@extends('layouts.admin.app')

@section('title', __('trans.page.add_new'))

@section('content')
    <div class="card">

        <h5 class="card-header">
            <a href="{{ url('admin/pages') }}" class="btn rounded-pill btn-label-primary">
                <i class="ti me-2 ti-arrow-forward-up"></i> {{ __('trans.page.title') }}
            </a>
            @yield('title')
        </h5>

        <div class="card-body">

            <form action="{{ route('pages.store') }}" method="POST">
                @csrf
                <div class="row">

                    <div class="col-md-12 mb-3">
                        <label class="form-label">{{ __('trans.page.name') }} <b class="text-danger">*</b></label>
                        <input type="text" class="form-control" required name="title" value="{{ old('title') }}"
                            placeholder="{{ __('trans.page.name') }}" />
                    </div>


                    <div class="col-md-12 mb-3">
                        <label class="form-label">{{ __('trans.page.slug') }} <b class="text-danger">*</b></label>
                        <input type="text" class="form-control" required name="slug" value="{{ old('slug') }}"
                            placeholder="{{ __('trans.page.slug') }}" />
                    </div>

                    <div class="col-md-12 mb-3">
                        <label class="form-label">{{ __('trans.page.status') }}</label>
                        <select name="status" class="form-select" required>
                            <option value="active" @selected(old('status') == 'active')>Active</option>
                            <option value="not_active" @selected(old('status') == 'not_active')>Not Active</option>
                        </select>
                    </div>

                    <div class="col-md-12 mb-3">
                        <label class="form-label">{{ __('trans.page.content') }} <b class="text-danger">*</b></label>
                        <textarea name="content" class="content" rows="7" placeholder="{{ __('trans.page.content') }}">{{ old('content') }}</textarea>
                    </div>

                    <div class="col-md-12 mt-3">
                        <button class="btn btn-primary btn-create w-100">{{ __('trans.save') }}</button>
                    </div>
                </div>

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


@section('js')
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/6.8.5/tinymce.min.js" referrerpolicy="origin"></script>
    <script src="{{ asset('admin/tinymce_config.js') }}"></script>
@endsection
