Skip to content
GitLab
Explore
Sign in
Commits on Source (2)
Add the filter for the surface in the mark search page (trainer)
· 75707c08
Marco De Donno
authored
Feb 10, 2020
75707c08
Add the filer for the pfsp in the mark search page
· 355b44a6
Marco De Donno
authored
Feb 10, 2020
355b44a6
Hide whitespace changes
Inline
Side-by-side
views/trainer/__init__.py
View file @
355b44a6
...
...
@@ -5,6 +5,7 @@ from flask import Blueprint
import
json
from
const
import
pfsp
import
config
from
utils.decorator
import
login_required
...
...
@@ -34,5 +35,6 @@ def search():
"
trainer/search.html
"
,
marks
=
marks
,
all_detection_technics
=
all_detection_technics
,
surfaces
=
surfaces
surfaces
=
surfaces
,
all_pfsp
=
pfsp
.
zones
)
views/trainer/templates/trainer/search.html
View file @
355b44a6
...
...
@@ -84,6 +84,15 @@
all_detection_technics
[
"
{{ dt[ 'id' ] }}
"
]
=
"
{{ dt[ 'name' ] }}
"
;
{
%
endfor
%
}
var
pfsp_sel
=
{};
{
%
for
pfsp
in
all_pfsp
%
}
var
tmp
=
[];
{
%
for
sel
in
pfsp
[
'
sel
'
]
%
}
tmp
.
push
(
"
{{ sel }}
"
);
{
%
endfor
%
}
pfsp_sel
[
"
{{ pfsp[ 'desc' ] }}
"
]
=
tmp
;
{
%
endfor
%
}
var
update_filter_detection
=
function
(
arg
)
{
var
selected
=
$
(
this
).
val
();
...
...
@@ -102,6 +111,46 @@
}
}
);
}
var
update_filter_surface
=
function
(
arg
)
{
var
selected
=
$
(
this
).
val
();
_
.
forEach
(
marks
,
function
(
m
){
var
tmp
=
[];
_
.
forEach
(
selected
,
function
(
s
)
{
tmp
.
push
(
m
[
"
surface
"
].
indexOf
(
s
)
);
}
);
if
(
Math
.
max
(
...
tmp
)
!=
-
1
)
{
$
(
"
#outer_div_mark_
"
+
m
[
"
uuid
"
]
).
show
();
}
else
{
$
(
"
#outer_div_mark_
"
+
m
[
"
uuid
"
]
).
hide
();
}
}
);
}
var
update_filter_pfsp
=
function
(
arg
)
{
var
selected
=
$
(
this
).
val
();
_
.
forEach
(
marks
,
function
(
m
){
var
tmp
=
[];
_
.
forEach
(
selected
,
function
(
s
)
{
_
.
forEach
(
pfsp_sel
[
s
],
function
(
ss
){
tmp
.
push
(
m
[
"
pfsp
"
].
indexOf
(
ss
)
);
}
);
}
);
if
(
Math
.
max
(
...
tmp
)
!=
-
1
)
{
$
(
"
#outer_div_mark_
"
+
m
[
"
uuid
"
]
).
show
();
}
else
{
$
(
"
#outer_div_mark_
"
+
m
[
"
uuid
"
]
).
hide
();
}
}
);
}
</script>
</head>
<body
class=
"icnml_main_layout"
>
...
...
@@ -118,6 +167,24 @@
{% endfor %}
</select>
</div>
<div
style=
"padding-top:5px; padding-bottom: 5px;"
>
Surface
</div>
<div
id=
"filter_surface"
>
<select
multiple
id=
"filter_surface_select"
data-placeholder=
"click to select the surface..."
class=
"chosen-select"
>
{% for s in surfaces %}
<option
value=
"{{ s[ 'id' ] }}"
>
{{ s[ 'name' ] }}
</option>
{% endfor %}
</select>
</div>
<div
style=
"padding-top:5px; padding-bottom: 5px;"
>
Position
</div>
<div
id=
"filter_pfsp"
>
<select
multiple
id=
"filter_pfsp_select"
data-placeholder=
"click to select the position..."
class=
"chosen-select"
>
{% for pfsp in all_pfsp %}
<option
value=
"{{ pfsp[ 'desc' ] }}"
>
{{ pfsp[ 'desc' ] }}
</option>
{% endfor %}
</select>
</div>
</div>
<div>
...
...
@@ -177,6 +244,16 @@
width
:
"
100%
"
}
).
change
(
update_filter_detection
);
$
(
"
#filter_surface_select
"
).
chosen
(
{
search_contains
:
true
,
width
:
"
100%
"
}
).
change
(
update_filter_surface
);
$
(
"
#filter_pfsp_select
"
).
chosen
(
{
search_contains
:
true
,
width
:
"
100%
"
}
).
change
(
update_filter_pfsp
);
$
(
"
#icnml_navigation_trainersearch
"
)
.
addClass
(
"
activated
"
);
</script>
...
...