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