uppdate
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
<script>
|
||||
(function () {
|
||||
var menuTimer = null;
|
||||
|
||||
function getCatIds() {
|
||||
return Array.from(document.querySelectorAll('[data-menu-cat]')).map(function (item) {
|
||||
return item.getAttribute('data-menu-cat');
|
||||
});
|
||||
}
|
||||
|
||||
function switchCat(id) {
|
||||
var catIds = getCatIds();
|
||||
catIds.forEach(function (c) {
|
||||
var item = document.getElementById('cat-' + c);
|
||||
var panel = document.getElementById('rp-' + c);
|
||||
if (item) item.classList.remove('cat-active');
|
||||
if (panel) panel.style.display = 'none';
|
||||
});
|
||||
|
||||
var activeItem = document.getElementById('cat-' + id);
|
||||
var activePanel = document.getElementById('rp-' + id);
|
||||
if (activeItem) activeItem.classList.add('cat-active');
|
||||
if (activePanel) activePanel.style.display = 'flex';
|
||||
}
|
||||
|
||||
function showMenu() {
|
||||
cancelMenuClose();
|
||||
closeShowroom();
|
||||
|
||||
var catIds = getCatIds();
|
||||
if (catIds.length > 0) switchCat(catIds[0]);
|
||||
|
||||
var megaMenu = document.getElementById('mega-menu');
|
||||
var overlay = document.getElementById('overlay');
|
||||
if (megaMenu) megaMenu.classList.remove('hidden');
|
||||
if (overlay) overlay.classList.remove('hidden');
|
||||
}
|
||||
|
||||
function scheduleMenuClose() {
|
||||
menuTimer = setTimeout(function () {
|
||||
var megaMenu = document.getElementById('mega-menu');
|
||||
var overlay = document.getElementById('overlay');
|
||||
if (megaMenu) megaMenu.classList.add('hidden');
|
||||
if (overlay) overlay.classList.add('hidden');
|
||||
}, 150);
|
||||
}
|
||||
|
||||
function cancelMenuClose() {
|
||||
if (menuTimer) {
|
||||
clearTimeout(menuTimer);
|
||||
menuTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleShowroom() {
|
||||
var panel = document.getElementById('showroom-panel');
|
||||
var arrow = document.getElementById('showroom-arrow');
|
||||
if (!panel || !arrow) return;
|
||||
|
||||
var isOpen = !panel.classList.contains('hidden');
|
||||
closeAll();
|
||||
if (!isOpen) {
|
||||
panel.classList.remove('hidden');
|
||||
var overlay = document.getElementById('overlay');
|
||||
if (overlay) overlay.classList.remove('hidden');
|
||||
arrow.style.transform = 'rotate(90deg)';
|
||||
}
|
||||
}
|
||||
|
||||
function closeShowroom() {
|
||||
var panel = document.getElementById('showroom-panel');
|
||||
var arrow = document.getElementById('showroom-arrow');
|
||||
if (panel) panel.classList.add('hidden');
|
||||
if (arrow) arrow.style.transform = '';
|
||||
}
|
||||
|
||||
function closeAll() {
|
||||
var megaMenu = document.getElementById('mega-menu');
|
||||
var panel = document.getElementById('showroom-panel');
|
||||
var overlay = document.getElementById('overlay');
|
||||
var arrow = document.getElementById('showroom-arrow');
|
||||
|
||||
if (megaMenu) megaMenu.classList.add('hidden');
|
||||
if (panel) panel.classList.add('hidden');
|
||||
if (overlay) overlay.classList.add('hidden');
|
||||
if (arrow) arrow.style.transform = '';
|
||||
cancelMenuClose();
|
||||
}
|
||||
|
||||
function showSearch() {
|
||||
closeAll();
|
||||
var popup = document.getElementById('search-popup');
|
||||
if (!popup) return;
|
||||
popup.classList.remove('hidden');
|
||||
popup.style.display = 'flex';
|
||||
}
|
||||
|
||||
function hideSearch() {
|
||||
var popup = document.getElementById('search-popup');
|
||||
if (!popup) return;
|
||||
popup.style.display = 'none';
|
||||
popup.classList.add('hidden');
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') {
|
||||
closeAll();
|
||||
hideSearch();
|
||||
}
|
||||
});
|
||||
|
||||
window.switchCat = switchCat;
|
||||
window.showMenu = showMenu;
|
||||
window.scheduleMenuClose = scheduleMenuClose;
|
||||
window.cancelMenuClose = cancelMenuClose;
|
||||
window.toggleShowroom = toggleShowroom;
|
||||
window.closeShowroom = closeShowroom;
|
||||
window.closeAll = closeAll;
|
||||
window.showSearch = showSearch;
|
||||
window.hideSearch = hideSearch;
|
||||
})();
|
||||
</script>
|
||||
@@ -1,3 +1,6 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
|
||||
|
||||
<!-- plugin upload image -->
|
||||
<link href="https://unpkg.com/filepond/dist/filepond.min.css" rel="stylesheet" />
|
||||
<link href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css"
|
||||
@@ -361,6 +364,23 @@
|
||||
}
|
||||
|
||||
|
||||
function initHomepageBannerSlider() {
|
||||
if (typeof Swiper === "undefined") return
|
||||
if (!document.querySelector(".homepage-banner-slider")) return
|
||||
|
||||
new Swiper(".homepage-banner-slider", {
|
||||
loop: true,
|
||||
autoplay: {
|
||||
delay: 3500,
|
||||
disableOnInteraction: false,
|
||||
},
|
||||
pagination: {
|
||||
el: ".homepage-banner-pagination",
|
||||
clickable: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function initAdminHomeTab() {
|
||||
document.querySelectorAll("#js-admin-home-tab a").forEach(function (link) {
|
||||
link.addEventListener("click", function (event) {
|
||||
@@ -389,6 +409,7 @@
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
initHomepageBannerSlider()
|
||||
initCustomerAcquisitionChart()
|
||||
initRevenueStatisticsChart()
|
||||
initGlobalSalesChart()
|
||||
@@ -405,4 +426,4 @@
|
||||
allowMultiple: true,
|
||||
labelIdle: 'Kéo thả file hoặc <span class="filepond--label-action">Chọn file</span>',
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts/dist/apexcharts.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/apexcharts/dist/apexcharts.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/simplebar/6.2.7/simplebar.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simplebar/6.2.7/simplebar.css" />
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.js"></script>
|
||||
|
||||
|
||||
<script src="https://unpkg.com/lucide@latest/dist/umd/lucide.min.js"></script>
|
||||
<script>
|
||||
lucide.createIcons();
|
||||
</script>
|
||||
{% include javascript/global %}
|
||||
|
||||
|
||||
{% if global.module == 'home' %}
|
||||
|
||||
Reference in New Issue
Block a user