parc_info_user_index.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. {% extends 'base.html' %}
  2. {% load crispy_forms_tags %}
  3. {% load static %}
  4. {% block modals%}
  5. <div class="modal" id="mo_user_get_info" tabindex="-1" role="dialog"></div>
  6. <div class="modal" id="mo_user_get_hist" tabindex="-1" role="dialog"></div>
  7. <div class="modal" id="mo_user_edit_info" data-backdrop="static" tabindex="-1" role="dialog"></div>
  8. <div class="modal" id="mo_services_info" tabindex="-1" role="dialog">
  9. <div class="modal-dialog modal-sm" role="document">
  10. <div class="modal-content">
  11. <div class="modal-header">
  12. <h5 class="modal-title" id="mo_services_info">Les services</h5>
  13. <button type="button" class="btn btn-sm btn-dark close" data-dismiss="modal" aria-label="Close">
  14. <span aria-hidden="true">&times;</span>
  15. </button>
  16. </div>
  17. <div class="modal-body">
  18. <table class="table table-sm">
  19. <tbody>
  20. {% for item in services%}
  21. <tr><td>{{item.SERVICE_Anag}}</td><td>{{item.SERVICE_Nom}}</td></tr>
  22. {% endfor %}
  23. </tbody>
  24. </table>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. {% endblock %}
  30. {% block script %}
  31. <script type="text/javascript">
  32. function user_get_list() {
  33. var $list_user_get_list = $('#user_get_list');
  34. var get_search = document.getElementById("id_PSearch").value
  35. if (get_search.length >= 3) {
  36. $list_user_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  37. $.ajax({
  38. type : 'GET',
  39. url: '/parc/api/clients/get_list?get_search='+get_search,
  40. success: function(feeds) {
  41. $list_user_get_list.html(feeds);
  42. }
  43. });
  44. }
  45. if (get_search.length == "") {
  46. $list_user_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  47. $.ajax({
  48. type : 'GET',
  49. url: '/parc/api/clients/get_list',
  50. success: function(feeds) {
  51. $list_user_get_list.html(feeds);
  52. }
  53. });
  54. }
  55. };
  56. function bt_get_user_info(id){
  57. $.ajax({
  58. type : 'GET',
  59. url: '/parc/api/clients/get_user/'+id,
  60. success: function(data) {
  61. $('#mo_user_get_info').html(data).modal('toggle');
  62. },
  63. });
  64. };
  65. function bt_get_user_hist(id){
  66. $.ajax({
  67. type : 'GET',
  68. url: '/parc/api/clients/get_hist/'+id,
  69. success: function(data) {
  70. $('#mo_user_get_hist').html(data).modal('toggle');
  71. },
  72. });
  73. };
  74. function bt_edit_user_info(id){
  75. var get_search = document.getElementById("id_PSearch").value
  76. $.ajax({
  77. type : 'GET',
  78. url: '/parc/api/clients/edit_user/'+id+'?get_search='+get_search,
  79. success: function(data) {
  80. $('#mo_user_edit_info').html(data).modal('toggle');
  81. },
  82. });
  83. };
  84. function bt_edit_user_statut(id){
  85. var get_search = document.getElementById("id_PSearch").value
  86. $.ajax({
  87. type : 'GET',
  88. url: '/parc/api/clients/edit_statut/'+id+'?get_search='+get_search,
  89. success: function(data) {
  90. $('#mo_user_edit_info').html(data).modal('toggle');
  91. },
  92. });
  93. };
  94. function bt_start_novnc(hostname){
  95. $.ajax({
  96. type : 'GET',
  97. url: '/parc/api/clients/novnc/'+hostname,
  98. success: function(data) {
  99. window.open(data, '_blank').focus();
  100. },
  101. });
  102. };
  103. function bt_send_edit_user_info(){
  104. document.getElementById("form_edit_user").submit();
  105. };
  106. function bt_send_edit_user_statut(){
  107. document.getElementById("form_edit_user").submit();
  108. };
  109. function onloading() {
  110. user_get_list();
  111. {% if page.item_id %}bt_get_user_info({{page.item_id}});{% endif %}
  112. };
  113. $(document).ready(function(){ onloading(); });
  114. </script>
  115. {% endblock %}
  116. {% block main %}
  117. <div class="card-body">
  118. {% if not page.output or page.err %}
  119. {{page.p_contenu|safe}}
  120. {% else %}
  121. {% if page.err %}{{page.err|safe}}{% endif %}
  122. {% if page.output and page.err %}<hr>{% endif %}
  123. {% if page.output %}{{page.output|safe|urlize}}{% endif %}
  124. {% endif %}
  125. </div>
  126. <div id="user_get_list"><h3><i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3></div>
  127. {% endblock %}
  128. {% block right_panel %}
  129. <div class="card-body">
  130. {% if page.search_see == "ok" %}
  131. <div id="div_id_PSearch" class="form-group">
  132. <label for="id_PSearch" class=" requiredField">Recherche d'un client (min 3 caractères) </label>
  133. <div class=""><input type="text" name="PSearch" maxlength="128" class="textinput textInput form-control" required="" id="id_PSearch" oninput="user_get_list()" value="{{page.search}}"></div>
  134. </div>
  135. {% else %}
  136. <input type="hidden" name="PSearch" id="id_PSearch">
  137. {% endif %}
  138. <p>{{page.p_right|safe}}</p>
  139. {% if services %}
  140. <div class="d-grid gap-2 mb-2"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mo_services_info"><i class="fas fa-info-circle"></i> Liste des services</button></div>
  141. {% endif %}
  142. <div class="d-grid gap-2 mb-2"><a class="btn btn-success" href="#" onclick="bt_edit_user_info(0)" role="button"><i class="far fa-plus-square"></i> Ajouter un équipements</a></div>
  143. <div class="d-grid gap-2"><a class="btn btn-primary" href="/parc" role="button"><i class="fas fa-undo-alt"></i> Retour</a></div>
  144. </div>
  145. {% endblock %}