Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/genlab_bestilling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ def update_status(self) -> None:
def filled_genlab_count(self) -> int:
return self.samples.filter(genlab_id__isnull=False).count()

@property
def isolated_count(self) -> int:
return self.samples.filter(is_isolated=True).count()

@property
def next_status(self) -> OrderStatus | None:
current_index = self.STATUS_ORDER.index(self.status)
Expand Down
13 changes: 12 additions & 1 deletion src/staff/templates/staff/sample_lab.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ <h3 class="text-4xl mb-5">{% block page-title %}{% if order %}Samples {{ order }
<form method="post" action="{% url 'staff:order-extraction-samples-lab' order.pk %}">
{% csrf_token %}
{% next_url_input %}
<div class="flex items-center">
{% for status in statuses %}
<button class="btn btn-sm custom_order_button_green" type="submit" name="status" value="{{ status }}">
{{ status|capfirst }}
</button>
{% endfor %}
<div class="inline-block text-left mb-5">
<div class="text-left">
<button type="button"
id="parent-dropdown-button"
onclick="document.getElementById('parent-dropdown-menu').classList.toggle('hidden')"
Expand Down Expand Up @@ -53,6 +54,16 @@ <h3 class="text-4xl mb-5">{% block page-title %}{% if order %}Samples {{ order }
{% endif %}
</div>
</div>
<div class="ml-auto text-right w-full max-w-xs">
<div class="mb-1 font-medium text-sm">
{{ order.isolated_count }} / {{ order.samples.count }} isolated samples
</div>
<div class="w-full bg-gray-200 h-2 rounded">
<div class="bg-[#C9EBB0] h-2 rounded" style="width:{{ progress_percent|default:0|floatformat:0 }}%;"></div>
</div>
</div>
</div>
<div class="mt-2"></div>
{% render_table table %}
</form>
{% endblock page-inner %}
Expand Down
7 changes: 7 additions & 0 deletions src/staff/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,13 @@ def get_base_fields(self) -> list[str]:
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data(**kwargs)
order = self.get_order()
total_samples = order.samples.count()
filled_count = order.isolated_count
context["progress_percent"] = (
(float(filled_count) / float(total_samples)) * 100
if total_samples > 0
else 0
)

context.update(
{
Expand Down