diff --git a/assets/script/global.js b/assets/script/global.js index 443a4c1..2ea4e56 100644 --- a/assets/script/global.js +++ b/assets/script/global.js @@ -1,40 +1,21 @@ -"use strict"; -const AdminFunction = (() => { - function capNhatTrangThaiMenu(e) { - !1 === e ? $("#js-admin-content-container").addClass("show-large-menu") : $("#js-admin-content-container").removeClass("show-large-menu"), $("#js-menu-big").toggleClass("hidden", e), $("#js-menu-small").toggleClass("hidden", !e), $("#js-form-search").toggleClass("menu-hide", e), localStorage.setItem(e ? "menu_big" : "menu_small", "hidden"), localStorage.removeItem(e ? "menu_small" : "menu_big"); - } - function e(e) { - let t = null; - return function (...n) { - const o = this, a = function () { - t = null, n.length > 0 && !e && func.apply(o, n); - }, i = e && !t; - clearTimeout(t), t = setTimeout(a, wait), i && func.apply(o, n); - }; - } - function t(t) { - $("#status_" + t).html('Đang xử lý..'), setTimeout(() => { - $("#status_" + t).html(""); - }, 1e3); - } - function n(e) { - $(e).keyup((() => { - $("#js-show-search").show(); - })); - $("body").click((() => { - $("#js-show-search").hide(); - })); - } - function o(e) { - $("#js-status-hottype-" + e).html('Đang xử lý..'), setTimeout(() => { - $("#js-status-hottype-" + e).html(""); - }, 1e3); - } - function i(e) { - $("#overlay").addClass("active"), $(".status-notificatiom").addClass("active"), !0 === e ? $(".status-notificatiom .content").html(' Cập nhật thành công\n
Đơn hàng #000-368 đã được cập nhật thành công
') : $(".status-notificatiom .content").html(' Lỗi cập nhậtCó một số vấn đề với hoạt động của bạn.
'); - } - function r() { - $("#overlay").removeClass("active"), $(".status-notificatiom").removeClass("active"); - } - return { capNhatTrangThaiMenu: capNhatTrangThaiMenu, add_product_to_category: t, run_search: n, update_product_hot: o, checkForm: i, closeForm: r }; +const o = /* @__PURE__ */ (() => { + function a(t) { + const s = $("#status_" + t); + s.html('Processing...'), setTimeout(() => { + s.html(""); + }, 1e3); + } + function n(t) { + const s = $("#js-status-hottype-" + t); + s.html('Processing...'), setTimeout(() => { + s.html(""); + }, 1e3); + } + return { + addProductToCategory: a, + markProductAsHot: n + }; })(); +export { + o as default +}; diff --git a/assets/typescript/main.js b/assets/typescript/main.js deleted file mode 100644 index c514bb2..0000000 --- a/assets/typescript/main.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -var AdminFunctions = (function () { - function toggleMenuVisibility(hideLargeMenu) { - var contentContainer = $('#js-admin-content-container'); - var largeMenu = $('#js-menu-big'); - var smallMenu = $('#js-menu-small'); - var searchForm = $('#js-form-search'); - contentContainer.toggleClass('show-large-menu', !hideLargeMenu); - largeMenu.toggleClass('hidden', hideLargeMenu); - smallMenu.toggleClass('hidden', !hideLargeMenu); - searchForm.toggleClass('menu-hide', hideLargeMenu); - localStorage.setItem(hideLargeMenu ? 'menu_big' : 'menu_small', 'hidden'); - localStorage.removeItem(hideLargeMenu ? 'menu_small' : 'menu_big'); - } - function debounce(func, wait, immediate) { - var timeout = null; - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var context = this; - var later = function () { - timeout = null; - if (!immediate) - func.apply(context, args); - }; - var callNow = immediate && !timeout; - if (timeout !== null) { - clearTimeout(timeout); - } - timeout = setTimeout(later, wait); - if (callNow) - func.apply(context, args); - }; - } - function addProductToCategory(productId) { - var statusElement = $('#status_' + productId); - statusElement.html('Processing...'); - setTimeout(function () { - statusElement.html(''); - }, 1000); - } - function searchSuggestions(inputSelector) { - $(inputSelector).keyup(debounce(function () { - $('#js-show-search').show(); - }, 300, false)); - $('body').click(function () { - $('#js-show-search').hide(); - }); - } - function markProductAsHot(productId) { - var statusElement = $('#js-status-hottype-' + productId); - statusElement.html('Processing...'); - setTimeout(function () { - statusElement.html(''); - }, 1000); - } - return { - toggleMenuVisibility: toggleMenuVisibility, - addProductToCategory: addProductToCategory, - searchSuggestions: searchSuggestions, - markProductAsHot: markProductAsHot - }; -})(); diff --git a/assets/typescript/main.ts b/assets/typescript/main.ts index f79d7b6..852bca1 100644 --- a/assets/typescript/main.ts +++ b/assets/typescript/main.ts @@ -1,46 +1,12 @@ "use strict"; interface AdminFunctions { - toggleMenuVisibility(hideLargeMenu: boolean): void; addProductToCategory(productId: string): void; - searchSuggestions(inputSelector: string): void; markProductAsHot(productId: string): void; } const AdminFunctions: AdminFunctions = (() => { - function toggleMenuVisibility(hideLargeMenu: boolean): void { - const contentContainer = $('#js-admin-content-container'); - const largeMenu = $('#js-menu-big'); - const smallMenu = $('#js-menu-small'); - const searchForm = $('#js-form-search'); - - contentContainer.toggleClass('show-large-menu', !hideLargeMenu); - largeMenu.toggleClass('hidden', hideLargeMenu); - smallMenu.toggleClass('hidden', !hideLargeMenu); - searchForm.toggleClass('menu-hide', hideLargeMenu); - - localStorage.setItem(hideLargeMenu ? 'menu_big' : 'menu_small', 'hidden'); - localStorage.removeItem(hideLargeMenu ? 'menu_small' : 'menu_big'); - } - - function debounce(func: (...args: any[]) => void, wait: number, immediate: boolean) { - let timeout: ReturnType