Files
vibetree/web/templates/pages/settings_import.html
T
Owen 42e7b2a21c Statuses import, an icon picker, folder-scoped CSV import, and site name
- Statuses can now be bulk-imported/updated via CSV (Name, Color columns;
  matches and updates existing statuses by name). New
  internal/statuses/csv.go, tested.
- Icon fields (folder create/rename, item type form) are now a searchable
  dropdown of the 50 most common Bootstrap Icons instead of a free-text
  box, via a small reusable .icon-picker widget in app.js/app.css.
- CSV asset import is now folder-scoped when triggered from the tree:
  right-click a folder (or its background) > Import CSV... imports every
  row directly into that folder, so the CSV needs no Folder column at
  all, and the option no longer appears at the top level. The original
  global, Folder-path-aware import (with auto-create-missing-folders)
  moved to a new admin-only Settings > Import / Export page, alongside
  the new Statuses import and format examples for both. assets.Import
  gained ImportOptions.TargetFolderID to drive the folder-scoped mode.
- Site Name (Settings > General) now actually renders in the navbar
  brand and <title>, via a per-App "siteName" template func bound in
  loadTemplates. The brand is plain text now, not a link to /inventory.
2026-08-17 15:57:59 -05:00

95 lines
4.7 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" "import"}}
</div>
<div class="col-md-9 col-lg-10" style="max-width: 900px">
{{if .Error}}
<div class="alert alert-danger">{{.Error}}</div>
{{else if eq .Kind "assets"}}
<div class="alert alert-success">Imported {{.Imported}} asset(s), updated {{.Updated}}.{{if .Errs}} {{.Errs}} row(s) had warnings.{{end}}</div>
{{else if eq .Kind "statuses"}}
<div class="alert alert-success">Imported {{.Imported}} status(es), updated {{.Updated}}.{{if .Errs}} {{.Errs}} row(s) had warnings.{{end}}</div>
{{end}}
<p class="text-body-secondary">
This page is for bulk, admin-level imports that can reference any folder path (and create missing
folders along the way). To import assets straight into one specific folder without a Folder column,
right-click that folder in the Inventory tree and choose <strong>Import CSV&hellip;</strong> instead.
</p>
<div class="card mb-4">
<div class="card-header py-2 fw-semibold">Import Assets</div>
<div class="card-body">
<form method="post" action="/settings/import/assets" enctype="multipart/form-data" class="mb-3">
<div class="mb-3">
<label class="form-label">CSV File</label>
<input type="file" class="form-control" name="file" accept=".csv" required>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="create_missing_folders" id="createMissingFolders" value="1" checked>
<label class="form-check-label" for="createMissingFolders">Create missing folders referenced in the Folder column</label>
</div>
<button type="submit" class="btn btn-primary">Import Assets</button>
</form>
<p class="mb-1 fw-semibold small">Format</p>
<p class="text-body-secondary small mb-2">
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_&lt;field_key&gt;</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>
</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>
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-header py-2 fw-semibold">Import Statuses</div>
<div class="card-body">
<form method="post" action="/settings/import/statuses" enctype="multipart/form-data" class="mb-3">
<div class="mb-3">
<label class="form-label">CSV File</label>
<input type="file" class="form-control" name="file" accept=".csv" required>
</div>
<button type="submit" class="btn btn-primary">Import Statuses</button>
</form>
<p class="mb-1 fw-semibold small">Format</p>
<p class="text-body-secondary small mb-2">
Required: <code>Name</code>. Optional: <code>Color</code> (any Bootstrap color name -
<code>primary</code>, <code>secondary</code>, <code>success</code>, <code>danger</code>,
<code>warning</code>, <code>info</code>, or <code>dark</code>; defaults to <code>secondary</code>).
A row whose name matches an existing status updates its color instead of creating a duplicate.
</p>
<div class="table-responsive">
<table class="table table-sm table-bordered mb-0 small">
<thead><tr><th>Name</th><th>Color</th></tr></thead>
<tbody>
<tr><td>In Use</td><td>success</td></tr>
<tr><td>Awaiting Parts</td><td>warning</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{{end}}