Skip to content
Commits on Source (2)
......@@ -19,8 +19,8 @@ def search():
Provide the search page.
"""
marks = config.db.query_fetchall( "SELECT * FROM mark_info" )
all_detection_technics = config.db.query_fetchall( "SELECT * FROM detection_technics" )
surfaces = config.db.query_fetchall( "SELECT * FROM surfaces" )
all_detection_technics = config.db.query_fetchall( "SELECT * FROM detection_technics ORDER BY name ASC" )
surfaces = config.db.query_fetchall( "SELECT * FROM surfaces ORDER BY name ASC" )
for _, v in enumerate( marks ):
for col in [ "detection_technic", "surface" ]:
......
......@@ -50,6 +50,14 @@
grid-column-gap: 20px;
grid-template-columns: auto 1fr;
}
.icnml_search_filters {
margin-bottom: 20px;
display: grid;
grid-gap 5px;
grid-column-gap: 20px;
grid-template-columns: auto 1fr;
}
</style>
<script type="text/javascript">
......@@ -58,6 +66,7 @@
var marks = {};
{% for mark in marks %}
marks[ "{{ mark[ 'uuid' ] }}" ] = {
"uuid": "{{ mark[ 'uuid' ] }}",
"id": "{{ mark[ 'id' ] }}",
"pfsp": "{{ mark[ 'pfsp' ] }}".split( "," ),
"dt": "{{ mark[ 'detection_technic' ] }}".split( "," ),
......@@ -74,6 +83,25 @@
{% for dt in all_detection_technics %}
all_detection_technics[ "{{ dt[ 'id' ] }}" ] = "{{ dt[ 'name' ] }}";
{% endfor %}
var update_filter_detection = function( arg )
{
var selected = $( this ).val();
_.forEach( marks, function( m ){
var tmp = [];
_.forEach( selected, function( s ) {
tmp.push( m[ "dt" ].indexOf( s ) );
} );
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">
......@@ -81,31 +109,44 @@
{% include navigation %}
<div class="icnml_content">
{% for mark in marks %}
<div id="outer_div_mark_{{ mark[ 'uuid' ] }}" class="mark_outer">
<div class="icnml_img">
<img src="{{ url_for( 'image.image_file_serve', file_id = mark[ 'uuid' ] ) }}">
</div>
<div>
<div class="icnml_mark_info">
<div>Name</div>
<div>Mark {{ mark[ 'id' ] }}</div>
<div>UUID</div>
<div>{{ mark[ 'uuid' ] }}</div>
<div>Position</div>
<div id="mark_{{ mark[ 'uuid' ] }}_pfsp"></div>
<div>Surface</div>
<div id="mark_{{ mark[ 'uuid' ] }}_surface">-</div>
<div>Detection technic</div>
<div id="mark_{{ mark[ 'uuid' ] }}_dt">-</div>
<div class="icnml_search_filters">
<div style="padding-top:5px; padding-bottom: 5px;">Detection technic</div>
<div id="filter_detection">
<select multiple id="filter_detection_select" data-placeholder="click to select the detection technic..." class="chosen-select">
{% for dt in all_detection_technics %}
<option value="{{ dt[ 'id' ] }}">{{ dt[ 'name' ] }}</option>
{% endfor %}
</select>
</div>
</div>
<div>
{% for mark in marks %}
<div id="outer_div_mark_{{ mark[ 'uuid' ] }}" class="mark_outer">
<div class="icnml_img">
<img src="{{ url_for( 'image.image_file_serve', file_id = mark[ 'uuid' ] ) }}">
</div>
<div>
<div class="icnml_mark_info">
<div>Name</div>
<div>Mark {{ mark[ 'id' ] }}</div>
<div>UUID</div>
<div>{{ mark[ 'uuid' ] }}</div>
<div>Position</div>
<div id="mark_{{ mark[ 'uuid' ] }}_pfsp"></div>
<div>Surface</div>
<div id="mark_{{ mark[ 'uuid' ] }}_surface">-</div>
<div>Detection technic</div>
<div id="mark_{{ mark[ 'uuid' ] }}_dt">-</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
<script type="text/javascript">
......@@ -130,6 +171,11 @@
.html( dt.join( "<br>" ) );
{% endfor %}
$( "#filter_detection_select" ).chosen( {
search_contains: true,
width: "100%"
} ).change( update_filter_detection );
$( "#icnml_navigation_trainersearch" )
.addClass( "activated" );
......