{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2026 Teclib' and contributors.
 # @licence   https://www.gnu.org/licenses/gpl-3.0.html
 #
 # ---------------------------------------------------------------------
 #
 # LICENSE
 #
 # This file is part of GLPI.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{% extends "generic_show_form.html.twig" %}
{% import 'components/form/fields_macros.html.twig' as fields %}
{% import 'components/form/basic_inputs_macros.html.twig' as inputs %}

{% block form_fields %}
   {{ inputs.hidden('notificationtemplates_id', template.fields['id']) }}
   {% set template_link %}
      <a href="{{ 'NotificationTemplate'|itemtype_form_path ~ '?id=' ~ template.fields['id'] }}">{{ template.fields['name'] }}</a>
   {% endset %}
   {{ fields.htmlField('', template_link, 'NotificationTemplate'|itemtype_name(1)) }}

   {% do call('Ajax::createIframeModalWindow', ['tags' ~ rand, path('/front/notification.tags.php?sub_type=') ~ template.fields['itemtype']]) %}
   {% set show_tags %}
      <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#tags{{ rand }}">
         {{ __('Show list of available tags') }}
      </button>
   {% endset %}
   {{ fields.htmlField('', show_tags, '') }}

   {{ fields.htmlField('', call('Dropdown::showLanguages', ['language', {
      value: item.fields['language'],
      used: used_languages,
      display_emptychoice: true,
      emptylabel: __('Default translation'),
      display: false
   }]), __('Language'), {
      full_width: true,
   }) }}

   {{ fields.nullField() }}
   {{ fields.textField('subject', item.fields['subject'], __('Subject'), {
      full_width: true,
   }) }}

   {% set text_content_label %}
      {{ __('Email text body') }}
      <br>
      {{ __('(leave the field empty for a generation from HTML)') }}
   {% endset %}
   {{ fields.textareaField('content_text', item.fields['content_text'], text_content_label, {
      full_width: true,
      rows: 15
   }) }}

   {{ fields.textareaField('content_html', item.fields['content_html']|safe_html, __('Email HTML body'), {
      full_width: true,
      rows: 15,
      enable_richtext: true,
      id: 'content' ~ rand
   }) }}
{% endblock %}
