-
Notifications
You must be signed in to change notification settings - Fork 1
/
app-details.js
37 lines (34 loc) · 1.42 KB
/
app-details.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(function () {
//get the table id
// const tBody = document.getElementById('tBody');
const table = document.getElementById('table');
const uid = document.getElementById('UID').value;
//get the firebase reference
const dbRefObject = firebase.database().ref().child('orders').child(uid);
var tableBody = document.getElementById('tBody');
var tbodyTotal = document.getElementById('total');
var summ=0 ;
//sync object changes using the on method
dbRefObject.on('value', function (snapshot) {
snapshot.forEach(function(childSnapshot) {
var childKey = childSnapshot.key;
var childData = childSnapshot.val();
// ...
/*console.log(childKey);
console.log(childData);*/
/*create a table row and td*/
var tr = document.createElement('tr');
tr.innerHTML = "" +
"<td>" + childKey + "</td>" +
"<td>" + childData.name + "</td>" +
"<td>" + childData.quantity + "</td>" +
"<td>Ksh." + childData.totalAmount + "/=</td>" +
"";
tr.className="warning";
tableBody.appendChild(tr);
table.appendChild(tableBody);
/*Disable loading button*/
document.getElementById('visibility').style.display='none';
});
});
}());