Skip to content
Snippets Groups Projects
Commit f3926ab4 authored by Ruginosu, M.I. (Ioana, Student B-BIT)'s avatar Ruginosu, M.I. (Ioana, Student B-BIT) :ear_tone1:
Browse files

issue#2 final

parent 1c2dfc0e
Branches issue#2
No related tags found
No related merge requests found
......@@ -62,3 +62,4 @@ function createPokemonTypesTable() {
`
}
......@@ -19,21 +19,19 @@ function updateTrainerTable() {
});
}
function updateDetails() {
const trainerId = document.getElementById('idTrainer');
function updateDetails(trainerId) {
const pt = trainers?.data?.find(item => item.id === trainerId);
const parent = document.getElementById(detailsParentId);
let time = new Date();
parent.innerHTML = `
<div class="card" id="${pt.id}_card">
<img src="${pt.imgUrl}" class="card-img-top" alt="${pt.classification}">
<img src="${pt.profileUrl}" class="card-img-top">
<div class="card-body">
<h5 class="card-title">${pt.name} #${pt.pokedexNumber}</h5>
<h5 class="card-title">${pt.name}</h5>
<p class="card-text">
Name: ${pt.name} </br>
Create: ${pt.created} </br>
Last updated: ${pt.lastUpDate?.join(", ") || "none"} </br>
Type: ${pt.profileUrl}
Last updated: ${pt.lastUpDate} </br>
</p>
</div>
</div>
......@@ -47,7 +45,6 @@ function trainersToRow(trainers) {
<td>${trainers.name}</td>
<td>#${trainers.created}</td>
<td>${trainers.lastUpDate}</td>
<td>${trainers.profileUrl || '-'}</td>
</tr>
`
}
......@@ -62,7 +59,6 @@ function createTrainersTable() {
<th scope="col">Name</th>
<th scope="col">Created</th>
<th scope="col">Last updated</th>
<th scope="col">Profile url</th>
</tr>
</thead>
<tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment