"Updated AdminController, added products method and addNewProduct method, modified adminfooter and adminheader blade files, and added routes for admin products and add new product"

This commit is contained in:
UronShrestha
2024-07-14 10:22:06 +05:45
parent 1550ab5d30
commit f37e18f125
12 changed files with 486 additions and 53 deletions

View File

@ -43,4 +43,47 @@
<!-- End custom js for this page-->
</body>
{{-- <script>
$(document).ready(function() {
// Disable form submissions if there are invalid fields
$('form.needs-validation').on('submit', function(event) {
event.preventDefault(); // Prevent the default form submission
var form = $(this);
if (form[0].checkValidity() === false) {
event.stopPropagation();
form.addClass('was-validated');
} else {
// If the form is valid, submit it via AJAX
$.ajax({
type: form.attr('method'), // GET or POST
url: form.attr('action'), // The form action URL
data: form.serialize(), // Serialize the form data
success: function(response) {
// Handle the successful form submission
Swal.fire({
icon: 'success',
title: 'Success',
text: 'Form submitted successfully!',
});
console.log(response);
// You can update the page content or redirect here
},
error: function(xhr, status, error) {
// Handle the error response
Swal.fire({
icon: 'error',
title: 'Error',
text: 'Form submission failed. Please try again.',
});
console.error(xhr.responseText);
}
});
}
form.addClass('was-validated');
});
});
</script> --}}
</html>