44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
"use strict";
|
|
const AdminFunction = (() => {
|
|
function e(e, t, n) {
|
|
let o = null;
|
|
return function (...a) {
|
|
const i = this,
|
|
r = function () {
|
|
o = null, !n && e.apply(i, a)
|
|
};
|
|
const c = n && !o;
|
|
clearTimeout(o), o = setTimeout(r, t), c && e.apply(i, a)
|
|
}
|
|
}
|
|
|
|
function t(e) {
|
|
$("#js-admin-content-container").toggleClass("show-large-menu", !e), $("#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")
|
|
}
|
|
return {
|
|
capNhatTrangThaiMenu: t,
|
|
add_product_to_category: function (e) {
|
|
$("#status_" + e).html('<span class="loading loading-bars loading-sm"></span><span class="ml-[3px]">Đang xử lý..</span>'), setTimeout(() => {
|
|
$("#status_" + e).html("")
|
|
}, 1e3)
|
|
},
|
|
run_search: function (e) {
|
|
$(e).keyup(e => {
|
|
! function (e) {
|
|
$("#js-show-search").show()
|
|
}(e.target)
|
|
}), $("body").click(() => {
|
|
$("#js-show-search").hide()
|
|
})
|
|
},
|
|
update_product_hot: function (e) {
|
|
$("#js-status-hottype-" + e).html('<span class="loading loading-bars loading-sm"></span><span class="ml-[3px]">Đang xử lý..</span>'), setTimeout(() => {
|
|
$("#js-status-hottype-" + e).html("")
|
|
}, 1e3)
|
|
},
|
|
searchSelect: function (e) {
|
|
$(e).select2()
|
|
}
|
|
}
|
|
})();
|