Skip to content

Commit

Permalink
profile: rating filter added
Browse files Browse the repository at this point in the history
  • Loading branch information
u5ele55 committed Dec 12, 2024
1 parent 4de8571 commit 7305f1a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions frontend/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ <h5 class="card-title">Посещённые дворы</h5>
<input class="form-control mr-2" type="date" name="start_date" oninput="filterVisits()">
<input class="form-control" type="date" name="end_date" oninput="filterVisits()">
</div>
<div class="d-flex mb-3">
<input class="form-control mr-2" placeholder="Рейтинг, от" type="number" name="courtyard_rating_from" oninput="filterVisits()">
<input class="form-control" placeholder="Рейтинг, до" type="number" name="courtyard_rating_to" oninput="filterVisits()">
</div>

<div class="list-group" id="visits">


<!-- More visited yards if needed -->
</div>
</div>
</div>
Expand All @@ -62,13 +65,19 @@ <h5 class="card-title">Посещённые дворы</h5>
function filterVisits() {
const startDate = document.querySelector("input[name='start_date']").value;
const endDate = document.querySelector("input[name='end_date']").value;
const ratingFrom = document.querySelector("input[name='courtyard_rating_from']").value;
const ratingTo = document.querySelector("input[name='courtyard_rating_to']").value;
const courtyard = document.querySelector("input[name='courtyard']").value;

const data = {
let data = {
visited_from: startDate,
visited_to: endDate,
courtyard_title: courtyard
};
if (ratingFrom)
data.courtyard_rating_from = ratingFrom;
if (ratingTo)
data.courtyard_rating_to = ratingTo;

// visits
fetch(`http://localhost:8081/users/${id}/visits?` + new URLSearchParams(data).toString(), {
Expand Down

0 comments on commit 7305f1a

Please sign in to comment.