update export
This commit is contained in:
@@ -37,7 +37,7 @@ class Browser {
|
||||
}
|
||||
}
|
||||
|
||||
test('Chrome submits project export proposals, approves/rejects, isolates creators and displays saved files on desktop/mobile', {
|
||||
test('Chrome preserves project export proposals and supports immediate manager exports for others on desktop/mobile', {
|
||||
skip: process.env.ACCMANAGER_EXPORT_BROWSER_TEST !== '1' ? 'Set ACCMANAGER_EXPORT_BROWSER_TEST=1 for isolated Chrome and SQL checks' : false,
|
||||
timeout: 120000
|
||||
}, async () => {
|
||||
@@ -49,6 +49,9 @@ test('Chrome submits project export proposals, approves/rejects, isolates creato
|
||||
f.app.get('/api/asset-projects', (_req, res) => res.json({ success: true, data: [
|
||||
{ ProjectId: 1, ProjectName: 'Dự án A' }, { ProjectId: 2, ProjectName: 'Dự án B' }
|
||||
] }));
|
||||
f.app.get('/api/users', (_req, res) => res.json({ success: true, data: [
|
||||
{ UserId: 1, FullName: 'Nguyễn An' }, { UserId: 2, FullName: 'Trần Bình' }, { UserId: 3, FullName: 'Quản lý kho' }
|
||||
] }));
|
||||
f.app.use('/api', (_req, res) => res.json({ success: true, data: [], unreadCount: 0, pagination: { total: 0, totalPages: 1 } }));
|
||||
f.app.get('/test-xlsx.js', (_req, res) => res.sendFile(require.resolve('xlsx/dist/xlsx.full.min.js')));
|
||||
f.app.get('/test-notiflix.js', (_req, res) => res.type('js').send('window.Notiflix={Notify:{init(){},success(){},failure(){},warning(){}}};'));
|
||||
@@ -71,6 +74,7 @@ test('Chrome submits project export proposals, approves/rejects, isolates creato
|
||||
await client.send('Emulation.setDeviceMetricsOverride', { width: 1600, height: 1050, deviceScaleFactor: 1, mobile: false });
|
||||
await client.send('Page.navigate', { url: `${f.origin}/pages/index.html#assets` });
|
||||
await client.until('typeof app !== "undefined" && app?.assets?.length === 3 && !!document.getElementById("borrowAssetBtn")');
|
||||
assert.equal(await client.evaluate('!!document.getElementById("exportAssetForOthersBtn")'), false);
|
||||
await client.evaluate(`document.querySelector('.asset-row-checkbox[data-asset-id="1"]').click(); document.getElementById('borrowAssetBtn').click()`);
|
||||
await client.until('document.getElementById("borrowAssetModal").classList.contains("open")');
|
||||
assert.equal(await client.evaluate('document.getElementById("borrowAssetUserInput").value'), 'Nguyễn An');
|
||||
@@ -122,7 +126,57 @@ test('Chrome submits project export proposals, approves/rejects, isolates creato
|
||||
await client.send('Page.reload');
|
||||
await client.until('typeof app !== "undefined" && app?.currentUser?.UserId === 2 && !app.assetExportLoading && !!document.getElementById("assetExportsTableBody")');
|
||||
assert.equal(await client.evaluate('app.assetExportRequests.length'), 0);
|
||||
assert.equal(await client.evaluate('!!document.getElementById("createAssetExportForOthersBtn")'), false);
|
||||
// The additional manager action exports immediately; the proposal action remains available.
|
||||
await client.send('Network.setExtraHTTPHeaders', { headers: { 'x-test-user': '3', 'x-test-role': 'admin' } });
|
||||
await client.send('Page.reload');
|
||||
await client.until('typeof app !== "undefined" && app?.currentUser?.Role === "admin" && !!document.getElementById("createAssetExportForOthersBtn")');
|
||||
await client.evaluate('document.getElementById("createAssetExportForOthersBtn").click()');
|
||||
await client.until('typeof app !== "undefined" && app?.currentUser?.Role === "admin" && app.assets.length === 3 && !!document.getElementById("exportAssetForOthersBtn")');
|
||||
await client.evaluate(`app.downloadBlobFile=(blob,name)=>{window.savedDownload={size:blob.size,name}}; document.querySelector('.asset-row-checkbox[data-asset-id="1"]').click(); document.getElementById('exportAssetForOthersBtn').click()`);
|
||||
await client.until('document.getElementById("borrowAssetModal").classList.contains("open")');
|
||||
assert.equal(await client.evaluate('document.getElementById("borrowAssetRecipientInput").required'), true);
|
||||
assert.equal(await client.evaluate('document.getElementById("borrowAssetRequesterField").hidden'), true);
|
||||
await client.evaluate('document.getElementById("borrowAssetRecipientInput").value="Trần Bình"; document.getElementById("borrowAssetProjectInput").value="Dự án A"; const quantity=document.getElementById("borrowQuantityInput"); quantity.value="2"; quantity.dispatchEvent(new Event("input",{bubbles:true})); document.querySelector("#borrowAssetForm button[type=submit]").scrollIntoView({block:"nearest"})');
|
||||
await delay(250);
|
||||
assert.equal(await client.evaluate('document.querySelector("#borrowAssetForm button[type=submit]").getBoundingClientRect().bottom <= innerHeight'), true);
|
||||
assert.equal(await client.evaluate('document.documentElement.scrollWidth <= innerWidth + 1'), true);
|
||||
await client.send('Page.captureScreenshot', { format: 'png' }).then(result => fs.writeFileSync(path.join(output, 'export-for-others-mobile.png'), Buffer.from(result.data, 'base64')));
|
||||
await client.evaluate('document.getElementById("borrowAssetForm").requestSubmit()');
|
||||
await client.until('!app.assetExportSubmitting && app.assets.find(row=>row.AssetId===1).EndingBalance===7 && window.savedDownload?.size>1000');
|
||||
assert.equal((await f.pool.request().query('SELECT COUNT(*) AS total FROM AssetExportRequests')).recordset[0].total, 2);
|
||||
assert.equal(await client.evaluate('location.hash'), '#assets');
|
||||
await client.evaluate(`app.closeModals(); document.querySelector('.asset-row-checkbox[data-asset-id="1"]').click(); document.getElementById('borrowAssetBtn').click()`);
|
||||
await client.until('document.getElementById("borrowAssetModal").classList.contains("open")');
|
||||
assert.equal(await client.evaluate('document.getElementById("borrowAssetForm").dataset.exportForOthers'), 'false');
|
||||
assert.equal(await client.evaluate('document.getElementById("borrowAssetRecipientInput").disabled'), true);
|
||||
assert.equal(await client.evaluate('document.querySelector("#borrowAssetForm button[type=submit]").textContent'), 'Gửi đơn chờ duyệt');
|
||||
// The asset role can export multiple items for a recipient in one saved document.
|
||||
await client.send('Network.setExtraHTTPHeaders', { headers: { 'x-test-user': '3', 'x-test-role': 'asset' } });
|
||||
await client.send('Page.reload');
|
||||
await client.until('typeof app !== "undefined" && app?.currentUser?.Role === "asset" && app.assets.length === 3 && !!document.getElementById("exportAssetForOthersBtn")');
|
||||
await client.send('Emulation.setDeviceMetricsOverride', { width: 1600, height: 1050, deviceScaleFactor: 1, mobile: false });
|
||||
await client.evaluate(`app.downloadBlobFile=(blob,name)=>{window.savedDownload={size:blob.size,name}}; document.querySelector('.asset-row-checkbox[data-asset-id="1"]').click(); document.querySelector('.asset-row-checkbox[data-asset-id="2"]').click(); document.getElementById('exportAssetForOthersBtn').click()`);
|
||||
await client.until('document.getElementById("batchAssetExportModal").classList.contains("open")');
|
||||
await client.evaluate('document.getElementById("batchAssetExportRecipientInput").value="Nguyễn An"; const common=document.getElementById("batchAssetExportCommonProject"); common.value="Dự án B"; common.dispatchEvent(new Event("change"))');
|
||||
await client.send('Page.captureScreenshot', { format: 'png' }).then(result => fs.writeFileSync(path.join(output, 'batch-export-for-others.png'), Buffer.from(result.data, 'base64')));
|
||||
await client.evaluate('document.getElementById("batchAssetExportForm").requestSubmit()');
|
||||
await client.until('!app.assetExportSubmitting && app.assets.find(row=>row.AssetId===1).EndingBalance===6 && window.savedDownload?.size>1000');
|
||||
assert.equal((await f.pool.request().query('SELECT EndingBalance FROM AssetInventory WHERE AssetId = 2')).recordset[0].EndingBalance, 3);
|
||||
assert.equal((await f.pool.request().query('SELECT COUNT(*) AS total FROM AssetExportRequests')).recordset[0].total, 2);
|
||||
const saved = (await f.pool.request().query('SELECT SnapshotJson FROM AssetExportDocuments ORDER BY ExportedDate DESC')).recordset;
|
||||
assert.equal(JSON.parse(saved[0].SnapshotJson).requesterName, 'Nguyễn An');
|
||||
assert.equal(JSON.parse(saved[1].SnapshotJson).requesterName, 'Trần Bình');
|
||||
await client.evaluate(`app.closeModals(); document.querySelector('.asset-row-checkbox[data-asset-id="1"]').click(); document.querySelector('.asset-row-checkbox[data-asset-id="2"]').click(); document.getElementById('borrowAssetBtn').click()`);
|
||||
await client.until('document.getElementById("batchAssetExportModal").classList.contains("open")');
|
||||
assert.equal(await client.evaluate('document.getElementById("batchAssetExportForm").dataset.exportForOthers'), 'false');
|
||||
assert.equal(await client.evaluate('document.getElementById("batchAssetExportRecipientInput").disabled'), true);
|
||||
assert.deepEqual(client.errors, []);
|
||||
} catch (err) {
|
||||
if (client) console.error('Browser failure state:', await client.evaluate(`({ url: location.href,
|
||||
role: typeof app !== 'undefined' && app?.currentUser?.Role, page: typeof app !== 'undefined' && app?.currentPage,
|
||||
assets: typeof app !== 'undefined' && app?.assets?.length, errors: document.body.innerText.slice(-500) })`), client.errors);
|
||||
throw err;
|
||||
} finally {
|
||||
if (client) client.socket.close();
|
||||
chrome.kill();
|
||||
|
||||
@@ -1,8 +1,54 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const sql = require('mssql');
|
||||
const XLSX = require('xlsx');
|
||||
const { createExportSqlFixture } = require('./asset-export-sql-fixture');
|
||||
|
||||
test('managers export for another recipient immediately while pending proposals remain separate', {
|
||||
skip: process.env.ACCMANAGER_EXPORT_SQL_TEST !== '1' ? 'Set ACCMANAGER_EXPORT_SQL_TEST=1 for a disposable database' : false,
|
||||
timeout: 120000
|
||||
}, async () => {
|
||||
const f = await createExportSqlFixture();
|
||||
try {
|
||||
const allocations = [{ projectName: 'Dự án A', quantity: 2 }, { projectName: 'Dự án B', quantity: 1 }];
|
||||
const stock = async id => (await f.pool.request().input('id', sql.Int, id)
|
||||
.query('SELECT EndingBalance, Borrower FROM AssetInventory WHERE AssetId = @id')).recordset[0];
|
||||
const payload = { borrowerName: 'Trần Bình', allocations, note: 'Cấp cho người khác' };
|
||||
for (const endpoint of ['/assets/1/export', '/assets/export']) {
|
||||
assert.equal((await f.request(endpoint, { method: 'POST', body: payload })).status, 403);
|
||||
}
|
||||
const pending = await f.request('/asset-export-requests', { user: 3, role: 'admin', method: 'POST', body: {
|
||||
borrowerName: 'Trần Bình', items: [{ assetId: 1, allocations }]
|
||||
} });
|
||||
assert.equal(pending.data.RequestStatus, 'pending'); assert.equal(pending.data.RequesterName, 'Quản lý kho');
|
||||
assert.equal((await stock(1)).EndingBalance, 10);
|
||||
const single = await f.request('/assets/1/export', { user: 3, role: 'admin', method: 'POST', body: payload });
|
||||
assert.equal(single.status, 200); assert.equal(single.data.length, 2);
|
||||
assert.equal((await stock(1)).EndingBalance, 7); assert.equal((await stock(1)).Borrower, null);
|
||||
const document = await f.request(`/asset-export-documents/${single.document.documentId}`, { user: 3, role: 'admin' });
|
||||
assert.equal(document.data.snapshot.borrowerName, 'Trần Bình');
|
||||
assert.equal(document.data.snapshot.exportedByName, 'Quản lý kho');
|
||||
const download = await f.request(`/asset-export-documents/${single.document.documentId}/download`, { user: 3, role: 'admin' });
|
||||
assert.deepEqual(download.buffer, Buffer.from(single.document.contentBase64, 'base64'));
|
||||
assert.ok(XLSX.read(download.buffer).Sheets.ycxvt);
|
||||
const batch = await f.request('/assets/export', { user: 3, role: 'asset', method: 'POST', body: {
|
||||
borrowerName: 'Nguyễn An', items: [{ assetId: 1, projectName: 'Dự án B', quantity: 1 },
|
||||
{ assetId: 2, projectName: 'Dự án A', quantity: 2 }]
|
||||
} });
|
||||
assert.equal(batch.status, 200); assert.equal(batch.data.length, 2);
|
||||
assert.equal((await stock(1)).EndingBalance, 6); assert.equal((await stock(2)).EndingBalance, 3);
|
||||
const requests = await f.request('/asset-export-requests', { user: 3, role: 'asset' });
|
||||
assert.equal(requests.data.length, 1); assert.equal(requests.data[0].RequestStatus, 'pending');
|
||||
const failed = await f.request('/assets/export', { user: 3, role: 'asset', method: 'POST', body: {
|
||||
borrowerName: 'Trần Bình', items: [{ assetId: 1, projectName: 'A', quantity: 1 },
|
||||
{ assetId: 2, projectName: 'A', quantity: 100 }]
|
||||
} });
|
||||
assert.equal(failed.status, 400);
|
||||
assert.equal((await stock(1)).EndingBalance, 6); assert.equal((await stock(2)).EndingBalance, 3);
|
||||
assert.equal((await f.pool.request().query('SELECT COUNT(*) AS total FROM AssetExportDocuments')).recordset[0].total, 2);
|
||||
} finally { await f.cleanup(); }
|
||||
});
|
||||
|
||||
test('SQL project export approvals preserve stock, ownership, documents, return isolation and concurrent decisions', {
|
||||
skip: process.env.ACCMANAGER_EXPORT_SQL_TEST !== '1' ? 'Set ACCMANAGER_EXPORT_SQL_TEST=1 for a disposable database' : false,
|
||||
timeout: 120000
|
||||
|
||||
@@ -6,20 +6,26 @@ const vm = require('node:vm');
|
||||
|
||||
function fixture() {
|
||||
const nodes = { borrowAssetIdInput: { value: '1' }, borrowAssetUserInput: { value: 'An' },
|
||||
borrowAssetProjectInput: { value: 'Dự án A' }, borrowQuantityInput: { value: '2' }, borrowAssetNoteInput: { value: '' } };
|
||||
const requests = [], messages = [];
|
||||
borrowAssetProjectInput: { value: 'Dự án A' }, borrowQuantityInput: { value: '2' }, borrowAssetNoteInput: { value: '' },
|
||||
borrowAssetForm: { dataset: {} }, borrowAssetRecipientInput: { value: 'Bình' },
|
||||
batchAssetExportForm: { dataset: {} }, batchAssetExportUserInput: { value: 'An' },
|
||||
batchAssetExportRecipientInput: { value: 'Bình' }, batchAssetExportNoteInput: { value: '' } };
|
||||
const requests = [], messages = [], documents = [], refreshes = [];
|
||||
const button = { disabled: false };
|
||||
const sandbox = { document: { addEventListener() {}, getElementById: id => nodes[id], querySelector: () => button, querySelectorAll: () => [] },
|
||||
window: {}, location: { hash: '#assets' }, console,
|
||||
fetch: async (url, options) => { requests.push({ url, options }); return { ok: true, json: async () => ({ success: true, data: { RequestStatus: 'pending' } }) }; } };
|
||||
fetch: async (url, options) => { requests.push({ url, options }); return { ok: true, json: async () => ({
|
||||
success: true, data: { RequestStatus: 'pending' }, document: { fileName: 'phieu-xuat.xlsx', contentBase64: 'ZmlsZQ==' }
|
||||
}) }; } };
|
||||
sandbox.window.fetch = sandbox.fetch;
|
||||
vm.runInNewContext(`${fs.readFileSync(path.join(__dirname, '../public/js/app.js'), 'utf8')}\napp = Object.create(AccountManager.prototype); globalThis.manager = app;`, sandbox);
|
||||
const manager = sandbox.manager;
|
||||
Object.assign(manager, { currentUser: { UserId: 1, Role: 'user', FullName: 'An' }, apiBase: '/api',
|
||||
selectedAssetIds: new Set([1]), assets: [{ AssetId: 1, AssetCode: 'TS-001', Quantity: 5, ExportInPeriod: 0, EndingBalance: 5 }],
|
||||
notifySuccess: message => messages.push(message), notifyFailure: message => messages.push(message), notifyWarning: message => messages.push(message),
|
||||
showExportRequestDocument: file => documents.push(file), refreshAssetsUI: async () => refreshes.push('assets'),
|
||||
closeModals() {} });
|
||||
return { manager, sandbox, requests, messages, nodes, button };
|
||||
return { manager, sandbox, requests, messages, nodes, button, documents, refreshes };
|
||||
}
|
||||
|
||||
test('ordinary users submit existing project allocations as pending proposals without downloading or changing stock', async () => {
|
||||
@@ -71,3 +77,80 @@ test('ordinary users cannot invoke the proposal decision UI', async () => {
|
||||
await f.manager.processAssetExportRequest(1, 'approved', '');
|
||||
assert.equal(f.requests.length, 0);
|
||||
});
|
||||
|
||||
test('admin and asset keep the existing single and batch pending proposal flows', async () => {
|
||||
for (const role of ['user', 'admin', 'asset']) {
|
||||
for (const batch of [false, true]) {
|
||||
const f = fixture(); f.manager.currentUser.Role = role;
|
||||
f.manager.collectBatchAssetExportItems = () => [{ assetId: 1, allocations: [{ projectName: 'Dự án A', quantity: 2 }] }];
|
||||
await f.manager[batch ? 'handleBatchAssetExportSubmit' : 'handleBorrowAssetSubmit']({ preventDefault() {} });
|
||||
assert.equal(f.requests[0].url, '/api/asset-export-requests');
|
||||
assert.equal(f.documents.length, 0); assert.equal(f.refreshes.length, 0);
|
||||
assert.match(f.messages[0], /chờ admin\/asset duyệt/);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('admin and asset can export selected assets to another recipient and download immediately', async () => {
|
||||
for (const role of ['admin', 'asset']) {
|
||||
for (const batch of [false, true]) {
|
||||
const f = fixture(); f.manager.currentUser.Role = role;
|
||||
f.nodes[batch ? 'batchAssetExportForm' : 'borrowAssetForm'].dataset.exportForOthers = 'true';
|
||||
f.manager.collectBatchAssetExportItems = () => [{ assetId: 1, allocations: [{ projectName: 'Dự án A', quantity: 2 }] }];
|
||||
await f.manager[batch ? 'handleBatchAssetExportSubmit' : 'handleBorrowAssetSubmit']({ preventDefault() {} });
|
||||
assert.equal(f.requests[0].url, batch ? '/api/assets/export' : '/api/assets/1/export');
|
||||
const body = JSON.parse(f.requests[0].options.body);
|
||||
assert.equal(body.borrowerName, 'Bình');
|
||||
assert.deepEqual(batch ? body.items[0].allocations : body.allocations, [{ projectName: 'Dự án A', quantity: 2 }]);
|
||||
assert.equal(f.documents[0].fileName, 'phieu-xuat.xlsx'); assert.deepEqual(f.refreshes, ['assets']);
|
||||
assert.equal(f.sandbox.location.hash, '#assets'); assert.equal(f.manager.selectedAssetIds.size, 0);
|
||||
assert.match(f.messages[0], /Bình/); assert.equal(f.button.disabled, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('exporting for others requires manager permission and a recipient for both forms', async () => {
|
||||
for (const batch of [false, true]) {
|
||||
for (const role of ['user', 'admin']) {
|
||||
const f = fixture(); f.manager.currentUser.Role = role;
|
||||
f.nodes[batch ? 'batchAssetExportForm' : 'borrowAssetForm'].dataset.exportForOthers = 'true';
|
||||
f.nodes[batch ? 'batchAssetExportRecipientInput' : 'borrowAssetRecipientInput'].value = '';
|
||||
f.manager.collectBatchAssetExportItems = () => [{ assetId: 1, allocations: [{ projectName: 'A', quantity: 1 }] }];
|
||||
await f.manager[batch ? 'handleBatchAssetExportSubmit' : 'handleBorrowAssetSubmit']({ preventDefault() {} });
|
||||
assert.equal(f.requests.length, 0); assert.equal(f.manager.selectedAssetIds.size, 1);
|
||||
assert.match(f.messages[0], role === 'user' ? /Asset\/Admin/ : /chọn người nhận/);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('reopening either form as a proposal clears the direct export mode and recipient validation', () => {
|
||||
for (const prefix of ['borrowAsset', 'batchAssetExport']) {
|
||||
const f = fixture();
|
||||
const form = f.nodes[`${prefix}Form`]; form.querySelector = () => f.button;
|
||||
for (const suffix of ['RequesterField', 'RecipientField', 'Title', 'Description']) f.nodes[`${prefix}${suffix}`] = {};
|
||||
f.nodes[`${prefix}RecipientInput`].id = `${prefix}RecipientInput`;
|
||||
f.manager.populateUserSelectOptions = id => { f.nodes[id].value = ''; };
|
||||
f.manager.configureAssetExportForm(prefix, true);
|
||||
assert.equal(form.dataset.exportForOthers, 'true'); assert.equal(f.nodes[`${prefix}RequesterField`].hidden, true);
|
||||
assert.equal(f.nodes[`${prefix}RecipientInput`].required, true); assert.equal(f.button.textContent, 'Xuất và tải Excel');
|
||||
f.nodes[`${prefix}RecipientInput`].value = 'Bình';
|
||||
f.manager.configureAssetExportForm(prefix, false);
|
||||
assert.equal(form.dataset.exportForOthers, 'false'); assert.equal(f.nodes[`${prefix}RequesterField`].hidden, false);
|
||||
assert.equal(f.nodes[`${prefix}RecipientField`].hidden, true); assert.equal(f.nodes[`${prefix}RecipientInput`].value, '');
|
||||
assert.equal(f.nodes[`${prefix}RecipientInput`].disabled, true); assert.equal(f.nodes[`${prefix}RecipientInput`].required, false);
|
||||
assert.equal(f.button.textContent, 'Gửi đơn chờ duyệt');
|
||||
}
|
||||
});
|
||||
|
||||
test('direct exports block duplicate submissions and preserve selection on server rejection', async () => {
|
||||
const f = fixture(); let complete;
|
||||
f.manager.currentUser.Role = 'asset'; f.nodes.borrowAssetForm.dataset.exportForOthers = 'true';
|
||||
f.sandbox.fetch = (url, options) => { f.requests.push({ url, options }); return new Promise(resolve => { complete = resolve; }); };
|
||||
const first = f.manager.handleBorrowAssetSubmit({ preventDefault() {} });
|
||||
await f.manager.handleBorrowAssetSubmit({ preventDefault() {} });
|
||||
assert.equal(f.requests.length, 1); assert.equal(f.button.disabled, true);
|
||||
complete({ ok: false, json: async () => ({ success: false, message: 'Không đủ tồn' }) });
|
||||
await first;
|
||||
assert.equal(f.manager.selectedAssetIds.size, 1); assert.equal(f.documents.length, 0);
|
||||
assert.equal(f.button.disabled, false); assert.equal(f.messages[0], 'Không đủ tồn');
|
||||
});
|
||||
|
||||
364
public/css/asset-actions.css
Normal file
364
public/css/asset-actions.css
Normal file
@@ -0,0 +1,364 @@
|
||||
/* Asset catalog actions: page utilities and actions on the current selection. */
|
||||
.assets-page {
|
||||
--asset-action-surface: #fff;
|
||||
--asset-action-text: #334155;
|
||||
--asset-action-muted: #64748b;
|
||||
--asset-action-border: #e2e8f0;
|
||||
--asset-action-tint: #f5f7ff;
|
||||
}
|
||||
|
||||
.assets-page .asset-page-heading {
|
||||
position: relative;
|
||||
z-index: 120;
|
||||
}
|
||||
|
||||
.asset-page-actions,
|
||||
.asset-selection-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
min-height: 2.5rem;
|
||||
padding: 0.5625rem 0.875rem;
|
||||
border: 1px solid var(--asset-action-border);
|
||||
border-radius: 0.625rem;
|
||||
background: var(--asset-action-surface);
|
||||
color: var(--asset-action-text);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
touch-action: manipulation;
|
||||
transition: border-color 0.15s, background-color 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
.asset-action-button .material-symbols-outlined,
|
||||
.asset-menu-item .material-symbols-outlined {
|
||||
flex-shrink: 0;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-button:hover:not(:disabled) {
|
||||
border-color: #b8c4e8;
|
||||
background: var(--asset-action-tint);
|
||||
color: #3755c3;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-primary {
|
||||
border-color: #3755c3;
|
||||
background: #3755c3;
|
||||
color: #fff;
|
||||
box-shadow: 0 2px 4px rgb(55 85 195 / 0.12);
|
||||
}
|
||||
|
||||
.assets-page .asset-action-primary:hover:not(:disabled) {
|
||||
border-color: #2848b7;
|
||||
background: #2848b7;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.asset-action-button:focus-visible,
|
||||
.asset-menu-item:focus-visible,
|
||||
.asset-selection-clear:focus-visible {
|
||||
outline: 2px solid #3755c3;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-button:disabled,
|
||||
.assets-page .asset-menu-item:disabled {
|
||||
color: #94a3b8;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.asset-action-menu {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.asset-action-menu > summary {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.asset-action-menu > summary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.asset-action-menu[open] > summary {
|
||||
border-color: #b8c4e8;
|
||||
color: #3755c3;
|
||||
background: var(--asset-action-tint);
|
||||
}
|
||||
|
||||
.asset-menu-chevron {
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
|
||||
.asset-action-menu[open] .asset-menu-chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.asset-menu-panel {
|
||||
position: absolute;
|
||||
top: calc(100% + 0.5rem);
|
||||
right: 0;
|
||||
z-index: 150;
|
||||
width: 19rem;
|
||||
max-width: calc(100vw - 2rem);
|
||||
max-height: min(28rem, calc(100dvh - 12rem));
|
||||
overflow-y: auto;
|
||||
padding: 0.375rem;
|
||||
border: 1px solid var(--asset-action-border);
|
||||
border-radius: 0.875rem;
|
||||
background: var(--asset-action-surface);
|
||||
box-shadow: 0 12px 36px rgb(15 23 42 / 0.12), 0 2px 6px rgb(15 23 42 / 0.04);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.assets-page .asset-menu-label {
|
||||
margin: 0;
|
||||
padding: 0.625rem 0.75rem 0.375rem;
|
||||
color: var(--asset-action-muted);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.assets-page .asset-menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.625rem 0.75rem;
|
||||
border: 0;
|
||||
border-radius: 0.5rem;
|
||||
background: transparent;
|
||||
color: var(--asset-action-text);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.asset-menu-item small,
|
||||
.asset-export-action small {
|
||||
display: block;
|
||||
margin-top: 0.1875rem;
|
||||
color: var(--asset-action-muted);
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.asset-menu-item:hover:not(:disabled) {
|
||||
background: var(--asset-action-tint);
|
||||
}
|
||||
|
||||
.asset-menu-item:disabled small {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.assets-page .asset-menu-danger {
|
||||
color: #c2413b;
|
||||
}
|
||||
|
||||
.asset-menu-danger:hover:not(:disabled) {
|
||||
background: #fff5f4;
|
||||
}
|
||||
|
||||
.asset-menu-divider {
|
||||
margin-top: 0.375rem !important;
|
||||
padding-top: 0.375rem;
|
||||
border-top: 1px solid var(--asset-action-border);
|
||||
}
|
||||
|
||||
.asset-selection-toolbar {
|
||||
position: relative;
|
||||
z-index: 110;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.75rem;
|
||||
padding: 0.75rem 0.875rem;
|
||||
border: 1px solid var(--asset-action-border);
|
||||
border-radius: 0.75rem;
|
||||
background: var(--asset-action-surface);
|
||||
transition: background-color 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.asset-selection-toolbar[data-has-selection="true"] {
|
||||
border-color: #cdd6f6;
|
||||
background: var(--asset-action-tint);
|
||||
}
|
||||
|
||||
.asset-selection-info {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
align-items: center;
|
||||
justify-content: start;
|
||||
gap: 0.3125rem 0.75rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.asset-selection-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--asset-action-text);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.asset-selection-count {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1.625rem;
|
||||
height: 1.625rem;
|
||||
padding: 0 0.3125rem;
|
||||
border-radius: 0.4375rem;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
[data-has-selection="true"] .asset-selection-count {
|
||||
background: #3755c3;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.asset-selection-hint {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
color: var(--asset-action-muted);
|
||||
font-size: 0.6875rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.asset-selection-clear {
|
||||
color: #3755c3;
|
||||
font-size: 0.75rem;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.asset-selection-clear:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.assets-page .asset-export-action {
|
||||
justify-content: flex-start;
|
||||
min-height: 3rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-proposal:not(:disabled) {
|
||||
border-color: #c2cdf1;
|
||||
color: #3755c3;
|
||||
}
|
||||
|
||||
.assets-page .asset-export-action:disabled small {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.asset-selection-toolbar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.assets-page .asset-page-actions {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.assets-page .asset-page-actions > button,
|
||||
.assets-page .asset-page-actions > details {
|
||||
flex: 1 1 auto;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.assets-page .asset-page-actions > details > summary {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.assets-page .asset-page-actions > .asset-action-primary {
|
||||
flex: 1 0 100%;
|
||||
order: -1;
|
||||
}
|
||||
|
||||
.assets-page .asset-action-button {
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
|
||||
.assets-page .asset-page-actions .asset-menu-panel {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.assets-page .asset-filter-bar {
|
||||
grid-template-columns: minmax(7rem, 0.35fr) minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.assets-page .asset-filter-bar .compact-filter-search {
|
||||
grid-column: auto;
|
||||
grid-row: auto;
|
||||
}
|
||||
|
||||
.asset-selection-toolbar {
|
||||
align-items: stretch;
|
||||
gap: 0.625rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.asset-selection-info {
|
||||
padding-right: 3rem;
|
||||
}
|
||||
|
||||
.asset-selection-actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.assets-page .asset-export-action {
|
||||
gap: 0.375rem;
|
||||
padding: 0.625rem;
|
||||
font-size: 0.75rem;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.asset-selection-menu {
|
||||
position: absolute;
|
||||
top: 0.75rem;
|
||||
right: 0.75rem;
|
||||
}
|
||||
|
||||
.assets-page .asset-selection-menu > summary {
|
||||
min-width: 2.75rem;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.asset-selection-menu > summary > span:last-child {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.dark .assets-page {
|
||||
--asset-action-surface: #172033;
|
||||
--asset-action-text: #e2e8f0;
|
||||
--asset-action-muted: #94a3b8;
|
||||
--asset-action-border: #334155;
|
||||
--asset-action-tint: #1e293b;
|
||||
}
|
||||
248
public/js/app.js
248
public/js/app.js
@@ -2104,6 +2104,7 @@ class AccountManager {
|
||||
<div class="compact-page-actions flex flex-wrap gap-2">
|
||||
<button id="refreshAssetExportsBtn" class="border border-slate-200 rounded-lg px-3 py-2 text-xs font-bold">Làm mới</button>
|
||||
<button id="createAssetExportBtn" class="bg-primary text-on-primary rounded-lg px-4 py-2 text-xs font-bold">Tạo đơn xuất dự án</button>
|
||||
${manager ? '<button id="createAssetExportForOthersBtn" class="border border-primary text-primary rounded-lg px-4 py-2 text-xs font-bold">Xuất cho người khác</button>' : ''}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 mb-4 shrink-0" role="tablist" aria-label="Danh sách xuất tài sản">
|
||||
@@ -2221,6 +2222,11 @@ class AccountManager {
|
||||
document.getElementById('assetExportSearchInput').oninput = event => { this.assetExportSearchTerm = event.target.value; this.assetExportPage = 1; this.renderAssetExportsTable(); };
|
||||
document.getElementById('refreshAssetExportsBtn').onclick = () => this.refreshAssetExportsPage();
|
||||
document.getElementById('createAssetExportBtn').onclick = () => { location.hash = '#assets'; this.notifyWarning('Chọn một hoặc nhiều tài sản, sau đó bấm Tạo đơn xuất dự án.'); };
|
||||
const exportForOthersButton = document.getElementById('createAssetExportForOthersBtn');
|
||||
if (exportForOthersButton) exportForOthersButton.onclick = () => {
|
||||
location.hash = '#assets';
|
||||
this.notifyWarning('Chọn một hoặc nhiều tài sản, sau đó bấm Xuất cho người khác.');
|
||||
};
|
||||
for (const [id, tab] of [['assetExportRequestsTab', 'requests'], ['assetExportHistoryTab', 'history']]) {
|
||||
document.getElementById(id).onclick = () => { this.assetExportTab = tab; this.assetExportPage = 1; this.renderAssetExportsTable(); };
|
||||
}
|
||||
@@ -7872,48 +7878,30 @@ class AccountManager {
|
||||
|
||||
return `
|
||||
<div class="assets-page flex flex-col p-4 md:p-6 overflow-hidden h-full">
|
||||
<div class="page-header flex items-center justify-between gap-4 mb-5 shrink-0">
|
||||
<div class="page-header asset-page-heading flex items-center justify-between gap-4 mb-5 shrink-0">
|
||||
<div>
|
||||
<h1 class="text-2xl font-extrabold text-on-surface tracking-tight">Quản lý tài sản</h1>
|
||||
<p class="text-sm text-on-surface-variant">Theo dõi tài sản, kho và trạng thái sử dụng.</p>
|
||||
</div>
|
||||
<div class="asset-header-actions flex flex-wrap items-center gap-2">
|
||||
<button id="archiveAllAssetsBtn" class="border border-red-200 text-red-700 px-3 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 ${canManageAssets && this.assets.length ? 'hover:bg-red-50' : 'opacity-50 cursor-not-allowed'}" ${canManageAssets && this.assets.length ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">archive</span>
|
||||
Xóa danh mục hiện tại
|
||||
</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ũ
|
||||
</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>
|
||||
Nhập Excel
|
||||
</button>
|
||||
<button id="exportAssetBtn" class="border border-slate-300 hover:bg-slate-100 text-slate-700 px-3 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95">
|
||||
<span class="material-symbols-outlined text-base">download</span>
|
||||
Xuất Excel
|
||||
</button>
|
||||
<button id="openAssetExportHistoryBtn" class="border border-amber-300 text-amber-700 px-3 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95 hover:bg-amber-50">
|
||||
<span class="material-symbols-outlined text-base">history</span>
|
||||
Lịch sử xuất
|
||||
</button>
|
||||
<button id="openAssetDamageHistoryBtn" class="border border-red-200 text-red-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-red-50' : 'opacity-50 cursor-not-allowed'}" ${canManageAssets ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">inventory_2</span>
|
||||
DS hỏng/TL
|
||||
</button>
|
||||
<button id="addAssetBtn" class="bg-primary text-on-primary px-4 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95 ${canManageAssets ? 'hover:bg-primary-dim' : 'opacity-50 cursor-not-allowed'}" ${canManageAssets ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">add_box</span>
|
||||
Thêm tài sản
|
||||
</button>
|
||||
<button id="borrowAssetBtn" class="border border-primary text-primary px-4 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95 ${(selectedCount > 0) ? 'hover:bg-primary/5' : 'opacity-50 cursor-not-allowed'}" ${(selectedCount > 0) ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">handshake</span>
|
||||
Tạo đơn xuất dự án
|
||||
</button>
|
||||
<button id="damageAssetBtn" class="border border-red-300 text-red-700 px-4 py-2 rounded-lg text-xs font-bold flex items-center gap-1.5 transition-all active:scale-95 ${(canManageAssets && selectedCount === 1) ? 'hover:bg-red-50' : 'opacity-50 cursor-not-allowed'}" ${(canManageAssets && selectedCount === 1) ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined text-base">broken_image</span>
|
||||
Hỏng/Thanh lý
|
||||
<div class="asset-page-actions" aria-label="Quản lý danh mục tài sản">
|
||||
<button type="button" id="openAssetExportHistoryBtn" class="asset-action-button">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">history</span><span>Lịch sử xuất</span>
|
||||
</button>
|
||||
<details class="asset-action-menu">
|
||||
<summary class="asset-action-button"><span class="material-symbols-outlined" aria-hidden="true">tune</span>Tiện ích<span class="material-symbols-outlined asset-menu-chevron" aria-hidden="true">expand_more</span></summary>
|
||||
<div class="asset-menu-panel">
|
||||
<p class="asset-menu-label">Dữ liệu Excel</p>
|
||||
${canManageAssets ? `<button type="button" id="importAssetBtn" class="asset-menu-item"><span class="material-symbols-outlined" aria-hidden="true">upload_file</span><span>Nhập Excel<small>Thêm tài sản từ bảng tính</small></span></button>` : ''}
|
||||
<button type="button" id="exportAssetBtn" class="asset-menu-item"><span class="material-symbols-outlined" aria-hidden="true">download</span><span>Xuất Excel<small>Tải danh sách tài sản</small></span></button>
|
||||
<p class="asset-menu-label asset-menu-divider">Tra cứu</p>
|
||||
<button type="button" id="openArchivedAssetBorrowsBtn" class="asset-menu-item"><span class="material-symbols-outlined" aria-hidden="true">inventory_2</span><span>Tài sản cũ<small>Xem danh mục đã lưu trữ</small></span></button>
|
||||
${canManageAssets ? `<button type="button" id="openAssetDamageHistoryBtn" class="asset-menu-item"><span class="material-symbols-outlined" aria-hidden="true">assignment</span><span>Danh sách hỏng / thanh lý</span></button>
|
||||
<div class="asset-menu-divider"><button type="button" id="archiveAllAssetsBtn" class="asset-menu-item asset-menu-danger" ${this.assets.length ? '' : 'disabled'}><span class="material-symbols-outlined" aria-hidden="true">archive</span><span>Xóa danh mục hiện tại<small>Chuyển sang tài sản cũ, giữ lại lịch sử</small></span></button></div>` : ''}
|
||||
</div>
|
||||
</details>
|
||||
${canManageAssets ? `<button type="button" id="addAssetBtn" class="asset-action-button asset-action-primary">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">add</span>Thêm tài sản
|
||||
</button>` : ''}
|
||||
<input id="assetImportInput" type="file" accept=".xlsx,.xls" class="hidden" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -7932,10 +7920,30 @@ class AccountManager {
|
||||
<span class="text-[10px] font-bold uppercase text-on-surface-variant">Tìm kiếm</span>
|
||||
<input id="assetSearch" class="flex-1 bg-surface-container-low border-slate-200 rounded-md text-[11px] py-1 px-2 focus:ring-1 focus:ring-primary shadow-sm" placeholder="Mã, tên, model, serial, dự án, vị trí...">
|
||||
</div>
|
||||
<button id="bulkDeleteAssetsBtn" class="compact-filter-action border border-red-200 text-red-600 px-3 py-1.5 rounded-md text-[11px] font-bold flex items-center gap-1.5 transition-colors ${(selectedCount === 0 || !canManageAssets) ? 'opacity-50 cursor-not-allowed' : 'hover:bg-red-50'}" ${(selectedCount === 0 || !canManageAssets) ? 'disabled' : ''}>
|
||||
<span class="material-symbols-outlined text-base">delete_sweep</span>
|
||||
Xóa đã chọn (<span id="selectedAssetCount">${selectedCount}</span>)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="assetSelectionToolbar" class="asset-selection-toolbar" data-has-selection="${selectedCount > 0}" role="region" aria-label="Thao tác với tài sản đã chọn">
|
||||
<div class="asset-selection-info">
|
||||
<div class="asset-selection-status" role="status" aria-live="polite" aria-atomic="true"><span id="selectedAssetCount" class="asset-selection-count">${selectedCount}</span><span>Tài sản đã chọn</span></div>
|
||||
<span id="assetSelectionHint" class="asset-selection-hint">${selectedCount ? 'Chọn thao tác áp dụng cho các tài sản này.' : 'Đánh dấu ô chọn trong danh sách để thao tác.'}</span>
|
||||
<button type="button" id="clearAssetSelectionBtn" class="asset-selection-clear" ${selectedCount ? '' : 'hidden'}>Bỏ chọn</button>
|
||||
</div>
|
||||
<div class="asset-selection-actions">
|
||||
<button type="button" id="borrowAssetBtn" class="asset-action-button asset-export-action asset-action-proposal" ${selectedCount ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">assignment_add</span><span>Tạo đơn xuất dự án<small>Chờ duyệt</small></span>
|
||||
</button>
|
||||
${canManageAssets ? `<button type="button" id="exportAssetForOthersBtn" class="asset-action-button asset-export-action" ${selectedCount ? '' : 'disabled'}>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">person_add</span><span>Xuất cho người khác<small>Trừ kho ngay</small></span>
|
||||
</button>
|
||||
<details class="asset-action-menu asset-selection-menu">
|
||||
<summary class="asset-action-button" aria-label="Thao tác khác với tài sản đã chọn"><span class="material-symbols-outlined" aria-hidden="true">more_horiz</span><span>Khác</span></summary>
|
||||
<div class="asset-menu-panel">
|
||||
<p class="asset-menu-label">Với tài sản đã chọn</p>
|
||||
<button type="button" id="damageAssetBtn" class="asset-menu-item" ${selectedCount === 1 ? '' : 'disabled'}><span class="material-symbols-outlined" aria-hidden="true">broken_image</span><span>Hỏng / Thanh lý<small>Áp dụng cho 1 tài sản</small></span></button>
|
||||
<div class="asset-menu-divider"><button type="button" id="bulkDeleteAssetsBtn" class="asset-menu-item asset-menu-danger" ${selectedCount ? '' : 'disabled'}><span class="material-symbols-outlined" aria-hidden="true">delete_sweep</span><span>Xóa tài sản đã chọn<small>Chuyển các tài sản này sang tài sản cũ</small></span></button></div>
|
||||
</div>
|
||||
</details>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 bg-white rounded-xl border border-slate-200 shadow-sm flex flex-col overflow-hidden min-h-0">
|
||||
@@ -8195,9 +8203,50 @@ class AccountManager {
|
||||
bulkDeleteBtn.dataset.boundClick = 'true';
|
||||
}
|
||||
|
||||
const clearSelectionButton = document.getElementById('clearAssetSelectionBtn');
|
||||
if (clearSelectionButton && !clearSelectionButton.dataset.boundClick) {
|
||||
clearSelectionButton.addEventListener('click', () => {
|
||||
this.selectedAssetIds.clear();
|
||||
document.querySelectorAll('.asset-row-checkbox').forEach(checkbox => { checkbox.checked = false; });
|
||||
this.updateAssetBulkActionState();
|
||||
});
|
||||
clearSelectionButton.dataset.boundClick = 'true';
|
||||
}
|
||||
|
||||
this.updateAssetBulkActionState();
|
||||
}
|
||||
|
||||
setupAssetActionMenus() {
|
||||
document.querySelectorAll('.assets-page .asset-action-menu').forEach(menu => {
|
||||
if (menu.dataset.boundMenu) return;
|
||||
menu.addEventListener('toggle', () => {
|
||||
if (menu.open) document.querySelectorAll('.assets-page .asset-action-menu[open]').forEach(other => {
|
||||
if (other !== menu) other.open = false;
|
||||
});
|
||||
});
|
||||
menu.addEventListener('click', event => {
|
||||
const button = event.target.closest('button');
|
||||
if (button && !button.disabled) menu.open = false;
|
||||
});
|
||||
menu.addEventListener('keydown', event => {
|
||||
if (event.key === 'Escape' && menu.open) {
|
||||
menu.open = false;
|
||||
menu.querySelector('summary').focus();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
menu.dataset.boundMenu = 'true';
|
||||
});
|
||||
if (!this.assetActionMenusBound) {
|
||||
document.addEventListener('click', event => {
|
||||
document.querySelectorAll('.assets-page .asset-action-menu[open]').forEach(menu => {
|
||||
if (!menu.contains(event.target)) menu.open = false;
|
||||
});
|
||||
});
|
||||
this.assetActionMenusBound = true;
|
||||
}
|
||||
}
|
||||
|
||||
updateAssetBulkActionState() {
|
||||
const canManageAssets = this.canCurrentUserManageAssets();
|
||||
const rowCheckboxes = Array.from(document.querySelectorAll('.asset-row-checkbox'));
|
||||
@@ -8227,30 +8276,21 @@ class AccountManager {
|
||||
selectedCountNode.textContent = String(selectedCount);
|
||||
}
|
||||
|
||||
const bulkDeleteBtn = document.getElementById('bulkDeleteAssetsBtn');
|
||||
if (bulkDeleteBtn) {
|
||||
const disabled = !canManageAssets || selectedCount === 0;
|
||||
bulkDeleteBtn.disabled = disabled;
|
||||
bulkDeleteBtn.classList.toggle('opacity-50', disabled);
|
||||
bulkDeleteBtn.classList.toggle('cursor-not-allowed', disabled);
|
||||
}
|
||||
const toolbar = document.getElementById('assetSelectionToolbar');
|
||||
if (toolbar) toolbar.dataset.hasSelection = String(selectedCount > 0);
|
||||
const hint = document.getElementById('assetSelectionHint');
|
||||
if (hint) hint.textContent = selectedCount ? 'Chọn thao tác áp dụng cho các tài sản này.' : 'Đánh dấu ô chọn trong danh sách để thao tác.';
|
||||
const clearSelectionButton = document.getElementById('clearAssetSelectionBtn');
|
||||
if (clearSelectionButton) clearSelectionButton.hidden = selectedCount === 0;
|
||||
|
||||
const borrowAssetBtn = document.getElementById('borrowAssetBtn');
|
||||
if (borrowAssetBtn) {
|
||||
const disabled = selectedCount === 0;
|
||||
borrowAssetBtn.disabled = disabled;
|
||||
borrowAssetBtn.classList.toggle('opacity-50', disabled);
|
||||
borrowAssetBtn.classList.toggle('cursor-not-allowed', disabled);
|
||||
borrowAssetBtn.classList.toggle('hover:bg-primary/5', !disabled);
|
||||
}
|
||||
|
||||
const damageAssetBtn = document.getElementById('damageAssetBtn');
|
||||
if (damageAssetBtn) {
|
||||
const disabled = !canManageAssets || selectedCount !== 1;
|
||||
damageAssetBtn.disabled = disabled;
|
||||
damageAssetBtn.classList.toggle('opacity-50', disabled);
|
||||
damageAssetBtn.classList.toggle('cursor-not-allowed', disabled);
|
||||
damageAssetBtn.classList.toggle('hover:bg-red-50', !disabled);
|
||||
for (const [id, disabled, title] of [
|
||||
['bulkDeleteAssetsBtn', !canManageAssets || selectedCount === 0, 'Chọn ít nhất 1 tài sản để xóa.'],
|
||||
['borrowAssetBtn', selectedCount === 0, 'Chọn ít nhất 1 tài sản để tạo đơn xuất dự án.'],
|
||||
['exportAssetForOthersBtn', !canManageAssets || selectedCount === 0, 'Chọn ít nhất 1 tài sản để xuất cho người khác.'],
|
||||
['damageAssetBtn', !canManageAssets || selectedCount !== 1, 'Chọn đúng 1 tài sản để ghi nhận hỏng hoặc thanh lý.']
|
||||
]) {
|
||||
const button = document.getElementById(id);
|
||||
if (button) { button.disabled = disabled; button.title = disabled ? title : ''; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8995,7 +9035,29 @@ class AccountManager {
|
||||
if (summary) summary.textContent = `${items.length} tài sản đã chọn · 1 phiếu Excel chung`;
|
||||
}
|
||||
|
||||
async openBatchAssetExportModal() {
|
||||
configureAssetExportForm(prefix, forOthers) {
|
||||
const form = document.getElementById(`${prefix}Form`);
|
||||
form.dataset.exportForOthers = String(forOthers);
|
||||
document.getElementById(`${prefix}RequesterField`).hidden = forOthers;
|
||||
document.getElementById(`${prefix}RecipientField`).hidden = !forOthers;
|
||||
const recipient = document.getElementById(`${prefix}RecipientInput`);
|
||||
recipient.disabled = !forOthers;
|
||||
recipient.required = forOthers;
|
||||
if (forOthers) this.populateUserSelectOptions(recipient.id, { emptyLabel: '-- Chọn người nhận --' });
|
||||
else recipient.value = '';
|
||||
const batch = prefix === 'batchAssetExport';
|
||||
document.getElementById(`${prefix}Title`).textContent = forOthers
|
||||
? (batch ? 'Xuất nhiều tài sản cho người khác' : 'Xuất tài sản cho người khác')
|
||||
: (batch ? 'Tạo đơn xuất nhiều tài sản vào dự án' : 'Tạo đơn xuất tài sản vào dự án');
|
||||
document.getElementById(`${prefix}Description`).textContent = forOthers
|
||||
? 'Chọn người nhận và dự án. Xác nhận sẽ trừ kho ngay và tạo phiếu Excel; tài sản xuất không hoàn lại kho.'
|
||||
: (batch ? 'Chọn số lượng và dự án cho từng tài sản. Chỉ trừ kho khi được duyệt; tài sản xuất không hoàn lại kho.'
|
||||
: 'Xuất vào dự án, không hoàn lại kho. Số lượng chỉ trừ khi admin/asset duyệt đơn.');
|
||||
form.querySelector('button[type="submit"]').textContent = forOthers ? 'Xuất và tải Excel' : 'Gửi đơn chờ duyệt';
|
||||
}
|
||||
|
||||
async openBatchAssetExportModal(forOthers = false) {
|
||||
if (forOthers && !this.ensureAssetManagePermission('xuất tài sản cho người khác')) return;
|
||||
const assets = this.assets.filter(asset => this.selectedAssetIds.has(Number(asset.AssetId)));
|
||||
if (!assets.length || assets.length > 100) {
|
||||
this.notifyWarning('Vui lòng chọn từ 1 đến 100 tài sản để xuất.');
|
||||
@@ -9006,10 +9068,12 @@ class AccountManager {
|
||||
this.notifyWarning(`${unavailable.AssetCode || unavailable.AssetName}: đã hết tồn, hãy bỏ chọn tài sản này.`);
|
||||
return;
|
||||
}
|
||||
if (forOthers && !this.users.length) await this.fetchUsers();
|
||||
if (!this.assetProjects.length) await this.fetchAssetProjects();
|
||||
const modal = document.getElementById('batchAssetExportModal');
|
||||
const form = document.getElementById('batchAssetExportForm');
|
||||
if (!modal || !form) { this.notifyFailure('Không tìm thấy biểu mẫu xuất nhiều tài sản.'); return; }
|
||||
this.configureAssetExportForm('batchAssetExport', forOthers);
|
||||
document.getElementById('batchAssetExportUserInput').value = this.getCurrentUserDisplayName();
|
||||
const commonProject = document.getElementById('batchAssetExportCommonProject');
|
||||
commonProject.innerHTML = '<option value="">-- Áp dụng dự án cho tất cả --</option>'
|
||||
@@ -9033,10 +9097,12 @@ class AccountManager {
|
||||
async handleBatchAssetExportSubmit(event) {
|
||||
event.preventDefault();
|
||||
if (this.assetExportSubmitting) return;
|
||||
const forOthers = document.getElementById('batchAssetExportForm')?.dataset.exportForOthers === 'true';
|
||||
if (forOthers && !this.ensureAssetManagePermission('xuất tài sản cho người khác')) return;
|
||||
const items = this.collectBatchAssetExportItems();
|
||||
const borrowerName = String(document.getElementById('batchAssetExportUserInput')?.value || '').trim();
|
||||
const borrowerName = String(document.getElementById(forOthers ? 'batchAssetExportRecipientInput' : 'batchAssetExportUserInput')?.value || '').trim();
|
||||
const note = String(document.getElementById('batchAssetExportNoteInput')?.value || '').trim();
|
||||
if (!borrowerName) { this.notifyWarning('Không xác định được người đề xuất.'); return; }
|
||||
if (!borrowerName) { this.notifyWarning(forOthers ? 'Vui lòng chọn người nhận.' : 'Không xác định được người đề xuất.'); return; }
|
||||
if (!items.length || items.length > 100) { this.notifyWarning('Vui lòng chọn từ 1 đến 100 tài sản.'); return; }
|
||||
for (const item of items) {
|
||||
const asset = this.assets.find(asset => Number(asset.AssetId) === item.assetId);
|
||||
@@ -9051,13 +9117,20 @@ class AccountManager {
|
||||
if (button) button.disabled = true;
|
||||
let exportSucceeded = false;
|
||||
try {
|
||||
const response = await fetch(`${this.apiBase}/asset-export-requests`, {
|
||||
const response = await fetch(`${this.apiBase}/${forOthers ? 'assets/export' : 'asset-export-requests'}`, {
|
||||
method: 'POST', headers: this.getAuthHeaders(true), body: JSON.stringify({ borrowerName, note, items })
|
||||
});
|
||||
const data = await response.json();
|
||||
if (!response.ok || !data.success) { this.notifyFailure(data.message || 'Xuất tài sản thất bại.'); return; }
|
||||
exportSucceeded = true;
|
||||
this.selectedAssetIds.clear();
|
||||
if (forOthers) {
|
||||
this.notifySuccess(`Đã xuất ${items.length} tài sản cho ${borrowerName} và lưu phiếu Excel vào lịch sử.`);
|
||||
this.closeModals();
|
||||
this.showExportRequestDocument(data.document);
|
||||
await this.refreshAssetsUI();
|
||||
return;
|
||||
}
|
||||
this.notifySuccess('Đã gửi đơn xuất vào dự án, chờ admin/asset duyệt.');
|
||||
this.closeModals();
|
||||
this.assetExportTab = 'requests';
|
||||
@@ -9067,7 +9140,9 @@ class AccountManager {
|
||||
location.hash = '#asset-exports';
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (exportSucceeded) this.notifyWarning('Đã gửi đơn xuất. Hãy mở danh sách đơn xuất để kiểm tra.');
|
||||
if (exportSucceeded) this.notifyWarning(forOthers
|
||||
? 'Đã xuất tài sản thành công. Hãy mở lịch sử xuất để kiểm tra hoặc tải lại phiếu Excel.'
|
||||
: 'Đã gửi đơn xuất. Hãy mở danh sách đơn xuất để kiểm tra.');
|
||||
else this.notifyFailure('Xuất tài sản thất bại.');
|
||||
} finally {
|
||||
this.assetExportSubmitting = false;
|
||||
@@ -9118,13 +9193,15 @@ class AccountManager {
|
||||
this.updateBorrowAllocationSummary();
|
||||
}
|
||||
|
||||
async openBorrowAssetModal() {
|
||||
if (this.selectedAssetIds.size > 1) return this.openBatchAssetExportModal();
|
||||
async openBorrowAssetModal(forOthers = false) {
|
||||
if (forOthers && !this.ensureAssetManagePermission('xuất tài sản cho người khác')) return;
|
||||
if (this.selectedAssetIds.size > 1) return this.openBatchAssetExportModal(forOthers);
|
||||
const asset = this.getSingleSelectedAssetForBorrowing(true);
|
||||
if (!asset) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (forOthers && !this.users.length) await this.fetchUsers();
|
||||
if (!this.assetProjects.length) {
|
||||
await this.fetchAssetProjects();
|
||||
}
|
||||
@@ -9150,6 +9227,8 @@ class AccountManager {
|
||||
return;
|
||||
}
|
||||
|
||||
this.configureAssetExportForm('borrowAsset', forOthers);
|
||||
|
||||
if (assetIdInput) {
|
||||
assetIdInput.value = String(asset.AssetId || '');
|
||||
}
|
||||
@@ -9176,8 +9255,10 @@ class AccountManager {
|
||||
async handleBorrowAssetSubmit(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const forOthers = document.getElementById('borrowAssetForm')?.dataset.exportForOthers === 'true';
|
||||
if (forOthers && !this.ensureAssetManagePermission('xuất tài sản cho người khác')) return;
|
||||
const assetIdInput = document.getElementById('borrowAssetIdInput');
|
||||
const borrowerInput = document.getElementById('borrowAssetUserInput');
|
||||
const borrowerInput = document.getElementById(forOthers ? 'borrowAssetRecipientInput' : 'borrowAssetUserInput');
|
||||
const noteInput = document.getElementById('borrowAssetNoteInput');
|
||||
|
||||
const selectedAssetId = Number(assetIdInput?.value || this.pendingBorrowAssetId);
|
||||
@@ -9194,7 +9275,7 @@ class AccountManager {
|
||||
|
||||
const borrowerName = String(borrowerInput?.value || '').trim();
|
||||
if (!borrowerName) {
|
||||
this.notifyWarning('Không xác định được người đề xuất.');
|
||||
this.notifyWarning(forOthers ? 'Vui lòng chọn người nhận.' : 'Không xác định được người đề xuất.');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9227,11 +9308,11 @@ class AccountManager {
|
||||
if (submitButton) submitButton.disabled = true;
|
||||
let exportSucceeded = false;
|
||||
try {
|
||||
const response = await fetch(`${this.apiBase}/asset-export-requests`, {
|
||||
const response = await fetch(`${this.apiBase}/${forOthers ? `assets/${selectedAssetId}/export` : 'asset-export-requests'}`, {
|
||||
method: 'POST',
|
||||
headers: this.getAuthHeaders(true),
|
||||
body: JSON.stringify({
|
||||
items: [{ assetId: selectedAssetId, allocations }],
|
||||
...(forOthers ? { borrowerName, allocations } : { items: [{ assetId: selectedAssetId, allocations }] }),
|
||||
note: exportNote
|
||||
})
|
||||
});
|
||||
@@ -9245,6 +9326,13 @@ class AccountManager {
|
||||
exportSucceeded = true;
|
||||
this.pendingBorrowAssetId = undefined;
|
||||
this.selectedAssetIds.clear();
|
||||
if (forOthers) {
|
||||
this.notifySuccess(`Đã xuất tài sản cho ${borrowerName} và lưu phiếu Excel vào lịch sử.`);
|
||||
this.closeModals();
|
||||
this.showExportRequestDocument(data.document);
|
||||
await this.refreshAssetsUI();
|
||||
return;
|
||||
}
|
||||
this.notifySuccess('Đã gửi đơn xuất vào dự án, chờ admin/asset duyệt.');
|
||||
this.closeModals();
|
||||
this.assetExportTab = 'requests';
|
||||
@@ -9254,7 +9342,9 @@ class AccountManager {
|
||||
location.hash = '#asset-exports';
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (exportSucceeded) this.notifyWarning('Đã gửi đơn xuất. Hãy mở danh sách đơn xuất để kiểm tra.');
|
||||
if (exportSucceeded) this.notifyWarning(forOthers
|
||||
? 'Đã xuất tài sản thành công. Hãy mở lịch sử xuất để kiểm tra hoặc tải lại phiếu Excel.'
|
||||
: 'Đã gửi đơn xuất. Hãy mở danh sách đơn xuất để kiểm tra.');
|
||||
else this.notifyFailure('Xuất tài sản thất bại');
|
||||
} finally {
|
||||
this.assetExportSubmitting = false;
|
||||
@@ -10584,6 +10674,7 @@ class AccountManager {
|
||||
setupAssetRowListeners() {
|
||||
this.setupArchivedAssetListeners();
|
||||
this.setupAssetSelectionListeners();
|
||||
this.setupAssetActionMenus();
|
||||
const canManageAssets = this.canCurrentUserManageAssets();
|
||||
|
||||
document.querySelectorAll('.view-asset').forEach(btn => {
|
||||
@@ -12000,6 +12091,11 @@ class AccountManager {
|
||||
borrowAssetBtn.addEventListener('click', () => this.openBorrowAssetModal());
|
||||
borrowAssetBtn.dataset.boundClick = 'true';
|
||||
}
|
||||
const exportForOthersButton = document.getElementById('exportAssetForOthersBtn');
|
||||
if (exportForOthersButton && !exportForOthersButton.dataset.boundClick) {
|
||||
exportForOthersButton.addEventListener('click', () => this.openBorrowAssetModal(true));
|
||||
exportForOthersButton.dataset.boundClick = 'true';
|
||||
}
|
||||
|
||||
const damageAssetBtn = document.getElementById('damageAssetBtn');
|
||||
if (damageAssetBtn && !damageAssetBtn.dataset.boundClick) {
|
||||
|
||||
@@ -700,16 +700,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm" id="borrowAssetModal">
|
||||
<div class="modal-content w-full max-w-lg bg-white rounded-xl shadow-2xl border border-slate-200 overflow-hidden m-4">
|
||||
<div class="px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50">
|
||||
<h3 class="text-base font-extrabold text-slate-900">Tạo đơn xuất tài sản vào dự án</h3>
|
||||
<div class="modal-content w-full max-w-lg bg-white rounded-xl shadow-2xl border border-slate-200 overflow-hidden m-4 flex flex-col" style="max-height: calc(100dvh - 2rem);">
|
||||
<div class="px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50 shrink-0">
|
||||
<h3 id="borrowAssetTitle" class="text-base font-extrabold text-slate-900">Tạo đơn xuất tài sản vào dự án</h3>
|
||||
<button type="button" class="p-1.5 rounded-lg hover:bg-slate-200 text-slate-400 transition-colors" data-close-modal="borrowAssetModal">
|
||||
<span class="material-symbols-outlined">close</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="borrowAssetForm" class="p-6 space-y-4 overflow-y-auto" style="max-height: 80vh;">
|
||||
<form id="borrowAssetForm" class="p-6 space-y-4 overflow-y-auto min-h-0">
|
||||
<input type="hidden" id="borrowAssetIdInput">
|
||||
<p class="text-sm text-slate-600">Xuất vào dự án, không hoàn lại kho. Số lượng chỉ trừ khi admin/asset duyệt đơn.</p>
|
||||
<p id="borrowAssetDescription" class="text-sm text-slate-600">Xuất vào dự án, không hoàn lại kho. Số lượng chỉ trừ khi admin/asset duyệt đơn.</p>
|
||||
<p id="borrowAssetStockSummary" class="text-sm font-semibold text-slate-700"></p>
|
||||
<div>
|
||||
<label class="text-[10px] font-bold uppercase text-slate-500 tracking-widest block mb-1">Tài sản</label>
|
||||
@@ -720,10 +720,16 @@
|
||||
<label for="borrowCurrentEndingInput" class="text-xs font-bold text-slate-500 block mb-1">Còn có thể xuất</label>
|
||||
<input type="number" id="borrowCurrentEndingInput" class="w-full border border-slate-200 rounded-lg text-sm py-2.5 px-3 bg-slate-50" readonly>
|
||||
</div>
|
||||
<div>
|
||||
<div id="borrowAssetRequesterField">
|
||||
<label for="borrowAssetUserInput" class="text-xs font-bold text-slate-500 block mb-1">Người đề xuất</label>
|
||||
<input type="text" id="borrowAssetUserInput" class="w-full border border-slate-200 rounded-lg text-sm py-2.5 px-3 bg-slate-50" readonly required>
|
||||
</div>
|
||||
<div id="borrowAssetRecipientField" hidden>
|
||||
<label for="borrowAssetRecipientInput" class="text-xs font-bold text-slate-500 block mb-1">Người nhận</label>
|
||||
<select id="borrowAssetRecipientInput" class="w-full border border-slate-200 rounded-lg text-sm py-2.5 px-3" disabled>
|
||||
<option value="">-- Chọn người nhận --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="md:col-span-2 space-y-3">
|
||||
<div class="flex items-end gap-2">
|
||||
<label for="borrowAssetProjectInput" class="flex-1 text-xs text-slate-600">Dự án
|
||||
@@ -756,12 +762,13 @@
|
||||
<div class="modal-backdrop fixed inset-0 z-[110] flex items-center justify-center bg-black/40 backdrop-blur-sm" id="batchAssetExportModal">
|
||||
<div class="modal-content w-full max-w-5xl bg-white rounded-xl shadow-2xl border border-slate-200 overflow-hidden m-4 flex flex-col" style="max-height: calc(100vh - 2rem);">
|
||||
<div class="px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50">
|
||||
<div><h3 class="text-base font-extrabold text-slate-900">Tạo đơn xuất nhiều tài sản vào dự án</h3><p class="mt-1 text-xs text-slate-500">Chọn số lượng và dự án cho từng tài sản. Chỉ trừ kho khi được duyệt; tài sản xuất không hoàn lại kho.</p></div>
|
||||
<div><h3 id="batchAssetExportTitle" class="text-base font-extrabold text-slate-900">Tạo đơn xuất nhiều tài sản vào dự án</h3><p id="batchAssetExportDescription" class="mt-1 text-xs text-slate-500">Chọn số lượng và dự án cho từng tài sản. Chỉ trừ kho khi được duyệt; tài sản xuất không hoàn lại kho.</p></div>
|
||||
<button type="button" class="p-1.5 rounded-lg hover:bg-slate-200 text-slate-400" data-close-modal="batchAssetExportModal" aria-label="Đóng"><span class="material-symbols-outlined">close</span></button>
|
||||
</div>
|
||||
<form id="batchAssetExportForm" class="p-6 space-y-4 overflow-y-auto">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<label class="text-xs font-semibold text-slate-600">Người đề xuất<input id="batchAssetExportUserInput" class="mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm bg-slate-50" readonly required></label>
|
||||
<label id="batchAssetExportRequesterField" class="text-xs font-semibold text-slate-600">Người đề xuất<input id="batchAssetExportUserInput" class="mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm bg-slate-50" readonly required></label>
|
||||
<label id="batchAssetExportRecipientField" class="text-xs font-semibold text-slate-600" hidden>Người nhận<select id="batchAssetExportRecipientInput" class="mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm" disabled><option value="">-- Chọn người nhận --</option></select></label>
|
||||
<label class="text-xs font-semibold text-slate-600">Dự án chung (tùy chọn)<select id="batchAssetExportCommonProject" class="mt-1 w-full border border-slate-200 rounded-lg px-3 py-2 text-sm"><option value="">-- Áp dụng dự án cho tất cả --</option></select></label>
|
||||
</div>
|
||||
<p id="batchAssetExportSummary" class="text-sm font-semibold text-slate-700" aria-live="polite"></p>
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
|
||||
</style>
|
||||
<link rel="stylesheet" href="../css/responsive.css?v=20261019-3" />
|
||||
<link rel="stylesheet" href="../css/asset-actions.css?v=20261111-1" />
|
||||
<link rel="stylesheet" href="../css/dashboard.css?v=20261103-1" />
|
||||
<link rel="stylesheet" href="../css/announcements.css?v=20261103-2" />
|
||||
</head>
|
||||
@@ -449,6 +450,6 @@
|
||||
|
||||
<script src="../js/document-formats.js?v=20261019-1"></script>
|
||||
<script src="../js/robot-bom.js?v=20261102-5"></script>
|
||||
<script src="../js/app.js?v=20261103-5"></script>
|
||||
<script src="../js/app.js?v=20261111-1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user