This repository has been archived by the owner on Jun 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome2.php
219 lines (173 loc) · 5.51 KB
/
home2.php
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
require_once 'dbconfig.php';
session_start();
?>
<!DOCTYPE html>
<html>
<header>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css'>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
</header>
<main>
<nav class="cyan">
<div class="nav-wrapper">
<a href="#" class="brand-logo center">e-Bonafide</a>
<ul id="nav-mobile" class="hide-on-small-only right">
Welcome, <?php $uname=$_SESSION['uname']; echo $uname;?>
</ul>
</div>
</nav>
<div class="container">
<div class="container">
<br>
<br>
<br>
<div class="row center">
<label><h5>Purpose</h5> </label>
<br>
<input class="with-gap col s6" name="optradio" type="radio" id="1" value="Scholarship"/><label for="1">Scholarship</label>
<input class="with-gap col s6" name="optradio" type="radio" id="3" value="Education Loan"/><label for="3">Education Loan</label>
<input id="amount" name="amount" type="text" class="validate" required>
<label for="amount" >Enter Amount</label>
</div>
</div>
<center>
<button class="waves-effect waves-light btn green" id="add" name="add" onclick="clicked()">ADD</button>
</center>
<br>
<!-- STATUS CARD -->
<div class="row">
<div class="card">
<div class="card-content">
<span class="card-title">REPORT</span>
<table class="center">
<thead>
<tr>
<th></th>
<th>Date & Time</th>
<th>Purpose</th>
<th>Certificate ID</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$regNo=$_SESSION['uname'];
$stable = $_SESSION['stable'];
$sql1="SELECT instituteId,campusId FROM $stable where RegNo='$regNo'";
$res1=mysqli_query($conn,$sql1);
$row1=mysqli_fetch_row($res1);
$iID=$row1[0];
$cID=$row1[1];
$actable='accounts_'.$iID.$cID;
$sql="SELECT certificateNo,regNo,purpose,FLAG,created_at,amount FROM $actable WHERE regNo='$regNo' AND type='b2'";
$res=mysqli_query($conn,$sql);
while($row=mysqli_fetch_row($res)){
echo '<tr>';
echo '<td><p>
<input name="group1" class="group1" type="radio" id="test1'.$row[0].'" />
<label for="test1'.$row[0].'"></label>
</p></td>';
echo '<td>'.$row[4].'</td>';
echo '<td>'.$row[2].'</td>';
echo '<td>'.$row[0].'</td>';
if($row[3]=='0'){
echo '<td><p class=" yellow-text">PENDING</p></td>';
}
else if($row[3]=='1'){
echo '<td><button class="btn green waves-effect waves-light download" type="submit" ">DOWNLOAD</button>
</td>';
}
else {
echo '<td><p class=" red-text">FAILED</p></td>';
}
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- STATUS CARD -->
</div>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>
<script src='https://code.jquery.com/jquery-2.1.3.min.js'></script>
<script type="text/javascript">
//ADD AMOUNT
function clicked() {
var purpose = '';
purpose = $( 'input[name=optradio]:checked' ).val();
amount = $( '#amount' ).val();
$.ajax({
type:"POST",
url:"add_amt.php",
data:{
pup:purpose,
amt:amount
},
success:function(data){
location.reload(true);
Materialize.toast('Request sent!', 4000);
},
error: function (data) {
Materialize.toast('An error occurred!', 4000);
console.log(data);
}
});
}
//DOWNLOAD PDF
$(".group1").click(function(e) {
var purpose = $(this).closest('tr').find('td:nth-child(3)').text();
var cno = $(this).closest('tr').find('td:nth-child(4)').text();
$.ajax({
type:"POST",
url:"process2.php",
data:{
cno:cno,
pup:purpose
},
dataType: "json" ,
success:function(data){
console.log(data);
buildPDF(data);
},
error: function (data) {
console.log('An error occurred.');
console.log(data);
}
});
//location.reload(true);
});
$(".download").click(function(e) {
doc.save('bonafide.pdf');
});
</script>
<script type="text/javascript" src="bonafide2.js"></script>
</main>
<footer class="page-footer cyan">
<center><a class="waves-effect waves-light btn light-blue" href="logout.php" id="download" name="logout">Log Out</a></center>
<br>
</footer>
</html>