script.blade.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script>
  2. @if(count($errors) > 0 || Session::has('success') || Session::has('info') || Session::has('warning'))
  3. $.confirm({
  4. title: '{{Session::get('info')}}',
  5. content: '{{Session::get('alert')}}',
  6. type: '{{Session::get('colors')}}',
  7. icon: '{{Session::get('icons')}}',
  8. typeAnimated: true,
  9. buttons: {
  10. close: function () {
  11. }
  12. }
  13. });
  14. @elseif(count($errors) == 0)
  15. @else
  16. $.confirm({
  17. title: '{{Session::has('info')}}',
  18. content: '{{Session::get('alert')}}',
  19. type: 'red',
  20. typeAnimated: true,
  21. icon: 'fas fa-exclamation-triangle',
  22. buttons: {
  23. close: function () {
  24. }
  25. }
  26. });
  27. @endif
  28. $('.deleteConfirmation').confirm({
  29. title: 'Delete',
  30. autoClose: 'no|8000',
  31. type: 'red',
  32. typeAnimated: true,
  33. icon: 'fas fa-trash',
  34. content: 'Are you sure to delete ?',
  35. buttons: {
  36. deleteUser: {
  37. text: 'Yes',
  38. btnClass: 'btn-danger',
  39. action: function () {
  40. location.href = this.$target.attr('href');
  41. }
  42. },
  43. no: function () {
  44. }
  45. }
  46. });
  47. $('.logoutConfirmation').confirm({
  48. title: 'Logout',
  49. autoClose: 'no|8000',
  50. type: 'red',
  51. typeAnimated: true,
  52. icon: 'fas fa-sign-out-alt',
  53. content: 'Are you sure to logout ?',
  54. buttons: {
  55. logout: {
  56. text: 'Yes',
  57. btnClass: 'btn-danger',
  58. action: function () {
  59. event.preventDefault();
  60. document.getElementById('logout-form').submit();
  61. location.href = this.$target.attr('href');
  62. }
  63. },
  64. no: function () {
  65. }
  66. }
  67. });
  68. $('#dataTable').dataTable()
  69. </script>