-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.php
More file actions
162 lines (146 loc) · 10.3 KB
/
index.php
File metadata and controls
162 lines (146 loc) · 10.3 KB
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
<?php
require_once 'bones/a_assets.php';
require_once 'bones/a_header.php';
?>
<div id="page-content-wrapper">
<div id="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="dashboard-box dashboard-box-chart bg-white content-box">
<div class="panel">
<div class="panel-body">
<h1 class="title-hero">
<div class="col-sm-12">
<b>Patient Records</b>
</div><br><br><br>
<div class="col-sm-7"></div>
<form action="index.php?1" method="post">
<div class="col-sm-4">
<input type="text" class="form-control" name="search" placeholder="Search" required>
</div>
<div class="col-sm-1">
<button name="search_patient" class="btn btn-primary">Search</button>
</div><br><br><br>
</form>
</h1>
<div class="example-box-wrapper">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th style="text-align:center;"></th>
<th style="text-align:center;">Name</th>
<th style="text-align:center;">Birthday</th>
<th style="text-align:center;">Gender</th>
<th style="text-align:center;">Address</th>
<th style="text-align:center;">Phone</th>
<th style="text-align:center;"></th>
</tr>
</thead>
<tbody>
<?php
if(isset($_POST['search_patient'])){
$search = filters('search');
$patients = fetch("$s patients $w status='1' and
name like '%$search%' or
birthday like '%$search%' or
gender like '%$search%' or
address like '%$search%' or
phone like '%$search%' or
img like '%$search%' or
patient_id like '%$search%'
");
if($patients<=0){
echo "<tr><td colspan='6' style='text-align:center; width:100%;'>No Results Found !</td></tr>";
} else {
foreach ($patients as $p) {
echo "<tr>
<td style='text-align:center; width:14.28%;'><img src='img/$p->img' style='width:70px;height:70px;'></td>
<td style='text-align:center; width:14.28%;'>$p->name</td>
<td style='text-align:center; width:14.28%;'>$p->birthday</td>
<td style='text-align:center; width:5%;'>$p->gender</td>
<td style='text-align:center; width:14.28%;'>$p->address</td>
<td style='text-align:center; width:14.28%;'>$p->phone</td>
<td style='text-align:center; width:23.56%;'>
<a href='patient_info.php?1&patient_id=$p->patient_id' class='btn btn-purple'>View</a>
<a href='edit_patient.php?1&patient_id=$p->patient_id' class='btn btn-success'>Edit</a>
<form action='index.php?1' method='post' style='display:inline !important;'>
<input type='hidden' name='patient_id' value='$p->patient_id'>
<button name='archive_patient' class='btn btn-danger'>Trash</button>
</form>
</td>
</tr> ";
}
}
} else {
$patients = fetch("$s patients $w status='1'");
if($patients<=0){
echo "<tr><td colspan='6' style='text-align:center; width:100%;'>No Records Yet !</td></tr>";
} else {
foreach ($patients as $p) {
echo "<tr>
<td style='text-align:center; width:14.28%;'><img src='img/$p->img' style='width:70px;height:70px;'></td>
<td style='text-align:center; width:14.28%;'>$p->name</td>
<td style='text-align:center; width:14.28%;'>$p->birthday</td>
<td style='text-align:center; width:5%;'>$p->gender</td>
<td style='text-align:center; width:14.28%;'>$p->address</td>
<td style='text-align:center; width:14.28%;'>$p->phone</td>
<td style='text-align:center; width:23.56%;'>
<a href='patient_info.php?1&patient_id=$p->patient_id ' class='btn btn-purple'>View</a>
<a href='edit_patient.php?1&patient_id=$p->patient_id' class='btn btn-success'>Edit</a>
<form action='index.php?1' method='post' style='display:inline !important;'>
<input type='hidden' name='patient_id' value='$p->patient_id'>
<button name='archive_patient' class='btn btn-danger'>Trash</button>
</form>
</td>
</tr> ";
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="assets/assets/widgets/datatable/datatable.js"></script>
<script type="text/javascript" src="assets/assets/widgets/datatable/datatable-bootstrap.js"></script>
<script type="text/javascript" src="assets/assets/widgets/datatable/datatable-tabletools.js"></script>
<script type="text/javascript">
/* Datatables basic */
$(document).ready(function() {
$('#datatable-example').dataTable();
});
/* Datatables hide columns */
$(document).ready(function() {
var table = $('#datatable-hide-columns').DataTable( {
"scrollY": "300px",
"paging": false
} );
$('#datatable-hide-columns_filter').hide();
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} );
/* Datatable row highlight */
$(document).ready(function() {
var table = $('#datatable-row-highlight').DataTable();
$('#datatable-row-highlight tbody').on( 'click', 'tr', function () {
$(this).toggleClass('tr-selected');
} );
});
$(document).ready(function() {
$('.dataTables_filter input').attr("placeholder", "Search...");
});
</script>
<?php require_once "bones/a_footer.php"; ?>