adminInstances.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <head th:replace="~{layouts/common.html :: head}"></head>
  5. <body id="page-top">
  6. <!-- Navigation -->
  7. <nav th:replace="~{layouts/common.html :: navbar}"></nav>
  8. <!-- Content -->
  9. <div class="content uv-content d-flex" id="uv-wrapper">
  10. <div class="bg-light border-right" id="uv-sidebar-wrapper" th:replace="~{layouts/sidebar.html :: sidebar}"></div>
  11. <div class="container uv-home-section navVisible" id="uv-content-wrapper">
  12. <div class="uv-loading-spinner" th:text="#{global.loading}"></div>
  13. <div class="col-sm-12"></div>
  14. <div class="uv-container">
  15. <div class="uv-table-group-procedure-info" style="margin-bottom:20px;">
  16. <div class="uv-table-title">
  17. <h6 class="uv-table-header-h6" th:text="#{admin.instances.title}"></h6>
  18. <hr class="uv-procedure-hr">
  19. <span th:text="#{admin.instances.subtitle}"></span>
  20. </div>
  21. </div>
  22. <div class="uv-table-group">
  23. <h5><br></h5>
  24. </div>
  25. <form enctype='multipart/form-data' method="POST" action="/admin/instances">
  26. <div class="uv-table-group-procedure" id="proceduresContainer">
  27. <label th:text="#{admin.instances.selector.procedure}">Proces(os)</label>
  28. <select class="selectpicker" id="proceduresSelector" name="procedure" data-live-search="true" data-width="100%" data-actions-box="true" th:attr="data-none-selected-text=#{global.selectors.noData}" required>
  29. <option th:each="item : ${procedures}" th:text="${#locale.language} == 'es' ? ${item.text2}:${item.text3}" th:attr="value=${item.value}"></option>
  30. </select>
  31. </div>
  32. <div class="uv-table-group-procedure">
  33. <label th:text="#{admin.instances.selector.center}">Centre(s)</label>
  34. <select class="selectpicker" id="centersSelector" name="center" data-live-search="true" data-width="100%" data-actions-box="true" th:attr="data-none-selected-text=#{global.selectors.noData}" required>
  35. <option th:each="item : ${centers}" th:text="${#locale.language} == 'es' ? ${item.text}:${item.text2}" th:attr="value=${item.value}"></option>
  36. </select>
  37. </div>
  38. <div class="uv-table-group-procedure">
  39. <label th:text="#{admin.instances.selector.titulation}">Titulació(ns)</label>
  40. <select class="selectpicker" id="titulationsSelector" name="titulation" data-live-search="true" data-width="100%" data-actions-box="true" required>
  41. <option th:each="item : ${titulations}" th:text="${#locale.language} == 'es' ? ${item.text}:${item.text2}" th:attr="value=${item.value}"></option>
  42. </select>
  43. </div>
  44. <div class="uv-table-group" style="margin-top:50px;">
  45. <button th:text="#{admin.actions.instance}" class="btn btn-primary">Cargar</button>
  46. </div>
  47. <div class="uv-table-group uv-admin-instance-success" th:if="${success}">
  48. <span th:text="#{admin.instances.done}"></span>
  49. <br><br>
  50. <span th:each="item : ${successCas}" th:if="${#locale.language == 'es'}"><span th:text="${item}"></span><br></span>
  51. <span th:each="item : ${successVal}" th:if="${#locale.language != 'es'}"><span th:text="${item}"></span><br></span>
  52. </div>
  53. <div class="uv-table-group uv-admin-instance-error" th:if="${error}">
  54. <span th:text="#{admin.instances.error}"></span>
  55. <br><br>
  56. <span th:each="item : ${errorCas}" th:if="${#locale.language == 'es'}"><span th:text="${item}"></span><br></span>
  57. <span th:each="item : ${errorVal}" th:if="${#locale.language != 'es'}"><span th:text="${item}"></span><br></span>
  58. </div>
  59. </form>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- contactModal -->
  64. <div th:replace="~{layouts/common.html :: contactModal}"></div>
  65. <!-- Footer -->
  66. <footer class="uv-footer uv-footer-text" th:replace="~{layouts/common.html :: footer}"></footer>
  67. <script th:src="@{/js/jquery/jquery.min.js}"></script>
  68. <script th:src="@{/js/popper.js}"></script>
  69. <script th:src="@{/js/bootstrap/bootstrap.min.js}"></script>
  70. <script th:src="@{/js/fa/all.js}"></script>
  71. <script th:src="@{/js/jquery/jquery.dataTables.min.js}"></script>
  72. <script th:src="@{/js/jquery/jquery.dataTables.responsive.min.js}"></script>
  73. <script th:src="@{/js/jquery/jquery.dataTables.rowReorder.min.js}"></script>
  74. <script th:src="@{/js/bootstrap/dataTables.bootstrap4.min.js}"></script>
  75. <script th:src="@{/js/jquery-easing/jquery.easing.min.js}"></script>
  76. <script th:src="@{/js/saic.js}"></script>
  77. <script th:src="@{/js/datepicker/bootstrap-datepicker.min.js}"></script>
  78. <script th:src="@{/js/bootstrap-select/bootstrap-select.js}"></script>
  79. <script th:src="@{/js/bootstrap-select/i18n/defaults-es_ES.js}" th:if="${#locale.language} == 'es'"></script>
  80. <script th:src="@{/js/bootstrap-select/i18n/defaults-ca_CA.js}" th:if="${#locale.language} != 'es'"></script>
  81. <script type="text/javascript">
  82. $( document ).ready(function(){
  83. layout = new Layout("");
  84. layout.initTableLayout({paging:false});
  85. layout.closeLoadingSpinner(".uv-loading-spinner");
  86. $('#proceduresSelector').val('').trigger('change');
  87. $('#centersSelector').val('').trigger('change');
  88. $('#centersSelector').change(completeTitulations);
  89. $('#proceduresSelector').change(complete);
  90. });
  91. function complete(){
  92. completeCenters();
  93. completeTitulations();
  94. }
  95. function completeCenters(){
  96. console.log('cents');
  97. var params = {'procedure':$('#proceduresSelector').val()};
  98. $.post("/ajax/find/centers", params, function(data){ $("#centersSelector").html(data).selectpicker('refresh'); $('#centersSelector').val('').trigger('change');});
  99. }
  100. function completeTitulations(){
  101. console.log('tits');
  102. if ($('#centersSelector').val() !== null && $('#centersSelector').val() !== ''){
  103. var params = {'procedure':$('#proceduresSelector').val(), 'center':$('#centersSelector').val()};
  104. $.post("/ajax/find/titulations", params, function(data){
  105. $("#titulationsSelector").html(data).selectpicker('refresh');
  106. $('#titulationsSelector').val('').trigger('change');
  107. /*if($('#centersSelector').val() === "0"){
  108. $('#titulationsSelector').removeAttr('required');
  109. }
  110. else{
  111. $('#titulationsSelector').attr('required', true);
  112. }*/
  113. });
  114. }
  115. }
  116. </script>
  117. </body>
  118. </html>