1
0

parc_info_srv_index.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. {% extends 'base.html' %}
  2. {% load crispy_forms_tags %}
  3. {% load static %}
  4. {% block modals%}
  5. <div class="modal" id="mo_srv_get_info" tabindex="-1" role="dialog"></div>
  6. <div class="modal" id="mo_srv_edit_info" tabindex="-1" role="dialog" data-backdrop="static"></div>
  7. {% endblock %}
  8. {% block script %}
  9. <script type="text/javascript">
  10. function srv_get_list() {
  11. var $list_srv_get_list = $('#srv_get_list');
  12. var get_search = document.getElementById("id_PSearch").value
  13. if (get_search.length >= 3) {
  14. $list_srv_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  15. $.ajax({
  16. type : 'GET',
  17. url: '/parc/api/serveurs/get_list?get_search='+get_search,
  18. success: function(feeds) {
  19. $list_srv_get_list.html(feeds);
  20. }
  21. });
  22. }
  23. if (get_search.length == "") {
  24. $list_srv_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  25. $.ajax({
  26. type : 'GET',
  27. url: '/parc/api/serveurs/get_list',
  28. success: function(feeds) {
  29. $list_srv_get_list.html(feeds);
  30. }
  31. });
  32. }
  33. };
  34. function bt_get_srv_info(id){
  35. $.ajax({
  36. type : 'GET',
  37. url: '/parc/api/serveurs/get_srv/'+id,
  38. success: function(data) {
  39. $('#mo_srv_get_info').html(data).modal('toggle');
  40. },
  41. });
  42. };
  43. function bt_edit_srv_info(id){
  44. var get_search = document.getElementById("id_PSearch").value
  45. $.ajax({
  46. type : 'GET',
  47. url: '/parc/api/serveurs/edit_srv/'+id+'?get_search='+get_search,
  48. success: function(data) {
  49. $('#mo_srv_edit_info').html(data).modal('toggle');
  50. },
  51. });
  52. };
  53. function bt_send_edit_srv_info(){
  54. document.getElementById("form_edit_server").submit();
  55. };
  56. function onloading() {
  57. srv_get_list();
  58. {% if page.item_id %}bt_get_srv_info({{page.item_id}});{% endif %}
  59. };
  60. $(document).ready(function(){ onloading(); });
  61. </script>
  62. {% endblock %}
  63. {% block main %}
  64. <div class="card-body">
  65. {% if not page.output or page.err %}
  66. {{page.p_contenu|safe}}
  67. {% else %}
  68. {% if page.err %}{{page.err|safe}}{% endif %}
  69. {% if page.output and page.err %}<hr>{% endif %}
  70. {% if page.output %}{{page.output|safe|urlize}}{% endif %}
  71. {% endif %}
  72. </div>
  73. <div id="srv_get_list"><h3><i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3></div>
  74. {% endblock %}
  75. {% block right_panel %}
  76. <div class="card-body">
  77. <div id="div_id_PSearch" class="form-group">
  78. <label for="id_PSearch" class=" requiredField">Recherche d'un serveur (min 3 caractères) </label>
  79. <div class=""><input type="text" name="PSearch" maxlength="128" class="textinput textInput form-control" required="" id="id_PSearch" oninput="srv_get_list()" value="{{page.search}}"></div>
  80. </div>
  81. <p>{{page.p_right|safe}}</p>
  82. <div class="d-grid gap-2 mb-2"><a class="btn btn-success" href="#" onclick="bt_edit_srv_info(0)" role="button"><i class="far fa-plus-square"></i> Ajouter un Serveur</a></div>
  83. <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>
  84. </div>
  85. {% endblock %}