diff --git a/assets/script/main.js b/assets/script/main.js index b425752..51a8afb 100644 --- a/assets/script/main.js +++ b/assets/script/main.js @@ -1,6 +1,23 @@ "use strict"; var AdminFunction = (function () { + + + function capNhatTrangThaiMenu(hideMenuBig) { + + if (hideMenuBig === false) { + $('#js-admin-content-container').addClass('show-large-menu') + } else { + $('#js-admin-content-container').removeClass('show-large-menu') + } + + $('#js-menu-big').toggleClass('hidden', hideMenuBig); + $('#js-menu-small').toggleClass('hidden', !hideMenuBig); + $('#js-form-search').toggleClass('menu-hide', hideMenuBig); + localStorage.setItem(hideMenuBig ? 'menu_big' : 'menu_small', 'hidden'); + localStorage.removeItem(hideMenuBig ? 'menu_small' : 'menu_big'); + } + function add_product_to_category(id) { $('#status_' + id).html('Đang xử lý..'); setTimeout(function () { @@ -8,8 +25,39 @@ var AdminFunction = (function () { }, 1000) } + function run_search(holder) { + + $(holder).keyup(debounce(function () { + var inputString = $(this).val(); + $('#js-show-search').show() + }, 300)); + + $('body').click(function () { + $("#js-show-search").hide(); + }); + + + } + + + function update_product_hot(id) { + $('#js-status-hottype-' + id).html('Đang xử lý..'); + setTimeout(function () { + $('#js-status-hottype-' + id).html(''); + }, 1000) + } + + + function searchSelect(holder) { + $(holder).select2(); + } + return { - add_product_to_category: add_product_to_category + capNhatTrangThaiMenu: capNhatTrangThaiMenu, + add_product_to_category: add_product_to_category, + run_search: run_search, + searchSelect: searchSelect, + update_product_hot: update_product_hot } })(); diff --git a/assets/script/pc_style.css b/assets/script/pc_style.css index 92d020c..f18c3a7 100644 --- a/assets/script/pc_style.css +++ b/assets/script/pc_style.css @@ -911,28 +911,27 @@ input[type=radio]:focus:before { vertical-align: inherit; } +#js-form-search [type=search]:focus::before { + position: absolute; + content: "\f00d"; + font-family: "Font Awesome 6 Free"; + font-weight: 900; + left: 0; + top: 0; +} + +.autocomplete-suggestions { + height: 334px; + overflow-y: auto; + z-index: 999; +} .autocomplete-suggestions .item { - padding: 12px 0; + padding: 10px 15px; border-bottom: 1px solid #ededed; } -.autocomplete-suggestions .item .info { - width: calc(100% - 108px); - margin-right: 48px; -} -.autocomplete-suggestions .item img { - width: 60px; - display: block; -} -.autocomplete-suggestions .item .name { - font-weight: 600; - line-height: 20px; -} -.autocomplete-suggestions .item .price { - font-weight: 600; - color: #fb4e4e; - line-height: 20px; - display: block; - margin-top: 5px; +.autocomplete-suggestions .item:hover { + font-weight: 700; + background: #f6f6f6; } .table-list-customer th { @@ -1268,4 +1267,9 @@ input[type=radio]:focus:before { } .list-category .style-checkbox { color: #919699; +} + +.order-detail-page .select2-container { + width: 100% !important; + margin-top: 10px; }/*# sourceMappingURL=pc_style.css.map */ \ No newline at end of file diff --git a/assets/script/pc_style.scss b/assets/script/pc_style.scss index ebd747c..5741c6a 100644 --- a/assets/script/pc_style.scss +++ b/assets/script/pc_style.scss @@ -941,28 +941,25 @@ input[type="radio"] { } } +#js-form-search [type="search"]:focus::before { + position: absolute; + content: "\f00d"; + font-family: "Font Awesome 6 Free"; + font-weight: 900; + left: 0; + top: 0; +} + .autocomplete-suggestions { + height: 334px; + overflow-y: auto; + z-index: 999; .item { - padding: 12px 0; + padding: 10px 15px; border-bottom: 1px solid #ededed; - .info { - width: calc(100% - 108px); - margin-right: 48px; - } - img { - width: 60px; - display: block; - } - .name { - font-weight: 600; - line-height: 20px; - } - .price { - font-weight: 600; - color: #fb4e4e; - line-height: 20px; - display: block; - margin-top: 5px; + &:hover { + font-weight: 700; + background: #f6f6f6; } } } @@ -1314,3 +1311,8 @@ input[type="radio"] { color: #919699; } } + +.order-detail-page .select2-container { + width: 100% !important; + margin-top: 10px; +} diff --git a/template/javascript/global.html b/template/javascript/global.html index 848f824..cd0d22e 100644 --- a/template/javascript/global.html +++ b/template/javascript/global.html @@ -5,35 +5,71 @@ // Sự kiện click để hiển thị menu $('#js-show-menu').click(function () { - capNhatTrangThaiMenu(false); + AdminFunction.capNhatTrangThaiMenu(false); }); // Sự kiện click để ẩn menu $('#js-hide-menu').click(function () { - capNhatTrangThaiMenu(true); + AdminFunction.capNhatTrangThaiMenu(true); }); // Kiểm tra localStorage và thiết lập trạng thái ban đầu của menu const hideMenuBig = localStorage.getItem('menu_big') === 'hidden'; - capNhatTrangThaiMenu(hideMenuBig); + AdminFunction.capNhatTrangThaiMenu(hideMenuBig); + + AdminFunction.run_search('#js-input-search') + + AdminFunction.searchSelect('#js-assign-admin'); + + AdminFunction.searchSelect('#js-order-status-select'); + }) - // Hàm để cập nhật trạng thái hiển thị menu và localStorage - function capNhatTrangThaiMenu(hideMenuBig) { - if (hideMenuBig === false) { - $('#js-admin-content-container').addClass('show-large-menu') - } else { - $('#js-admin-content-container').removeClass('show-large-menu') - } + function debounce(func, wait, immediate) { + var timeout; + return function () { + var context = this, args = arguments; + var later = function () { + timeout = null; + if (!immediate) func.apply(context, args); + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + }; - $('#js-menu-big').toggleClass('hidden', hideMenuBig); - $('#js-menu-small').toggleClass('hidden', !hideMenuBig); - $('#js-form-search').toggleClass('menu-hide', hideMenuBig); - localStorage.setItem(hideMenuBig ? 'menu_big' : 'menu_small', 'hidden'); - localStorage.removeItem(hideMenuBig ? 'menu_small' : 'menu_big'); + function getTextAreaSelection(textarea) { + var start = textarea.selectionStart, end = textarea.selectionEnd; + return { + start: start, + end: end, + length: end - start, + text: textarea.value.slice(start, end) + }; } + function detectPaste(textarea, callback) { + textarea.onpaste = function () { + var sel = getTextAreaSelection(textarea); + var initialLength = textarea.value.length; + window.setTimeout(function () { + var val = textarea.value; + var pastedTextLength = val.length - (initialLength - sel.length); + var end = sel.start + pastedTextLength; + callback({ + start: sel.start, + end: end, + length: pastedTextLength, + text: val.slice(sel.start, end) + }); + }, 1); + }; + } + // end search + function formatCurrency(a) { var b = parseFloat(a).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1.").toString(); diff --git a/template/order/detail.html b/template/order/detail.html index fcc38b0..db062ed 100644 --- a/template/order/detail.html +++ b/template/order/detail.html @@ -4,14 +4,25 @@
Đơn hàng #000-368
-Thời gian: 16-11-2023, 9:59 am
+Thời gian: 16-11-2023, 9:59 am
Nhân sự xử lý đơn hàng
Ghi chú
- - + +