modal.blade.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <div class="modal fade" id="modal_page" aria-hidden="true" aria-labelledby="exampleModalLabel" tabindex="-1">
  2. <div class="modal-dialog modal-lg">
  3. <!-- Modal content-->
  4. <div class="modal-content">
  5. <div class="modal-header" style="background-color: #141639c4; color: white;">
  6. <h6 class="modal-title" id="exampleModalLabel" style="font-weight: bold !important; margin-left: 10px;"></h6>
  7. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  8. </div>
  9. <div class="modal-body" style="background-color: #8492a33d !important;"></div>
  10. </div>
  11. </div>
  12. </div>
  13. <script>
  14. //Start of jquery
  15. function wait_me(selector, config=null){
  16. if(config){
  17. selector.waitMe(config);
  18. }else{
  19. selector.waitMe({
  20. effect: 'facebook',
  21. //color: '#000',
  22. text: 'Please! Wait ...'
  23. });
  24. }
  25. }
  26. $(function(){
  27. $('#modal_page').on('submit', '.ajax-form', function(event){
  28. event.preventDefault();
  29. ajax_form(this, function(form){
  30. var replace_content=$(form).find('input[name=replace_content]').val();
  31. if(replace_content){
  32. url=$(form).find("input[name='replace_content']").data('replace');
  33. $(replace_content).waitMe({
  34. effect: 'facebook',
  35. text: 'Please! Wait ...'
  36. });
  37. $(replace_content).load(url, null, function(){
  38. $(replace_content).waitMe('hide');
  39. });
  40. $('#modal_page').modal('hide');
  41. }else window.location.reload();
  42. });
  43. });
  44. $(document).on('click', '.open_modal_page', function(){
  45. let url=$(this).data('url');
  46. let title=$(this).data('title');
  47. if(!title) title='Modal Form';
  48. $('.modal-title').html(title);
  49. //$('#modal_page').modal({show:true});
  50. let open_modal = new bootstrap.Modal('#modal_page', {
  51. keyboard: false
  52. });
  53. open_modal.show();
  54. $('.modal-body').load(url, null, function(){
  55. $('.tooltips').tooltip();
  56. });
  57. });
  58. $('.tooltips').tooltip();
  59. $('#modal_page').on('show.bs.modal', function(e){
  60. $('.modal-body').html("<h1 class='text-center mt-3'><i class='fa fa-refresh fa-spin fa-2x'></i></h1>");
  61. });
  62. $('#modal_page').on('hidden.bs.modal', function (e){
  63. $('.modal-body').empty();
  64. });
  65. });
  66. //End of jquery
  67. </script>