-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdashboard.js
119 lines (99 loc) · 3.02 KB
/
dashboard.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
const createCard = (name, role) => {
const linkWrapper = document.createElement('a')
linkWrapper.setAttribute('href', 'profile.html')
const cardContainer = document.createElement('div')
cardContainer.classList.add('card')
const largeText = document.createElement('p')
largeText.textContent = name
const smallText = document.createElement('p')
smallText.textContent = role
smallText.classList.add('role')
cardContainer.appendChild(largeText)
cardContainer.appendChild(smallText)
linkWrapper.appendChild(cardContainer)
document.querySelector('#record').appendChild(linkWrapper)
}
const initializeCards = (n) => {
createCardContainer()
// Fetching Records
for (let i = 0; i < n; i++) {
createCard(records[i].name, records[i].designation)
}
}
const createCardContainer = () => {
const container = document.createElement('div')
container.classList.add('flex-column')
container.id = "record"
const parent = document.getElementById('results')
const elem = document.getElementById('right-chevron')
parent.insertBefore(container, elem)
}
const sendFormData = () => {
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://10.140.11.221:5000/user/login");
// This fires up when the connection is successful
xhr.onload = function(event){
// alert("Success, server responded with: " + event.target.response);
// localStorage.clear()
// localStorage.setItem('response', xhr.response)
// console.log(xhr.status)
console.log(xhr.response)
};
// var formData = new FormData(document.getElementById("credentials-form"));
// xhr.send(formData);
}
const createPageNumber = (currentPage, totalPages) => {
const container = document.createElement('div')
container.classList.add('center')
const text = document.createElement('p')
text.classList.add('font-grey')
text.textContent = `Page ${currentPage} / ${totalPages}`
container.appendChild(text)
document.querySelector(".container").appendChild(container)
}
const records = [
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
{
'name': 'Mohamed Asif',
'designation': 'DevOps Engineer'
},
]
const currentPage = 1;
const totalPages = 11;
initializeCards(10)
createPageNumber(currentPage, totalPages)