|
39 | 39 | {% endif %}
|
40 | 40 |
|
41 | 41 | {% set users = get_current_user().getUsersFromDelegatedGroups() %}
|
42 |
| - {% set user_dropdown_html %} |
43 |
| - {{ fields.dropdownArrayField( |
44 |
| - 'delegation_users_id', |
45 |
| - selected_user.getID(), |
46 |
| - users, |
47 |
| - '', |
48 |
| - { |
49 |
| - 'no_label' : true, |
50 |
| - 'width' : 'auto', |
51 |
| - 'field_class' : '', |
52 |
| - 'mb' : '', |
53 |
| - 'aria_label' : __('Select the user to delegate'), |
54 |
| - 'wrapper_class' : 'd-inline-block', |
55 |
| - } |
56 |
| - ) }} |
57 |
| - {% endset %} |
| 42 | + {% if users|length > 1 %} |
| 43 | + {% set user_dropdown_html %} |
| 44 | + {{ fields.dropdownArrayField( |
| 45 | + 'delegation_users_id', |
| 46 | + selected_user.getID(), |
| 47 | + users, |
| 48 | + '', |
| 49 | + { |
| 50 | + 'no_label' : true, |
| 51 | + 'width' : 'auto', |
| 52 | + 'field_class' : '', |
| 53 | + 'mb' : '', |
| 54 | + 'aria_label' : __('Select the user to delegate'), |
| 55 | + 'wrapper_class' : 'd-inline-block', |
| 56 | + } |
| 57 | + ) }} |
| 58 | + {% endset %} |
58 | 59 |
|
59 |
| - {% set notification_part_html %} |
60 |
| - <span class="input-group d-inline-flex w-auto"> |
61 |
| - {% if selected_user.getID() == get_current_user().getID() %} |
62 |
| - {{ fields.dropdownArrayField( |
63 |
| - 'delegation_use_notification', |
64 |
| - '1', |
65 |
| - { |
66 |
| - '0': __('I don\'t want'), |
67 |
| - '1': __('I want'), |
68 |
| - }, |
69 |
| - '', |
70 |
| - { |
71 |
| - 'no_label' : true, |
72 |
| - 'width' : 'auto', |
73 |
| - 'field_class' : '', |
74 |
| - 'mb' : '', |
75 |
| - 'aria_label' : __('Do you want to be notified of future events of this ticket'), |
76 |
| - 'wrapper_class' : 'd-inline-block', |
77 |
| - } |
78 |
| - ) }} |
79 |
| - {% else %} |
80 |
| - {{ fields.dropdownArrayField( |
81 |
| - 'delegation_use_notification', |
82 |
| - '1', |
83 |
| - { |
84 |
| - '0': __('He doesn\'t want'), |
85 |
| - '1': __('He wants'), |
86 |
| - }, |
87 |
| - '', |
88 |
| - { |
89 |
| - 'no_label' : true, |
90 |
| - 'width' : 'auto', |
91 |
| - 'field_class' : '', |
92 |
| - 'mb' : '', |
93 |
| - 'aria_label' : __('Do you want to be notified of future events of this ticket'), |
94 |
| - 'wrapper_class' : 'd-inline-block', |
95 |
| - } |
96 |
| - ) }} |
97 |
| - {% endif %} |
98 |
| - <button |
99 |
| - type="button" |
100 |
| - class="btn btn-icon rounded-end" |
101 |
| - data-bs-toggle="dropdown" |
102 |
| - data-bs-auto-close="outside" |
103 |
| - aria-expanded="false" |
104 |
| - aria-label="{{ __('Address to send the notification') }}" |
105 |
| - > |
106 |
| - <i class="ti ti-mail-cog"></i> |
107 |
| - </button> |
108 |
| - <div class="dropdown-menu p-3 pt-1 rounded-3" style="width: 250px"> |
109 |
| - {{ fields.textField( |
110 |
| - 'delegation_alternative_email', |
111 |
| - selected_user.getDefaultEmail(), |
112 |
| - __('Address to send the notification'), |
113 |
| - { |
114 |
| - 'is_horizontal': false, |
115 |
| - 'field_class' : '', |
116 |
| - 'mb' : '', |
117 |
| - } |
118 |
| - ) }} |
119 |
| - </div> |
120 |
| - </span> |
121 |
| - {% endset %} |
| 60 | + {% if selected_user.getID() != get_current_user().getID() %} |
| 61 | + {% set notification_part_html %} |
| 62 | + <span class="input-group d-inline-flex w-auto"> |
| 63 | + {{ fields.dropdownArrayField( |
| 64 | + 'delegation_use_notification', |
| 65 | + '1', |
| 66 | + { |
| 67 | + '0': __('He doesn\'t want'), |
| 68 | + '1': __('He wants'), |
| 69 | + }, |
| 70 | + '', |
| 71 | + { |
| 72 | + 'no_label' : true, |
| 73 | + 'width' : 'auto', |
| 74 | + 'field_class' : '', |
| 75 | + 'mb' : '', |
| 76 | + 'aria_label' : __('Do you want to be notified of future events of this ticket'), |
| 77 | + 'wrapper_class' : 'd-inline-block', |
| 78 | + } |
| 79 | + ) }} |
| 80 | + <button |
| 81 | + type="button" |
| 82 | + class="btn btn-icon rounded-end" |
| 83 | + data-bs-toggle="dropdown" |
| 84 | + data-bs-auto-close="outside" |
| 85 | + aria-expanded="false" |
| 86 | + aria-label="{{ __('Address to send the notification') }}" |
| 87 | + > |
| 88 | + <i class="ti ti-mail-cog"></i> |
| 89 | + </button> |
| 90 | + <div class="dropdown-menu p-3 pt-1 rounded-3" style="width: 250px"> |
| 91 | + {{ fields.textField( |
| 92 | + 'delegation_alternative_email', |
| 93 | + selected_user.getDefaultEmail(), |
| 94 | + __('Address to send the notification'), |
| 95 | + { |
| 96 | + 'is_horizontal': false, |
| 97 | + 'field_class' : '', |
| 98 | + 'mb' : '', |
| 99 | + } |
| 100 | + ) }} |
| 101 | + </div> |
| 102 | + </span> |
| 103 | + {% endset %} |
122 | 104 |
|
123 |
| - <div class="alert d-flex align-items-center justify-content-start flex-wrap"> |
124 |
| - {% if users|length > 1 %} |
125 |
| - {{ __('This ticket is for %1$s and %2$s to be notified of future events of this ticket.')|format( |
126 |
| - '<span class="mx-2">' ~ user_dropdown_html|raw ~ '</span>', |
127 |
| - '<span class="mx-2">' ~ notification_part_html|raw ~ '</span>' |
128 |
| - )|raw }} |
| 105 | + <div class="alert d-flex align-items-center justify-content-start flex-wrap"> |
| 106 | + {{ __('This ticket is for %1$s and %2$s to be notified of future events of this ticket.')|format( |
| 107 | + '<span class="mx-2">' ~ user_dropdown_html|raw ~ '</span>', |
| 108 | + '<span class="mx-2">' ~ notification_part_html|raw ~ '</span>' |
| 109 | + )|raw }} |
| 110 | + </div> |
129 | 111 | {% else %}
|
130 |
| - {{ __('%1$s to be notified of future events of this ticket.')|format( |
131 |
| - '<span class="mx-2">' ~ notification_part_html|raw ~ '</span>' |
132 |
| - )|raw }} |
| 112 | + <div class="alert d-flex align-items-center justify-content-start flex-wrap"> |
| 113 | + {{ __('This ticket is for %1$s')|format( |
| 114 | + '<span class="mx-2">' ~ user_dropdown_html|raw ~ '</span>' |
| 115 | + )|raw }} |
| 116 | + </div> |
133 | 117 | {% endif %}
|
134 |
| - </div> |
| 118 | + {% endif %} |
135 | 119 | {% endif %}
|
0 commit comments