{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2024 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @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 . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% import 'components/form/basic_inputs_macros.html.twig' as inputs %} {% macro forceUnlockButton(item, check_unlock_right) %} {% set real_profile = session('glpilocksavedprofile')|default(null) %} {% if not check_unlock_right or (real_profile != null and real_profile[item.fields['itemtype']] b-and constant('UNLOCK')) %} {% endif %} {% endmacro %} {% if autolock_readmode %}
{{ __('Read-only mode') }}
{{ inputs.hidden('_glpi_csrf_token', csrf_token()) }} {{ inputs.submit('lockwrite', __('Edit'), 1, { class: 'btn btn-sm btn-primary ms-2', icon: 'ti ti-pencil', }) }}
{% else %} {% if not new_lock %}
{% if item.fields['users_id'] != session('glpiID') %} {% set locked_by_msg %} {% set locked_by_link %} {{ user_data['name'] }} {% endset %} {{ __('Locked: %1$s by %2$s')|e|format(item.fields['date']|relative_datetime, locked_by_link)|raw }} {% endset %} {{ fields.htmlField('', locked_by_msg, '', { no_label: true, helper: user_data['comment'], field_class: 'd-inline-block', wrapper_class: 'd-block', mb: '', }) }} {% if show_ask_unlock %}
{{ inputs.label(__('Alert me when unlocked'), 'alertMe', {}, 'form-label mb-0 me-2') }} {{ inputs.checkbox('alertMe', 0, { id: 'alertMe' }) }}
{{ _self.forceUnlockButton(item, true) }} {% endif %} {% else %} {{ __('Locked by you!') }} {{ _self.forceUnlockButton(item, false) }} {% endif %}
{% endif %} {% endif %}