fix danh mục
This commit is contained in:
@@ -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 {
|
||||
</div>
|
||||
|
||||
<div class="page-filters flex items-center gap-3 mb-4 shrink-0">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-[10px] font-bold uppercase text-on-surface-variant">Danh mục</span>
|
||||
<select id="assetBorrowTypeFilter" class="bg-surface-container-low border-slate-200 rounded-md text-[11px] py-1 px-2 pr-6 focus:ring-1 focus:ring-primary shadow-sm">
|
||||
<option value="" ${!this.assetBorrowTypeFilter ? 'selected' : ''}>Tất cả</option>
|
||||
<option value="borrow" ${this.assetBorrowTypeFilter === 'borrow' ? 'selected' : ''}>Mượn tài sản</option>
|
||||
<option value="return" ${this.assetBorrowTypeFilter === 'return' ? 'selected' : ''}>Trả tài sản</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5 flex-1">
|
||||
<span class="text-[10px] font-bold uppercase text-on-surface-variant">Tìm kiếm</span>
|
||||
<input
|
||||
@@ -3302,6 +3318,19 @@ class AccountManager {
|
||||
}
|
||||
|
||||
setupAssetBorrowListeners() {
|
||||
const typeFilter = document.getElementById('assetBorrowTypeFilter');
|
||||
if (typeFilter && typeFilter.dataset.boundChange !== 'true') {
|
||||
typeFilter.addEventListener('change', event => {
|
||||
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) => {
|
||||
|
||||
Reference in New Issue
Block a user