Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin: Improve display of payment data #20

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 56 additions & 32 deletions website/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@
document.getElementById("effective_balance_value").removeAttribute("aria-busy")
document.getElementById("effective_balance_value").innerHTML = xhr.response["finance"]["effective_balance"];

document.getElementById("recent_payments_busy_row").remove()
payment_details = ""
document.getElementById("outstanding_payments_busy_row").remove()
document.getElementById("processed_payments_busy_row").remove()
payment_details = "";
processed_payment_details = "";
for (let i = 0; i < xhr.response["payments"].length; i++) {
payment = xhr.response["payments"][i];
if ("processed" in payment) {
payment_details += `<tr><th scope="row"><a href="details.html?author=${ payment["username"] }">${ payment["username"] }</a></th><th scope="row">${ payment["amount"] }</th><th scope="row">${ payment["title"] }</th><th scope="row"><a href="${ payment["processed"]["order"] }">${ payment["details"] }</a></th></tr>`;
processed_payment_details += `<tr><th scope="row"><a href="details.html?author=${ payment["username"] }">${ payment["username"] }</a></th><th scope="row">${ payment["amount"] }</th><th scope="row">${ payment["title"] }</th><th scope="row"><a href="${ payment["processed"]["order"] }">${ payment["details"] }</a></th></tr>`;
} else {
payment_details += `<tr><th scope="row"><a href="details.html?author=${ payment["username"] }">${ payment["username"] }</a></th><th scope="row">${ payment["amount"] }</th><th scope="row">${ payment["title"] }</th><th scope="row">${ payment["details"] }</th></tr>`;
}
}
document.getElementById("recent_payments_body").innerHTML += payment_details;
document.getElementById("outstanding_payments_body").innerHTML += payment_details;
document.getElementById("processed_payments_body").innerHTML += processed_payment_details;

get_contributors();
} else {
Expand All @@ -57,7 +60,7 @@
for (let i = 0; i < xhr.response[author].length; i++) {
pr_links += "<a href='https://github.com/getmoto/moto/pull/" + xhr.response[author][i]["number"] + "'>" + xhr.response[author][i]["title"] + "</a><br />";
}
document.getElementById("approved_pr_table_body").innerHTML += "<tr><td scope='row'>" + author + "</td><td scope='row'>" + pr_links + "</td><td scope='row'><a href='/details.html?author=" + author + "'>Details</a></td></tr>";
document.getElementById("recent_contributors_table_body").innerHTML += "<tr><td scope='row'><a href='/details.html?author=" + author + "'>" + author + "</a></td><td scope='row'>" + pr_links + "</td></tr>";
}
} else {
console.log(`Error: ${xhr.status}`);
Expand Down Expand Up @@ -118,31 +121,6 @@ <h3>Finances</h3>
</table>
</div>

<div id="payment-details">

<h3>Payments</h3>

<table>
<thead>
<tr>
<th scope="col">Contributor</th>
<th scope="col">Amount</th>
<th scope="col">Title</th>
<th scope="col">Details</th>
</tr>
</thead>
<tbody id="recent_payments_body">
<tr id="recent_payments_busy_row"> <!-- To Be deleted once data comes in -->
<th scope="row" aria-busy="true"></th>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row"></th>
</tr>
</tbody>
</table>

</div>

</div>

<input type="radio" name="tabs" id="tab_recent_prs">
Expand All @@ -159,18 +137,64 @@ <h3>Payments</h3>
<th scope="col"></th>
</tr>
</thead>
<tbody id="approved_pr_table_body">
<tbody id="recent_contributors_table_body">
<tr id="recent_pr_busy_row"> <!-- To Be deleted once data comes in -->
<th scope="row" aria-busy="true"></th>
<th scope="row"></th>
<th scope="row"></th> <!-- Award Payment -->
</tr>
</tbody>
</table>

</div>
</div>

<input type="radio" name="tabs" id="tab_outstanding_payments">
<label for="tab_outstanding_payments">Outstanding Payments</label>
<div class="tab">
<table>
<thead>
<tr>
<th scope="col">Contributor</th>
<th scope="col">Amount</th>
<th scope="col">Title</th>
<th scope="col">Details</th>
</tr>
</thead>
<tbody id="outstanding_payments_body">
<tr id="outstanding_payments_busy_row"> <!-- To Be deleted once data comes in -->
<th scope="row" aria-busy="true"></th>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row"></th>
</tr>
</tbody>
</table>

</div>

<input type="radio" name="tabs" id="tab_processed_payments">
<label for="tab_processed_payments">Processed Payments</label>
<div class="tab">
<table>
<thead>
<tr>
<th scope="col">Contributor</th>
<th scope="col">Amount</th>
<th scope="col">Title</th>
<th scope="col">Details</th>
</tr>
</thead>
<tbody id="processed_payments_body">
<tr id="processed_payments_busy_row"> <!-- To Be deleted once data comes in -->
<th scope="row" aria-busy="true"></th>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row"></th>
</tr>
</tbody>
</table>
</div>

</div>

</main>
Expand Down