Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.2 KiB

5 years ago
  1. {% extends get_global_template('list') %}
  2. {% block list_table %}
  3. {{ parent() }}
  4. <div class="modal fade" tabindex="-1" role="dialog" id="inscripcionModal" aria-labelledby="wmModalLabel">
  5. <div class="modal-dialog" role="document">
  6. <div class="loader"></div>
  7. <div class="modal-content">
  8. </div><!-- /.modal-content -->
  9. </div><!-- /.modal-dialog -->
  10. </div><!-- /.modal -->
  11. {% endblock %}
  12. {% block javascripts %}
  13. {{ parent() }}
  14. <script>
  15. $(function() {
  16. let reload = false;
  17. $("a.inscripcion_link").on('click', function (e) {
  18. e.preventDefault();
  19. let $modal = $("#inscripcionModal");
  20. let $modalContent = $modal.find('.modal-content');
  21. $modalContent.html('');
  22. $modal.modal('show');
  23. $modal.find('.loader').show();
  24. let url = $(this).attr('href');
  25. $modal.data('formUrl', url);
  26. $.get(url, function(response){
  27. console.log(response);
  28. $modal.find('.loader').hide();
  29. $modalContent.html(response);
  30. });
  31. });
  32. $("#inscripcionModal").on('click', "#submit-inscripcion", function (e) {
  33. let $modal = $("#inscripcionModal");
  34. let $modalContent = $modal.find('.modal-content');
  35. let formData = $modal.find('form').serialize();
  36. $modal.find('.loader').show();
  37. $.post($modal.data('formUrl'), formData, function(response){
  38. console.log(response);
  39. $modalContent.find('.modal-footer').find('.btn-success').remove();
  40. $modalContent.find('.modal-footer').find('.btn-danger').remove();
  41. $modalContent.find('.body-content-scrollable').html(response);
  42. reload = true;
  43. });
  44. });
  45. $("#inscripcionModal").on('hidden.bs.modal', function () {
  46. if(reload){
  47. window.location.reload();
  48. }
  49. });
  50. });
  51. </script>
  52. {% endblock %}