[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant-frontends] branch master updated: Fetching
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant-frontends] branch master updated: Fetching order_id|amount|timestamp from /history and fill table with them. |
Date: |
Mon, 27 Feb 2017 12:30:41 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant-frontends.
The following commit(s) were added to refs/heads/master by this push:
new 13a2fd7 Fetching order_id|amount|timestamp from /history and fill
table with them.
13a2fd7 is described below
commit 13a2fd719daa10d5da9a73c0e2c1e9aed6b4950b
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Feb 27 12:30:02 2017 +0100
Fetching order_id|amount|timestamp from /history and
fill table with them.
---
talerfrontends/blog/static/backoffice.js | 38 +++++++++++++++++++++++++--
talerfrontends/blog/static/web-common | 2 +-
talerfrontends/blog/templates/backoffice.html | 3 +++
talerfrontends/donations/static/web-common | 2 +-
4 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/talerfrontends/blog/static/backoffice.js
b/talerfrontends/blog/static/backoffice.js
index 5bc8b6a..d451edb 100644
--- a/talerfrontends/blog/static/backoffice.js
+++ b/talerfrontends/blog/static/backoffice.js
@@ -27,9 +27,32 @@
*/
"use strict";
+var FRACTION = 100000000;
+
+function amount_to_string(amount){
+ var number = Number(amount.value) + (Number(amount.fraction)/FRACTION);
+ var fmt = amount.currency + ":" + number;
+ return fmt;
+}
+
+function parse_date(date){
+
+ var split = date.match(/Date\((.*)\)/);
+ var seconds;
+ if(isNaN(seconds = Number(split[1]))){
+ console.error("Malformed date gotten from backend");
+ return;
+ }
+ console.log("Extracting timestamp", split[1]);
+ var d = new Date(seconds * 1000);
+ return d.toDateString();
+}
+
function get_history(){
+
var DAYS = 10;
var INSTANCE = "FSF";
+
var req = new XMLHttpRequest();
req.open("GET", `/history?days=${DAYS}&instance=${INSTANCE}`, true);
req.onload = function(){
@@ -44,9 +67,20 @@ function get_history(){
var table = document.getElementById("history");
for (var i=0; i<history.length; i++){
var entry = history[i];
- console.log(`Order id: ${entry.order_id}`);
var row = document.createElement("tr");
- row.innerHTML = `<td>${entry.order_id}</td>`;
+ var td_order_id = document.createElement("td");
+ var td_summary = document.createElement("td");
+ var td_amount = document.createElement("td");
+ var td_timestamp = document.createElement("td");
+ td_order_id.innerHTML = entry.order_id;
+ td_summary.innerHTML = "TBD";
+ td_amount.innerHTML = amount_to_string(entry.amount);
+ td_timestamp.innerHTML = parse_date(entry.timestamp);
+ row.appendChild(td_order_id);
+ row.appendChild(td_summary);
+ row.appendChild(td_amount);
+ row.appendChild(td_timestamp);
+ console.log("childs");
table.appendChild(row);
}
table.style.visibility = "";
diff --git a/talerfrontends/blog/static/web-common
b/talerfrontends/blog/static/web-common
index afe6788..aae7c0a 160000
--- a/talerfrontends/blog/static/web-common
+++ b/talerfrontends/blog/static/web-common
@@ -1 +1 @@
-Subproject commit afe6788f89eb0c5e6148e07d63f5928475cdef19
+Subproject commit aae7c0a87a9ff1640c3cd72dd4df0ac590f8b0e4
diff --git a/talerfrontends/blog/templates/backoffice.html
b/talerfrontends/blog/templates/backoffice.html
index 10a2784..a234550 100644
--- a/talerfrontends/blog/templates/backoffice.html
+++ b/talerfrontends/blog/templates/backoffice.html
@@ -8,6 +8,9 @@
<tbody>
<tr>
<th>Order ID</th>
+ <th>Summary</th>
+ <th>Amount</th>
+ <th>Date</th>
</tr>
</tbody>
</table>
diff --git a/talerfrontends/donations/static/web-common
b/talerfrontends/donations/static/web-common
index afe6788..aae7c0a 160000
--- a/talerfrontends/donations/static/web-common
+++ b/talerfrontends/donations/static/web-common
@@ -1 +1 @@
-Subproject commit afe6788f89eb0c5e6148e07d63f5928475cdef19
+Subproject commit aae7c0a87a9ff1640c3cd72dd4df0ac590f8b0e4
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant-frontends] branch master updated: Fetching order_id|amount|timestamp from /history and fill table with them.,
gnunet <=