Skip to content
Commits on Source (2)
...@@ -5,6 +5,7 @@ from flask import Blueprint ...@@ -5,6 +5,7 @@ from flask import Blueprint
import json import json
from const import pfsp
import config import config
from utils.decorator import login_required from utils.decorator import login_required
...@@ -34,5 +35,6 @@ def search(): ...@@ -34,5 +35,6 @@ def search():
"trainer/search.html", "trainer/search.html",
marks = marks, marks = marks,
all_detection_technics = all_detection_technics, all_detection_technics = all_detection_technics,
surfaces = surfaces surfaces = surfaces,
all_pfsp = pfsp.zones
) )
...@@ -84,6 +84,15 @@ ...@@ -84,6 +84,15 @@
all_detection_technics[ "{{ dt[ 'id' ] }}" ] = "{{ dt[ 'name' ] }}"; all_detection_technics[ "{{ dt[ 'id' ] }}" ] = "{{ dt[ 'name' ] }}";
{% endfor %} {% 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 update_filter_detection = function( arg )
{ {
var selected = $( this ).val(); var selected = $( this ).val();
...@@ -102,6 +111,46 @@ ...@@ -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> </script>
</head> </head>
<body class="icnml_main_layout"> <body class="icnml_main_layout">
...@@ -118,6 +167,24 @@ ...@@ -118,6 +167,24 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </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>
<div> <div>
...@@ -177,6 +244,16 @@ ...@@ -177,6 +244,16 @@
width: "100%" width: "100%"
} ).change( update_filter_detection ); } ).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" ) $( "#icnml_navigation_trainersearch" )
.addClass( "activated" ); .addClass( "activated" );
</script> </script>
......