Files
SmartScanProbeTrack/templates/probe_list.html
2025-07-29 10:51:42 -04:00

93 lines
4.1 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Probe Management</h2>
<a href="{{ url_for('probes.new_probe') }}" class="btn btn-primary">Add New Probe</a>
</div>
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">All Probes</h5>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="activeFilter"
{% if active_only %}checked{% endif %}
onchange="window.location.search = '?active_only=' + this.checked">
<label class="form-check-label" for="activeFilter">Only show active probes</label>
</div>
</div>
<div class="card-body">
{% if probes %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Model</th>
<th>Created</th>
<th>Retired</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for probe in probes|sort(attribute='model_name') %}
<tr class="probe-row" data-active="{{ 'true' if not probe.retired_at else 'false' }}">
<td>{{ probe.model_name }}</td>
<td>{{ probe.created_at.strftime('%Y-%m-%d') }}</td>
<td>
{% if probe.retired_at %}
<span class="badge bg-secondary">Yes</span>
{% else %}
<span class="badge bg-success">No</span>
{% endif %}
</td>
<td>
<a href="{{ url_for('probes.view_probe', probe_id=probe.id) }}"
class="btn btn-sm btn-outline-primary">View/Edit</a>
</td>
</tr>
{% if probe.channels %}
{% for channel in probe.channels %}
<tr class="channel-row">
<td colspan="2">
<small class="text-muted">
Channel: {{ channel.parameter.parameter_name }} ({{ channel.serial_number }})
</small>
</td>
<td></td>
<td>
<a href="{{ url_for('channels.view_channel', channel_id=channel.id) }}"
class="btn btn-sm btn-outline-secondary">View</a>
</td>
</tr>
{% endfor %}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">No probes found</div>
{% endif %}
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const activeFilter = document.getElementById('activeFilter');
function filterProbes() {
const showActiveOnly = activeFilter.checked;
document.querySelectorAll('.probe-row').forEach(row => {
const isActive = row.dataset.active === 'true';
row.style.display = (showActiveOnly && !isActive) ? 'none' : '';
});
}
// Initial filter on page load
filterProbes();
});
</script>
{% endblock %}