mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 04:31:49 +02:00
Merge pull request #2 from Huda11Baig/filter_by_year
added filter by year
This commit is contained in:
commit
235477676e
1 changed files with 28 additions and 1 deletions
|
@ -66,6 +66,29 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<script>
|
||||
function myFunction() {
|
||||
// Declare variables
|
||||
var input, filter, table, tr, td, i, txtValue;
|
||||
input = document.getElementById("myInput");
|
||||
filter = input.value;
|
||||
table = document.getElementById("myTable");
|
||||
tr = table.getElementsByTagName("tr");
|
||||
|
||||
// Loop through all table rows, and hide those who don't match the search query
|
||||
for (i = 0; i < tr.length; i++) {
|
||||
td = tr[i].getElementsByTagName("td")[0];
|
||||
if (td) {
|
||||
txtValue = td.textContent || td.innerText;
|
||||
if (txtValue.indexOf(filter) > -1) {
|
||||
tr[i].style.display = "";
|
||||
} else {
|
||||
tr[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="bill-form" class="modal fade show" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
@ -103,6 +126,7 @@
|
|||
</div>
|
||||
|
||||
{% if bills.total > 0 %}
|
||||
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Filter by year">
|
||||
<h3>Active Bills</h3>
|
||||
<table id="bill_table" class="col table table-striped table-hover table-responsive-sm">
|
||||
<thead>
|
||||
|
@ -113,7 +137,7 @@
|
|||
</th><th>{{ _("How much?") }}
|
||||
</th><th>{{ _("Actions") }}</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody id="myTable">
|
||||
{% for (weights, bill) in bills.items %}
|
||||
{% if bill.archive == false %}
|
||||
<tr owers="{{bill.owers|join(',','id')}}" payer="{{bill.payer.id}}">
|
||||
|
@ -178,3 +202,6 @@
|
|||
</div></div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue