Skip to content

Commit

Permalink
Merge pull request #147 from AnthonyDeSantiago/users
Browse files Browse the repository at this point in the history
Users: Approved users table now has modal populating
  • Loading branch information
AnthonyDeSantiago authored Dec 4, 2023
2 parents b986d93 + d995f3d commit 12309b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
4 changes: 2 additions & 2 deletions public/admin_table_all_users.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ <h1 class="mt-4">Users</h1>



<!-- The modal for transactions -->
<!-- The modal for pending users -->
<div class="modal fade" id="approval-modal" tabindex="-1" role="dialog"
aria-labelledby="editAccountModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
Expand Down Expand Up @@ -341,7 +341,7 @@ <h5 class="modal-title" id="addAccountModalLabel">Approve or Reject Entry</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<table id="modal-table" class="table table-bordered table-hover" style="width:100%">
<table id="approved-modal-table" class="table table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th>Username</th>
Expand Down
34 changes: 13 additions & 21 deletions public/js/users-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,19 @@ async function pendingModalCallback(user) {
`;
}

async function rejectedModalCallback(entry) {
$('#rejected-modal').modal('show');
const modalTableBody = document.querySelector(`#${"rejected-modal-table"} tbody`);
const transactions = entry.data().transactions;
console.log("transactions in rej: ", transactions);
for (let i = 0; i < transactions.length; i++) {
console.log('transaction description', transactions[0])
const transaction = await getDocumentReference('transactions', transactions[i]);
const row = modalTableBody.insertRow(i);
row.innerHTML = `
<td>Testing</td>
<td>${transaction.description}</td>
<td>${transaction.debit}</td>
<td>${transaction.credit}</td>
`;
}
console.log("called rejected modal");
}

async function approvedModalCallback(entry) {
$('#rejected-modal').modal('show');
async function approvedModalCallback(user) {
$('#approved-modal').modal('show');
const modalTableBody = document.querySelector(`#${"approved-modal-table"} tbody`);
const row = modalTableBody.insertRow();
row.innerHTML = `
<td>${user.data().username}
<td>${user.data().firstName}</td>
<td>${user.data().lastName}</td>
<td>${user.data().userEmail}</td>
<td>${user.data().role}</td>
<td>${user.data().address}</td>
<td>${user.data().suspended}</td>
`;
console.log("called approved modal");
}

Expand Down

0 comments on commit 12309b8

Please sign in to comment.