Commit d02dd2a7 authored by hypsug0's avatar hypsug0
Browse files

feat:WIP on study detail page

parent 64590231
......@@ -1110,7 +1110,6 @@ const SightingObject = (session_id) => {
}
}
Vue.component('transmitterSelect', {
data() {
return {
......@@ -1484,7 +1483,7 @@ const sigthingFormApp = (id_session, type_contact) => {
messages: [],
countDetailSelectedItem: -1,
postInProgress: 0,
sightingToDelete: -1
sightingToDelete: -1,
}
},
methods: {
......@@ -1587,9 +1586,7 @@ const sigthingFormApp = (id_session, type_contact) => {
},
getSpecieValue(isp, field) {
specieList = this.dicts.Specie
return isp
? specieList.find((r) => r.id === isp)[field]
: null
return isp ? specieList.find((r) => r.id === isp)[field] : null
},
getSpClass(isp) {
specieList = this.dicts.Specie
......@@ -1650,7 +1647,6 @@ const sigthingFormApp = (id_session, type_contact) => {
.then((r) => {
console.log('DELETE', r)
this.data.splice(i, 1)
})
} else {
this.data.splice(i, 1)
......@@ -1818,21 +1814,34 @@ const sigthingFormApp = (id_session, type_contact) => {
}
const studyDataApp = (pk) => {
return {
el: '#StudyData',
delimiters: ['[[', ']]'],
data() {
return {
pk :pk,
pk: pk,
msg: 'Test',
placeData: [],
sessionData: [],
sightingData: [],
data_source: 'stats',
dataSource: 'sessions',
loading: true,
}
}
},
methods: {
getSightings() {
$http
.get(`/api/v1/study/${pk}/observations?format=json`)
.then((r) => {
this.sightingData = r.data.features
console.log(this.sightingData)
this.loading = false
})
.catch((error) => console.error(error))
},
},
mounted() {
this.getSightings()
},
}
}
......@@ -67,49 +67,62 @@
<div id="StudyData" class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<select class="pull-right input-sm" v-model="dataSource">
<option value="stats" default>statistiques générales</option>
<option value="localités">Localités</option>
<option value="sessions">Sessions</option>
<option value="observations">Observations</option>
</select>
<i class="fas fa-clipboard-list fa-fw"></i>Données (Sessions: {{object.sessions.count}})
</h4>
</div>
<div class="list-group">
{% for s in object.sessions.all %}
<div class="list-group-item">
<div style="overflow-y: auto; max-height: 500px;">
<div v-if="dataSource=='sessions'" class="list-group">
{% for s in object.sessions.all %}
<div class="list-group-item">
<h4 class="list-group-item-heading">
<span class="pull-right label label-default label-lg">{{s.contact.descr}}</span>
{{s.place.name}} - {{s.date_start}}
</h4>
<p class="list-group-item-text">
<dl class="dl-horizontal">
<dt>Observateur principal</dt>
<dd>
{{s.main_observer.get_full_name}}</dd>
<dt>Observations</dt>
<dd>
<ul class="list-unstyled">
{%for o in s.sighting_set.all %}
<li class="{{o.codesp.sp_true|yesno:',text-muted'}}">
<strong>{{o.codesp.common_name_fr}}</strong>
(<i>{{o.codesp.sci_name}}</i>)
: {{o.total_count}}
{{o.is_breeding}}</li>
{% endfor %}
</ul>
</dd>
</dl>
</p>
<h4 class="list-group-item-heading">
<span class="pull-right label label-default label-lg">{{s.contact.descr}}</span>
{{s.place.name}} - {{s.date_start}}
</h4>
<p class="list-group-item-text">
<dl class="dl-horizontal">
<dt>Observateur principal</dt>
<dd>
{{s.main_observer.get_full_name}}</dd>
<dt>Observations</dt>
<dd>
<ul class="list-unstyled">
{%for o in s.sighting_set.all %}
<li class="{{o.codesp.sp_true|yesno:',text-muted'}}">
<strong>{{o.codesp.common_name_fr}}</strong>
(<i>{{o.codesp.sci_name}}</i>)
: {{o.total_count}}
{{o.is_breeding}}</li>
{% endfor %}
</ul>
</dd>
</dl>
</p>
</div>
{% endfor %}
</div>
<div v-if="dataSource=='observations'" class="list-group">
test
<div v-for="(s, i) in sightingData" class="list-group-item">
[[s.properties.specie_data.common_name_fr]] - [[s.properties.total_count]]
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</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 %}
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