diff --git a/compensation/templates/compensation/report/eco_account/report.html b/compensation/templates/compensation/report/eco_account/report.html index e2147f69..85e8b82d 100644 --- a/compensation/templates/compensation/report/eco_account/report.html +++ b/compensation/templates/compensation/report/eco_account/report.html @@ -30,17 +30,44 @@ {% endif %} + + {% trans 'Available' %} + + {{available_total|floatformat:2}} / {{obj.deductable_surface|default_if_none:0.00|floatformat:2}} m² + {% with available as value %} + {% include 'konova/widgets/progressbar.html' %} + {% endwith %} + + {% trans 'Deductions for' %} - {% for deduction in deductions %} - - {{deduction.intervention__identifier}} - {{deduction.intervention__title}} - -
- {% empty %} - {% trans 'None' %} - {% endfor %} + + + + {% for deduction in deductions %} + + + + {% empty %} + + + + {% endfor %} + +
+ {% translate 'Intervention' %} + + {% translate 'Amount' %} +
+ + {{deduction.intervention__identifier}} - {{deduction.intervention__title}} + + {{ deduction.surface|floatformat:2 }} m² + {% translate 'None' %} + + / +
diff --git a/compensation/views/eco_account/report.py b/compensation/views/eco_account/report.py index beb53cd9..5a9b764b 100644 --- a/compensation/views/eco_account/report.py +++ b/compensation/views/eco_account/report.py @@ -66,7 +66,15 @@ class EcoAccountPublicReportView(AbstractPublicReportView): deductions = acc.deductions.all() \ .distinct("intervention") \ .select_related("intervention") \ - .values_list("intervention__id", "intervention__identifier", "intervention__title", named=True) + .values_list("intervention__id", + "intervention__identifier", + "intervention__title", + "surface", + named=True) + + # Calculate rest of available surface for deductions + available_total = acc.deductable_rest + available_relative = acc.get_deductable_rest_relative() context = { "obj": acc, @@ -86,6 +94,8 @@ class EcoAccountPublicReportView(AbstractPublicReportView): "actions": actions, "deductions": deductions, "tables_scrollable": False, + "available": available_relative, + "available_total": available_total, TAB_TITLE_IDENTIFIER: tab_title, } context = BaseContext(request, context).context