<form method="post" enctype="multipart/form-data">

	<!-- Page header -->
    {include file="components/group-buttons.tpl" url="{$adminUrl}/faqs?page={if !empty($page)}{$page}{/if}{$buildQueryString}"}

    {capture name="breadcrumb"}
		<a href="{$adminUrl}/faqs" class="breadcrumb-item">{$title}</a>
		<span class="breadcrumb-item active">{general:add}</span>
    {/capture}

    {capture name="showBy"}{/capture}

    {include file="components/page-header.tpl" buttons=$smarty.capture.buttons breadcrumb=$smarty.capture.breadcrumb showBy=$smarty.capture.showBy}
	<!-- /page header -->

    <div class="content">
        <div class="row"> 
            <div class="col-md-12">

    		    <div class="card border shadow-sm">
			        <div class="card-header d-flex flex-wrap">
				        <h6 class="mb-0">{general:card:general}</h6>
				        <div class="d-inline-flex ms-auto">
					        <a class="text-body" data-card-action="collapse"><i class="ph-caret-down"></i></a>
				        </div>
			        </div>
			        <div class="collapse show">
	                    <div class="card-body">
	                        <div class="row">
	                            <div class="col-md-6">
	                                <div class="form-group mb-3">
	                                    <label class="form-label is-visible {if isset($errors.question)}text-danger{/if}">{sliders:general:title}</label>
	                                    <input type="text" class="form-control" name="faq[question]" value="{if isset($faq.question)}{$faq.question}{/if}" />
	                                </div>
	                            </div>
                                {* field status *}
                                {include file="components/fields/select.tpl" col="col-md-6" id="status" title="{general:status}" field="faq[status]" array=$statuses selected=$faq.status|default:'visible' class="form-group mb-3"}
                                {* /field status *}
	                        </div>
	                    </div>
			        </div>
    		    </div>
	            <div class="card border shadow-sm">
		            <div class="card-header d-flex flex-wrap">
			            <h6 class="mb-0">{general:card:description}</h6>
			            <div class="d-inline-flex ms-auto">
				            <a class="text-body" data-card-action="collapse"><i class="ph-caret-down"></i></a>
			            </div>
		            </div>
		            <div class="collapse show">
			            <div class="card-body flex-column flex-md-row m-0 p-0">
				            <textarea id="description" name="faq[answer]" class="description">{if isset($faq.answer)}{$faq.answer}{/if}</textarea>
			            </div>
		            </div>
	            </div>
            </div>

	        <div class="col-md-12 text-center">
                {if isset($faq.faqId)}<input type="hidden" class="form-control" id="id" name="id" value="{$faq.faqId|default:''}">{/if}
                {$smarty.capture.buttons nofilter}
	        </div>
        </div>
    </div>
</form>

{* Подключаем Tiny MCE *}
{include file='tinymce_init.tpl'}

<script>
    $(document).ready(function () {
        {if isset($messages.saved)} new Noty({ text: 'Вопрос сохранен', type: 'success' }).show(); {/if}
        {if isset($errors.not_saved)} new Noty({ text: 'Вопрос не сохранен', type: 'error', timeout: 1500 }).show(); {/if}

        {if isset($errors.question)} new Noty({ text: '{sliders:errors:1}', type: 'error' }).show(); {/if}

    });
</script>
