[UPDT] filter tags

This commit is contained in:
Horilla
2023-09-05 10:52:25 +05:30
parent c6fd4802b3
commit efa139471c
6 changed files with 40 additions and 83 deletions

View File

@@ -15,30 +15,7 @@
</ul>
{% endif %}
<!-- filter items showing here -->
<div class="oh-filter-tag-container "
style="position: fixed;top: 150;z-index: 9999;">
{%for field,values in filter_dict.items %}
{%if values %}
<span class="oh-filter-tag filter-field" data-x-field="{{field}}" >
{{field|filter_field}} : {% for value in values%} {{ value|capfirst }}{% endfor %}
<button class="oh-filter-tag__close">
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"> </ion-icon>
</button>
</span>
{%endif%}
{% endfor %}
</div>
<script>
var form_submit_id = 'feedback-filter-form-submit'
$(document).ready(function () {
$('.filter-field').on('click',function(){
const field_id = $(this).attr("data-x-field")
$('#id_'+field_id).val('')
$('#'+form_submit_id).click()
})
});
</script>
{% include 'filter_tags.html' %}
<div class="oh-tabs__contents">
<div class="oh-tabs__content oh-tabs__content" id="tab_1">
<!-- Sticky Table for self feedback -->

View File

@@ -141,7 +141,7 @@
</div>
</div>
<div class="oh-dropdown__filter-footer">
<button class="oh-btn oh-btn--secondary oh-btn--small w-100" id="feedback-filter-form-submit">{% trans "Filter" %}</button>
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton" id="feedback-filter-form-submit">{% trans "Filter" %}</button>
</div>
</form>
</div>

View File

@@ -1,29 +1,7 @@
{% load i18n %}
{% load basefilters %}
<!-- filter items showing here -->
<div class="oh-filter-tag-container "
style="position: fixed;top: 150;z-index: 9999;">
{%for field,values in filter_dict.items %}
{%if values %}
<span class="oh-filter-tag filter-field" data-x-field="{{field}}" >
{{field|filter_field}} : {% for value in values%} {{ value|capfirst }}{% endfor %}
<button class="oh-filter-tag__close">
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"> </ion-icon>
</button>
</span>
{%endif%}
{% endfor %}
</div>
<script>
var form_submit_id = "objective-filter-form-submit";
$(document).ready(function () {
$(".filter-field").on("click", function () {
const field_id = $(this).attr("data-x-field");
$("#id_" + field_id).val("");
$("#" + form_submit_id).click();
});
});
</script>
{% include 'filter_tags.html' %}
<div class="oh-tabs__contents">
<!-- own objective-->
<div class="oh-tabs__content" id="tab_1">

View File

@@ -132,7 +132,7 @@
</div>
</div>
<div class="oh-dropdown__filter-footer">
<button class="oh-btn oh-btn--secondary oh-btn--small w-100" id="objective-filter-form-submit">{% trans "Filter" %}</button>
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton" id="objective-filter-form-submit">{% trans "Filter" %}</button>
</div>
</form>
</div>

View File

@@ -31,14 +31,7 @@ def recruitment_search(request):
recruitment_obj = sortby(request, filter_obj.qs, "orderby")
data_dict = parse_qs(previous_data)
get_key_instances(Recruitment, data_dict)
if request.GET.get("is_active"):
if data_dict["is_active"] == ["unknown"]:
data_dict.pop("is_active")
return render(
request,
"recruitment/recruitment_component.html",
@@ -88,9 +81,6 @@ def candidate_search(request):
if not request.GET.get("dashboard"):
data_dict = parse_qs(previous_data)
get_key_instances(Candidate, data_dict)
keys_to_remove = [key for key, value in data_dict.items() if value == ["unknown"]]
for key in keys_to_remove:
data_dict.pop(key)
template = "candidate/candidate_card.html"
if request.GET.get("view") == "list":

View File

@@ -1,29 +1,41 @@
{% load basefilters %}
<!-- filter items showing here -->
<div class="oh-filter-tag-container "
style="position: fixed;top: 150;z-index: 9999;">
{%for field,values in filter_dict.items %}
{%if values %}
<span class="oh-filter-tag filter-field" data-x-field="{{field}}" >
{{field|filter_field}} : {% for value in values%} {{ value|capfirst }}{% endfor %}
<button class="oh-filter-tag__close">
<ion-icon name="close-outline" role="img" class="md hydrated" aria-label="close outline"> </ion-icon>
</button>
</span>
{%endif%}
{% endfor %}
<div
class="oh-filter-tag-container"
style="position: fixed; top: 150; z-index: 9999"
>
{%for field,values in filter_dict.items %} {%if values %}
<span class="oh-filter-tag filter-field" data-x-field="{{field}}">
{{field|filter_field}} : {% for value in values%} {{ value|capfirst }}{% endfor %}
<button class="oh-filter-tag__close">
<ion-icon
name="close-outline"
role="img"
class="md hydrated"
aria-label="close outline"
>
</ion-icon>
</button>
</span>
{%endif%} {% endfor %}
</div>
<script>
var form_submit_id = '.filterButton'
$(document).ready(function () {
$('.filter-field').on('click',function(){
const field_id = $(this).attr("data-x-field")
// Update all elements with the same ID to have null values
{% comment %} $('[id="id_' + field_id + '"]').val(''); {% endcomment %}
$(`[name=${field_id}]`).val('');
console.log( $(`[name=${field_id}]`))
$(form_submit_id).click()
})
var form_submit_id = ".filterButton";
$(document).ready(function () {
$(".filter-field").on("click", function () {
const field_id = $(this).attr("data-x-field");
// Update all elements with the same ID to have null values
$(`.oh-main__topbar:first [name=${field_id}]`).val("");
const elementId = $(`.oh-main__topbar:first [name=${field_id}]`).attr("id");
alert(elementId)
console.log(elementId)
const spanElement = $(`.oh-main__topbar:first #select2-id_${field_id}-container, .oh-main__topbar:first #select2-${elementId}-container`);
if (spanElement.length) {
spanElement.attr("title", "---------");
spanElement.text("---------");
}
$(form_submit_id).click();
});
</script>
});
</script>