Skip to content

Commit 3f230ed

Browse files
Simplify ticket page on helpdesk
1 parent a503e22 commit 3f230ed

File tree

8 files changed

+131
-117
lines changed

8 files changed

+131
-117
lines changed

css/includes/components/itilobject/_layout.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
}
169169
}
170170

171-
.horizontal-layout {
171+
.central.horizontal-layout {
172172
.itil-object {
173173
@include media-breakpoint-up(lg) {
174174
height: calc(100vh - 257px);

phpunit/functional/TicketTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,20 +1691,20 @@ public function testFormPostOnly()
16911691

16921692
$this->checkFormOutput(
16931693
$ticket,
1694-
$name = false,
1695-
$textarea = true,
1696-
$priority = false,
1697-
$save = true,
1698-
$assign = false,
1699-
$openDate = false,
1700-
$timeOwnResolve = false,
1701-
$type = false,
1702-
$status = false,
1703-
$urgency = true,
1704-
$impact = false,
1705-
$category = true,
1706-
$requestSource = false,
1707-
$location = false
1694+
name: false,
1695+
textarea: true,
1696+
priority: false,
1697+
save: false,
1698+
assign: false,
1699+
openDate: false,
1700+
timeOwnResolve: false,
1701+
type: false,
1702+
status: false,
1703+
urgency: false,
1704+
impact: false,
1705+
category: false,
1706+
requestSource: false,
1707+
location: false,
17081708
);
17091709

17101710
$uid = getItemByTypeName('User', TU_USER, true);

src/Ticket.php

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -831,35 +831,29 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
831831

832832
public function defineTabs($options = [])
833833
{
834-
$ong = [];
835-
$this->addDefaultFormTab($ong);
836-
$this->addStandardTab(__CLASS__, $ong, $options);
837-
$this->addStandardTab('TicketValidation', $ong, $options);
838-
$this->addStandardTab('KnowbaseItem_Item', $ong, $options);
839-
$this->addStandardTab('Item_Ticket', $ong, $options);
840-
841-
if ($this->hasImpactTab()) {
842-
$this->addStandardTab('Impact', $ong, $options);
843-
}
844-
845-
$this->addStandardTab('TicketCost', $ong, $options);
846-
$this->addStandardTab('Itil_Project', $ong, $options);
847-
$this->addStandardTab('ProjectTask_Ticket', $ong, $options);
848-
$this->addStandardTab('Problem_Ticket', $ong, $options);
849-
$this->addStandardTab('Change_Ticket', $ong, $options);
834+
$tabs = [];
835+
$this->addDefaultFormTab($tabs);
850836

851837
if (Session::getCurrentInterface() == 'central') {
852-
$this->addStandardTab(Ticket_Contract::class, $ong, $options);
853-
}
838+
$this->addStandardTab(__CLASS__, $tabs, $options);
839+
$this->addStandardTab('TicketValidation', $tabs, $options);
840+
$this->addStandardTab('KnowbaseItem_Item', $tabs, $options);
841+
$this->addStandardTab('Item_Ticket', $tabs, $options);
854842

855-
if (
856-
Entity::getAnonymizeConfig($this->getEntityID()) == Entity::ANONYMIZE_DISABLED
857-
|| Session::getCurrentInterface() == 'central'
858-
) {
859-
$this->addStandardTab('Log', $ong, $options);
843+
if ($this->hasImpactTab()) {
844+
$this->addStandardTab('Impact', $tabs, $options);
845+
}
846+
847+
$this->addStandardTab('TicketCost', $tabs, $options);
848+
$this->addStandardTab('Itil_Project', $tabs, $options);
849+
$this->addStandardTab('ProjectTask_Ticket', $tabs, $options);
850+
$this->addStandardTab('Problem_Ticket', $tabs, $options);
851+
$this->addStandardTab('Change_Ticket', $tabs, $options);
852+
$this->addStandardTab(Ticket_Contract::class, $tabs, $options);
853+
$this->addStandardTab('Log', $tabs, $options);
860854
}
861855

862-
return $ong;
856+
return $tabs;
863857
}
864858

865859

templates/components/itilobject/footer.html.twig

Lines changed: 80 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# ---------------------------------------------------------------------
3232
#}
3333

34+
{% set is_helpdesk = get_current_interface() == 'helpdesk' %}
3435
{% set timeline_btns_cls = left_regular_cls %}
3536
{% set form_btns_cls = is_expanded ? right_expanded_cls : "col-lg" %}
3637
{% set timeline_btn_layout = session('glpitimeline_action_btn_layout') %}
@@ -43,7 +44,7 @@
4344

4445
<div class="mx-n2 mb-n2 itil-footer itil-footer p-0 border-top" id="itil-footer">
4546
<div class="buttons-bar d-flex py-2">
46-
<div class="col {{ timeline_btns_cls }} ps-3 timeline-buttons d-flex">
47+
<div class="col {{ not is_helpdesk ? timeline_btns_cls : '' }} ps-3 timeline-buttons d-flex">
4748
{% if not item.isNewItem() %}
4849
{% set main_actions_itemtypes = timeline_itemtypes|filter((v, k) => v.hide_in_menu is not defined or v.hide_in_menu != true) %}
4950

@@ -58,7 +59,7 @@
5859
<div class="main-actions" style="display:inline-flex">
5960
{% endif %}
6061
<button
61-
class="btn btn-primary answer-action mb-2 {{ default_action != "answer" ? "action-" ~ default_action : "" }}"
62+
class="btn btn-primary answer-action {{ default_action != "answer" ? "action-" ~ default_action : "" }}"
6263
data-bs-toggle="collapse"
6364
data-bs-target="#new-{{ default_action_data.class }}-block"
6465
>
@@ -70,7 +71,7 @@
7071
{% if timeline_btn_layout == constant('Config::TIMELINE_ACTION_BTN_SPLITTED') %}
7172
{% for action, timeline_itemtype in main_actions_itemtypes %}
7273
{% if loop.index0 > 0 %}
73-
<button class="ms-2 mb-2 btn btn-primary answer-action action-{{ action }}" data-bs-toggle="collapse" data-bs-target="#new-{{ timeline_itemtype.class }}-block">
74+
<button class="ms-2 btn btn-primary answer-action action-{{ action }}" data-bs-toggle="collapse" data-bs-target="#new-{{ timeline_itemtype.class }}-block">
7475
<i class="{{ timeline_itemtype.icon }}"></i>
7576
<span>{{ timeline_itemtype.short_label }}</span>
7677
</button>
@@ -79,7 +80,7 @@
7980
{% else %}
8081
<button
8182
type="button"
82-
class="btn btn-primary dropdown-toggle dropdown-toggle-split mb-2 {{ default_action != "answer" ? "action-" ~ default_action : "" }}"
83+
class="btn btn-primary dropdown-toggle dropdown-toggle-split {{ default_action != "answer" ? "action-" ~ default_action : "" }}"
8384
data-bs-toggle="dropdown"
8485
aria-expanded="false"
8586
>
@@ -104,74 +105,89 @@
104105
<ul class="legacy-timeline-actions">
105106
{{ legacy_timeline_actions|default('')|raw }}
106107
</ul>
107-
{{ include('components/itilobject/timeline/filter_timeline.html.twig') }}
108+
109+
<div class="ms-auto"></div>
110+
111+
{% if item.canDeleteItem() %}
112+
<button class="btn btn-ghost-danger" type="submit" name="delete" form="itil-form">
113+
<i class="ti ti-trash me-1"></i>
114+
<span>{{ __("Cancel ticket") }}</span>
115+
</button>
116+
{% endif %}
117+
118+
{% if not is_helpdesk %}
119+
{{ include('components/itilobject/timeline/filter_timeline.html.twig') }}
120+
{% endif %}
108121
{% endif %}
109122
</div>
110123

111-
<div class="form-buttons {{ form_btns_cls }} d-flex justify-content-between ms-auto ms-lg-0 my-n2 py-2 pe-3 card-footer border-top-0 position-relative">
112-
<span class="d-none d-lg-block ms-n3"
113-
data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Toggle panels width') }}">
114-
<button type="button" class="switch-panel-width btn btn-icon btn-ghost-secondary px-0">
115-
<i class="{{ switch_btn_cls }}"></i>
116-
</button>
117-
<button type="button" class="collapse-panel btn btn-icon btn-ghost-secondary px-0 mr-1">
118-
<i class="ti ti-caret-right-filled"></i>
119-
</button>
120-
</span>
121-
122-
<span>
123-
{% if item.isNewItem() %}
124-
<button class="btn btn-primary" type="submit" name="add" form="itil-form"
125-
title="{{ _x('button', 'Add') }}">
126-
<i class="ti ti-plus"></i>
127-
<span class="d-none d-lg-block">{{ _x('button', 'Add') }}</span>
128-
</button>
129-
{% else %}
130-
131-
<div class="btn-group" role="group" id="right-actions">
132-
{% set is_locked = params['locked'] is defined and params['locked'] %}
133-
{% set display_save_btn = not is_locked and (canupdate or can_requester or canpriority or canassign or canassigntome) %}
134-
{% if display_save_btn %}
135-
<button class="btn btn-primary" type="submit" name="update" form="itil-form"
136-
title="{{ _x('button', 'Save') }}">
137-
<i class="ti ti-device-floppy"></i>
138-
<span class="d-none d-xl-block">{{ _x('button', 'Save') }}</span>
139-
</button>
140-
{% endif %}
141-
142-
{% if item.canDeleteItem() %}
143-
{% if item.isDeleted() %}
144-
<button class="btn btn-outline-secondary" type="submit" name="restore" form="itil-form"
145-
title="{{ _x('button', 'Restore') }}">
146-
<i class="ti ti-trash-off"></i>
147-
<span class="d-none d-lg-block">{{ _x('button', 'Restore') }}</span>
124+
{% if not is_helpdesk %}
125+
<div class="form-buttons {{ form_btns_cls }} d-flex justify-content-between ms-auto ms-lg-0 my-n2 py-2 pe-3 card-footer border-top-0 position-relative">
126+
<span class="d-none d-lg-block ms-n3"
127+
data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Toggle panels width') }}">
128+
<button type="button" class="switch-panel-width btn btn-icon btn-ghost-secondary px-0">
129+
<i class="{{ switch_btn_cls }}"></i>
130+
</button>
131+
<button type="button" class="collapse-panel btn btn-icon btn-ghost-secondary px-0 mr-1">
132+
<i class="ti ti-caret-right-filled"></i>
133+
</button>
134+
</span>
135+
136+
<span>
137+
{% if item.isNewItem() %}
138+
<button class="btn btn-primary" type="submit" name="add" form="itil-form"
139+
title="{{ _x('button', 'Add') }}">
140+
<i class="ti ti-plus"></i>
141+
<span class="d-none d-lg-block">{{ _x('button', 'Add') }}</span>
142+
</button>
143+
{% else %}
144+
145+
<div class="btn-group" role="group" id="right-actions">
146+
{% set is_locked = params['locked'] is defined and params['locked'] %}
147+
{% set display_save_btn = not is_locked and (canupdate or can_requester or canpriority or canassign or canassigntome) %}
148+
{% if display_save_btn %}
149+
<button class="btn btn-primary" type="submit" name="update" form="itil-form"
150+
title="{{ _x('button', 'Save') }}">
151+
<i class="ti ti-device-floppy"></i>
152+
<span class="d-none d-xl-block">{{ _x('button', 'Save') }}</span>
148153
</button>
154+
{% endif %}
149155

150-
<button class="btn btn-outline-danger" type="submit" name="purge" form="itil-form"
151-
title="{{ _x('button', 'Delete permanently') }}"
152-
onclick="return confirm('{{ __('Confirm the final deletion?') }}');">
153-
<i class="ti ti-trash"></i>
154-
<span class="d-none d-lg-block">{{ _x('button', 'Delete permanently') }}</span>
155-
</button>
156-
{% else %}
157-
<button class="btn btn-outline-danger" type="submit" name="delete" form="itil-form"
158-
title="{{ _x('button', 'Put in trashbin') }}"
159-
data-bs-toggle="tooltip" data-bs-placement="top">
160-
<i class="ti ti-trash"></i>
161-
</button>
156+
{% if item.canDeleteItem() %}
157+
{% if item.isDeleted() %}
158+
<button class="btn btn-outline-secondary" type="submit" name="restore" form="itil-form"
159+
title="{{ _x('button', 'Restore') }}">
160+
<i class="ti ti-trash-off"></i>
161+
<span class="d-none d-lg-block">{{ _x('button', 'Restore') }}</span>
162+
</button>
163+
164+
<button class="btn btn-outline-danger" type="submit" name="purge" form="itil-form"
165+
title="{{ _x('button', 'Delete permanently') }}"
166+
onclick="return confirm('{{ __('Confirm the final deletion?') }}');">
167+
<i class="ti ti-trash"></i>
168+
<span class="d-none d-lg-block">{{ _x('button', 'Delete permanently') }}</span>
169+
</button>
170+
{% else %}
171+
<button class="btn btn-outline-danger" type="submit" name="delete" form="itil-form"
172+
title="{{ _x('button', 'Put in trashbin') }}"
173+
data-bs-toggle="tooltip" data-bs-placement="top">
174+
<i class="ti ti-trash"></i>
175+
</button>
176+
{% endif %}
162177
{% endif %}
163-
{% endif %}
164178

165-
{% if canupdate %}
166-
{{ include('components/form/single-action.html.twig', {
167-
'onlyicon': true
168-
}) }}
169-
{% endif %}
170-
</div>
179+
{% if canupdate %}
180+
{{ include('components/form/single-action.html.twig', {
181+
'onlyicon': true
182+
}) }}
183+
{% endif %}
184+
</div>
185+
186+
{% endif %}
187+
</span>
188+
</div>
189+
{% endif %}
171190

172-
{% endif %}
173-
</span>
174-
</div>
175191
</div>
176192
</div>
177193

templates/components/itilobject/layout.html.twig

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
{% set rand = random() %}
3535
{% set main_rand = rand %}
36+
{% set is_helpdesk = get_current_interface() == 'helpdesk' %}
3637

3738
{% set itil_layout = user_pref('itil_layout', true) %}
3839
{% set is_collapsed = itil_layout['collapsed'] == "true" %}
@@ -63,22 +64,24 @@
6364
<div class="row d-flex flex-column alin-items-stretch itil-object">
6465
{% set is_timeline_reversed = user_pref('timeline_order') == constant('CommonITILObject::TIMELINE_ORDER_REVERSE') %}
6566
{% set fl_direction = (item.isNewItem() or is_timeline_reversed ? 'flex-column' : 'flex-column-reverse') %}
66-
<div class="itil-left-side col-12 {{ left_side_cls }} order-last order-lg-first pt-2 pe-2 pe-lg-4 d-flex {{ fl_direction }} border-top border-4">
67+
<div class="itil-left-side col-12 {{ left_side_cls }} order-last order-lg-first pt-2 pe-2 pe-lg-4 d-flex {{ fl_direction }} border-top border-4 {{ is_helpdesk ? "w-100" : "" }}">
6768
{% if item.isNewItem() %}
6869
{{ include('components/itilobject/timeline/new_form.html.twig') }}
6970
{% else %}
7071
{{ include('components/itilobject/timeline/timeline.html.twig') }}
7172
{% endif %}
7273
</div>
73-
<div class="itil-right-side col-12 {{ right_side_cls }} mt-0 mt-lg-n1 card-footer p-0 rounded-0">
74-
{% if not item.isNewItem() %}
75-
{{ include('components/itilobject/mainform_open.html.twig') }}
76-
{% endif %}
77-
{{ include('components/itilobject/fields_panel.html.twig') }}
78-
{% if not item.isNewItem() %}
79-
{{ include('components/itilobject/mainform_close.html.twig') }}
80-
{% endif %}
81-
</div>
74+
{% if not is_helpdesk %}
75+
<div class="itil-right-side col-12 {{ right_side_cls }} mt-0 mt-lg-n1 card-footer p-0 rounded-0">
76+
{% if not item.isNewItem() %}
77+
{{ include('components/itilobject/mainform_open.html.twig') }}
78+
{% endif %}
79+
{{ include('components/itilobject/fields_panel.html.twig') }}
80+
{% if not item.isNewItem() %}
81+
{{ include('components/itilobject/mainform_close.html.twig') }}
82+
{% endif %}
83+
</div>
84+
{% endif %}
8285
</div>
8386

8487
{% if not params['template_preview'] %}

templates/components/itilobject/timeline/filter_timeline.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
}) %}
8888
{% endif %}
8989

90-
<div class="filter-timeline position-relative ms-auto">
90+
<div class="filter-timeline position-relative">
9191
<span data-bs-toggle="tooltip" data-bs-placement="top" title="{{ __('Timeline filter') }}">
9292
<button type="button"
93-
class="btn btn-icon btn-ghost-secondary open-timeline-filter-popover"
93+
class="btn btn-icon btn-ghost-secondary open-timeline-filter-popover me-2"
9494
data-bs-toggle="collapse"
9595
data-bs-target="#filter-timeline-popover"
9696
data-bs-trigger="click">

templates/components/itilobject/timeline/timeline.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
#}
3333

3434
{% set is_timeline_reversed = user_pref('timeline_order') == constant('CommonITILObject::TIMELINE_ORDER_REVERSE') %}
35+
{% set is_helpdesk = get_current_interface() == 'helpdesk' %}
3536

36-
<div class="itil-timeline d-flex flex-column align-items-start mb-auto">
37+
<div class="itil-timeline d-flex flex-column align-items-start mb-auto {{ is_helpdesk ? "px-3 py-2" : '' }}">
3738
{% if not is_timeline_reversed %}
3839
{{ include('components/itilobject/timeline/main_description.html.twig') }}
3940
{% else %}

templates/layout/parts/page_header.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{% set is_horizontal = not is_vertical %}
3838
{% set is_helpdesk = get_current_interface() == 'helpdesk' %}
3939

40-
<body class="{{ user_pref('fold_menu') and is_vertical ? 'navbar-collapsed' : '' }} {{ is_vertical ? 'vertical-layout' : 'horizontal-layout' }} {{ is_debug_active ? 'debug-active' : '' }}">
40+
<body class="{{ user_pref('fold_menu') and is_vertical ? 'navbar-collapsed' : '' }} {{ is_vertical ? 'vertical-layout' : 'horizontal-layout' }} {{ is_debug_active ? 'debug-active' : '' }} {{ is_helpdesk ? 'helpdesk' : 'central' }}">
4141
{% if call('DBConnection::isDbAvailable') and constant('SKIP_UPDATES') is defined and not call('Update::isDbUpToDate') %}
4242
<div class="banner-need-update">
4343
{{ __("You are bypassing a needed update") }}

0 commit comments

Comments
 (0)