{% extends 'layouts/app.twig' %} {% import 'macros/base.twig' as m %} {% import 'macros/form.twig' as f %} {% block title %}{{ news and news.id ? __('news.edit.edit') : __('news.edit.add') }}{% endblock %} {% block content %}

{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }} {{ block('title') }}

{% include 'layouts/parts/messages.twig' %} {% if news and news.id %}

{{ m.icon('clock') }} {{ news.updated_at.format(__('general.datetime')) }} {% if news.updated_at != news.created_at %}  {{ __('news.updated') }}
{{ m.icon('clock') }} {{ news.created_at.format(__('general.datetime')) }} {% endif %}  {{ m.user(news.user) }}

{% endif %}
{{ csrf() }}
{{ f.input( 'title', __('news.edit.subject'), { 'required': true, 'value': news ? news.title : '', } ) }}
{{ f.checkbox('is_meeting', __('news.edit.is_meeting'), { 'checked': is_meeting, }) }} {{ f.checkbox('is_pinned', __('news.edit.is_pinned'), { 'checked': is_pinned, }) }} {% if can('news.highlight') %} {{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), { 'checked': is_highlighted, }) }} {% endif %}
{{ f.textarea('text', __('news.edit.message'), { 'required': true, 'rows': 10, 'value': news ? news.text : '', }) }}

{{ m.info(__('news.edit.hint')) }}

{{ f.submit(__('form.save'), {'icon_left': 'save'}) }} {{ f.submit(m.icon('eye'), {'name': 'preview', 'btn_type': 'info', 'title': __('form.preview')}) }} {% if news and news.id %} {{ f.delete(__('form.delete'), {'confirm_title': __('news.delete.title', [news.title[:40]|e])}) }} {% endif %} {{ f.checkbox('send_notification', __('form.send_notification', [notifications_count]), {'checked': send_notification, 'class': 'ms-2 form-check-inline'}) }}
{% if news %}

{{ __('form.preview') }}

{% if news.is_meeting %}{{ __('news.is_meeting') }}{% endif %} {{ news.title }}
{{ news.text|markdown }}
{% endif %}
{% endblock %}