gest_user_index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. {% extends 'base.html' %}
  2. {% load crispy_forms_tags %}
  3. {% load static %}
  4. {% block modals%}
  5. <div class="modal" id="mo_get_info" tabindex="-1" role="dialog"></div>
  6. <div class="modal" id="mo_edit_info" data-backdrop="static" tabindex="-1" role="dialog"></div>
  7. <div class="modal" id="mo_edit_port" data-backdrop="static" tabindex="-1" role="dialog"></div>
  8. {% endblock %}
  9. {% block script %}
  10. <script type="text/javascript">
  11. function get_list() {
  12. var $list_get_list = $('#get_list');
  13. var get_search = document.getElementById("id_PSearch").value
  14. if (get_search.length >= 3) {
  15. $list_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  16. $.ajax({
  17. type : 'GET',
  18. url: '/user/api/get_list?get_search='+get_search,
  19. success: function(feeds) {
  20. $list_get_list.html(feeds);
  21. }
  22. });
  23. }
  24. if (get_search.length == "") {
  25. $list_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  26. $.ajax({
  27. type : 'GET',
  28. url: '/user/api/get_list',
  29. success: function(feeds) {
  30. $list_get_list.html(feeds);
  31. }
  32. });
  33. }
  34. };
  35. function bt_get_info(id){
  36. $.ajax({
  37. type : 'GET',
  38. url: '/user/api/get/'+id,
  39. success: function(data) {
  40. $('#mo_get_info').html(data).modal('toggle');
  41. },
  42. });
  43. };
  44. function bt_edit_info(id){
  45. var get_search = document.getElementById("id_PSearch").value
  46. $.ajax({
  47. type : 'GET',
  48. url: '/user/api/edit/'+id+'?get_search='+get_search,
  49. success: function(data) {
  50. $('#mo_edit_info').html(data).modal('toggle');
  51. },
  52. });
  53. };
  54. function bt_edit_app_info(id){
  55. var get_search = document.getElementById("id_PSearch").value
  56. $.ajax({
  57. type : 'GET',
  58. url: '/user/api/app/edit/'+id+'?get_search='+get_search,
  59. success: function(data) {
  60. $('#mo_edit_info').html(data).modal('toggle');
  61. },
  62. });
  63. };
  64. function bt_app_remove(id){
  65. var get_search = document.getElementById("id_PSearch").value
  66. $.ajax({
  67. type : 'GET',
  68. url: '/user/api/app/remove/'+id,
  69. success: function(data) {
  70. window.open("/user/liste?get_id="+data+"&get_search="+get_search, "_self" );
  71. },
  72. });
  73. };
  74. function bt_app_add(user_id){
  75. var get_search = document.getElementById("id_PSearch").value;
  76. var app_id = document.getElementById("id_GES_APPLink_APP").options[document.getElementById("id_GES_APPLink_APP").selectedIndex].value;
  77. $.ajax({
  78. type : 'GET',
  79. url: '/user/api/app/add/'+user_id+'/'+app_id,
  80. success: function(data) {
  81. window.open("/user/liste?get_id="+data+"&get_search="+get_search, "_self" );
  82. },
  83. });
  84. }
  85. function bt_switch_app_status(id){
  86. var get_search = document.getElementById("id_PSearch").value
  87. $.ajax({
  88. type : 'GET',
  89. url: '/user/api/app/switch/'+id,
  90. success: function(data) {
  91. window.open("/user/liste?get_id="+data+"&get_search="+get_search, "_self" );
  92. },
  93. });
  94. };
  95. function bt_edit_complete(id){
  96. var get_search = document.getElementById("id_PSearch").value
  97. $.ajax({
  98. type : 'GET',
  99. url: '/user/api/complete/'+id,
  100. success: function(data) {
  101. window.open("/user/liste?get_id="+data+"&get_search="+get_search, "_self" );
  102. },
  103. });
  104. };
  105. function bt_edit_close(id){
  106. var get_search = document.getElementById("id_PSearch").value
  107. $.ajax({
  108. type : 'GET',
  109. url: '/user/api/close/'+id,
  110. success: function(data) {
  111. window.open("/user/liste?get_id="+data+"&get_search="+get_search, "_self" );
  112. },
  113. });
  114. };
  115. function bt_send_edit(){
  116. document.getElementById("form_edit").submit();
  117. };
  118. function onloading() {
  119. get_list();
  120. {% if page.item_id %}bt_get_info({{page.item_id}});{% endif %}
  121. };
  122. $(document).ready(function(){ onloading(); });
  123. </script>
  124. {% endblock %}
  125. {% block main %}
  126. <div class="card-body">
  127. {% if not page.output or page.err %}
  128. {{page.p_contenu|safe}}
  129. {% else %}
  130. {% if page.err %}{{page.err|safe}}{% endif %}
  131. {% if page.output and page.err %}<hr>{% endif %}
  132. {% if page.output %}{{page.output|safe|urlize}}{% endif %}
  133. {% endif %}
  134. </div>
  135. <div id="get_list" style="user-select : text;"><h3><i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3></div>
  136. {% endblock %}
  137. {% block right_panel %}
  138. <div class="card-body">
  139. <div id="div_id_PSearch" class="form-group">
  140. <label for="id_PSearch" class=" requiredField">Recherche d'un Utilisateur (min 3 caractères) </label>
  141. <div class=""><input type="text" name="PSearch" maxlength="128" class="textinput textInput form-control" required="" id="id_PSearch" oninput="get_list()" value="{{page.search}}"></div>
  142. </div>
  143. <p>{{page.p_right|safe}}</p>
  144. <p>Dernier matricule APTA : {{page.lastapta}}</p>
  145. <div class="d-grid gap-2 mb-2"><a class="btn btn-success" href="#" onclick="bt_edit_info(0)" role="button"><i class="fas fa-user-plus"></i> Ajouter un utilisateur</a></div>
  146. {% if planning_query %}
  147. <p>Agenda des comptes à crée :</p>
  148. <table class="table table-hover">
  149. <thead class="thead-dark">
  150. <tr>
  151. <th scope="col">&nbsp;</th>
  152. <th scope="col">Service</th>
  153. <th scope="col">Nom - Prénom</th>
  154. <th scope="col">Date d'arrivée</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. {% for item in planning_query%}
  159. <tr>
  160. <td onmouseover="this.style.cursor='pointer';"><i class="fas fa-search-plus" onclick="bt_get_info({{item.id}})"></i></td>
  161. <td>{{item.GES_Service}}</td>
  162. <td>{{item.GES_Nom}} {{item.GES_Prenom}}</td>
  163. <td>{{item.GES_Date}}</td>
  164. </tr>
  165. {% endfor %}
  166. </tbody>
  167. </table>
  168. {% endif %}
  169. {% if planning_query_clos %}
  170. <p>Agenda des comptes à cloturé :</p>
  171. <table class="table table-hover">
  172. <thead class="thead-dark">
  173. <tr>
  174. <th scope="col">&nbsp;</th>
  175. <th scope="col">Service</th>
  176. <th scope="col">Nom - Prénom</th>
  177. <th scope="col">Date de départ</th>
  178. </tr>
  179. </thead>
  180. <tbody>
  181. {% for item in planning_query_clos%}
  182. <tr>
  183. <td onmouseover="this.style.cursor='pointer';"><i class="fas fa-search-plus" onclick="bt_get_info({{item.id}})"></i></td>
  184. <td>{{item.GES_Service}}</td>
  185. <td>{{item.GES_Nom}} {{item.GES_Prenom}}</td>
  186. <td>{{item.GES_Date}}</td>
  187. </tr>
  188. {% endfor %}
  189. </tbody>
  190. </table>
  191. {% endif %}
  192. </div>
  193. {% endblock %}