Skip to content

Commit

Permalink
added registration date filter
Browse files Browse the repository at this point in the history
  • Loading branch information
u5ele55 committed Dec 12, 2024
1 parent bafe0ad commit e34474c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions frontend/advanced_user_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,28 @@ <h2 class="header py-2">Расширенный поиск пользовател
<input name="patronymic" type="text" class="form-control" placeholder="Отчество">
</div>
</div>
<div class="form-row">
<div class="form-row mb-3">
<div class="col">
<input name="username" type="text" class="form-control" placeholder="Никнейм">
</div>
<div class="col doubled">
<input name="min_visits" type="number" min="0" class="form-control" placeholder="Посетил, от">
<input name="max_visits" type="number" min="0" class="form-control" placeholder="Посетил, до">
</div>
<div class="col doubled">
<input class="form-control" type="date" name="created_at_from" value="" min="2000-01-01">
<input class="form-control" type="date" name="created_at_to" value="" min="2000-01-01">
</div>
</div>
<div class="form-row">
<div class="col">
<button type="submit" class="btn btn-primary btn-block" id="find" onclick="findUsers()">Найти</button>
</div>
</div>
</div>

<div class="row" id="found-users-list">



</div>
</div>
</div>
Expand All @@ -56,7 +61,9 @@ <h2 class="header py-2">Расширенный поиск пользовател
const username = document.querySelector("input[name='username']").value;
const min_visits = document.querySelector("input[name='min_visits']").value;
const max_visits = document.querySelector("input[name='max_visits']").value;

const created_at_from = document.querySelector("input[name='created_at_from']").value;
const created_at_to = document.querySelector("input[name='created_at_to']").value;
// new Date('2024-12-12').getTime()
let data = {
last_name: last_name,
first_name: first_name,
Expand All @@ -66,6 +73,10 @@ <h2 class="header py-2">Расширенный поиск пользовател
};
if (max_visits)
data.max_visits = max_visits;
if (created_at_from)
data.created_at_from = new Date(created_at_from).getTime();
if (created_at_to)
data.created_at_to = new Date(created_at_to).getTime();

console.log(data);
let list = document.getElementById("found-users-list");
Expand Down

0 comments on commit e34474c

Please sign in to comment.