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.
82 lines
3.7 KiB
HTML
82 lines
3.7 KiB
HTML
{{define "panel_folder"}}
|
|
<div class="panel-content p-3" data-panel-type="folder" data-folder-id="{{.Folder.ID}}">
|
|
{{template "breadcrumb" .Breadcrumb}}
|
|
|
|
<h4 class="mb-1" data-context="folder-header" data-id="{{.Folder.ID}}">
|
|
<i class="bi {{iconOr .Folder.Icon "bi-folder-fill"}} text-warning-emphasis me-1"></i>{{.Folder.Name}}
|
|
</h4>
|
|
{{if .Folder.Description}}<p class="text-body-secondary">{{.Folder.Description}}</p>{{end}}
|
|
|
|
{{if .Subfolders}}
|
|
<h6 class="mt-3 mb-2">Subfolders</h6>
|
|
<div class="list-group mb-3">
|
|
{{range .Subfolders}}
|
|
<a href="#" class="list-group-item list-group-item-action folder-link d-flex align-items-center" data-id="{{.ID}}">
|
|
<i class="bi {{iconOr .Icon "bi-folder-fill"}} text-warning-emphasis me-2"></i>
|
|
{{.Name}}
|
|
<span class="ms-auto text-body-secondary small">{{.FolderCount}} folder(s), {{.AssetCount}} asset(s)</span>
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
<div class="d-flex align-items-center flex-wrap gap-2 mt-3 mb-2">
|
|
<h6 class="mb-0 me-2">Assets</h6>
|
|
<form class="d-flex gap-2 flex-wrap align-items-center panel-filter-form" data-folder-id="{{.Folder.ID}}">
|
|
<select class="form-select form-select-sm" name="item_type_id" style="width:auto">
|
|
<option value="">All Types</option>
|
|
{{range .ItemTypes}}<option value="{{.ID}}" {{if eq .ID $.FilterType}}selected{{end}}>{{.Name}}</option>{{end}}
|
|
</select>
|
|
<select class="form-select form-select-sm" name="status_id" style="width:auto">
|
|
<option value="">All Statuses</option>
|
|
{{range .Statuses}}<option value="{{.ID}}" {{if eq .ID $.FilterStat}}selected{{end}}>{{.Name}}</option>{{end}}
|
|
</select>
|
|
<input type="search" class="form-control form-control-sm" name="q" value="{{.Query}}" placeholder="Filter assets…" style="width:160px">
|
|
</form>
|
|
</div>
|
|
|
|
{{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>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>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{$pages := ceilDiv .Total .PageSize}}
|
|
{{if gt $pages 1}}
|
|
<nav>
|
|
<ul class="pagination pagination-sm">
|
|
{{range $i := seqFrom1 $pages}}
|
|
<li class="page-item {{if eq $i $.Page}}active{{end}}">
|
|
<a class="page-link panel-page-link" href="#" data-folder-id="{{$.Folder.ID}}" data-page="{{$i}}">{{$i}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</nav>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="text-body-secondary">No assets in this folder yet. <span class="admin-only">Right-click here to add one.</span></p>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|