fix - ASS-OLD
This commit is contained in:
@@ -2896,6 +2896,7 @@ class AccountManager {
|
||||
item.BorrowerName,
|
||||
item.AssetCode,
|
||||
item.AssetName,
|
||||
isArchived ? 'Tài sản cũ' : 'Danh mục hiện tại',
|
||||
this.getAssetRequestTypeMeta(item.RequestType).label,
|
||||
this.getAssetRequestStatusMeta(item.RequestStatus, item).label,
|
||||
item.Unit,
|
||||
@@ -5072,7 +5073,7 @@ class AccountManager {
|
||||
class="border border-amber-300 text-amber-700 px-4 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 hover:bg-amber-50"
|
||||
>
|
||||
<span class="material-symbols-outlined text-base">history</span>
|
||||
Tài sản cũ còn mượn
|
||||
Tài sản cũ
|
||||
</button>
|
||||
<button
|
||||
id="addAssetBorrowRequestBtn"
|
||||
@@ -5808,8 +5809,8 @@ class AccountManager {
|
||||
const countNode = document.getElementById('bulkDeleteAssetsConfirmCount');
|
||||
const titleNode = document.getElementById('bulkDeleteAssetsConfirmTitle');
|
||||
const message = archiveAll
|
||||
? 'Xóa toàn bộ danh mục tài sản hiện tại để nhập dữ liệu mới? Lịch sử và số lượng còn đang mượn được giữ trong tài sản cũ. Dữ liệu nhập mới được quản lý riêng, kể cả khi trùng mã tài sản.'
|
||||
: `Xóa ${selectedCount} tài sản đã chọn khỏi danh mục hiện tại? Lịch sử mượn/trả và số lượng còn đang mượn vẫn được giữ trong tài sản cũ.`;
|
||||
? 'Xóa toàn bộ danh mục tài sản hiện tại để nhập dữ liệu mới? Toàn bộ hồ sơ được lưu trong Tài sản cũ, gồm cả lịch sử và số lượng còn đang mượn. Dữ liệu nhập mới được quản lý riêng, kể cả khi trùng mã tài sản.'
|
||||
: `Xóa ${selectedCount} tài sản đã chọn khỏi danh mục hiện tại? Toàn bộ hồ sơ, lịch sử mượn/trả và số lượng còn đang mượn vẫn được giữ trong Tài sản cũ.`;
|
||||
|
||||
if (!modal || !messageNode || !countNode) {
|
||||
return window.confirm(message);
|
||||
@@ -6714,7 +6715,7 @@ class AccountManager {
|
||||
</button>
|
||||
<button id="openArchivedAssetBorrowsBtn" class="border border-amber-300 text-amber-700 px-3 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 hover:bg-amber-50">
|
||||
<span class="material-symbols-outlined text-base">history</span>
|
||||
Tài sản cũ còn mượn
|
||||
Tài sản cũ
|
||||
</button>
|
||||
<button id="importAssetBtn" class="border border-slate-300 text-slate-700 px-3 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95 ${canManageAssets ? 'hover:bg-slate-100' : 'opacity-50 cursor-not-allowed'}" ${canManageAssets ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">upload_file</span>
|
||||
@@ -7201,7 +7202,7 @@ class AccountManager {
|
||||
}
|
||||
}
|
||||
|
||||
getArchivedOutstandingAssets() {
|
||||
getFilteredArchivedAssets() {
|
||||
const search = String(this.archivedAssetSearchTerm || '').trim().toLowerCase();
|
||||
return (this.archivedAssets || []).map(asset => {
|
||||
const borrowerQuantity = this.parseBorrowerEntries(asset.Borrower)
|
||||
@@ -7210,28 +7211,38 @@ class AccountManager {
|
||||
...asset,
|
||||
OutstandingQuantity: Math.max(borrowerQuantity, this.parseNonNegativeInteger(asset.ExportInPeriod, 0))
|
||||
};
|
||||
}).filter(asset => asset.OutstandingQuantity > 0 && (!search || [
|
||||
asset.AssetCode, asset.AssetName, asset.Model, asset.SerialNumber,
|
||||
this.formatBorrowerSummaryText(asset.Borrower), asset.Department, asset.Project, asset.Location
|
||||
].some(value => String(value || '').toLowerCase().includes(search))));
|
||||
}).filter(asset => !search || [
|
||||
asset.AssetId, asset.AssetCode, asset.AssetName, asset.Model, asset.SerialNumber,
|
||||
this.formatBorrowerSummaryText(asset.Borrower), asset.Department, asset.Project,
|
||||
asset.Location, asset.Custodian, asset.Notes, this.formatDateOnly(asset.ArchivedDate)
|
||||
].some(value => String(value || '').toLowerCase().includes(search)));
|
||||
}
|
||||
|
||||
getArchivedOutstandingAssets() {
|
||||
return this.getFilteredArchivedAssets().filter(asset => asset.OutstandingQuantity > 0);
|
||||
}
|
||||
|
||||
renderArchivedAssetBorrowsTable() {
|
||||
const tableBody = document.getElementById('archivedAssetBorrowsTableBody');
|
||||
if (!tableBody) return;
|
||||
const rows = this.getArchivedOutstandingAssets();
|
||||
const rows = this.getFilteredArchivedAssets();
|
||||
tableBody.innerHTML = rows.length ? rows.map(asset => `
|
||||
<tr class="border-b border-slate-100">
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml(asset.AssetCode || '-')}<div class="text-[11px] text-slate-500">Hồ sơ cũ #${Number(asset.AssetId) || 0}</div></td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml(asset.AssetName || '-')}<div class="text-[11px] text-slate-500">${this.escapeHtml(asset.SerialNumber || '')}</div></td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700 whitespace-pre-line">${this.escapeHtml(this.formatBorrowerSummaryText(asset.Borrower) || 'Chưa có tên người mượn')}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml(asset.AssetName || '-')}<div class="text-[11px] text-slate-500">${this.escapeHtml([asset.Model, asset.SerialNumber].filter(Boolean).join(' · '))}</div></td>
|
||||
<td class="px-4 py-3 text-sm text-slate-600 whitespace-nowrap">${this.escapeHtml(this.formatDateTime(asset.ArchivedDate))}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.parseNonNegativeInteger(asset.Quantity, 0)}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.parseNonNegativeInteger(asset.ImportInPeriod, 0)}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.parseNonNegativeInteger(asset.ExportInPeriod, 0)}</td>
|
||||
<td class="px-4 py-3 text-sm font-bold text-slate-700">${this.parseNonNegativeInteger(asset.EndingBalance, 0)}</td>
|
||||
<td class="px-4 py-3 text-sm font-bold text-slate-700">${asset.OutstandingQuantity}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml(asset.Unit || '-')}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml(asset.Project || asset.Department || '-')}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700 whitespace-pre-line">${this.escapeHtml(this.formatBorrowerSummaryText(asset.Borrower) || '-')}</td>
|
||||
<td class="px-4 py-3 text-sm text-slate-700">${this.escapeHtml([asset.Department, asset.Project].filter(Boolean).join(' / ') || '-')}</td>
|
||||
</tr>
|
||||
`).join('') : '<tr><td colspan="6" class="px-4 py-8 text-center text-sm text-slate-500">Không có tài sản cũ còn mượn phù hợp.</td></tr>';
|
||||
`).join('') : '<tr><td colspan="11" class="px-4 py-8 text-center text-sm text-slate-500">Không có tài sản cũ phù hợp.</td></tr>';
|
||||
const count = document.getElementById('archivedAssetBorrowsCount');
|
||||
if (count) count.textContent = `${rows.length} hồ sơ tài sản cũ còn mượn`;
|
||||
if (count) count.textContent = `${rows.length}/${(this.archivedAssets || []).length} hồ sơ tài sản cũ`;
|
||||
}
|
||||
|
||||
async openArchivedAssetBorrowsModal() {
|
||||
|
||||
Reference in New Issue
Block a user