-
Notifications
You must be signed in to change notification settings - Fork 9
/
initialize.js
132 lines (120 loc) · 4.58 KB
/
initialize.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Initialize Cloud Firestore through Firebase
var db = firebase.firestore();
var employeesRef = db.collection("employees");
// employeesRef.doc("R.Dikles").set({
// fName: "Ranice",
// lName: "Dikles",
// email: "rdikles0@hatena.ne.jp",
// age: 39,
// gender: 'Female',
// yearsOfExperience: 9,
// isFullTime: true,
// });
// employeesRef.doc("A.Lamberton").set({
// fName: "Adler",
// lName: "Lamberton",
// email: "alamberton1@ft.com",
// age: 50,
// gender: 'Male',
// yearsOfExperience: 7,
// isFullTime: true,
// });
// employeesRef.doc("J.Summerson").set({
// fName: "Jeremy",
// lName: "Summerson",
// email: "jsummerson2@aboutads.info",
// age: 58,
// gender: 'Male',
// yearsOfExperience: 6,
// isFullTime: true,
// });
// employeesRef.doc("G.O'Byrne").set({
// fName: "Gunilla",
// lName: "O'Byrne",
// email: "gobyrne3@bbc.co.uk",
// age: 56,
// gender: 'Female',
// yearsOfExperience: 14,
// isFullTime: true,
// });
// employeesRef.doc("W.Ells").set({
// fName: "Weston",
// lName: "Ells",
// email: "wells4@linkedin.com",
// age: 60,
// gender: 'Male',
// yearsOfExperience: 8,
// isFullTime: false,
// });
// employeesRef.doc("F.Penhall").set({
// fName: "Freddy",
// lName: "Penhall",
// email: "fpenhall5@blogspot.com",
// age: 50,
// gender: 'Female',
// yearsOfExperience: 8,
// isFullTime: true,
// });
// employeesRef.doc("M.Pothergill").set({
// fName: "Marion",
// lName: "Pothergill",
// email: "mpothergill6@theglobeandmail.com",
// age: 39,
// gender: 'Male',
// yearsOfExperience: 14,
// isFullTime: false,
// });
// employeesRef.doc("P.Leechman").set({
// fName: "Prinz",
// lName: "Leechman",
// email: "pleechman7@ehow.com",
// age: 58,
// gender: 'Male',
// yearsOfExperience: 14,
// isFullTime: true,
// });
// employeesRef.doc("B.Newby").set({
// fName: "Babita",
// lName: "Newby",
// email: "bnewby9@techcrunch.com",
// age: 41,
// gender: 'Female',
// yearsOfExperience: 10,
// isFullTime: false,
// });
// employeesRef.doc("C.Blest").set({
// fName: "Celestia",
// lName: "Blest",
// email: "cblesta@delicious.com",
// age: 19,
// gender: 'Female',
// yearsOfExperience: 1,
// isFullTime: false,
// });
// employeesRef.doc("N.Tather").set({
// fName: "Nannette",
// lName: "Tather",
// email: "ntatherb@delicious.com",
// age: 40,
// gender: 'Female',
// yearsOfExperience: 13,
// isFullTime: true,
// });
employeesRef.get().then(function(querySnapshot) {
var tableRow='';
querySnapshot.forEach(function(doc) {
var document = doc.data();
tableRow +='<tr>';
tableRow += '<td class="fname">' + document.fName + '</td>';
tableRow += '<td class="lname">' + document.lName + '</td>';
tableRow += '<td class="email">' + document.email + '</td>';
tableRow += '<td class="age">' + document.age + '</td>';
tableRow += '<td class="gender">' + document.gender + '</td>';
tableRow += '<td class="yearsofexperience">' + document.yearsOfExperience + '</td>';
tableRow += '<td class="isfulltime">' + document.isFullTime + '</td>';
tableRow += '<td class="editEmployee"><i class="fa fa-pencil" aria-hidden="true" style="color:green"></i></td>'
tableRow += '<td class="deleteEmployee"><i class="fa fa-trash" aria-hidden="true" style="color:red"></i></td>'
tableRow += '</tr>';
});
$('tbody.tbodyData').append(tableRow);
});