parc_info_taches_index.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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" tabindex="-1" role="dialog"></div>
  7. {% endblock %}
  8. {% block script %}
  9. <script type="text/javascript">
  10. function get_list() {
  11. var $list_get_list = $('#get_list');
  12. $list_get_list.html('<h3> <i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3>');
  13. $.ajax({
  14. type : 'GET',
  15. url: '/taches/api/get_list',
  16. success: function(feeds) {
  17. $list_get_list.html(feeds);
  18. }
  19. });
  20. };
  21. function bt_get_info(id){
  22. stop_crono();
  23. $.ajax({
  24. type : 'GET',
  25. url: '/taches/api/get_taches/'+id,
  26. success: function(data) {
  27. $('#mo_get_info').html(data).modal('toggle');
  28. },
  29. });
  30. };
  31. function bt_edit_info(id){
  32. stop_crono();
  33. $.ajax({
  34. type : 'GET',
  35. url: '/taches/api/edit_taches/'+id,
  36. success: function(data) {
  37. $('#mo_edit_info').html(data).modal('toggle');
  38. },
  39. });
  40. };
  41. function bt_send_edit_info(){
  42. document.getElementById("form_edit").submit();
  43. };
  44. function onloading() {
  45. get_list();
  46. };
  47. $(document).ready(function(){
  48. onloading()
  49. set_crono()
  50. });
  51. function set_crono(){
  52. crono = window.setInterval(function(){onloading();}, 60000);
  53. }
  54. function stop_crono(){
  55. window.clearInterval(crono)
  56. }
  57. </script>
  58. {% endblock %}
  59. {% block main %}
  60. <div class="card-body">
  61. {% if not page.output or page.err %}
  62. {{page.p_contenu|safe}}
  63. {% else %}
  64. {% if page.err %}{{page.err|safe}}{% endif %}
  65. {% if page.output and page.err %}<hr>{% endif %}
  66. {% if page.output %}{{page.output|safe|urlize}}{% endif %}
  67. {% endif %}
  68. </div>
  69. <div id="get_list"><h3><i class="fas fa-spinner fa-pulse fa-fw"></i> Loading...</h3></div>
  70. {% endblock %}
  71. {% block right_panel %}
  72. <div class="card-body">
  73. <p>{{page.p_right|safe}}</p>
  74. <div class="d-grid gap-2 mb-2"><a class="btn btn-success" href="#" onclick="bt_edit_info(0)" role="button"><i class="far fa-plus-square"></i> Ajouter une tâche</a></div>
  75. <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>
  76. </div>
  77. {% endblock %}