-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequestMed.php
More file actions
135 lines (124 loc) · 7.33 KB
/
requestMed.php
File metadata and controls
135 lines (124 loc) · 7.33 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
<?php
require_once('../../includes/header.php');
?>
<link rel="stylesheet" href="../../assets/css/style.css">
</head>
<body>
<?php require_once('navbarMed.php')?>
<div class="login content-wrap" id="addMed">
<div class="login-image">
<h2>Welcome Admin</h2>
</div>
<div class="login-box">
<ul class="nav nav-tabs nav-justified" role="tablist">
<div class="slider"></div>
<li class="nav-item">
<a class="nav-link active" id="restockTab" data-bs-toggle="tab" data-bs-target="#restock-nav" type="button" role="tab" aria-controls="restock-nav" aria-selected="true">Find Medicine</a>
</li>
<li class="nav-item">
<a class="nav-link" id="addTab" data-bs-toggle="tab" data-bs-target="#add-nav" type="button" role="tab" aria-controls="add-nav" aria-selected="false">Add Medicine</a>
</li>
</ul>
<div class="tab-content" id="nav-tabContent" style="margin-top:15px;">
<div class="tab-pane fade show active" id="restock-nav" role="tabpanel" aria-labelledby="restockTab">
<form method="post" action="addMed.php">
<div class="login-form">
<div class="form-group">
<label>Medicine name</label>
<input type="text" class="form-control" name="medName" placeholder="Name" required>
</div>
<div class="text-center"><input type="submit" name="findMedSubmit" class="btn btn-primary " value="Find"></div>
</div>
</form>
<?php
if (isset($_POST["medName"])) {
require_once('medSearch.php');
if (count($results)) {
echo '<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col"> ID</th>
<th scope="col">Medicine Name</th>
<th scope="col">Manufacturer</th>
<th scope="col">Medicine Type</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Expiration Date</th>
</tr>
</thead>
<tbody>';
foreach (array_values($results) as $medicine) {
# code...
?>
<tr>
<td><?php echo $medicine["ID"] ?></td>
<td><?php echo $medicine["medName"] ?></td>
<td><?php echo $medicine["manufacturer"] ?></td>
<td><?php echo $medicine["medType"] ?></td>
<td><?php echo $medicine["price"] ?></td>
<td><?php echo $medicine["quantity"] ?></td>
<td><?php echo $medicine["expirationDate"] ?></td>
</tr>
<?php
}
echo "</tbody>";
echo "</table>";
} //else {
// echo "<h2> The medicine is not available </h2>";
// }
}
?>
</div>
<div class="tab-pane fade show" id="add-nav" role="tabpanel" aria-labelledby="addTab">
<form method="post" action="processAddMed.php">
<div class="login-form">
<div class="form-group">
<label>Medicine name</label>
<input type="text" class="form-control" name="medName" placeholder="Name" required>
</div>
<div class="form-group">
<label>Medicine manifacturer</label>
<input type="text" class="form-control" name="medMani" placeholder="Manifacturer" required>
</div>
<div class="form-group">
<label>Medicine price</label>
<input type="text" class="form-control" name="medPrice" placeholder="Price" required>
</div>
<div class="form-group">
<label> Medicine type</label>
<select name="medType" id="" class="form-select" aria-label=".form-select-sm example">
<option selected>Select Medicine Type</option>
<option value="Liquid">Liquid</option>
<option value="Tablet">Tablet</option>
<option value="Capsule">Capsule</option>
<option value="Others">Others</option>
</select>
</div>
<div class="form-group">
<label> Medicine quantity</label>
<input type="text" class="form-control" name="medQuantity" placeholder="Amount to add (at least 1)" required>
</div>
<div class="form-group">
<label > Medicine usage</label>
<input type="text" class="form-control" name="medUsage" placeholder="Usage" required>
</div>
<div class="form-group">
<label>Manufacture date</label>
<input type="date" class="form-control" name="medManuDate" style="color:gray;" value="" min="1997-01-01" max="<?php $date = date('Y-m-d');
echo $date; ?>" required>
</div>
<div class="form-group">
<label>Expiration date</label>
<input type="date" class="form-control" name="medExpireDate" style="color:gray;" value="" min="<?php $date = date('Y-m-d');
echo $date; ?>" max="2030-12-31" required>
</div>
<div class="text-center"><input type="submit" name="addMedSubmit" class="btn btn-primary " value="Add"></div>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
require_once('../../includes/footer.php');
?>