templates/admin/person/persons_balance.html.twig line 1

Open in your IDE?
  1. {% extends 'admin/base.html.twig' %}
  2. {% block title %}Баланс средств{% endblock %}
  3. {% block content %}
  4.     <h1 class="h3 mb-2 text-gray-800">Баланс средств</h1>
  5.     <div class="card shadow mb-4 mt-4">
  6.         <div class="card-header py-3">
  7.             <h6 class="m-0 font-weight-bold text-primary">Баланс средств</h6>
  8.         </div>
  9.         <div class="card-body">
  10.             <div id="persons-balance-table-filters" class="mb-4 d-flex align-items-center" style="gap: 20px; flex-wrap: wrap;">
  11.                 {% include 'components/table_filter.html.twig' with { options: {
  12.                     labelText: 'Уровень учащегося',
  13.                     dropdownIdPrefix: 'level',
  14.                     allItemsButtonText: 'Все уровни',
  15.                 }} %}
  16.                 {% include 'components/table_filter.html.twig' with { options: {
  17.                     labelText: 'Статус учащегося',
  18.                     dropdownIdPrefix: 'status',
  19.                     allItemsButtonText: 'Все статусы',
  20.                 }} %}
  21.             </div>
  22.             <div class="table-responsive">
  23.                 {% set financeCategories = financeCategoryService.getAllWithIdKeys() %}
  24.                 {% set hasWithoutFinanceCategory = false %}
  25.                 {% for item in persons %}
  26.                     {% if item.balance[-1] is defined %}
  27.                         {% set hasWithoutFinanceCategory = true %}
  28.                     {% endif %}
  29.                 {% endfor %}
  30.                 <table class="table table-bordered" id="persons-balance-table">
  31.                     <thead>
  32.                     <tr>
  33.                         <th data-table-type="num">Номер п/п</th>
  34.                         <th>Имя</th>
  35.                         <th data-table-dropdown-id="levelDropdown"
  36.                             data-table-badge-id="levelBadge"
  37.                             data-table-dropdown-text-for-all="Все уровни">Уровень учащегося</th>
  38.                         <th data-export-exclude-col>Статус учащегося</th>
  39.                         <th data-table-hide-col
  40.                             data-table-dropdown-id="statusDropdown"
  41.                             data-table-badge-id="statusBadge"
  42.                             data-table-dropdown-text-for-all="Все статусы">Статус учащегося (текст)</th>
  43.                         {% for id, fc in financeCategories %}
  44.                             <th data-table-type="num">{{ fc.name }}</th>
  45.                         {% endfor %}
  46.                         {% if hasWithoutFinanceCategory %}
  47.                             <th data-table-type="num">Без статьи финансов</th>
  48.                         {% endif %}
  49.                     </tr>
  50.                     </thead>
  51.                     <tbody>
  52.                     {% for item in persons %}
  53.                         {% set student = item.student %}
  54.                         <tr>
  55.                             <td>{{ loop.index }}</td>
  56.                             <td>{{ getFirstLastNameWithOld(item, false, true) }}</td>
  57.                             <td>{{ student ? student.level : '–' }}</td>
  58.                             <td>
  59.                                 <span class="btn btn-{{ item.virtualStudentStatusCssClass }} btn-icon-split w-max cursor-default">
  60.                                     <span class="icon text-white-50"><i class="fas fa-tag"></i></span>
  61.                                     <span class="text">{{ item.virtualStudentStatusText }}</span>
  62.                                 </span>
  63.                             </td>
  64.                             <td>{{ item.virtualStudentStatusText }}</td>
  65.                             {% for fcId, fc in financeCategories %}
  66.                                 <td>{{ item.balance[fcId]|default(0) }}</td>
  67.                             {% endfor %}
  68.                             {% if hasWithoutFinanceCategory %}
  69.                                 {% if item.balance[-1] is defined %}
  70.                                     <td>{{ item.balance[-1] }}</td>
  71.                                 {% else %}
  72.                                     <td>0</td>
  73.                                 {% endif %}
  74.                             {% endif %}
  75.                         </tr>
  76.                     {% endfor %}
  77.                     </tbody>
  78.                 </table>
  79.             </div>
  80.         </div>
  81.     </div>
  82. {% endblock %}
  83. {% block addJs %}
  84.     <script>
  85.         let table = new CustomDataTable('#persons-balance-table', {
  86.             drawRowNumbersForColIndex: 0,
  87.         });
  88.         table.initDataTable();
  89.     </script>
  90. {% endblock %}