Commit 5efff2ba authored by hypsug0's avatar hypsug0
Browse files

WIP sighting form

parent 02ea708d
......@@ -835,6 +835,14 @@ BS Full screen Modal
}
}
/************************************/
/* Sighting form */
/************************************/
/*
#sighting-form {
margin: 5px;
padding: 0px 5px;
......@@ -851,15 +859,75 @@ BS Full screen Modal
border-radius: 5px;
}
#sessionSightingEdit H1 {
margin: 10px;
#sessionSightingEdit h1, h3, h4 {
/* margin: 0; */
}
#sessionSightingEditFormList {
background: white;
/* padding: 0px; */
}
#sessionSightingEditFormDetails {
/* background: whitesmoke; */
/* padding: 0; */
}
#sessionSightingEditFormDetails h3 {
padding: 10px;
}
#listSpecie {
padding: 10px;
border-bottom: 1px solid #777 ;
}
#specieForm {
padding: 10px;
border-bottom: 1px solid #777 ;
background-color: whitesmoke;
}
#specieDetail {
padding: 5px;
border-bottom: 1px solid #777 ;
border-top: 1px solid #777 ;
background-color: white;
}
.bg-default {
background: whitesmoke;
} */
#moreSightingForm {
padding: 10px;
}
/************************************/
/* Some custom css */
/************************************/
.statBlock {
background-color: white;
border: 1px solid whitesmoke;
padding: 10px;
border-radius: 10px;
line-height: 1.5em;
}
.statBlock i {
line-height: 1.5em;
}
.statBlock .statCount{
font-size: 2em;
}
.statBlock .statDesc {
font-size: 1em;
}
......@@ -982,9 +982,6 @@ const sightingSearchBlock = () => {
const CountDetailObject = (lastdata) => {
return {
// session: id_session,
// sighting: null,
// taxa: null,
id_countdetail: null,
method: null,
sex: null,
......@@ -1027,7 +1024,7 @@ const SightingObject = (session_id) => {
id_sighting: null,
codesp: null,
breed_colo: null,
total_count: null,
total_count: 0,
observer: null,
is_doubtful: false,
comment: null,
......@@ -1043,21 +1040,20 @@ new Vue({
},
})
const sigthingFormApp = (id_session) => {
const sigthingFormApp = (id_session, type_contact) => {
VeeValidate.extend('positive', (value) => {
return value >= 0
})
VeeValidate.extend('required', {
validate(value) {
return {
required: true,
valid: ['', null, undefined].indexOf(value) === -1
};
return {
required: true,
valid: ['', null, undefined].indexOf(value) === -1,
}
},
computesRequired: true
});
computesRequired: true,
})
VeeValidate.configure({
classes: {
......@@ -1089,11 +1085,13 @@ const sigthingFormApp = (id_session) => {
isVisible: false,
showRawData: false,
selectedItem: 0,
typeContact: type_contact,
moreSightingForm: false,
}
},
methods: {
selectItem(i) {
this.selectedItem = i;
this.selectedItem = i
},
showCountDetail(item) {
item.isVisible = !item.isVisible
......@@ -1107,6 +1105,7 @@ const sigthingFormApp = (id_session) => {
},
addNewSighting() {
this.data.push({ ...this.newSighting })
this.selectedItem = this.data.length - 1
},
addNewCountDetail(is) {
const newEmptyCountDetail = { ...this.newCountDetail }
......@@ -1136,10 +1135,10 @@ const sigthingFormApp = (id_session) => {
delCountDetail(is, icd) {
this.data[is].countdetails.splice(icd, 1)
},
getSciName(isp) {
getSpecieValue(isp, field) {
specieList = this.dicts.Specie
return isp
? specieList.find((r) => r.id === isp).sci_name
? specieList.find((r) => r.id === isp)[field]
: 'Not defined'
},
getSpClass(isp) {
......@@ -1203,6 +1202,12 @@ const sigthingFormApp = (id_session) => {
// // )
// this.data.forEach(e => this.postSighting(e))
},
filteredDict(dict, contact) {
return dict.filter((e) => e.contact == contact)
},
taxaSelectOptions(dict, contact){
return
},
getDicts() {
if (localStorage.getItem('dicts') == null) {
console.debug('No dicts in localStorage')
......@@ -1226,6 +1231,10 @@ const sigthingFormApp = (id_session) => {
this.data.user = obj
console.warn(obj)
},
sumCountDetails(is) {
Countsum = (a, c) => a + parseInt(c.count)
return this.data[is].countdetails.reduce(Countsum, 0)
},
getData() {
$http
.get(sightingDataListUrl)
......@@ -1241,8 +1250,7 @@ const sigthingFormApp = (id_session) => {
})
},
},
computed: {},
// watch: {
// computed: {
// data: () => {
// Countsum = (a, c) => a + c.count
// console.log('TEST DATA', this.data);
......@@ -1251,6 +1259,16 @@ const sigthingFormApp = (id_session) => {
// )
// }
// },
watch: {
data: {
handler() {
this.data.forEach((e, i) => {
e.total_count = this.sumCountDetails(i)
})
},
deep: true,
},
},
mounted() {
this.getDicts()
this.getData()
......
......@@ -34,7 +34,6 @@ countdetail_fields = (
"precision",
"count",
"unit",
"time",
"device",
"manipulator",
"validator",
......
......@@ -4,31 +4,31 @@
<div class="row" style="text-align:center;font-size:2rem;">
<div class="col-sm-12 col-md-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-body">
<i class="{{ placesicon }}"></i> {{ placescount }} {{ placestext }}
</div>
<div class="statBlock">
<i class="text-muted fas fa-map-marked-alt fa-2x"></i><br>
<span class="statCount">{{ placescount }}</span><br>
<span class="statDesc text-muted"> {{ placestext }}</span><br>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-body">
<i class="{{ sessionsicon }}"></i> {{ sessionscount }} {{ sessionstext }}
</div>
<div class="statBlock">
<i class="text-muted fas fa-calendar-check fa-2x "></i><br>
<span class="statCount">{{ sessionscount }}</span><br>
<span class="statDesc text-muted"> {{ sessionstext }}</span><br>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-body">
<i class="{{ sightingsicon }}"></i> {{ sightingscount }} {{ sightingstext }}
</div>
<div class="statBlock">
<i class="text-muted fas fa-eye fa-2x"></i><br>
<span class="statCount">{{ sightingscount }}</span><br>
<span class="statDesc text-muted"> {{ sightingstext }}</span><br>
</div>
</div>
<div class="col-sm-12 col-md-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-body">
<i class="{{ observersicon }}"></i> {{ observerscount }} {{ observerstext }}
</div>
<div class="statBlock">
<i class="text-muted fas fa-users fa-2x"></i><br>
<span class="statCount">{{ observerscount }}</span><br>
<span class="statDesc text-muted"> {{ observerstext }}</span><br>
</div>
</div>
</div>
......@@ -47,9 +47,9 @@
</div>
{% else %}
<div class="row" style="text-align:center;font-size:2rem;">
<div class="col-xs-12" >
<a href="{% url 'auth_login' %}" class="btn btn-info btn-lg btn-block" alt="{% trans 'Se connecter' %}"><i class="fa fa-fw fa-sign-in-alt" aria-hidden="true"
></i>
<div class="col-xs-12">
<a href="{% url 'auth_login' %}" class="btn btn-info btn-lg btn-block" alt="{% trans 'Se connecter' %}"><i
class="fa fa-fw fa-sign-in-alt" aria-hidden="true"></i>
{% trans 'Se connecter' %}</a>
</div>
</div>
......
This diff is collapsed.
Supports Markdown
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