v0.10.0 - Add session archive/activate feature with access controls
This commit is contained in:
@@ -6,13 +6,22 @@
|
||||
<div class="session-detail-container">
|
||||
<div class="session-detail-header">
|
||||
<div>
|
||||
<a href="{{ url_for('dashboard') }}" class="breadcrumb">← Back to Dashboard</a>
|
||||
<h1 class="page-title">{{ count_session.session_name }}</h1>
|
||||
<!-- Fixed variable name from session.session_type to count_session.session_type -->
|
||||
<a href="{{ url_for('dashboard') }}{% if count_session.status == 'archived' %}?show_archived=1{% endif %}" class="breadcrumb">← Back to Dashboard</a>
|
||||
<h1 class="page-title">
|
||||
{{ count_session.session_name }}
|
||||
{% if count_session.status == 'archived' %}<span class="archived-badge">ARCHIVED</span>{% endif %}
|
||||
</h1>
|
||||
<span class="session-type-badge session-type-{{ count_session.session_type }}">
|
||||
{{ 'Full Physical' if count_session.session_type == 'full_physical' else 'Cycle Count' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="session-actions-header">
|
||||
{% if count_session.status == 'archived' %}
|
||||
<button class="btn btn-success" onclick="activateSession()">✓ Activate Session</button>
|
||||
{% else %}
|
||||
<button class="btn btn-secondary" onclick="archiveSession()">📦 Archive Session</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Baseline Upload Section -->
|
||||
@@ -675,5 +684,38 @@ document.addEventListener('keydown', function(e) {
|
||||
closeReopenConfirm();
|
||||
}
|
||||
});
|
||||
function archiveSession() {
|
||||
if (!confirm('Archive this session? It will be hidden from the main dashboard but can be reactivated later.')) return;
|
||||
|
||||
fetch('{{ url_for("sessions.archive_session", session_id=count_session.session_id) }}', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'}
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
window.location.href = '{{ url_for("dashboard") }}';
|
||||
} else {
|
||||
alert(data.message || 'Error archiving session');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function activateSession() {
|
||||
if (!confirm('Reactivate this session? It will appear on the main dashboard again.')) return;
|
||||
|
||||
fetch('{{ url_for("sessions.activate_session", session_id=count_session.session_id) }}', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'}
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
location.reload();
|
||||
} else {
|
||||
alert(data.message || 'Error activating session');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user