-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.js
186 lines (186 loc) · 8.88 KB
/
student.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
function inactiveStudent(id, action) {
if (id == "") {
//alert("Please pass proper id");
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(action === 'active') {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px;"></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveStudent('+id+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
} else {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveStudent('+id+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_student.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
}
function inactiveFaculty(id, action) {
if (id == "") {
//alert("Please pass proper id");
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(action === 'active') {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px; "></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveFaculty('+id+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
} else {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveFaculty('+id+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_faculty.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
}
function inactiveUser(id, action) {
if (id == "") {
//alert("Please pass proper id");
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(action === 'active') {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px; "></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveUser('+id+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
} else {
document.getElementById('status'+id).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id).innerHTML = '<a onclick="inactiveUser('+id+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_user.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
}
function AllFacultyStatus(id,action){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
for(var i =0;i<id.length;i++){
if(action === 'active') {
document.getElementById('status'+id[i]).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px; "></i>';
document.getElementById('inner_status'+id[i]).innerHTML = '<a onclick="inactiveFaculty('+id[i]+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
} else {
document.getElementById('status'+id[i]).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id[i]).innerHTML = '<a onclick="inactiveFaculty('+id[i]+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_faculty.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
function DeleteFaculty(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('table_row'+id).style.display = 'none';
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_faculty.php?id=" + id + "&action=delete", true);
//xmlhttp.open("GET","faculty.php?message=Faculty Data Deleted",true);
xmlhttp.send();
}
function AllUserStatus(id,action){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
for(var j =0;j<id.length;j++){
console.log(document.getElementById('inner_status'+id[j]));
if(action === 'active') {
document.getElementById('status'+id[j]).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px; "></i>';
document.getElementById('inner_status'+id[j]).innerHTML = '<a onclick="inactiveUser('+id[j]+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
//console.log(document.getElementById('inner_status'+id[i]).innerHTML);
} else {
document.getElementById('status'+id[j]).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id[j]).innerHTML = '<a onclick="inactiveUser('+id[j]+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_user.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
function DeleteUser(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('table_row'+id).style.display = 'none';
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_user.php?id=" + id + "&action=delete", true);
xmlhttp.send();
}
function updateStatusAll(id, action) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(action === 'active') {
console.log(id)
for(var i=0;i<id.length;i++){
document.getElementById('status'+id[i]).innerHTML = '<i class="fa fa-check-square-o" aria-hidden="true" style="font-size:20px;"></i>';
document.getElementById('inner_status'+id[i]).innerHTML = '<a onclick="inactiveStudent('+id[i]+',\'inactive\')"><i class="fa fa-trash-o fa-fw"></i> Inactive</a>';
}
} else {
for(var i=0;i<id.length;i++){
document.getElementById('status'+id[i]).innerHTML = '<i class="fa fa-minus-square-o" aria-hidden="true" style="font-size:20px; color:red"></i>';
document.getElementById('inner_status'+id[i]).innerHTML = '<a onclick="inactiveStudent('+id[i]+',\'active\')"><i class="fa fa-trash-o fa-fw"></i> Active</a>';
}
}
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_student.php?id=" + id + "&action="+action, true);
xmlhttp.send();
}
function DeleteStudent(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('table_row'+id).style.display = 'none';
document.getElementById('loader').style.display = 'none';
//alert("Status successfully updated");
} else {
document.getElementById('loader').style.display = 'block';
}
};
xmlhttp.open("GET", "../Controller/process_student.php?id=" + id + "&action=delete", true);
xmlhttp.send();
}