{#
 # ---------------------------------------------------------------------
 #
 # 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 %}

{% block form_fields %}
    {% if not item.isNewItem() %}
        {{ fields.textField('name', item.fields['name'], __('Name')) }}
    {% endif %}
    {{ fields.textField('url', item.fields['url'], __('URL'), {
        full_width: true
    }) }}

    {{ fields.htmlField('', user|e('html'), __('By')) }}
    {{ fields.nullField() }}

    {{ fields.dropdownYesNo('is_active', item.fields['is_active'], __('Active')) }}
    {{ fields.dropdownTimestampField('refresh_rate', item.fields['refresh_rate'], __('Refresh rate'), {
        min: constant('HOUR_TIMESTAMP'),
        max: constant('DAY_TIMESTAMP'),
        step: constant('HOUR_TIMESTAMP'),
        display_emptychoice: false,
        toadd: [
            5 * constant('MINUTE_TIMESTAMP'),
            15 * constant('MINUTE_TIMESTAMP'),
            30 * constant('MINUTE_TIMESTAMP'),
            45 * constant('MINUTE_TIMESTAMP')
        ]
    }) }}

    {{ fields.dropdownNumberField('max_items', item.fields['max_items'], __('Number of items displayed')) }}
    {{ fields.textareaField('comment', item.fields['comment'], __('Comments')) }}

    {% set status_field %}
        {% if item.fields['have_error'] and item.fields['url'] is not url_safe %}
            {{ __('URL "%s" is not allowed by your administrator.')|format(item.fields['url']) }}
        {% else %}
            {{ item.fields['have_error'] ? __('Yes') : __('No') }}
        {% endif %}
    {% endset %}
    {{ fields.htmlField('', status_field|e('html'), __('Error retrieving RSS feed')) }}
{% endblock %}
