|
| 1 | +{# |
| 2 | +# ------------------------------------------------------------------------- |
| 3 | +# Transferticketentity plugin for GLPI |
| 4 | +# ------------------------------------------------------------------------- |
| 5 | +# |
| 6 | +# LICENSE |
| 7 | +# |
| 8 | +# This file is part of Transferticketentity. |
| 9 | +# |
| 10 | +# Transferticketentity is free software; you can redistribute it and/or modify |
| 11 | +# it under the terms of the GNU General Public License as published by |
| 12 | +# the Free Software Foundation; either version 2 of the License, or |
| 13 | +# (at your option) any later version. |
| 14 | +# |
| 15 | +# Transferticketentity is distributed in the hope that it will be useful, |
| 16 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | +# GNU General Public License for more details. |
| 19 | +# |
| 20 | +# You should have received a copy of the GNU General Public License |
| 21 | +# along with Transferticketentity. If not, see <http://www.gnu.org/licenses/>. |
| 22 | +# ------------------------------------------------------------------------- |
| 23 | +# @copyright Copyright (C) 2026-2026 by Transferticketentity plugin team. |
| 24 | +# @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html |
| 25 | +# @link https://github.com/InfotelGLPI/Transferticketentity |
| 26 | +# ------------------------------------------------------------------------- |
| 27 | +#} |
| 28 | + |
| 29 | +{% import "components/form/fields_macros.html.twig" as fields %} |
| 30 | +{% set field_options = {'label_class': 'col-5', 'input_class': 'col-7', 'full_width': false} %} |
| 31 | +{{ include('components/form/header.html.twig') }} |
| 32 | + |
| 33 | +{% set rand = random() %} |
| 34 | + |
| 35 | +{% if can_edit %} |
| 36 | + <form name="form" action="{{ action }}" method="post"> |
| 37 | + <div class="card"> |
| 38 | + <div class="card-header"> |
| 39 | + <input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}"> |
| 40 | + <input type="hidden" name="id_ticket" value="{{ id_ticket }}"> |
| 41 | + <input type="hidden" name="id_user" value="{{ id_user }}"> |
| 42 | + <input type="hidden" name="entities_id" value="{{ entities_id }}"> |
| 43 | + <h3 class="card-title"> |
| 44 | + {{ __('Transfer the ticket', 'transferticketentity') }} - {{ entities_name }} |
| 45 | + </h3> |
| 46 | + </div> |
| 47 | + |
| 48 | + <div class="card-body"> |
| 49 | + <div class="card-text"> |
| 50 | + <p class='alert alert-warning'> |
| 51 | + {{ __('Once the transfer has been completed, the ticket will remain visible only if you have the required rights.', 'transferticketentity') }} |
| 52 | + </p> |
| 53 | + |
| 54 | + <div class='form-field row align-items-center col-12 col-sm-12 mb-2 tt_entity_choice'> |
| 55 | + <label class='col-form-label col-xxl-5 text-xxl-end' for='entity_choice'> |
| 56 | + {{ __("Select ticket entity to transfer","transferticketentity") }} |
| 57 | + </label> |
| 58 | + |
| 59 | + <div class='col-xxl-7 field-container'> |
| 60 | + {% do call('Dropdown::showFromArray', [ |
| 61 | + 'entity_choice', |
| 62 | + entities, |
| 63 | + { |
| 64 | + 'multiple' : false, |
| 65 | + 'value' : null, |
| 66 | + 'required' : checkMandatoryCategory, |
| 67 | + 'rand': rand |
| 68 | + } |
| 69 | + ]) %} |
| 70 | + |
| 71 | + {% do call('Ajax::updateItemOnSelectEvent', [ |
| 72 | + 'dropdown_entity_choice' ~ rand, |
| 73 | + 'show_entitygroup', |
| 74 | + config('root_doc') ~ '/' ~ root_plugin ~ '/ajax/showentitygroups.php', |
| 75 | + { |
| 76 | + 'entity_selection': '__VALUE__', |
| 77 | + 'rand': rand |
| 78 | + } |
| 79 | + ]) %} |
| 80 | + |
| 81 | + {% do call('Ajax::updateItemOnSelectEvent', [ |
| 82 | + 'dropdown_entity_choice' ~ rand, |
| 83 | + 'showmandatoryjustification', |
| 84 | + config('root_doc') ~ '/' ~ root_plugin ~ '/ajax/showentitymandatoryjustification.php', |
| 85 | + { |
| 86 | + 'entity_selection': '__VALUE__', |
| 87 | + 'rand': rand |
| 88 | + } |
| 89 | + ]) %} |
| 90 | + |
| 91 | + {% do call('Ajax::updateItemOnSelectEvent', [ |
| 92 | + 'dropdown_entity_choice' ~ rand, |
| 93 | + 'showmandatorygroup', |
| 94 | + config('root_doc') ~ '/' ~ root_plugin ~ '/ajax/showentitymandatorygroup.php', |
| 95 | + { |
| 96 | + 'entity_selection': '__VALUE__', |
| 97 | + 'rand': rand |
| 98 | + } |
| 99 | + ]) %} |
| 100 | + </div> |
| 101 | + </div> |
| 102 | + |
| 103 | + <div class='form-field row align-items-center col-12 col-sm-12 mb-2'> |
| 104 | + <label class='col-form-label col-xxl-5 text-xxl-end' for='group_choice'> |
| 105 | + {{ __("Select the group to assign", "transferticketentity") }} |
| 106 | + <span id='showmandatorygroup'> |
| 107 | + </span> |
| 108 | + </label> |
| 109 | + <div class='col-xxl-7 field-container'> |
| 110 | + <span id='show_entitygroup'> |
| 111 | + </span> |
| 112 | + </div> |
| 113 | + </div> |
| 114 | + |
| 115 | + <div class='form-field row align-items-start col-12 col-sm-12 mb-2'> |
| 116 | + <label class='col-form-label col-xxl-5 text-xxl-end' for='justification' |
| 117 | + style='vertical-align: middle;'> |
| 118 | + {{ __("Justification", "transferticketentity") }} |
| 119 | + <span id='showmandatoryjustification'> |
| 120 | + </span> |
| 121 | + </label> |
| 122 | + <div class='col-xxl-7 field-container'> |
| 123 | + {{ fields.textareaField( |
| 124 | + 'justification', |
| 125 | + null, |
| 126 | + null, |
| 127 | + { |
| 128 | + 'label_class': "", |
| 129 | + 'input_class': "col-xxl-11", |
| 130 | + 'field_class' : "col-12", |
| 131 | + } |
| 132 | + ) }} |
| 133 | + |
| 134 | + </div> |
| 135 | + </div> |
| 136 | + |
| 137 | + <p class='alert alert-warning'> |
| 138 | + {{ __("Warning, category will be reset if it does not exist in the target entity.","transferticketentity") }} |
| 139 | + </p> |
| 140 | + |
| 141 | + <div class="hr mt-3 mb-3"></div> |
| 142 | + <div class="hstack gap-1"> |
| 143 | + <div class="pe-5 ms-auto"> |
| 144 | + <button class="btn btn-primary" type="submit" name="transfertticket" value="1"> |
| 145 | + <i class="ti ti-device-floppy"></i> |
| 146 | + <span>{{ __('Confirm', 'transferticketentity') }}</span> |
| 147 | + </button> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </div> |
| 152 | + </div> |
| 153 | + </form> |
| 154 | +{% endif %} |
0 commit comments