+ | @assetsTableViewModel.UserUID |
@assetsTableViewModel.AssetCn |
@assetsTableViewModel.AssetName |
@assetsTableViewModel.LocationName |
@@ -711,7 +711,7 @@ document.addEventListener('DOMContentLoaded', () => {
.asset-row > td {
transition: 0.1s ease;
}
-.asset-row:has(td:not(:last-child):hover) > td {
+.asset-row:has(td:not(:last-child):is(:hover, :focus)) > td {
background-color: #17a2b8;
}
@@ -725,145 +725,152 @@ document.addEventListener('DOMContentLoaded', () => {
});
function registerRowDetailviewClick(row) {
- const viewModal = document.getElementById('viewAssetModal');
- const viewContent = document.getElementById('viewAssetContent');
- row.addEventListener('click', async (e) => {
- // Avoid clicks on buttons inside the row
- if (e.target.closest('button')) return;
-
- const assetId = row.getAttribute('data-asset-id');
- viewContent.innerHTML = '@T["Loading..."]
';
-
- const modal = new bootstrap.Modal(viewModal);
- modal.show();
-
- try {
- const response = await fetch(`/Assets/Get?cn=${assetId}`);
- const json = await response.json();
- const asset = json.assetsModel;
-
- if (!asset) {
- viewContent.innerHTML = `@T["Asset not found."]
`;
- return;
- }
-
- const html = `
-
-
@T["Barcode"]
-
-
-
-
-
-
-
-
-
-
-
@T["Inventory"]
-
-
-
-
-
-
-
-
-
-
-
-
-
- ${asset.Description?.Attributes ? `
-
- ` : ''}
-
- ${asset.Description?.Purchase ? `
-
- ` : ''}
- `;
- viewContent.innerHTML = html;
- JsBarcode("#@barcodeType", getBarcodeValue("@barcodeType", asset.Cn), {
- format: "@barcodeType",
- lineColor: "#000",
- width: 2,
- height: 80,
- displayValue: true
- });
- document.getElementById("downloadBtn").addEventListener("click", () => {
- downloadBarcode("@barcodeType", getBarcodeValue("@barcodeType", asset.Cn));
- });
- document.getElementById("printBtn").addEventListener("click", () => {
- addAssetIdToBatch(asset.Cn);
- showToast("@T["Successfully added barcode to print batch"]", "success");
- bootstrap.Modal.getInstance('#viewAssetModal').hide();
- });
- } catch (err) {
- console.error(err);
- viewContent.innerHTML = `@T["Error loading asset details"]
`;
+ row.addEventListener('click', async (e) => handleRowDetailViewEvent(e, row));
+ row.addEventListener('keydown', e => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ row.click();
}
});
}
+async function handleRowDetailViewEvent(e, row) {
+ const viewModal = document.getElementById('viewAssetModal');
+ const viewContent = document.getElementById('viewAssetContent');
+ // Avoid clicks on buttons inside the row
+ if (e.target.closest('button')) return;
+
+ const assetId = row.getAttribute('data-asset-id');
+ viewContent.innerHTML = '@T["Loading..."]
';
+
+ const modal = new bootstrap.Modal(viewModal);
+ modal.show();
+
+ try {
+ const response = await fetch(`/Assets/Get?cn=${assetId}`);
+ const json = await response.json();
+ const asset = json.assetsModel;
+
+ if (!asset) {
+ viewContent.innerHTML = `@T["Asset not found."]
`;
+ return;
+ }
+ let i = 0;
+ const html = `
+
+
@T["Barcode"]
+
+
+
+
+
+
+
+
+
+
+
@T["Inventory"]
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${asset.Description?.Attributes ? `
+
+ ` : ''}
+
+ ${asset.Description?.Purchase ? `
+
+ ` : ''}
+ `;
+ viewContent.innerHTML = html;
+ JsBarcode("#@barcodeType", getBarcodeValue("@barcodeType", asset.Cn), {
+ format: "@barcodeType",
+ lineColor: "#000",
+ width: 2,
+ height: 80,
+ displayValue: true
+ });
+ document.getElementById("downloadBtn").addEventListener("click", () => {
+ downloadBarcode("@barcodeType", getBarcodeValue("@barcodeType", asset.Cn));
+ });
+ document.getElementById("printBtn").addEventListener("click", () => {
+ addAssetIdToBatch(asset.Cn);
+ showToast("@T["Successfully added barcode to print batch"]", "success");
+ bootstrap.Modal.getInstance('#viewAssetModal').hide();
+ });
+ } catch (err) {
+ console.error(err);
+ viewContent.innerHTML = `@T["Error loading asset details"]
`;
+ }
+}
+
document.addEventListener('DOMContentLoaded', () => {
const presetApplyButton = document.getElementById('createPresetApply');