@push('scripts') @endpush
@if(isset($id)) {{ html()->modelForm($data, 'PATCH', route('post.update', $id) )->attribute('enctype', 'multipart/form-data')->open() }} @else {{ html()->form('POST', route('post.store'))->attribute('enctype', 'multipart/form-data')->open() }} @endif

{{ $pageTitle }}

{{ html()->label(__('message.title') . ' *', 'title')->class('form-control-label') }} {{ html()->text('title')->placeholder(__('message.title'))->class('form-control')->attribute('required','required') }}
{{ html()->label(__('message.tags').' *')->class('form-control-label') }} {{ html()->select('tags_id[]', $selected_tags ?? [], isset($id) ? $data->tags_id : []) ->class('select2js form-group tags') ->multiple('multiple') ->attribute('data-placeholder', __('message.select_name', ['select' => __('message.tags')])) ->attribute('data-ajax--url', route('ajax-list', ['type' => 'tags'])) ->attribute('required', 'required') }}
{{ html()->label(__('message.category').' *')->class('form-control-label') }} {{ html()->select('category_ids[]', $selected_category ?? [], isset($id) ? $data->category_ids : []) ->class('select2js form-group tags') ->multiple('multiple') ->attribute('data-placeholder', __('message.select_name', ['select' => __('message.category')])) ->attribute('data-ajax--url', route('ajax-list', ['type' => 'category'])) ->attribute('required', 'required') }}
{{ html()->label(__('message.datetime').' *')->class('form-control-label') }} {{ html()->text('datetime', old('datetime'))->placeholder(__('message.datetime'))->class('datetimepicker form-control')->attribute('required', 'required') }}
{{ html()->label(__('message.status') . ' *', 'status')->class('form-control-label') }} {{ html()->select('status',[ 'publish' => __('message.publish'), 'draft' => __('message.draft') ], old('status'))->class('form-control select2js')->attribute('required', 'required') }}
{{ html()->label(__('message.featured'))->class('form-control-label') }}
{{ html()->radio('is_featured', old('is_featured') == 'yes' || true, 'yes')->class('form-check-input')->id('is_featured-yes') }}
{{ html()->radio('is_featured', old('is_featured') == 'no', 'no')->class('form-check-input')->id('is_featured-no') }}
@if(Module::has('Frontend') && Module::isEnabled('Frontend'))
{{ html()->label(__('frontend::message.send_mail_subscribers'))->class('form-control-label me-2') }}
{!! html()->checkbox('send_mail_to_subscribers', false, 1)->class('form-check-input')->id('send_mail_to_subscribers') !!}
@endif
{{ html()->label(__('message.description'))->class('form-control-label') }} {{ html()->textarea('description', null)->class('form-control tinymce-description')->placeholder(__('message.description')) }}
@if( isset($id) && getMediaFileExit($data, 'post_image')) @endif

{{ html()->submit( __('message.save') )->class('btn btn-md btn-primary float-end') }}
@if(isset($id)) {{ html()->closeModelForm() }} @else {{ html()->form()->close() }} @endif