-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.js
82 lines (67 loc) · 2.99 KB
/
service.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const firebaseConfig = {
apiKey: "AIzaSyAO_ml9bYT2k8rSC_TFheB4-55zqx2qU-A",
authDomain: "test-web-tutorial.firebaseapp.com",
databaseURL: "https://test-web-tutorial.firebaseio.com",
projectId: "test-web-tutorial",
storageBucket: "test-web-tutorial.appspot.com",
messagingSenderId: "477439235921",
appId: "1:477439235921:web:c27e1569025872d10d2570",
measurementId: "G-6DDKTQT9WW"
};
firebase.initializeApp(firebaseConfig);
document.getElementById("body").onload = function () {
//console.log("hellohi22");
var createRowElem = function(value) {
var td = document.createElement('td');
td.appendChild(document.createTextNode(value));
return td;
}
//new
var ref = firebase.database().ref('tokenRecord');
//ref2 = firebase.database().ref('customer');
ref.once('value', (snapshot) => {
//var childSnapshot = 'customer';
var table = document.getElementById('tableTwo');
snapshot.forEach(childSnapshot => {
var childKey = childSnapshot.key;
var childKey2 = parseInt(childKey);
// console.log();
if(childKey != 'currentToken' && childKey != 'totalProfit' && childKey != 'totalSell' ){
var childData = childSnapshot.val();
//console.log(childKey);
//console.log(childData['name']);
var trBody = document.createElement('tr');
trBody.appendChild(createRowElem(childData['tokenID']));
trBody.appendChild(createRowElem(childData['customerID']));
trBody.appendChild(createRowElem(childData['prodID']));
trBody.appendChild(createRowElem(childData['amount']));
trBody.appendChild(createRowElem(childData['payBill']));
trBody.appendChild(createRowElem(childData['profit']));
trBody.appendChild(createRowElem(childData['serviceDate']));
//}
table.appendChild(trBody);
// break;
}
else{
}
});
});
}
function mysfunc() {
console.log("Hello3333");
var input, filter, table, tr, td, i, txtvalue;
input = document.getElementById("myinput");
filter = input.value.toUpperCase();
table = document.getElementById("tableTwo");
tr = table.getElementsByTagName("tr");
for(i = 0; i<tr.length; i++){
td = tr[i].getElementsByTagName("td")[1];
if(td){
txtvalue = td.textContent || td.innerText;
if(txtvalue.toUpperCase().indexOf(filter) > -1){
tr[i].style.display = "";
}
else tr[i].style.display = "none";
}
}
}