Added Account section
This commit is contained in:
54
account/paymentreceipt/index.shtml
Normal file
54
account/paymentreceipt/index.shtml
Normal file
@ -0,0 +1,54 @@
|
||||
<!--
|
||||
This file is part of Linode Manager Classic.
|
||||
|
||||
Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>LMC - Account // View Payment</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="paymentreceipt.css" />
|
||||
<script src="paymentreceipt.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="/include/header.html"-->
|
||||
<!--#include virtual="/include/account_subnav.html"-->
|
||||
<div id="main-content" class="wrapper">
|
||||
<div id="paymentreceipt">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Payment</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Date</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr1">
|
||||
<td>Payment #<span id="payment-id"></span>. Thank you.</td>
|
||||
<td id="date"></td>
|
||||
<td id="amount"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Payment Total: <span id="total"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
36
account/paymentreceipt/paymentreceipt.css
Normal file
36
account/paymentreceipt/paymentreceipt.css
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import url('/global.css');
|
||||
|
||||
.lmc-table tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border-bottom: 1px solid #E8E8E8;
|
||||
}
|
||||
|
||||
#paymentreceipt {
|
||||
padding: 15px 15px 15px;
|
||||
}
|
||||
|
||||
#paymentreceipt p {
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table td:nth-of-type(3) {
|
||||
text-align: right;
|
||||
}
|
87
account/paymentreceipt/paymentreceipt.js
Normal file
87
account/paymentreceipt/paymentreceipt.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { settings, elements, apiGet, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.amount = "amount";
|
||||
elements.date = "date";
|
||||
elements.paymentID = "payment-id";
|
||||
elements.subnav = "subnav-link";
|
||||
elements.subnavActive = "subnav-link-active";
|
||||
elements.total = "total";
|
||||
|
||||
// Data received from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.amount = {};
|
||||
ui.date = {};
|
||||
ui.paymentID = {};
|
||||
ui.total = {};
|
||||
|
||||
// Callback for payment details API call
|
||||
var displayPayment = function(response)
|
||||
{
|
||||
var paymentDate = new Date(response.date + "Z");
|
||||
ui.date.innerHTML = paymentDate.toLocaleDateString();
|
||||
ui.amount.innerHTML = "$" + response.usd.toFixed(2);
|
||||
ui.total.innerHTML = "$" + response.usd.toFixed(2);
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a payment ID, so die if we don't have it
|
||||
if (!data.params.pid) {
|
||||
alert("No payment ID supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Highlight the billing history subnav link
|
||||
var subnavLinks = document.getElementsByClassName(elements.subnav);
|
||||
for (var i = 0; i < subnavLinks.length; i++) {
|
||||
if (subnavLinks[i].pathname == "/account/billing_history")
|
||||
subnavLinks[i].className = elements.subnav + " " + elements.subnavActive;
|
||||
else
|
||||
subnavLinks[i].className = elements.subnav;
|
||||
}
|
||||
|
||||
// Get element references
|
||||
ui.amount = document.getElementById(elements.amount);
|
||||
ui.date = document.getElementById(elements.date);
|
||||
ui.paymentID = document.getElementById(elements.paymentID);
|
||||
ui.total = document.getElementById(elements.total);
|
||||
|
||||
// Set payment ID
|
||||
ui.paymentID.innerHTML = data.params.pid;
|
||||
|
||||
// Get data from API
|
||||
apiGet("/account/payments/" + data.params.pid, displayPayment, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
Reference in New Issue
Block a user