-
Notifications
You must be signed in to change notification settings - Fork 0
/
userpage.js
57 lines (49 loc) · 1.79 KB
/
userpage.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
var firebaseConfig = {
apiKey: "AIzaSyB0IolPCQhnFsBsj386_lhACoYPITXtikw",
authDomain: "helping-hands-f52f1.firebaseapp.com",
projectId: "helping-hands-f52f1",
storageBucket: "helping-hands-f52f1.appspot.com",
messagingSenderId: "130421144161",
appId: "1:130421144161:web:116c820cdd51c1a6a44820",
measurementId: "G-1PE5SJ660Y"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
let database=firebase.firestore();
let tableBody=document.querySelector("#tableBody");
database.collection("users").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
var data=doc.data();
var image=data.image;
var name=data.name;
var email=data.email;
var contact=data.contact;
var address=data.address;
if(email===undefined)
email="-"
if(address===undefined)
address="-"
const tr=document.createElement('tr');
const nametd=document.createElement('td');
const mailtd=document.createElement('td');
const phonetd=document.createElement('td');
const addtd=document.createElement('td');
const ispan=document.createElement('span');
const imag =document.createElement('img');
imag.setAttribute("src","cap1.PNG");
//imag.src=image;
imag.setAttribute("class","userImg");
ispan.appendChild(imag);
nametd.appendChild(ispan);
nametd.innerHTML=name;
mailtd.innerHTML=email;
phonetd.innerHTML=contact;
addtd.innerHTML=address;
tr.appendChild(nametd);
tr.appendChild(addtd);
tr.appendChild(mailtd);
tr.appendChild(phonetd);
tableBody.appendChild(tr);
});
document.querySelector(".bar").style.visibility = "hidden";
});