Commit 0b872e56 authored by hypsug0's avatar hypsug0
Browse files

WIP study sheet

parent e6635243
import logging
from rest_framework.serializers import ModelSerializer
from rest_framework.serializers import ModelSerializer, SerializerMethodField
from rest_framework_gis.serializers import GeoFeatureModelSerializer
from accounts.serializer import ProfileSearchSerializer
......@@ -49,3 +49,7 @@ class StudyDataSerializer(GeoFeatureModelSerializer):
geo_field = "geom"
depth = 0
fields = ("name", "sessions")
# def get_sessions(self, instance):
# queryset = instance.sessions.order_by("-date_start")
# return SessionSerializer(queryset, many=True).data
......@@ -69,53 +69,69 @@
<h4 class="panel-title">
<select class="pull-right input-sm" v-model="dataSource">
<option value="stats">statistiques générales</option>
<option value="localités">Localités</option>
<option value="sessions">Sessions</option>
<option value="observations" default>Observations</option>
</select>
<i class="fas fa-clipboard-list fa-fw"></i>Données
</h4>
</div>
<div style="overflow-y: auto; max-height: 500px;">
<div v-if="dataSource=='observations'" class="list-group">
<div v-for="(sp, ip) in sightingData" class="list-group-item">
<h3 class="list-group-item-heading"><i class="fa fa-map-marker fa-fw"></i>[[sp.properties.name]]</h3>
<div class="list-group">
<div v-for="(se, ie) in sp.properties.sessions" class="list-group-item">
<h4 class="list-group-item-heading">
<span class="pull-right label label-default label-lg">[[se.contact.descr]]</span>
[[se.date_start]]
</h4>
<p class="list-group-item-text">
<dl class="dl-horizontal">
<dt>Observateur principal</dt>
<dd>
[[se.main_observer?.get_full_name]]</dd>
<dt>Observations</dt>
<dd>
<ul class="list-unstyled">
<li v-for='(o, io) in se.observations' :class="{'text-muted':!o.codesp.sp_true}">
<strong>[[o.codesp.common_name_fr]]</strong>
(<i>[[o.codesp.sci_name]]</i>)
: [[o.total_count]]
[[o.is_breeding]]</li>
</ul>
</dd>
</dl>
</p>
</div>
<div v-if="dataSource=='stats'" class="row" style="text-align:center;font-size:2rem;">
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="statBlock">
<i class="text-muted fas fa-map-marked-alt fa-2x"></i><br>
<span class="statCount">{{ object.sessions.place.count }}</span><br>
<span class="statDesc text-muted"> localités</span><br>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="statBlock">
<i class="text-muted fas fa-calendar-check fa-2x "></i><br>
<span class="statCount">{{ object.sessions.count }}</span><br>
<span class="statDesc text-muted"> sessions}</span><br>
</div>
</div>
</div>
</div>
<div v-if="dataSource=='observations'" class="list-group">
<div v-for="(sp, ip) in sightingData" class="list-group-item">
<h3 class="list-group-item-heading"><i class="fa fa-map-marker fa-fw"></i>[[sp.properties.name]]</h3>
<div class="list-group">
<div v-for="(se, ie) in sp.properties.sessions" class="list-group-item">
<h4 class="list-group-item-heading">
<span class="pull-right label label-default label-lg">[[se.contact.descr]]</span>
<span class="text-info">[[se.date_start]]</span>
</h4>
<p class="list-group-item-text">
<dl class="dl-horizontal">
<dt>Observateur principal</dt>
<dd>
[[se.main_observer?.get_full_name]]</dd>
<dt>Observations</dt>
<dd>
<ul class="list-unstyled">
<li v-for='(o, io) in se.observations' :class="{'text-muted':!o.codesp.sp_true}">
<i v-show="o.breed_colo" class="fas fa-baby fa-fw text-success"></i>
<strong>[[o.codesp.common_name_fr]]</strong>
(<i>[[o.codesp.sci_name]]</i>)
: [[o.total_count ? o.total_count: '-']]
</li>
</ul>
</dd>
</dl>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
const studyId = parseInt('{{object.pk}}')
</div>
<script>
const studyId = parseInt('{{object.pk}}')
$(document).ready(() => {
const vm = new Vue(studyDataApp(parseInt('{{object.pk}}')))
})
$(document).ready(() => {
const vm = new Vue(studyDataApp(parseInt('{{object.pk}}')))
})
</script>
{% endblock %}
</script>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment