Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
c bon
Browse files Browse the repository at this point in the history
  • Loading branch information
elouanjef committed Dec 11, 2023
1 parent c9ffe59 commit e5d6dcf
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions templates/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ <h5 class="card-title">{{ vm.name }}</h5>
<div class="tab-pane" id="rubrique2">
<h1 class="text-left">Comptes utilisateurs</h1>
<div class="mt-4">
<div id="users-div" class="cards d-flex justify-content-start"></div>
</div>
<table class="table" id="users-table">
<thead>
<tr>
<th>Prénom</th>
<th>Nom</th>
<th>Email</th>
</tr>
</thead>
</table>
<hr>
<div class="mt-4">
<div id="create-user-div" class="cards d-flex justify-content-start"></div>
Expand Down Expand Up @@ -109,17 +116,27 @@ <h1 class="text-left">Templates de VMs</h1>
success: function (response) {
var users = response;
usersDiv = $('#users-div');

var table = $('<table>').addClass('table');
var thead = $('<thead>').append('<tr><th>Prénom</th><th>Nom</th><th>Email</th></tr>');
table.append(thead);
usersDiv.append(table);
createUsersTable(users, usersDiv);
},
error: function (error) {
alert('Erreur d\'obtention d\'informations d\'users');
}
});
}

function createUsersTable(users, usersDiv) {
users.forEach(addUserToTable);
usersDiv.append(table);
}

function addUserToTable(user) {
var row = $('<tr>');
row.append('<td>' + user.first_name + '</td>');
row.append('<td>' + user.last_name + '</td>');
row.append('<td>' + user.email + '</td>');

$('#users-table').append(row);
}

function addTemplateToDOM(template) {
var templateCard = createTemplateCard(template);
Expand Down

0 comments on commit e5d6dcf

Please sign in to comment.