diff --git a/public/js/app.js b/public/js/app.js index 853ecb9..b75b421 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -39,6 +39,7 @@ class AccountManager { this.assetStatusFilter = ''; this.assetBorrows = []; this.assetBorrowSearchTerm = ''; + this.assetBorrowTypeFilter = ''; this.myBorrowedAssetSearchTerm = ''; this.assetBorrowProductSearchTimer = undefined; this.assetBorrowProductItems = []; @@ -1471,9 +1472,16 @@ class AccountManager { getFilteredAssetBorrows() { const search = String(this.assetBorrowSearchTerm || '').toLowerCase(); + const typeFilter = String(this.assetBorrowTypeFilter || '').trim().toLowerCase(); const rows = Array.isArray(this.assetBorrows) ? this.assetBorrows : []; return rows.filter(item => { + const requestType = this.normalizeAssetRequestType(item.RequestType); + const matchesType = !typeFilter || requestType === typeFilter; + if (!matchesType) { + return false; + } + if (!search) { return true; } @@ -3220,6 +3228,14 @@ class AccountManager {
+
+ Danh mục + +
Tìm kiếm { + const nextValue = String(event.target.value || '').trim().toLowerCase(); + this.assetBorrowTypeFilter = (nextValue === 'borrow' || nextValue === 'return') + ? nextValue + : ''; + this.assetBorrowPage = 1; + this.renderAssetBorrowsTableBody(); + }); + typeFilter.dataset.boundChange = 'true'; + } + const searchInput = document.getElementById('assetBorrowSearch'); if (searchInput && searchInput.dataset.boundInput !== 'true') { searchInput.addEventListener('input', (event) => {