Sindbad~EG File Manager

Current Path : /home/escuelai/public_html/it/marketplace/fields/templates/
Upload File :
Current File : /home/escuelai/public_html/it/marketplace/fields/templates/container_display_conditions.html.twig

{#
 # -------------------------------------------------------------------------
 # 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">
   <div class="flash-messages">
      <div class="alert alert-info">
         {{ __('The engine is used for hide block when main object meets condition')}}
      </div>
   </div>
   <div class="d-flex align-items-start mb-3">
      {% if has_fields %}
         <button class="btn btn-primary me-2"
                 type="button"
                 name="switch_add"
                 value="1"
                 data-container-id="{{ container_id }}">
            <i class="far fa-plus"></i>
            <span>{{ __('Add condition to hide block', 'fields') }}</span>
         </button>
      {% endif %}
   </div>

   {{ fields.largeTitle(_n('Condition to hide block', 'Conditions to hide block', get_plural_number(), '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>{{ __('Condition') }}</th>
                           <th>{{ __('Value') }}</th>
                           <th></th>
                        </tr>
                     </thead>
                     <tbody>
                        {% if container_display_conditions|length > 0 %}
                           {% for container_display_condition in container_display_conditions %}
                              <tr>
                                 <td>{{ container_display_condition.itemtype|itemtype_name }}</td>
                                 <td>{{ call('PluginFieldsContainerDisplayCondition::getFieldName', [container_display_condition.search_option, container_display_condition.itemtype]) }}</td>
                                 <td>{{ call('PluginFieldsContainerDisplayCondition::getConditionName', [container_display_condition.condition]) }}</td>
                                 <td>{{ call('PluginFieldsContainerDisplayCondition::getRawValue', [container_display_condition.search_option, container_display_condition.itemtype, container_display_condition.value]) }}</td>
                                 <td>
                                    <form class="d-inline" method="post" action="{{ 'PluginFieldsContainerDisplayCondition'|itemtype_form_path }}">
                                       <input type="hidden" name="id" value="{{ container_display_condition.id }}" />
                                       <input type="hidden" name="plugin_fields_containers_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') }}</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="plugin_fields_containers_id"]').val();

            glpi_ajax_dialog(
               {
                  title: __('Edit condition to hide block', 'fields'),
                  url: CFG_GLPI.root_doc + '/' + GLPI_PLUGINS_PATH.fields + '/ajax/container_display_condition.php',
                  method: 'get',
                  params: {
                      action: 'get_edit_form',
                      id: id,
                      plugin_fields_containers_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 condition to hide block', 'fields'),
                  url: CFG_GLPI.root_doc + '/' + GLPI_PLUGINS_PATH.fields + '/ajax/container_display_condition.php',
                  method: 'get',
                  params: {
                     action: 'get_add_form',
                     plugin_fields_containers_id: container_id
                  },
                  dialogclass: 'modal-xl'
               }
            );
         });
      });
   </script>
</div>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists