Sindbad~EG File Manager
{#
# -------------------------------------------------------------------------
# Fields plugin for GLPI
# -------------------------------------------------------------------------
#
# LICENSE
#
# This file is part of Fields.
#
# Fields 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 2 of the License, or
# (at your option) any later version.
#
# Fields 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 Fields. If not, see <http://www.gnu.org/licenses/>.
# -------------------------------------------------------------------------
# @copyright Copyright (C) 2013-2022 by Fields plugin team.
# @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
# @link https://github.com/pluginsGLPI/fields
# -------------------------------------------------------------------------
#}
{% import 'components/form/fields_macros.html.twig' as fields %}
{% set rand = random() %}
<div id="container{{ rand }}" class="asset {{ bg }}">
{% if has_fields %}
<div class="d-flex align-items-start mb-3">
<button class="btn btn-primary me-2"
type="button"
name="switch_add"
data-container-id="{{ container_id }}">
<i class="far fa-plus"></i>
<span>{{ __('Add new status override', 'fields') }}</span>
</button>
</div>
{% endif %}
{{ fields.largeTitle(__('Status overrides', 'fields'), '', false) }}
<div class="card-body d-flex flex-wrap">
<div class="col-12 flex-column">
<div class="d-flex flex-row flex-wrap flex-xl-nowrap">
<div class="row flex-row align-items-start flex-grow-1">
<div class="row flex-row">
<table class="table">
<thead>
<tr>
<th>{{ __('Item type') }}</th>
<th>{{ __('Field') }}</th>
<th>{{ __('Status') }}</th>
<th>{{ __('Mandatory') }}</th>
<th>{{ __('Read only') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% if overrides|length > 0 %}
{% for override in overrides %}
<tr>
<td>{{ override.itemtype }}</td>
<td>{{ override.field_name }}</td>
<td>{{ override.status_names|join(', ') }}</td>
<td>{{ override.mandatory ? __('Yes') : __('No') }}</td>
<td>{{ override.is_readonly ? __('Yes') : __('No') }}</td>
<td>
<form class="d-inline" method="post" action="{{ 'PluginFieldsStatusOverride'|itemtype_form_path }}">
<input type="hidden" name="id" value="{{ override.id }}" />
<input type="hidden" name="container_id" value="{{ container_id }}" />
<button type="button" class="btn btn-sm btn-primary" name="edit"
title="{{ _x('button', 'Edit') }}"
data-bs-toggle="tooltip" data-bs-placement="top">
<i class="ti ti-pencil"></i>
</button>
<button type="submit" class="btn btn-sm btn-danger" name="delete"
title="{{ _x('button', 'Delete permanently') }}"
data-bs-toggle="tooltip" data-bs-placement="top">
<i class="ti ti-trash"></i>
</button>
<input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}" />
</form>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6">{{ __('No item found', 'fields') }}</td>
</tr>
{% endif %}
</tbody>
</table>
</div> {# .row #}
</div> {# .row #}
</div> {# .flex-row #}
</div>
</div> {# .card-body #}
<script>
$(document).ready(() => {
$('#container{{ rand }}').on('click', 'button[name="edit"]', (e) => {
const button = $(e.currentTarget);
const row = button.closest('tr');
const id = row.find('input[name="id"]').val();
const container_id = row.find('input[name="container_id"]').val();
glpi_ajax_dialog(
{
title: __('Edit status override', 'fields'),
url: CFG_GLPI.root_doc + '/' + GLPI_PLUGINS_PATH.fields + '/ajax/status_override.php',
method: 'get',
params: {
action: 'get_edit_form',
id: id,
container_id: container_id
},
dialogclass: 'modal-xl'
}
);
});
$('#container{{ rand }}').on('click', 'button[name="switch_add"]', (e) => {
const button = $(e.currentTarget);
const container_id = button.attr('data-container-id');
glpi_ajax_dialog(
{
title: __('Add new status override', 'fields'),
url: CFG_GLPI.root_doc + '/' + GLPI_PLUGINS_PATH.fields + '/ajax/status_override.php',
method: 'get',
params: {
action: 'get_add_form',
container_id: container_id
},
dialogclass: 'modal-xl'
}
);
});
});
</script>
</div>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists