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.
72 lines
3.4 KiB
HTML
72 lines
3.4 KiB
HTML
{{define "content"}}
|
|
<div class="container-fluid p-3">
|
|
<h4 class="mb-3">Settings</h4>
|
|
<div class="row g-3">
|
|
<div class="col-md-3 col-lg-2">
|
|
{{template "settings_nav" "users"}}
|
|
</div>
|
|
<div class="col-md-9 col-lg-10" style="max-width: 600px">
|
|
<div class="d-flex align-items-center mb-3">
|
|
<h5 class="mb-0">{{if .EditUser}}Edit User{{else}}New User{{end}}</h5>
|
|
<a href="/settings/users" class="btn btn-sm btn-outline-secondary ms-auto">Back to Users</a>
|
|
</div>
|
|
|
|
{{if .Error}}<div class="alert alert-danger">{{.Error}}</div>{{end}}
|
|
|
|
<div class="card mb-3">
|
|
<div class="card-body">
|
|
<form method="post" action="{{if .EditUser}}/settings/users/{{.EditUser.ID}}{{else}}/settings/users{{end}}">
|
|
<div class="mb-3">
|
|
<label class="form-label">Username</label>
|
|
<input type="text" class="form-control" name="username" value="{{if .EditUser}}{{.EditUser.Username}}{{end}}" required autofocus>
|
|
</div>
|
|
{{if not .EditUser}}
|
|
<div class="mb-3">
|
|
<label class="form-label">Password</label>
|
|
<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">
|
|
<label class="form-label">Role</label>
|
|
<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">
|
|
<input class="form-check-input" type="checkbox" name="enabled" id="enabled" {{if .EditUser}}{{if .EditUser.Enabled}}checked{{end}}{{else}}checked{{end}}>
|
|
<label class="form-check-label" for="enabled">Enabled</label>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Save</button>
|
|
</form>
|
|
{{if .EditUser}}
|
|
<form method="post" action="/settings/users/{{.EditUser.ID}}/delete" class="d-inline mt-2" onsubmit="return confirm('Delete this user?')">
|
|
<button type="submit" class="btn btn-outline-danger">Delete User</button>
|
|
</form>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if and .EditUser .EditUser.CanLogin}}
|
|
<div class="card">
|
|
<div class="card-header py-2 fw-semibold">Change Password</div>
|
|
<div class="card-body">
|
|
<form method="post" action="/settings/users/{{.EditUser.ID}}/password" class="row g-2 align-items-end">
|
|
<div class="col">
|
|
<label class="form-label">New Password</label>
|
|
<input type="password" class="form-control" name="password" autocomplete="new-password">
|
|
</div>
|
|
<div class="col-auto">
|
|
<button type="submit" class="btn btn-outline-primary">Set Password</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|