engelsystem/resources/views/pages/faq/edit.twig

79 lines
2.8 KiB
Twig

{% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ faq and faq.id ? __('faq.edit') : __('faq.add') }}{% endblock %}
{% block content %}
<div class="container">
<h1>
{{ m.button(m.icon('chevron-left'), url('/faq'), {'size': 'sm', 'title': __('general.back')}) }}
{{ block('title') }}
</h1>
{% include 'layouts/parts/messages.twig' %}
{% if faq and faq.id %}
<div class="row">
<div class="col-md-6">
<p>
{{ m.icon('clock') }} {{ faq.updated_at.format(__('general.datetime')) }}
{% if faq.updated_at != faq.created_at %}
&emsp;{{ __('form.updated') }}
<br>
{{ m.icon('clock') }} {{ faq.created_at.format(__('general.datetime')) }}
{% endif %}
</p>
</div>
</div>
{% endif %}
<form action="" enctype="multipart/form-data" method="post">
{{ csrf() }}
<div class="row mb-4">
<div class="col-md-12">
{{ f.input('question', __('faq.question'), {
'required': true,
'value': faq ? faq.question : '',
}) }}
</div>
<div class="col-md-12">
{{ f.textarea('text', __('faq.message'), {
'required': true,
'rows': 10,
'value': faq ? faq.text : '',
}) }}
{{ f.submit(__('form.save'), {'icon_left': 'save'}) }}
{{ f.submit(m.icon('eye'), {'name': 'preview', 'btn_type': 'info', 'title': __('form.preview')}) }}
{% if faq and faq.id %}
{{ f.delete(__('form.delete'), {'confirm_title': __('faq.delete.title', [faq.question[:40]|e])})}}
{% endif %}
</div>
</div>
{% if faq %}
<div class="row">
<div class="col-md-12">
<h2>{{ __('form.preview') }}</h2>
<div class="card {{ m.type_bg_class() }}">
<div class="card-header">
{{ faq.question }}
</div>
<div class="card-body bg-body">
{{ faq.text|markdown }}
</div>
</div>
</div>
</div>
{% endif %}
</form>
</div>
{% endblock %}