Adding OData Import

This commit is contained in:
Ian Roddis committed 2026-06-25 15:52:21 -03:00
1 parent c8696e67b5
commit 291416544e
18 files changed
+547 -3

No files matched your search

@@ -0,0 +1,44 @@
<div id="imported-parts-section">
{% if sync_result %}
<p class="muted">{{ sync_result }}</p>
{% endif %}
{% if sync_error %}
<p style="color:var(--color-danger,#c00)">{{ sync_error }}</p>
{% endif %}
<div class="card" style="overflow-x:auto">
<p class="muted" style="margin-bottom:.5rem">
Showing {{ parts|length }} record{{ '' if parts|length == 1 else 's' }}{% if total and total > parts|length %} of {{ total }} total{% endif %}.
</p>
<table class="table">
<thead>
<tr>
<th>InventoryID</th>
<th>Description</th>
<th>TBX Colour</th>
<th>Max Thread Depth (mm)</th>
<th>Max Thread Depth (in)</th>
<th>OD (mm)</th>
<th>OD (in)</th>
<th>Thread Attribute</th>
</tr>
</thead>
<tbody>
{% for p in parts %}
<tr>
<td>{{ p.InventoryID }}</td>
<td>{{ p.Description or '—' }}</td>
<td>{{ p.TBXColour or '—' }}</td>
<td>{{ p.ProductMaxThreadDepthmm or '—' }}</td>
<td>{{ p.ProductMaxThreadDepthin or '—' }}</td>
<td>{{ p.ProductODmm or '—' }}</td>
<td>{{ p.ProductODin or '—' }}</td>
<td>{{ p.TBXThreadAttribute or '—' }}</td>
</tr>
{% else %}
<tr><td colspan="8" class="muted">No imported parts. Use Refresh to sync from OData.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
+41
View File
@@ -0,0 +1,41 @@
{% extends "base.html" %}
{% block title %}Imported Parts · {{ app_name }}{% endblock %}
{% block body %}
{% include "_nav.html" %}
<main class="container">
<h1>Imported Parts</h1>
<div class="card">
<h2>OData Configuration</h2>
<form hx-post="/admin/imported-parts/config"
hx-target="#config-status"
hx-swap="innerHTML"
class="form-grid">
<label>OData URL
<input type="url" name="odata_url" value="{{ config.odata_url or '' }}" placeholder="https://…">
</label>
<label>Username
<input type="text" name="username" value="{{ config.username or '' }}" autocomplete="off">
</label>
<label>Password
<input type="password" name="password" placeholder="{{ '(set — leave blank to keep)' if config.has_password else '(none set)' }}" autocomplete="new-password">
</label>
<button type="submit" class="btn btn-primary">Save Configuration</button>
</form>
<div id="config-status" class="muted" style="margin-top:.5rem"></div>
</div>
<div style="margin-bottom:1rem">
<button class="btn btn-primary"
hx-post="/admin/imported-parts/refresh"
hx-target="#imported-parts-section"
hx-swap="outerHTML"
hx-indicator="#refresh-indicator">
Refresh from OData
</button>
<span id="refresh-indicator" class="htmx-indicator muted"> Loading…</span>
</div>
{% include "admin/_imported_parts_table.html" %}
</main>
{% endblock %}