some updates
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
{% extends "atlas/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
{% include "atlas/question_link_header.html" %}
|
||||
<h2>Update Series for Case: {{ object.title }}</h2>
|
||||
<form method="post" enctype="multipart/form-data" data-bs-theme="dark">
|
||||
{% csrf_token %}
|
||||
{% crispy form form.helper %}
|
||||
{{ series_formset.management_form }}
|
||||
<div id="series_formset">
|
||||
{% for form in series_formset %}
|
||||
<div class="card mb-3 series-form">
|
||||
<div class="card-body">
|
||||
{{ form.non_field_errors }}
|
||||
{{ form.errors }}
|
||||
{{ form|crispy }}
|
||||
{% if form.can_delete %}
|
||||
<div class="form-check mt-2">
|
||||
{{ form.DELETE }} <label for="{{ form.DELETE.id_for_label }}">Delete</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<!-- Empty form template for JS -->
|
||||
<div id="empty-form" style="display:none;">
|
||||
<div class="card mb-3 series-form">
|
||||
<div class="card-body">
|
||||
{{ series_formset.empty_form|crispy }}
|
||||
{% if series_formset.empty_form.can_delete %}
|
||||
<div class="form-check mt-2">
|
||||
{{ series_formset.empty_form.DELETE }} <label for="{{ series_formset.empty_form.DELETE.id_for_label }}">Delete</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="add-series" class="btn btn-secondary mt-2">Add Series</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const addBtn = document.getElementById("add-series");
|
||||
const formsetDiv = document.getElementById("series_formset");
|
||||
const emptyFormDiv = document.getElementById("empty-form");
|
||||
let totalForms = document.getElementById("id_seriesdetail_set-TOTAL_FORMS");
|
||||
|
||||
addBtn.addEventListener("click", function() {
|
||||
let formIdx = parseInt(totalForms.value);
|
||||
let newFormHtml = emptyFormDiv.innerHTML.replace(/__prefix__/g, formIdx);
|
||||
let tempDiv = document.createElement('div');
|
||||
tempDiv.innerHTML = newFormHtml;
|
||||
// Clear the id field value for the new form
|
||||
let idInput = tempDiv.querySelector('input[name$="-id"]');
|
||||
if (idInput) {
|
||||
idInput.value = "";
|
||||
}
|
||||
formsetDiv.appendChild(tempDiv.firstElementChild);
|
||||
totalForms.value = formIdx + 1;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -39,6 +39,7 @@
|
||||
<span class="series-block">
|
||||
<span>
|
||||
<span class="series-block-series-number">Series {{ forloop.counter }}:</span><br>
|
||||
test
|
||||
{{series.get_block}}
|
||||
<br />
|
||||
{% comment %} <button class="show-series no-padding text-secondary border-secondary" data-case={{case.pk}} data-target="/ohif/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:series_dicom_json' series.pk %}">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'atlas:case_detail' pk=case.pk %}" title="View the Case">View</a>
|
||||
<a href="{% url 'atlas:case_update' pk=case.pk %}" title="Edit the Case">Edit</a>
|
||||
<a href="{% url 'atlas:case_series_update' pk=case.pk %}" title="Edit the Cases Series">Series</a>
|
||||
<a href="{% url 'atlas:case_clone' pk=case.pk %}"
|
||||
title="Clone the Case (duplicate everything but the images)">Clone</a>
|
||||
<a href="{% url 'atlas:case_delete' pk=case.pk %}" title="Delete the Case">Delete</a>
|
||||
|
||||
Reference in New Issue
Block a user