-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
101 lines (82 loc) · 3.01 KB
/
app.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Initialize Firebase
var firebaseConfig = {
apiKey: "AIzaSyC2HejOZEs_nGRsIdwYhq2miXOrtkEaR3k",
authDomain: "asfe-a1906.firebaseapp.com",
databaseURL: "https://asfe-a1906.firebaseio.com",
projectId: "asfe-a1906",
storageBucket: "asfe-a1906.appspot.com",
messagingSenderId: "36343720523",
appId: "1:36343720523:web:a897faadd8762a260dbbce"
}; firebase.initializeApp(firebaseConfig);
// firebase.auth().onAuthStateChanged(function (user) {
// if (!user) {
// alert("you have successfully logged out.")
// window.location.href = 'index.html';
// console.log('no authentication')
// } else {
// console.log('logged in');
// }
// });
var db = firebase.firestore();
var i = 1;
var j=1;
db.collection('alumini').get().then(snapshot => {
snapshot.docs.forEach(doc => {
j++;
});document.getElementById("count").innerHTML="total count : "+j;
});
function renderCafe(doc){
let li = document.createElement('li');
let name = document.createElement('div');
let batch =document.createElement('div');
let address=document.createElement('div')
let course = document.createElement('div');
let company = document.createElement('div');
let desig = document.createElement('div');
let email = document.createElement('div');
let higher = document.createElement('div');
let location = document.createElement('div');
let phone = document.createElement('div');
li.setAttribute('data-id', doc.id);
name.textContent = doc.data().name;
company.textContent = doc.data().company;
address.textContent=doc.data().address
batch.textContent = doc.data().batch;
course.textContent = doc.data().course;
desig.textContent = doc.data().desig;
email.textContent = doc.data().email;
higher.textContent = doc.data().higher;
location.textContent = doc.data().location;
phone.textContent = doc.data().phone;
var table = document.getElementById("table");
var row = table.insertRow(i);
var cell1 = row.insertCell(0);
var cell2 =row.insertCell(1);
var cell3 =row.insertCell(2);
var cell4 =row.insertCell(3);
var cell5 =row.insertCell(4);
var cell6 =row.insertCell(5);
var cell7 =row.insertCell(6);
var cell8 =row.insertCell(7);
var cell9 =row.insertCell(8);
var cell10 =row.insertCell(9);
var cell11 =row.insertCell(10);
cell1.innerHTML= i;
cell2.innerHTML = name.textContent;
cell3.innerHTML = batch.textContent;
cell4.innerHTML = address.textContent;
cell5.innerHTML = course.textContent;
cell6.innerHTML = desig.textContent;
cell7.innerHTML = email.textContent;
cell8.innerHTML = phone.textContent;
cell9.innerHTML = location.textContent;
cell10.innerHTML = higher.textContent;
cell11.innerHTML = company.textContent;
i++
}
// getting data
db.collection('alumini').orderBy('batch').get().then(snapshot => {
snapshot.docs.forEach(doc => {
renderCafe(doc);
});
});