index.html.twig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. {% extends base_template %}
  2. {% if params.page is empty %}
  3. {% set page = 1 %}
  4. {% else %}
  5. {% set page = params.page %}
  6. {% endif %}
  7. {% set page_ini = 1 %}
  8. {% set page_end = params.pages %}
  9. {% if params.pages > 1 %}
  10. {% if page == 1 %}
  11. {% set page_prev = page_end %}
  12. {% set page_next = page + 1 %}
  13. {% elseif page == page_end %}
  14. {% set page_prev = page - 1 %}
  15. {% set page_next = 1 %}
  16. {% else %}
  17. {% set page_prev = page - 1 %}
  18. {% set page_next = page + 1 %}
  19. {% endif %}
  20. {% else %}
  21. {% set page_prev = 1 %}
  22. {% set page_next = 1 %}
  23. {% endif %}
  24. {% block title %}
  25. - {{ params.label }}
  26. {% endblock %}
  27. {% block breadcrumb %}
  28. {% set links = [{label: params.label, class: 'active', link: ''}] %}
  29. {% include "BaseAdminBundle:Utils:breadcrumb.html.twig" with links %}
  30. {% endblock %}
  31. {% block list_filters %}
  32. <style type="text/css">
  33. .filter {
  34. margin: 5px;
  35. display: block;
  36. }
  37. .filter-title {
  38. width: 200px;
  39. }
  40. .filter-value {
  41. width: 400px;
  42. }
  43. input[type='text']:focus {
  44. border-color: #66afe9 !important;
  45. box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
  46. outline: 0 none;
  47. transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
  48. }
  49. input[type='text'] {
  50. width: inherit;
  51. padding: 4px;
  52. -webkit-border-radius: 0px;
  53. -moz-border-radius: 0px;
  54. border-radius: 0px;
  55. direction: ltr;
  56. border: 1px solid #cccccc;
  57. color: #555;
  58. font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
  59. background: #fff none repeat scroll 0 0;
  60. }
  61. .inactive {
  62. display: none;
  63. }
  64. .active {
  65. display: block;
  66. }
  67. .glyphicon-chevron-down, .glyphicon-chevron-up {
  68. cursor: pointer;
  69. }
  70. </style>
  71. <div class="col-xs-12 col-md-12">
  72. <div class="box">
  73. <form id="filter_form" action="{{ url('entity_audit') }}" method="POST">
  74. <fieldset class="filter_legend">
  75. <legend class="filter_legend"> <i id="filter-icon" class="glyphicon glyphicon-chevron-{% if data|length == 0 and not form.vars.submitted %}down{% else %}up{% endif %} btn-xs" title="{{ 'audit.filter.show_hide'|trans({}, 'AuditBundle') }}"></i> {{ 'FILTROS'|trans({}, 'AuditBundle') }}</legend>
  76. <div class="filter_container {% if data|length == 0 and not form.vars.submitted %}inactive{% endif %}" style="padding: 0 15px 15px 15px;">
  77. <table class="bordered-table">
  78. <tbody>
  79. <tr class="filter">
  80. <td class="filter-title" width="200">{{ 'Entidad'|trans({}, 'AuditBundle') }}:</td>
  81. <td class="filter-value form-inline">
  82. {{ form_widget(form.entity) }}
  83. </td>
  84. </tr>
  85. <tr class="filter">
  86. <td class="filter-title" width="200">{{ 'Tipo de Revisión'|trans({}, 'AuditBundle') }}:</td>
  87. <td class="filter-value form-inline">
  88. {{ form_widget(form.types) }}
  89. </td>
  90. </tr>
  91. <tr class="filter">
  92. <td class="filter-title" width="200">{{ 'ID del Elemento'|trans({}, 'AuditBundle') }}:</td>
  93. <td class="filter-value form-inline">
  94. {{ form_widget(form.idx) }}
  95. </td>
  96. </tr>
  97. <tr class="filter">
  98. <td class="filter-title" width="200">{{ 'Usuario'|trans({}, 'AuditBundle') }}:</td>
  99. <td class="filter-value form-inline">
  100. {{ form_widget(form.users) }}
  101. </td>
  102. </tr>
  103. <tr class="filter">
  104. <td class="filter-title">{{ 'Fecha Desde'|trans({}, 'AuditBundle') }}:</td> <td class="filter-value form-inline">
  105. {{ form_widget(form.dateFrom) }}
  106. </td>
  107. </tr>
  108. <tr class="filter">
  109. <td class="filter-title">{{ 'Fecha Hasta'|trans({}, 'AuditBundle') }}:</td>
  110. <td class="filter-value">
  111. {{ form_widget(form.dateTo) }}
  112. </td>
  113. </tr>
  114. <tr class="filter">
  115. <td class="filter-title" width="200">{{ 'Datos'|trans({}, 'AuditBundle') }}:</td>
  116. <td class="filter-value form-inline">
  117. {{ form_widget(form.searchValue) }}
  118. </td>
  119. </tr>
  120. <tr class="filter">
  121. <td class="filter-title" width="200">{{ 'Resultados por Página'|trans({}, 'AuditBundle') }}:</td>
  122. <td class="filter-value form-inline">
  123. {{ form_widget(form.resxpage) }}
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. {{ form_widget(form.page) }}
  129. {{ form_widget(form.sort_by) }}
  130. {{ form_widget(form.sort_order) }}
  131. {{ form_row(form._token) }}
  132. <input class="btn btn-small btn-primary" type="submit" value="{{ 'Buscar'|trans({}, 'AuditBundle') }}">
  133. <a class="btn btn-small btn-default" href="{{ url('entity_audit') }}">{{ 'Limpiar'|trans({}, 'AuditBundle') }}</a>
  134. </div>
  135. </fieldset>
  136. </form>
  137. </div>
  138. </div>
  139. {% endblock %}
  140. {% block list_table %}
  141. <div class="col-xs-12 col-md-12">
  142. <div class="box box-primary" style="margin-bottom: 100px; min-height: ">
  143. {% if data and is_post %}
  144. <div class="box-body no-padding table-responsive">
  145. <p style="float: right">{{ total }} {{ 'resultado(s)'|trans({}, 'AuditBundle') }}</p>
  146. <table class="table table-bordered table-striped sonata-ba-list">
  147. <thead>
  148. <tr>
  149. <th>{{ 'Entidad'|trans({}, 'AuditBundle') }}</th>
  150. <th>{{ 'ID del Elemento'|trans({}, 'AuditBundle') }}</th>
  151. <th>{{ 'Tipo de Revisión'|trans({}, 'AuditBundle') }}</th>
  152. <th>{{ 'Usuario'|trans({}, 'AuditBundle') }}</th>
  153. <th>{{ 'Fecha'|trans({}, 'AuditBundle') }}</th>
  154. <th>{{ 'Datos'|trans({}, 'AuditBundle') }}</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. {% for item in data %}
  159. <tr>
  160. <td><a href="{{ path('entity_audit_view_details', { 'classValue': entities[entity], 'id':item['id'], 'rev':item['rev'] }) }}">{{ item['rev'] }}</a></td>
  161. <td>{{ item['id'] }}</td>
  162. <td>{{ item['revtype'] }}</td>
  163. <td>{{ item['username'] }}</td>
  164. <td>{{ item['timestamp'] }}</td>
  165. <td style="font-size: 14px">
  166. <ul>
  167. {% for column in columns[entity] %}
  168. <li style="float: left; width: 23%; margin-right: 2%; line-height: 1 !important"><strong>{{ column }}:</strong> {{ item[column] }}</li>
  169. {% endfor %}
  170. </ul>
  171. </td>
  172. </tr>
  173. {% endfor %}
  174. </tbody>
  175. <tfoot>
  176. <tr>
  177. <td colspan="6" class="pager">
  178. <div class="pagination">
  179. <ul style="float: right; text-align: center">
  180. <p>{{ 'Página'|trans({}, 'AuditBundle') }} {{ page }} {{ 'de'|trans({}, 'AuditBundle') }} {{ params.pages }}</p>
  181. {% if params.pages > 1 %}
  182. <li>
  183. <a href="javascript:void(0)" onclick="SetPage('{{ page_ini }}');">«</a>
  184. </li>
  185. <li>
  186. <a href="javascript:void(0)" onclick="SetPage('{{ page_prev }}');">‹</a>
  187. </li>
  188. <li>
  189. <a href="javascript:void(0)" onclick="SetPage('{{ page_next }}');">›</a>
  190. </li>
  191. <li>
  192. <a href="javascript:void(0)" onclick="SetPage('{{ page_end }}');">»</a>
  193. </li>
  194. {% endif %}
  195. </ul>
  196. </div>
  197. </td>
  198. </tr>
  199. </tfoot>
  200. </table>
  201. </div>
  202. {% else %}
  203. <div style="padding: 15px;">
  204. {% if is_post %}
  205. {{ 'nothingfound' |trans({}, 'AuditBundle') }}
  206. {% else %}
  207. {{ 'readysearch' |trans({}, 'AuditBundle') }}
  208. {% endif %}
  209. </div>
  210. {% endif %}
  211. </div>
  212. </div>
  213. <script type="text/javascript" src="{{ asset('bundles/sonataadmin/vendor/jqueryui/ui/i18n/jquery.ui.datepicker-es.js') }}"></script>
  214. <script type="text/javascript">
  215. $(document).ready(function () {
  216. $('.datepicker').datepicker({
  217. dateFormat: 'dd/mm/yy'
  218. });
  219. $('#filter-icon').on('click', function() {
  220. var filter_container = $('.filter_container');
  221. if (filter_container.hasClass('inactive')) {
  222. filter_container.removeClass('inactive');
  223. filter_container.addClass('active');
  224. $(this).removeClass('glyphicon-chevron-down');
  225. $(this).addClass('glyphicon-chevron-up');
  226. } else {
  227. filter_container.removeClass('active');
  228. filter_container.addClass('inactive');
  229. $(this).removeClass('glyphicon-chevron-up');
  230. $(this).addClass('glyphicon-chevron-down');
  231. }
  232. });
  233. });
  234. function SetPage(page) {
  235. $('[name$="[page]"]').val(page);
  236. $('#filter_form').submit();
  237. }
  238. </script>
  239. {% endblock %}