Update template with new structure
This commit is contained in:
parent
0da3e15a03
commit
324eaa215c
|
@ -86,6 +86,9 @@
|
|||
<li class="nav-item">
|
||||
<a href="#log" class="nav-link" data-bs-toggle="tab" data-bs-target="#log">{% trans 'Log' %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#environmental_impact" class="nav-link" data-bs-toggle="tab" data-bs-target="#environmental_impact">{% trans 'Environmental Impact' %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,6 +108,8 @@
|
|||
|
||||
{% include 'tabs/dpps.html' %}
|
||||
|
||||
{% include 'tabs/environmental_impact.html' %}
|
||||
|
||||
<!-- Add a note popup -->
|
||||
<div class="modal fade" id="addNoteModal" tabindex="-1" aria-labelledby="addNoteModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
|
20
device/templates/tabs/environmental_impact.html
Normal file
20
device/templates/tabs/environmental_impact.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% load i18n %}
|
||||
|
||||
<div class="tab-pane fade show active" id="environmental_impact">
|
||||
<h5 class="card-title">{% trans 'Environmental Impact Details' %}</h5>
|
||||
<hr />
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 text-muted fw-bold">
|
||||
{% trans 'Carbon Saved' %}
|
||||
</div>
|
||||
<div class="col-sm-8">{{ impact.carbon_saved|default:'0.0' }} kg</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4 text-muted fw-bold">
|
||||
{% trans 'CO2 Emissions' %}
|
||||
</div>
|
||||
<div class="col-sm-8">{{ impact.co2_emissions|default:'0.0' }} kg</div>
|
||||
</div>
|
||||
</div>
|
|
@ -37,6 +37,7 @@ class DeviceLogMixin(DashboardView):
|
|||
institution=self.request.user.institution
|
||||
)
|
||||
|
||||
|
||||
class NewDeviceView(DashboardView, FormView):
|
||||
template_name = "new_device.html"
|
||||
title = _("New Device")
|
||||
|
@ -99,24 +100,26 @@ class DetailsView(DashboardView, TemplateView):
|
|||
uuid__in=self.object.uuids,
|
||||
type=PROOF_TYPE["IssueDPP"]
|
||||
)
|
||||
for x in _dpps:
|
||||
dpp = "{}:{}".format(self.pk, x.signature)
|
||||
dpps.append((dpp, x.signature[:10], x))
|
||||
# TODO Specify algorithm via dropdown, if not specified, use default.
|
||||
enviromental_impact_algorithm = FactoryEnvironmentImpactAlgorithm.run_environmental_impact_calculation(
|
||||
"dummy_calc"
|
||||
)
|
||||
enviromental_impact = enviromental_impact_algorithm.get_device_environmental_impact(
|
||||
self.object)
|
||||
for x in _dpps:
|
||||
dpp = "{}:{}".format(self.pk, x.signature)
|
||||
dpps.append((dpp, x.signature[:10], x))
|
||||
|
||||
last_evidence = self.object.get_last_evidence()
|
||||
uuids = self.object.uuids
|
||||
state_definitions = StateDefinition.objects.filter(
|
||||
institution=self.request.user.institution
|
||||
).order_by('order')
|
||||
device_states = State.objects.filter(snapshot_uuid__in=uuids).order_by('-date')
|
||||
device_states = State.objects.filter(
|
||||
snapshot_uuid__in=uuids).order_by('-date')
|
||||
device_logs = DeviceLog.objects.filter(
|
||||
snapshot_uuid__in=uuids).order_by('-date')
|
||||
device_notes = Note.objects.filter(snapshot_uuid__in=uuids).order_by('-date')
|
||||
device_notes = Note.objects.filter(
|
||||
snapshot_uuid__in=uuids).order_by('-date')
|
||||
context.update({
|
||||
'object': self.object,
|
||||
'snapshot': last_evidence,
|
||||
|
|
Loading…
Reference in a new issue