Add asset checkout, quantity/uniqueness, contacts, and QR labels
Checkout:
- assets.AssignUser + POST /app/assets/{id}/checkout assign/unassign an
asset's user independent of the full edit form. New shared
#checkoutModal, wired from a "Check Out..." context-menu action, backed
by GET /app/assets/{id} and GET /app/users/options JSON endpoints.
Quantity / uniqueness:
- Item types gain an IsUnique flag (checked by default, matching prior
behavior). Assets gain a Quantity column, fixed at 1 for unique types
and adjustable via +/- steppers (POST /app/assets/{id}/quantity) for
non-unique ones. Flipping a type back to unique clamps existing assets'
quantity back to 1. CSV import/export gained a Quantity column.
Migration 0003_quantity.sql.
Contacts:
- New models.RoleContact: an assignable person who cannot sign in
(User.CanLogin). Migration 0004_contacts.sql rebuilds the users table
(SQLite can't alter a CHECK constraint in place) to allow the role.
Users form/list updated; contact creation auto-generates an unusable
password since the login path is blocked by role regardless.
QR asset tags and printable labels:
- Each asset's QR code (via github.com/skip2/go-qrcode, pure Go) encodes
an absolute /scan/<tag> URL; GET /scan/{tag} resolves it and redirects
into /inventory?asset=<id>, which app.js picks up on load to
auto-select that asset - works from a phone camera or a USB
scanner-as-keyboard-wedge pointed at the address bar.
- GET /labels renders a print-ready sheet (right-click an asset for one
label, a folder for every asset in it) with a template switcher between
Avery 5160 (verified dimensions) and 61526 asset tag labels (best-effort
layout, flagged as such on the page).
Also refreshed README to reflect the right-click-first tree UX and all of
the above.
This commit is contained in:
@@ -243,6 +243,7 @@
|
||||
items.push({ label: 'Import CSV…', icon: 'bi-upload', action: function () { openImportModal(id); } });
|
||||
}
|
||||
items.push({ label: 'Export CSV', icon: 'bi-download', action: function () { window.location = '/export/assets.csv?folder_id=' + id + '&recursive=1'; } });
|
||||
items.push({ label: 'Print Labels…', icon: 'bi-qr-code', action: function () { window.open('/labels?folder_id=' + id + '&recursive=1', '_blank'); } });
|
||||
if (isAdmin) {
|
||||
items.push({ divider: true });
|
||||
items.push({ label: 'Delete', icon: 'bi-trash', danger: true, action: function () { startDeleteFolder(id); } });
|
||||
@@ -252,8 +253,10 @@
|
||||
|
||||
function assetMenuItems(id) {
|
||||
var items = [{ label: 'Open', icon: 'bi-box-arrow-up-right', action: function () { navigateAndSelect('asset', id); } }];
|
||||
items.push({ label: 'Print Label', icon: 'bi-qr-code', action: function () { window.open('/labels?asset_id=' + id, '_blank'); } });
|
||||
if (isAdmin) {
|
||||
items.push({ label: 'Edit', icon: 'bi-pencil', action: function () { loadAssetEditForm(id); } });
|
||||
items.push({ label: 'Check Out…', icon: 'bi-person-check', action: function () { openCheckoutModal(id); } });
|
||||
items.push({ label: 'Duplicate', icon: 'bi-files', action: function () { duplicateAsset(id); } });
|
||||
items.push({ label: 'Move to…', icon: 'bi-arrows-move', action: function () { openMoveAssetModal(id); } });
|
||||
items.push({ divider: true });
|
||||
@@ -615,6 +618,55 @@
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Check out / check in modal
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
var checkoutModalEl = document.getElementById('checkoutModal');
|
||||
var checkoutModal = (checkoutModalEl && window.bootstrap) ? new bootstrap.Modal(checkoutModalEl) : null;
|
||||
|
||||
async function openCheckoutModal(id) {
|
||||
if (!checkoutModal) return;
|
||||
checkoutModalEl.dataset.assetId = id;
|
||||
var sel = document.getElementById('checkoutUserSelect');
|
||||
var currentText = document.getElementById('checkoutCurrent');
|
||||
sel.innerHTML = '<option value="">Unassigned (check in)</option>';
|
||||
currentText.textContent = 'Loading…';
|
||||
try {
|
||||
var asset = await apiFetch('/app/assets/' + id);
|
||||
var users = await apiFetch('/app/users/options');
|
||||
(users || []).forEach(function (u) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = u.id;
|
||||
opt.textContent = u.username;
|
||||
if (asset.AssignedUserID === u.id) opt.selected = true;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
currentText.textContent = asset.AssignedUsername
|
||||
? 'Currently checked out to ' + asset.AssignedUsername + '.'
|
||||
: 'Not currently checked out to anyone.';
|
||||
document.getElementById('checkoutModalTitle').textContent = 'Check Out "' + asset.Name + '"';
|
||||
} catch (err) {
|
||||
currentText.textContent = '';
|
||||
}
|
||||
checkoutModal.show();
|
||||
}
|
||||
|
||||
var confirmCheckoutBtn = document.getElementById('confirmCheckoutBtn');
|
||||
if (confirmCheckoutBtn) {
|
||||
confirmCheckoutBtn.addEventListener('click', async function () {
|
||||
var id = checkoutModalEl.dataset.assetId;
|
||||
var val = document.getElementById('checkoutUserSelect').value;
|
||||
try {
|
||||
await apiFetch('/app/assets/' + id + '/checkout', { method: 'POST', json: { assigned_user_id: val ? Number(val) : null } });
|
||||
checkoutModal.hide();
|
||||
await navigateAndSelect('asset', id);
|
||||
} catch (err) {
|
||||
alert('Checkout failed: ' + err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Asset form (create / edit) - shown in a modal
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -701,6 +753,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
// adjustAssetQuantity handles the +/- steppers shown next to non-unique
|
||||
// assets (in the asset detail panel and folder asset tables), updating
|
||||
// the displayed number in place without reloading the whole panel.
|
||||
async function adjustAssetQuantity(stepBtn) {
|
||||
var wrapper = stepBtn.closest('[data-quantity-stepper]');
|
||||
if (!wrapper) return;
|
||||
var id = wrapper.dataset.assetId;
|
||||
var valueEl = wrapper.querySelector('[data-quantity-value]');
|
||||
var delta = parseInt(stepBtn.dataset.step, 10) || 0;
|
||||
try {
|
||||
var res = await apiFetch('/app/assets/' + id + '/quantity', { method: 'POST', json: { delta: delta } });
|
||||
if (valueEl) valueEl.textContent = res.quantity;
|
||||
} catch (err) {
|
||||
alert('Could not update quantity: ' + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Folder listing filters / pagination
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -879,6 +948,9 @@
|
||||
|
||||
if (mainPanel) {
|
||||
mainPanel.addEventListener('click', function (e) {
|
||||
var stepBtn = e.target.closest('[data-action="panel-quantity-step"], [data-action="table-quantity-step"]');
|
||||
if (stepBtn) { e.preventDefault(); e.stopPropagation(); adjustAssetQuantity(stepBtn); return; }
|
||||
|
||||
var folderLink = e.target.closest('.folder-link');
|
||||
if (folderLink) { e.preventDefault(); navigateAndSelect('folder', folderLink.dataset.id); return; }
|
||||
|
||||
@@ -936,6 +1008,14 @@
|
||||
submitAssetForm(e.target);
|
||||
}
|
||||
});
|
||||
assetModalEl.addEventListener('click', function (e) {
|
||||
var stepBtn = e.target.closest('[data-action="quantity-step"]');
|
||||
if (!stepBtn) return;
|
||||
var input = document.getElementById('assetFormQuantity');
|
||||
if (!input) return;
|
||||
var next = (parseInt(input.value, 10) || 0) + parseInt(stepBtn.dataset.step, 10);
|
||||
input.value = Math.max(0, next);
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -971,4 +1051,25 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// QR/barcode scan landing: /scan/<tag> redirects here with ?asset=<id>
|
||||
// (or ?scan_error=<tag> if the tag didn't match anything).
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
var inventoryShell = document.querySelector('.inventory-shell');
|
||||
if (inventoryShell) {
|
||||
var autoOpenId = inventoryShell.dataset.autoOpenAsset;
|
||||
if (autoOpenId) {
|
||||
navigateAndSelect('asset', autoOpenId);
|
||||
}
|
||||
var scanError = inventoryShell.dataset.scanError;
|
||||
if (scanError) {
|
||||
alert('No asset found for scanned tag "' + scanError + '".');
|
||||
}
|
||||
if (autoOpenId || scanError) {
|
||||
// Drop the query string so a page refresh doesn't re-trigger this.
|
||||
window.history.replaceState({}, '', '/inventory');
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{define "content"}}
|
||||
<div class="inventory-shell d-flex">
|
||||
<div class="inventory-shell d-flex" {{if .AutoOpenAssetID}}data-auto-open-asset="{{.AutoOpenAssetID}}"{{end}} {{if .ScanError}}data-scan-error="{{.ScanError}}"{{end}}>
|
||||
<aside id="tree-pane" class="tree-pane border-end d-flex flex-column">
|
||||
<div class="p-2 border-bottom">
|
||||
<div class="input-group input-group-sm">
|
||||
|
||||
@@ -51,6 +51,18 @@
|
||||
<label class="form-check-label" for="enabled">Enabled</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="is_unique" id="isUnique" {{if .ItemType}}{{if .ItemType.IsUnique}}checked{{end}}{{else}}checked{{end}}>
|
||||
<label class="form-check-label" for="isUnique">
|
||||
Unique — each asset of this type has its own identity (e.g. a laptop's serial number)
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
Uncheck this for bulk/consumable types (e.g. a USB-A cable) that are tracked as one row
|
||||
with a quantity instead of one row per unit.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-3">Save</button>
|
||||
{{if .ItemType}}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{{define "content"}}
|
||||
<style>{{.SheetCSS}}
|
||||
@media print {
|
||||
.app-navbar, .print-toolbar { display: none !important; }
|
||||
body { margin: 0; background: #fff; }
|
||||
.label-sheet { margin: 0; }
|
||||
}
|
||||
.label-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 11pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.label-name { font-size: 8pt; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
</style>
|
||||
|
||||
<div class="print-toolbar d-flex flex-wrap align-items-center gap-3 p-3 border-bottom">
|
||||
<button class="btn btn-primary" onclick="window.print()"><i class="bi bi-printer"></i> Print</button>
|
||||
<span class="text-body-secondary">{{len .Labels}} label(s)</span>
|
||||
<form method="get" class="d-flex align-items-center gap-2 ms-auto">
|
||||
{{if .AssetID}}<input type="hidden" name="asset_id" value="{{.AssetID}}">{{end}}
|
||||
{{if .FolderID}}<input type="hidden" name="folder_id" value="{{.FolderID}}">{{end}}
|
||||
{{if .Recursive}}<input type="hidden" name="recursive" value="1">{{end}}
|
||||
<label class="form-label mb-0 small text-body-secondary" for="labelTemplateSelect">Label sheet</label>
|
||||
<select class="form-select form-select-sm" id="labelTemplateSelect" name="template" onchange="this.form.submit()">
|
||||
{{range $key := .TemplateKeys}}
|
||||
{{$t := index $.Templates $key}}
|
||||
<option value="{{$key}}" {{if eq $key $.Selected.Key}}selected{{end}}>{{$t.DisplayName}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{if .Selected.Approximate}}
|
||||
<div class="alert alert-warning m-3">
|
||||
This layout's grid/margins aren't from a verified spec sheet - print one test page on plain paper and
|
||||
hold it up to a real label sheet before printing a full (often waterproof, non-refundable) sheet.
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="label-sheet">
|
||||
{{range .Labels}}
|
||||
<div class="label">
|
||||
<img src="{{.QRData}}" alt="QR code for {{.Asset.AssetTag}}">
|
||||
<div class="min-w-0">
|
||||
<div class="label-tag">{{.Asset.AssetTag}}</div>
|
||||
<div class="label-name">{{.Asset.Name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{if not .Labels}}
|
||||
<p class="text-body-secondary p-3">No assets to print.</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -41,17 +41,19 @@
|
||||
Required: <code>Name</code>, <code>Item Type</code>, <code>Status</code>. Optional:
|
||||
<code>Asset ID</code> (auto-generated if blank; matches an existing asset to update it),
|
||||
<code>Folder</code> (a <code>/</code>-separated path such as <code>Main Office/Network</code>),
|
||||
<code>Assigned User</code>, <code>Notes</code>, and one <code>cf_<field_key></code> column
|
||||
per custom field (e.g. <code>cf_serial_number</code>).
|
||||
<code>Assigned User</code>, <code>Notes</code>, <code>Quantity</code> (defaults to 1; only
|
||||
meaningful for item types that aren't marked Unique), and one <code>cf_<field_key></code>
|
||||
column per custom field (e.g. <code>cf_serial_number</code>).
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0 small">
|
||||
<thead>
|
||||
<tr><th>Asset ID</th><th>Name</th><th>Item Type</th><th>Folder</th><th>Status</th><th>Assigned User</th><th>Notes</th><th>cf_serial_number</th></tr>
|
||||
<tr><th>Asset ID</th><th>Name</th><th>Item Type</th><th>Folder</th><th>Status</th><th>Assigned User</th><th>Notes</th><th>Quantity</th><th>cf_serial_number</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td></td><td>Core Switch</td><td>Switch</td><td>Main Office/Network</td><td>In Use</td><td></td><td></td><td>SN-12345</td></tr>
|
||||
<tr><td>IT-000042</td><td>Front Desk PC</td><td>Desktop</td><td>Main Office/Workstations</td><td>In Use</td><td>jdoe</td><td>Loaner unit</td><td></td></tr>
|
||||
<tr><td></td><td>Core Switch</td><td>Switch</td><td>Main Office/Network</td><td>In Use</td><td></td><td></td><td></td><td>SN-12345</td></tr>
|
||||
<tr><td>IT-000042</td><td>Front Desk PC</td><td>Desktop</td><td>Main Office/Workstations</td><td>In Use</td><td>jdoe</td><td>Loaner unit</td><td></td><td></td></tr>
|
||||
<tr><td></td><td>USB-A Cable</td><td>Cable</td><td>Main Office/Spares</td><td>Spare</td><td></td><td></td><td>25</td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
{{if not .EditUser}}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password</label>
|
||||
<input type="password" class="form-control" name="password" required autocomplete="new-password">
|
||||
<input type="password" class="form-control" name="password" autocomplete="new-password">
|
||||
<div class="form-text">Leave blank for a Contact - they can't sign in, so no password is needed.</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="mb-3">
|
||||
@@ -31,6 +32,7 @@
|
||||
<select class="form-select" name="role">
|
||||
<option value="user" {{if .EditUser}}{{if eq .EditUser.Role "user"}}selected{{end}}{{end}}>User</option>
|
||||
<option value="admin" {{if .EditUser}}{{if eq .EditUser.Role "admin"}}selected{{end}}{{end}}>Admin</option>
|
||||
<option value="contact" {{if .EditUser}}{{if eq .EditUser.Role "contact"}}selected{{end}}{{end}}>Contact (no login - assignable only)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
@@ -47,7 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .EditUser}}
|
||||
{{if and .EditUser .EditUser.CanLogin}}
|
||||
<div class="card">
|
||||
<div class="card-header py-2 fw-semibold">Change Password</div>
|
||||
<div class="card-body">
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
{{range .Users}}
|
||||
<tr>
|
||||
<td><a href="/settings/users/{{.ID}}/edit">{{.Username}}</a></td>
|
||||
<td>{{if .IsAdmin}}<span class="badge text-bg-primary">Admin</span>{{else}}<span class="badge text-bg-secondary">User</span>{{end}}</td>
|
||||
<td>
|
||||
{{if eq .Role "admin"}}<span class="badge text-bg-primary">Admin</span>
|
||||
{{else if eq .Role "contact"}}<span class="badge text-bg-info">Contact</span>
|
||||
{{else}}<span class="badge text-bg-secondary">User</span>{{end}}
|
||||
</td>
|
||||
<td>{{if .Enabled}}<span class="badge text-bg-success">Enabled</span>{{else}}<span class="badge text-bg-secondary">Disabled</span>{{end}}</td>
|
||||
<td>{{fmtDateShort .CreatedAt}}</td>
|
||||
<td class="text-end"><a href="/settings/users/{{.ID}}/edit" class="btn btn-sm btn-outline-secondary">Edit</a></td>
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
{{define "asset_fields_only"}}
|
||||
{{if .}}
|
||||
{{if not .IsUnique}}
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="assetFormQuantity">Quantity</label>
|
||||
<div class="input-group" style="max-width: 220px">
|
||||
<button class="btn btn-outline-secondary" type="button" data-action="quantity-step" data-step="-1">−</button>
|
||||
<input type="number" class="form-control text-center" name="quantity" id="assetFormQuantity" min="0" step="1" value="{{.Quantity}}">
|
||||
<button class="btn btn-outline-secondary" type="button" data-action="quantity-step" data-step="1">+</button>
|
||||
</div>
|
||||
<div class="form-text">This item type isn't Unique, so it's tracked by quantity instead of one row per unit.</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<input type="hidden" name="quantity" value="1">
|
||||
{{end}}
|
||||
{{if .Fields}}
|
||||
<h6 class="mt-3 mb-2">Type-Specific Fields</h6>
|
||||
{{range .}}
|
||||
{{range .Fields}}
|
||||
{{$fv := .}}
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="field-{{.Def.ID}}">{{.Def.Name}}{{if .Def.Required}} <span class="text-danger">*</span>{{end}}</label>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<select class="form-select" name="assigned_user_id">
|
||||
<option value="">Unassigned</option>
|
||||
{{range .Users}}
|
||||
<option value="{{.ID}}" {{if eq $selectedUser .ID}}selected{{end}}>{{.Username}}</option>
|
||||
<option value="{{.ID}}" {{if eq $selectedUser .ID}}selected{{end}}>{{.Username}}{{if eq .Role "contact"}} (Contact){{end}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="asset-fields-container">
|
||||
{{template "asset_fields_only" .Fields}}
|
||||
{{template "asset_fields_only" (dict "IsUnique" .SelectedITUnique "Quantity" .Quantity "Fields" .Fields)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -128,6 +128,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Check out / check in asset -->
|
||||
<div class="modal fade" id="checkoutModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="checkoutModalTitle">Check Out Asset</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="text-body-secondary small mb-3" id="checkoutCurrent"></p>
|
||||
<label class="form-label">Assigned User</label>
|
||||
<select class="form-select" id="checkoutUserSelect">
|
||||
<option value="">Unassigned (check in)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="confirmCheckoutBtn">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Import CSV into a specific folder (right-click a folder > Import CSV...) -->
|
||||
<div class="modal fade" id="importModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
|
||||
@@ -25,7 +25,19 @@
|
||||
<div class="card-header py-2 fw-semibold">Details</div>
|
||||
<table class="table table-sm mb-0">
|
||||
<tbody>
|
||||
<tr><th class="w-25">Assigned User</th><td>{{if .Asset.AssignedUsername}}{{.Asset.AssignedUsername}}{{else}}<span class="text-body-secondary">Unassigned</span>{{end}}</td></tr>
|
||||
<tr><th class="w-25">Assigned User</th><td>{{if .Asset.AssignedUsername}}{{.Asset.AssignedUsername}}{{else}}<span class="text-body-secondary">Unassigned — right-click above to check out</span>{{end}}</td></tr>
|
||||
{{if not .Asset.ItemTypeIsUnique}}
|
||||
<tr>
|
||||
<th>Quantity</th>
|
||||
<td>
|
||||
<div class="input-group input-group-sm" style="max-width: 150px" data-quantity-stepper data-asset-id="{{.Asset.ID}}">
|
||||
<button class="btn btn-outline-secondary" type="button" data-action="panel-quantity-step" data-step="-1">−</button>
|
||||
<span class="form-control text-center" data-quantity-value>{{.Asset.Quantity}}</span>
|
||||
<button class="btn btn-outline-secondary" type="button" data-action="panel-quantity-step" data-step="1">+</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
<tr><th>Created</th><td>{{fmtDate .Asset.CreatedAt}}</td></tr>
|
||||
<tr><th>Updated</th><td>{{fmtDate .Asset.UpdatedAt}}</td></tr>
|
||||
</tbody>
|
||||
|
||||
@@ -38,13 +38,23 @@
|
||||
{{if .Assets}}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover asset-table">
|
||||
<thead><tr><th>Asset ID</th><th>Name</th><th>Type</th><th>Status</th><th>Assigned</th></tr></thead>
|
||||
<thead><tr><th>Asset ID</th><th>Name</th><th>Type</th><th>Qty</th><th>Status</th><th>Assigned</th></tr></thead>
|
||||
<tbody>
|
||||
{{range .Assets}}
|
||||
<tr class="asset-row" data-id="{{.ID}}">
|
||||
<td>{{.AssetTag}}</td>
|
||||
<td><i class="bi {{iconOr .ItemTypeIcon "bi-box-seam"}} me-1"></i>{{.Name}}</td>
|
||||
<td>{{.ItemTypeName}}</td>
|
||||
<td>
|
||||
{{if .ItemTypeIsUnique}}<span class="text-body-secondary">—</span>
|
||||
{{else}}
|
||||
<div class="input-group input-group-sm" style="width:6.5rem" data-quantity-stepper data-asset-id="{{.ID}}">
|
||||
<button class="btn btn-outline-secondary py-0" type="button" data-action="table-quantity-step" data-step="-1">−</button>
|
||||
<span class="form-control text-center py-0" data-quantity-value>{{.Quantity}}</span>
|
||||
<button class="btn btn-outline-secondary py-0" type="button" data-action="table-quantity-step" data-step="1">+</button>
|
||||
</div>
|
||||
{{end}}
|
||||
</td>
|
||||
<td><span class="badge text-bg-{{.StatusColor}}">{{.StatusName}}</span></td>
|
||||
<td>{{if .AssignedUsername}}{{.AssignedUsername}}{{else}}<span class="text-body-secondary">—</span>{{end}}</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user