{# # ------------------------------------------------------------------------- # Order plugin for GLPI # ------------------------------------------------------------------------- # # LICENSE # # This file is part of Order. # # Order 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. # # Order 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 Order. If not, see . # ------------------------------------------------------------------------- # @copyright Copyright (C) 2009-2023 by Order plugin team. # @copyright 2015-2025 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html # @link https://github.com/pluginsGLPI/order # ------------------------------------------------------------------------- #} {% set datatable_id = datatable_id|default('datatable' ~ random()) %} {% set showmassiveactions = showmassiveactions and canedit %} {% set table_visible = table_visible|default(false) %} {% set entries = entries|default([]) %} {% set columns = columns|default({}) %} {% set formatters = formatters|default({}) %} {% set filters = filters|default({}) %} {% set total_number = total_number|default(0) %} {% set start = start|default(0) %} {% set limit = limit|default(15) %} {% set displayed_count = displayed_count|default(0) %} {% set sort = sort|default('') %} {% set order = order|default('ASC') %} {% set countainer_name = countainer_name|default('') %} {% set nosort = nosort|default(false) %} {% if hide_and_show is defined and hide_and_show %} {% endif %} {% if form_action is defined %}
{% endif %} {% if hidden_fields is defined %} {% for field_name, field_value in hidden_fields %} {% endfor %} {% endif %} {% if total_number < 1 and filters|length == 0 %} {% if super_header is defined and super_header is not empty %} {% set super_header_label = super_header is array ? super_header['label'] : super_header %} {% if super_header_label is not empty %} {% set super_header_raw = super_header is array ? super_header['is_raw'] : false %} {% endif %} {% endif %}
{{ super_header_raw ? super_header_label|raw : super_header_label }}
{{ __('No results found') }}
{% else %} {% set total_cols = columns|length + (showmassiveactions ? 1 : 0) + (nofilter ? 0 : 1) %}
{% if showmassiveactions %}
{% do call('Html::showMassiveActions', [massiveactionparams|default([])]) %}
{% endif %} {% if super_header is defined and super_header is not empty %} {% set super_header_label = super_header is array ? super_header['label'] : super_header %} {% set super_header_raw = super_header is array ? super_header['is_raw'] : false %} {% if super_header_raw is not same as 'th_elements' %}{% endif %} {% endif %} {% if no_header is not defined or no_header == false %} {% if showmassiveactions %} {% endif %} {% for colkey, column in columns %} {% set column_label = column is array ? column['label'] : column %} {% set raw_header = column is array ? column['raw_header']|default(false) : false %} {% set sort_icon = '' %} {% set new_order = "DESC" %} {% if sort == colkey %} {% set sort_icon = order == 'ASC' ? 'ti ti-sort-ascending' : (order == 'DESC' ? 'ti ti-sort-descending' : '') %} {% set new_order = (order == 'ASC' ? 'DESC' : 'ASC') %} {% endif %} {% set sort_href = "javascript:reloadTab('start=" ~ start ~ "&limit=" ~ limit ~ "&" ~ countainer_name ~ "sort=" ~ colkey ~ "&" ~ countainer_name ~ "order=" ~ new_order ~ "&" ~ countainer_name ~ "visible=" ~ true ~ "');" %} {% endfor %} {% if nofilter is not defined or csv_url is defined %} {% endif %} {% endif %} {% if filters|length > 0 %} {% if showmassiveactions %} {% endif %} {% for colkey, colum in columns %} {% set formatter = colum['filter_formatter']|default(formatters[colkey])|default('') %} {% endfor %} {% endif %} {% if entries|length > 0 %} {% for entry in entries %} {% set row_class = entry['row_class']|default('') %} {% set itemtype = entry['itemtype']|default('') %} {% set id = entry['id']|default('') %} {% set row_massiveactions = entry['showmassiveactions']|default(showmassiveactions) %} {% if row_massiveactions %} {% endif %} {% for colkey, colum in columns %} {% endfor %} {% if not nofilter %} {% endif %} {% endfor %} {% else %} {% endif %} {% if footers is defined and footers|length > 0 %} {% for footer in footers %} {% if showmassiveactions %} {% endif %} {% for footer_col, footerval in footer %} {% endfor %} {% if nofilter is not defined %} {% endif %} {% endfor %} {% endif %}
{% endif %} {{ super_header_raw ? super_header_label|raw : super_header_label }} {% if super_header_raw is not same as 'th_elements' %}
{% if not nosort and not (column is array and column['nosort'] is defined) %} {% endif %} {{ raw_header ? column_label|raw : column_label }} {% if not nosort and not (column is array and column['nosort'] is defined) %} {% endif %} {% if nofilter is not defined %} {% endif %} {% if csv_url|length %} {{ __('Export') }} {% endif %}
{% if colum is not array or colum['no_filter']|default(false) == false %} {% if formatter == "array" and columns_values[colkey] is defined %} {% elseif formatter == "datetime" %} {{ call("Html::showDateTimeField", [ "filters[" ~ colkey ~ "]", { 'value': filters[colkey], 'display': false } ])|raw }} {% elseif formatter == "date" %} {{ call("Html::showDateField", [ "filters[" ~ colkey ~ "]", { 'value': filters[colkey], 'display': false } ])|raw }} {% elseif formatter starts with "progress" %} {% elseif formatter == 'avatar' %} {# Cannot be filtered #} {% elseif formatter == 'yesno' %} {% else %} {% endif %} {% endif %}
{% if entry['skip_ma'] is not defined or entry['skip_ma'] == false %} {% endif %} {% if colkey in entry|keys %} {% set formatter = formatters[colkey]|default('') %} {% if formatter == "maintext" %} {{ entry[colkey] }} {% elseif formatter == "longtext" %} {{ entry[colkey] }} {% elseif formatter == "duration" %} {{ entry[colkey]|formatted_duration }} {% elseif formatter == "bytesize" %} {{ call("Toolbox::getSize", [entry[colkey]])|raw }} {% elseif formatter == 'number' %} {{ entry[colkey]|formatted_number }} {% elseif formatter == 'integer' %} {{ entry[colkey] }} {% elseif formatter == "raw_html" %} {{ entry[colkey]|raw }} {% elseif formatter == "editable_price" %} {% if canedit %} {% if is_summary_table is defined and is_summary_table %} {% else %} {% endif %} {% else %} {{ entry[colkey] }} {% endif %} {% elseif formatter == "editable_discount" %} {% if canedit %} {% if is_summary_table is defined and is_summary_table %} {% else %} {% endif %} {% else %} {{ entry[colkey] }} {% endif %} {% elseif formatter == "editable_quantity" %} {% if canedit %} {% if is_summary_table is defined and is_summary_table %} {% else %} {% endif %} {% else %} {{ entry[colkey] }} {% endif %} {% elseif formatter == 'avatar' %} {# Note: Does not support anonymization currently #} {% set entry_data = entry[colkey] %} {% set avatar_size = entry_data['avatar_size'] ?? 'avatar-md' %} {% set img = entry_data['picture'] %} {% set initials = entry_data['initials'] %} {% set bg_color = img is not empty ? 'inherit' : entry_data['initials_bg'] %} {% if img is empty %} {{ initials }} {% endif %} {% elseif formatter == "badge" %} {% set entry_data = entry[colkey] %} {% set content = entry_data['content'] %} {% set color = entry_data['color'] ?? '#BBBBBB' %} {% if not (color matches '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/') %} {% set color = '#BBBBBB' %} {% endif %} {% if content is not empty %}
{{ content }}
{% endif %} {% else %} {{ entry[colkey] }} {% endif %} {% endif %}
{{ __('No results found') }}
{{ footerval|nl2br }}
{% if not nopager and total_number > 0 %}
{{ __('Showing %s to %s of %s entries', 'order')|format( start + 1, (start + displayed_count > total_number ? total_number : start + displayed_count), total_number ) }}
{{ __('Entries to show:', 'order') }} {% include 'components/dropdown/limit.html.twig' with { 'is_tab': true, 'right': true, 'additional_params': 'id=' ~ ID ~ '&start=' ~ start ~ '&' ~ countainer_name ~ 'sort=' ~ sort ~ '&' ~ countainer_name ~ 'order=' ~ order ~ '&' ~ countainer_name ~ 'visible=1' } %}
{% set nb_pages = (total_number / limit)|round(0, 'ceil') %} {% if nb_pages > 1 %}
  • {% set current_page = (start / limit)|round(0, 'floor') + 1 %} {% set start_page = max(1, current_page - 2) %} {% set end_page = min(nb_pages, current_page + 2) %} {% for i in start_page..end_page %}
  • {{ i }}
  • {% endfor %}
{% endif %}
{% endif %}
{# Inline editing functionality #} {% if canedit %} {# Summary table editing #} {% if is_summary_table is defined and is_summary_table %} {% endif %} {# Detail table editing #} {% if is_detail_table is defined and is_detail_table and edit_data|length > 0 %} {% endif %} {% endif %}
{% endif %} {% if form_action is defined %}
{% endif %} {% if hide_and_show is defined and hide_and_show %} {% endif %}