Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dbchiro
dbchiroweb
Commits
8cfc2c2d
Commit
8cfc2c2d
authored
Mar 10, 2021
by
hypsug0
Browse files
wip select species
parent
5efff2ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/static/js/app.js
View file @
8cfc2c2d
...
...
@@ -1066,6 +1066,7 @@ const sigthingFormApp = (id_session, type_contact) => {
Vue
.
component
(
'
ValidationProvider
'
,
VeeValidate
.
ValidationProvider
)
Vue
.
component
(
'
ValidationObserver
'
,
VeeValidate
.
ValidationObserver
)
Vue
.
component
(
'
v-select
'
,
VueSelect
.
VueSelect
)
return
{
el
:
'
#sessionSightingEdit
'
,
...
...
@@ -1107,6 +1108,10 @@ const sigthingFormApp = (id_session, type_contact) => {
this
.
data
.
push
({
...
this
.
newSighting
})
this
.
selectedItem
=
this
.
data
.
length
-
1
},
// refactorForSelect(dict, contact) {
// const dict = this.filteredDict(dict, contact)
// const options = dict.map(x => {label: x.})
// },
addNewCountDetail
(
is
)
{
const
newEmptyCountDetail
=
{
...
this
.
newCountDetail
}
console
.
debug
(
...
...
@@ -1205,7 +1210,7 @@ const sigthingFormApp = (id_session, type_contact) => {
filteredDict
(
dict
,
contact
)
{
return
dict
.
filter
((
e
)
=>
e
.
contact
==
contact
)
},
taxaSelectOptions
(
dict
,
contact
){
taxaSelectOptions
(
dict
,
contact
)
{
return
},
getDicts
()
{
...
...
@@ -1214,6 +1219,10 @@ const sigthingFormApp = (id_session, type_contact) => {
$http
.
get
(
'
/api/v1/dicts
'
)
.
then
((
response
)
=>
{
console
.
debug
(
'
Saving downloaded dicts in localStorage
'
,
response
.
data
)
localStorage
.
setItem
(
'
dicts
'
,
JSON
.
stringify
(
response
.
data
)
...
...
@@ -1240,6 +1249,9 @@ const sigthingFormApp = (id_session, type_contact) => {
.
get
(
sightingDataListUrl
)
.
then
((
response
)
=>
{
this
.
data
=
response
.
data
?.
results
if
(
this
.
data
.
length
==
0
)
{
this
.
addNewSighting
()
}
console
.
debug
(
'
this.data
'
,
this
.
data
)
})
.
then
(()
=>
{
...
...
templates/sights/sighting_form.html
View file @
8cfc2c2d
...
...
@@ -14,8 +14,9 @@
</style>
{% comment %}
<script
src=
"https://unpkg.com/vue-select@latest"
></script>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/vue-select@latest/dist/vue-select.css"
/>
{% endcomment %}
<script
src=
"https://unpkg.com/vue-select@latest"
></script>
<link
rel=
"stylesheet"
href=
"https://unpkg.com/vue-select@latest/dist/vue-select.css"
>
<div
id=
"sessionSightingEdit"
>
<div
id=
"sessionSightingEditTitle"
class=
"col-12"
>
<h1><i
class=
"{{ icon | safe }}"
></i>
{{ title | safe }}
<span
v-if=
"initialDataLoaded"
...
...
@@ -94,20 +95,17 @@
<div
class=
"panel-body"
>
<div
class=
"specieForm"
>
<div
class=
"form-inline"
>
<input
type=
"hidden"
id=
"id"
placeholder=
"id_sighting"
v-model:title=
"data[selectedItem].id_sighting"
v-model:content=
"data[selectedItem].id_sighting"
/>
<validation-provider
rules=
"required"
immediate
v-slot=
"{ errors, valid, invalid, classes}"
>
<input
type=
"hidden"
id=
"id"
placeholder=
"id_sighting"
v-model:title=
"data[selectedItem].id_sighting"
v-model:content=
"data[selectedItem].id_sighting"
/>
<div
class=
"form-group"
:class=
'classes'
>
<label
class=
"control-label"
for=
"codeSp"
>
Taxon
</label>
<select
id=
"codeSp"
class=
"form-control input-sm"
v-model:title=
"data[selectedItem].codesp"
v-model:content=
"data[selectedItem].codesp"
class=
"form-control"
required
>
<option
v-for=
"sp in dicts.Specie"
v-bind:value=
"sp.id"
>
[[ sp.sci_name ]]
</option>
</select>
<span
v-if=
'invalid'
class=
"text-danger help-block"
>
[[ errors[0] ]]
</span>
</div>
</validation-provider>
<div
class=
"form-group"
:class=
'classes'
>
<label
class=
"control-label"
for=
"codeSp"
>
Taxon
</label>
<v-select
class=
"form-control"
id=
"codeSp"
:options=
"dicts.Specie"
:reduce=
"sp => sp.id"
label=
"codesp"
v-model=
"data[selectedItem].codesp"
/>
<span
v-if=
'invalid'
class=
"text-danger help-block"
>
[[ errors[0] ]]
</span>
</div>
</validation-provider>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"codeSp"
>
Nombre total
</label>
<input
id=
"codeSp"
type=
"number"
class=
"form-control input-sm"
placeholder=
"Nombre total"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment