Mise en place de la structure définitive du CRUD et modification de la page principale avec les datas
This commit is contained in:
@@ -1,10 +1,77 @@
|
||||
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
(function ($) {
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
// Write your JavaScript code.
|
||||
function toggleSidebar() {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const toggleBtn = document.querySelector('.toggle-btn');
|
||||
sidebar.classList.toggle('collapsed');
|
||||
toggleBtn.classList.toggle('collapsed');
|
||||
}
|
||||
// Toggle the side navigation
|
||||
$("#sidebarToggle, #sidebarToggleTop").on('click', function (e) {
|
||||
$("body").toggleClass("sidebar-toggled");
|
||||
$(".sidebar").toggleClass("toggled");
|
||||
if ($(".sidebar").hasClass("toggled")) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Close any open menu accordions when window is resized below 768px
|
||||
$(window).resize(function () {
|
||||
if ($(window).width() < 768) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
|
||||
// Toggle the side navigation when window is resized below 480px
|
||||
if ($(window).width() < 480 && !$(".sidebar").hasClass("toggled")) {
|
||||
$("body").addClass("sidebar-toggled");
|
||||
$(".sidebar").addClass("toggled");
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
|
||||
$('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function (e) {
|
||||
if ($(window).width() > 768) {
|
||||
var e0 = e.originalEvent,
|
||||
delta = e0.wheelDelta || -e0.detail;
|
||||
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Scroll to top button appear
|
||||
$(document).on('scroll', function () {
|
||||
var scrollDistance = $(this).scrollTop();
|
||||
if (scrollDistance > 100) {
|
||||
$('.scroll-to-top').fadeIn();
|
||||
} else {
|
||||
$('.scroll-to-top').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// Smooth scrolling using jQuery easing
|
||||
$(document).on('click', 'a.scroll-to-top', function (e) {
|
||||
var $anchor = $(this);
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: ($($anchor.attr('href')).offset().top)
|
||||
}, 1000, 'easeInOutExpo');
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
|
||||
/**
|
||||
* 💶 Formate un nombre en chaîne de caractères au format français avec division par 1000.
|
||||
* Exemples :
|
||||
* 123456 => "123,456"
|
||||
* 5000 => "5,000"
|
||||
* "1000" => "1,000"
|
||||
* null => "0,000"
|
||||
*
|
||||
* @param {number|string} valeur - Le nombre à formater (peut être une chaîne ou un nombre)
|
||||
* @returns {string} Représentation formatée (ex: "1,234")
|
||||
*/
|
||||
function toPriceFormat(valeur) {
|
||||
const nombre = parseFloat(valeur);
|
||||
if (isNaN(nombre)) return "0";
|
||||
|
||||
return nombre.toLocaleString('fr-FR', {
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: 0
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user