Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 87e4ee726c | |||
| cbe309f114 | |||
| 2aa625a6ac | |||
| d39e758df4 |
@@ -156,6 +156,8 @@ class AbstractModelAPISerializer:
|
|||||||
if isinstance(geojson, dict):
|
if isinstance(geojson, dict):
|
||||||
geojson = json.dumps(geojson)
|
geojson = json.dumps(geojson)
|
||||||
geometry = geos.fromstr(geojson)
|
geometry = geos.fromstr(geojson)
|
||||||
|
if not geometry.valid:
|
||||||
|
raise ValueError(f"Invalid geometry: {geometry.valid_reason}")
|
||||||
is_4326 = Geometry.is_valid_4326(geometry)
|
is_4326 = Geometry.is_valid_4326(geometry)
|
||||||
if not is_4326:
|
if not is_4326:
|
||||||
raise ValueError("Geometry not in EPSG:4326 (WGS84). Unknown spatial reference system.")
|
raise ValueError("Geometry not in EPSG:4326 (WGS84). Unknown spatial reference system.")
|
||||||
|
|||||||
@@ -30,17 +30,44 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans 'Available' %}</th>
|
||||||
|
<td>
|
||||||
|
{{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 %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans 'Deductions for' %}</th>
|
<th scope="row">{% trans 'Deductions for' %}</th>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
{% for deduction in deductions %}
|
<table class="table table-hover">
|
||||||
<a href="{% url 'intervention:report' deduction.intervention__id %}">
|
<th scope="col">
|
||||||
{{deduction.intervention__identifier}} - {{deduction.intervention__title}}
|
{% translate 'Intervention' %}
|
||||||
</a>
|
</th>
|
||||||
<br>
|
<th scope="col">
|
||||||
{% empty %}
|
{% translate 'Amount' %}
|
||||||
{% trans 'None' %}
|
</th>
|
||||||
{% endfor %}
|
{% for deduction in deductions %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'intervention:report' deduction.intervention__id %}">
|
||||||
|
{{deduction.intervention__identifier}} - {{deduction.intervention__title}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{ deduction.surface|floatformat:2 }} m²</td>
|
||||||
|
{% empty %}
|
||||||
|
<td>
|
||||||
|
{% translate 'None' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
/
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -66,7 +66,15 @@ class EcoAccountPublicReportView(AbstractPublicReportView):
|
|||||||
deductions = acc.deductions.all() \
|
deductions = acc.deductions.all() \
|
||||||
.distinct("intervention") \
|
.distinct("intervention") \
|
||||||
.select_related("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 = {
|
context = {
|
||||||
"obj": acc,
|
"obj": acc,
|
||||||
@@ -86,6 +94,8 @@ class EcoAccountPublicReportView(AbstractPublicReportView):
|
|||||||
"actions": actions,
|
"actions": actions,
|
||||||
"deductions": deductions,
|
"deductions": deductions,
|
||||||
"tables_scrollable": False,
|
"tables_scrollable": False,
|
||||||
|
"available": available_relative,
|
||||||
|
"available_total": available_total,
|
||||||
TAB_TITLE_IDENTIFIER: tab_title,
|
TAB_TITLE_IDENTIFIER: tab_title,
|
||||||
}
|
}
|
||||||
context = BaseContext(request, context).context
|
context = BaseContext(request, context).context
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 16.07.26
|
||||||
|
|
||||||
|
"""
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""
|
||||||
|
Author: Michel Peltriaux
|
||||||
|
Created on: 16.07.26
|
||||||
|
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user