diff --git a/compensation/models.py b/compensation/models.py index ecd432af..1d3e7cce 100644 --- a/compensation/models.py +++ b/compensation/models.py @@ -17,7 +17,7 @@ from compensation.settings import COMPENSATION_IDENTIFIER_LENGTH, COMPENSATION_I from intervention.models import Intervention, ResponsibilityData from konova.models import BaseObject, BaseResource, Geometry, UuidModel from konova.utils.generators import generate_random_string -from user.models import UserActionLogEntry, UserAction +from user.models import UserActionLogEntry class Payment(BaseResource): diff --git a/compensation/tables.py b/compensation/tables.py index c8b5ae39..29c9627d 100644 --- a/compensation/tables.py +++ b/compensation/tables.py @@ -239,7 +239,7 @@ class EcoAccountTable(BaseTable): """ withdraws = record.withdraws.all() - withdraw_surfaces = withdraws.aggregate(Sum("amount"))["amount__sum"] or 0 + withdraw_surfaces = withdraws.aggregate(Sum("surface"))["surface__sum"] or 0 after_states_surfaces = record.after_states.all().aggregate(Sum("surface"))["surface__sum"] or withdraw_surfaces ## no division by zero value = int(((after_states_surfaces - withdraw_surfaces) / after_states_surfaces) * 100) html = render_to_string("konova/custom_widgets/progressbar.html", {"value": value}) diff --git a/compensation/templates/compensation/detail/eco_account/includes/withdraws.html b/compensation/templates/compensation/detail/eco_account/includes/withdraws.html new file mode 100644 index 00000000..d085742e --- /dev/null +++ b/compensation/templates/compensation/detail/eco_account/includes/withdraws.html @@ -0,0 +1,61 @@ +{% load i18n l10n fontawesome_5 humanize %} +
+ {% trans 'Intervention Identifier' %} + | ++ {% trans 'Amount' %} + | ++ {% trans 'Action' %} + | +
---|---|---|
+ + {{ withdraw.intervention.identifier }} + + | +{{ withdraw.surface|floatformat:2|intcomma }} m² | ++ {% if is_default_member and has_access %} + + {% endif %} + | +
{% trans 'Title' %} | +{{obj.title}} | +
---|---|
{% trans 'Available' %} | ++ {% with available as value %} + {% include 'konova/custom_widgets/progressbar.html' %} + {% endwith %} + | +
{% trans 'Recorded' %} | ++ {% if obj.recorded is None %} + + {% fa5_icon 'bookmark' 'far' %} + + {% else %} + + {% fa5_icon 'bookmark' %} + + {% endif %} + | +
{% trans 'Last modified' %} | +
+ {{obj.created.timestamp|default_if_none:""|naturalday}}
+ + {{obj.created.user.username}} + |
+
{% trans 'Shared with' %} | ++ {% for user in obj.users.all %} + {% include 'user/includes/contact_modal_button.html' %} + {% endfor %} + | +