scritptIndex.js 1.5 KB

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