scriptIndex.blade.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
  2. <script type="text/javascript">
  3. $('.show_confirm').click(function(event) {
  4. var form = $(this).closest("form");
  5. var name = $(this).data("name");
  6. event.preventDefault();
  7. swal({
  8. title: `Are you sure you want to delete this record?`
  9. , text: "If you delete this, it will be gone forever."
  10. , icon: "warning"
  11. , buttons: true
  12. , dangerMode: true
  13. , })
  14. .then((willDelete) => {
  15. if (willDelete) {
  16. form.submit();
  17. }
  18. });
  19. });
  20. function myFunction() {
  21. document.getElementById("demo").innerHTML = "Hello World";
  22. }
  23. var myModal = document.getElementById('myModal')
  24. var myInput = document.getElementById('myInput')
  25. myModal.addEventListener('shown.bs.modal', function() {
  26. myInput.focus()
  27. })
  28. $('form input').on('change', function() {
  29. $(this).closest('form').submit();
  30. });
  31. </script>
  32. <script>
  33. $(function() {
  34. $('.toggle-class').change(function() {
  35. var etat = $(this).prop('checked') == true ? 1 : 0;
  36. var Id = $(this).data('id');
  37. $.ajax({
  38. type: "GET"
  39. , dataType: "json"
  40. , url: '/changeStatusPresentation'
  41. , data: {
  42. 'etat': etat
  43. , 'Id': Id
  44. }
  45. , success: function(data) {
  46. console.log(data.success)
  47. }
  48. });
  49. })
  50. })
  51. </script>