2020-01-10 16:52:55 +01:00
|
|
|
<div class="card mb-3 mt-1">
|
|
|
|
<div class="card-header text-white bg-dark">
|
2020-01-13 11:10:03 +01:00
|
|
|
<h5 class="card-title">Search {{object_name}} by Tags :</h5>
|
2020-01-10 16:52:55 +01:00
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
|
2020-01-20 15:13:03 +01:00
|
|
|
{%if object_type=='item'%}
|
|
|
|
<div class="row mb-3">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="input-group" id="date-range-from">
|
|
|
|
<div class="input-group-prepend"><span class="input-group-text"><i class="far fa-calendar-alt" aria-hidden="true"></i></span></div>
|
|
|
|
<input class="form-control" id="date-range-from-input" placeholder="yyyy-mm-dd" value="{{ date_from[0:4] }}-{{ date_from[4:6] }}-{{ date_from[6:8] }}" name="date_from" autocomplete="off">
|
|
|
|
</div>
|
2020-01-10 16:52:55 +01:00
|
|
|
</div>
|
2020-01-20 15:13:03 +01:00
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="input-group" id="date-range-to">
|
|
|
|
<div class="input-group-prepend"><span class="input-group-text"><i class="far fa-calendar-alt" aria-hidden="true"></i></span></div>
|
|
|
|
<input class="form-control" id="date-range-to-input" placeholder="yyyy-mm-dd" value="{{ date_to[0:4] }}-{{ date_to[4:6] }}-{{ date_to[6:8] }}" name="date_to" autocomplete="off">
|
|
|
|
</div>
|
2020-01-10 16:52:55 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-20 15:13:03 +01:00
|
|
|
{%endif%}
|
2020-01-10 16:52:55 +01:00
|
|
|
|
|
|
|
<div class="input-group mb-3">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<button class="btn btn-outline-danger" type="button" id="button-clear-tags" style="z-index: 1;" onclick="emptyTags()">
|
|
|
|
<i class="fas fa-eraser"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<input id="ltags" name="ltags" type="text" class="form-control" aria-describedby="button-clear-tags" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<button class="btn btn-primary" type="button" id="button-search-tags" onclick="searchTags()">
|
2020-01-13 11:10:03 +01:00
|
|
|
<i class="fas fa-search"></i> Search {{object_name}}
|
2020-01-10 16:52:55 +01:00
|
|
|
</button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-01-13 11:10:03 +01:00
|
|
|
|
2020-01-10 16:52:55 +01:00
|
|
|
<link href="{{ url_for('static', filename='css/tags.css') }}" rel="stylesheet" type="text/css" />
|
|
|
|
<script src="{{ url_for('static', filename='js/tags.js') }}"></script>
|
|
|
|
<script>
|
|
|
|
var ltags;
|
2020-01-13 11:10:03 +01:00
|
|
|
$.getJSON("{{ url_for('tags_ui.get_all_obj_tags') }}?object_type={{ object_type }}",
|
2020-01-10 16:52:55 +01:00
|
|
|
function(data) {
|
|
|
|
ltags = $('#ltags').tagSuggest({
|
|
|
|
data: data,
|
2020-01-13 11:10:03 +01:00
|
|
|
value: [{%if "current_tags"%}{% for tag in current_tags %}'{{tag|safe}}',{%endfor%}{%endif%}],
|
2020-01-10 16:52:55 +01:00
|
|
|
sortOrder: 'name',
|
|
|
|
maxDropHeight: 200,
|
|
|
|
name: 'ltags'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
function searchTags() {
|
|
|
|
var data = ltags.getValue();
|
2020-01-13 11:10:03 +01:00
|
|
|
var parameter = "?ltags=" + data + "&object_type={{ object_type }}{%if page%}&page={{ page }}{%endif%}";
|
2020-01-20 15:13:03 +01:00
|
|
|
{%if object_type=='item'%}
|
|
|
|
var date_from = $('#date-range-from-input').val();
|
|
|
|
var date_to =$('#date-range-to-input').val();
|
|
|
|
parameter = parameter + "&date_from=" + date_from + "&date_to=" + date_to;
|
|
|
|
{%endif%}
|
2020-01-13 11:10:03 +01:00
|
|
|
window.location.replace("{{ url_for('tags_ui.get_obj_by_tags') }}" + parameter);
|
2020-01-10 16:52:55 +01:00
|
|
|
}
|
|
|
|
function emptyTags() {
|
|
|
|
ltags.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-20 15:13:03 +01:00
|
|
|
{%if object_type=='item'%}
|
|
|
|
$('#date-range-from').dateRangePicker({
|
|
|
|
separator : ' to ',
|
|
|
|
getValue: function(){
|
|
|
|
if ($('#date-range-from-input').val() && $('#date-range-to-input').val() )
|
|
|
|
return $('#date-range-from-input').val() + ' to ' + $('#date-range-to-input').val();
|
|
|
|
else
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
setValue: function(s,s1,s2){
|
|
|
|
$('#date-range-from-input').val(s1);
|
|
|
|
$('#date-range-to-input').val(s2);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#date-range-to').dateRangePicker({
|
|
|
|
separator : ' to ',
|
|
|
|
getValue: function(){
|
|
|
|
if ($('#date-range-from-input').val() && $('#date-range-to-input').val() )
|
|
|
|
return $('#date-range-from-input').val() + ' to ' + $('#date-range-to-input').val();
|
|
|
|
else
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
setValue: function(s,s1,s2){
|
|
|
|
$('#date-range-from-input').val(s1);
|
|
|
|
$('#date-range-to-input').val(s2);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
{%endif%}
|
|
|
|
|
2020-01-10 16:52:55 +01:00
|
|
|
</script>
|