-
Notifications
You must be signed in to change notification settings - Fork 3
/
all_records.php
172 lines (164 loc) · 8.67 KB
/
all_records.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
<?php
include 'includes/header.php';
if(isset($_GET['page'])){
$page = $_GET['page'];
}else{
$page = 1;
}
if(isset($_POST['pquery'])){
$pquery = $_POST['pquery'];
$url = "https://apis.stmorg.in/medical/records/records?pquery=".$pquery ."&page=".$page;
$data = get_api_data($url);
$data = json_decode($data, true);
$total_pages = $data['total_pages'];
$data = $data['data'];
}else{
$url = "https://apis.stmorg.in/medical/records/records?page=".$page;
$data = get_api_data($url);
$data = json_decode($data, true);
$total_pages = $data['total_pages'];
$data = $data['data'];
}
?>
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="page-header">
<h3 class="page-title">
<span class="page-title-icon bg-gradient-danger text-white me-2">
<i class="mdi mdi-home"></i>
</span>
List Users
</h3>
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<!-- search bar -->
<li>
<form method="POST">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Query"
aria-label="Recipient's username" name="pquery" aria-describedby="basic-addon2">
<div class="input-group-append">
<button class="btn btn-sm btn-gradient-primary" type="submit">Search</button>
</div>
</div>
</div>
</form>
</li>
</ul>
</nav>
</div>
<!-- form -->
<div class="row">
<div class="col-12 grid-margin">
<div class="card">
<div class="card-body">
<h4 class="card-title">Recent records</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Record Id</th>
<th>Diagnosis</th>
<th>Prescription</th>
<th>Doctor</th>
<th>Last Visit</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
if(isset($data['status']) && $data['status']=='error'){
}else{
for($i=0; $i<count($data); $i++){
$doctor = $data[$i]['doctor'];
$url = "https://apis.stmorg.in/medical/doctors/doctors?did=".$doctor;
$ddata = get_api_data($url);
$ddata = json_decode($ddata, true);
$ddata = $ddata['data'];
$diag = $data[$i]['diagnosis'];
$url = "https://apis.stmorg.in/medical/diagnosis/diagnosis?did=".$diag;
$diagdata = get_api_data($url);
$diagdata = json_decode($diagdata, true);
$diagdata = $diagdata['data'];
?>
<tr onclick="window.location.href='recordview?id=<?php echo $data[$i]['id']; ?>'">
<td>STMR<?php echo $data[$i]['id']; ?></td>
<td><?php echo $diagdata[0]['name'] ?></td>
<td><?php echo $data[$i]['prescription']; ?></td>
<td><?php echo $ddata[0]['name'] ?></td>
<td><?php echo $data[$i]['last_visit']; ?></td>
<td>
<?php
if($data[$i]['status'] == 1){
?>
<label class="badge badge-gradient-success">Active</label>
<?php
}else{
?>
<label class="badge badge-gradient-danger">Inactive</label>
<?php
}
?>
</td>
<td>
<a href="manage_records?rid=<?php echo $data[$i]['id']; ?>"
class="btn btn-gradient-info btn-sm">Edit</a>
<a href="manage_users?deluid=<?php echo $data[$i]['id']; ?>"
class="btn btn-gradient-danger btn-sm">Delete</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<!-- pagination -->
<div class="btn-group page-group" role="group" aria-label="Basic example">
<?php if ($total_pages): ?>
<ul class="pagination">
<?php if ($page > 1): ?>
<li class="prev"><a href="?page=<?php echo $page-1 ?>">Prev</a></li>
<?php endif; ?>
<?php if ($page > 3): ?>
<li class="start"><a href="?page=1">1</a></li>
<li class="dots">...</li>
<?php endif; ?>
<?php if ($page-2 > 0): ?><li class="page"><a
href="?page=<?php echo $page-2 ?>"><?php echo $page-2 ?></a>
</li><?php endif; ?>
<?php if ($page-1 > 0): ?><li class="page"><a
href="?page=<?php echo $page-1 ?>"><?php echo $page-1 ?></a>
</li><?php endif; ?>
<li class="currentpage"><a href="?page=<?php echo $page ?>"><?php echo $page ?></a>
</li>
<?php if ($page+1 < $total_pages+1): ?><li class="page"><a
href="?page=<?php echo $page+1 ?>"><?php echo $page+1 ?></a>
</li><?php endif; ?>
<?php if ($page+2 < $total_pages+1): ?><li class="page"><a
href="?page=<?php echo $page+2 ?>"><?php echo $page+2 ?></a>
</li><?php endif; ?>
<?php if ($page < $total_pages-2): ?>
<li class="dots">...</li>
<li class="end"><a
href="?page=<?php echo $total_pages ?>"><?php echo $total_pages ?></a>
</li>
<?php endif; ?>
<?php if ($page < $total_pages): ?>
<li class="next"><a href="?page=<?php echo $page+1 ?>">Next</a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
<?php
include 'includes/footer.php';
?>