Skip to content

Commit

Permalink
added registration date to user search
Browse files Browse the repository at this point in the history
  • Loading branch information
u5ele55 committed Dec 22, 2024
1 parent 1027cc2 commit e7de09d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/advanced_user_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h2 class="header py-2">Расширенный поиск пользовател
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 Down Expand Up @@ -92,11 +92,13 @@ <h2 class="header py-2">Расширенный поиск пользовател
list.innerHTML = "<p>Ничего не найдено</p>";
return;
}
console.log(body);
list.innerHTML = "";
body.forEach(user =>
list.innerHTML += addColumnClass(
generateUserCard(
user.nickname, user.last_name, user.first_name, user.patronymic, user.visited_courtyards, user.id
generateAdvancedUserCard(
user.nickname, user.last_name, user.first_name, user.patronymic,
user.visited_courtyards, timestampToDate(user.created_at), user.id
)
)
);
Expand Down
23 changes: 23 additions & 0 deletions frontend/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,29 @@ function generateUserCard(username, last_name, first_name, patronymic, visited,
</div>`
}

function generateAdvancedUserCard(username, last_name, first_name, patronymic, visited, created_at, id) {

return `<div class="mb-3 advanced-search-card">
<div class="list-group-item d-flex justify-content-between align-items-center">
<span>
<span class="card-username">${username}</span>
<span class="card-aka">aka ${last_name} ${first_name} ${patronymic}</span>
<br>
<small class="text-danger">${visited} двора</small>
</span>
<span style="
align-items: flex-end;
display: flex;
flex-direction: column;
">
<a href="profile.html?id=${id}"><span class="material-icons purple f-24">open_in_new</span></a>
<small class="">Зарегистрирован:</small>
<small>${created_at}</small>
</span>
</div>
</div>`
}

function generateVisitCard(title, address, rating, visited_at, id) {
rating = normalizeRating(rating);
return `<div class="list-group-item">
Expand Down

0 comments on commit e7de09d

Please sign in to comment.