-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrate_card.php
More file actions
240 lines (222 loc) · 8.48 KB
/
rate_card.php
File metadata and controls
240 lines (222 loc) · 8.48 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
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
include 'connectDB.php';
$sql = "SELECT * FROM rate_card;";
$result = mysqli_query($conn,$sql);
session_start();
if(!(isset($_SESSION["login"]))){
$_SESSION["login"]=0;
}
if($_SESSION['login']==0){
$disable = "value='Login as Admin' disabled";
}
else{
$disable = '';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Rate Card</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Aclonica' rel='stylesheet'>
<style type="text/css">
.myfont{
font-size: 1vw;
color: white;
background-color: #0d0d0d;
padding-right: 35px;
}
</style>
<body>
<span class="d-flex flex-column" style="background-color: #0d0d0d;">
<span class="p-3"></span>
<span class="d-flex flex-row">
<span class="p-2 w-50 text-center" style="border-radius: 0 60px 0 0;font-size: 2vw;background-color: #66ff33;font-family: 'Aclonica'">SAYALI INDUSTRIES</span>
<span class="p-2 text-center">
<input type="button" class="btn myfont" value="HOME" onclick="window.location='index.php'" />
<input type="button" class="btn myfont" value="IMPORTS" onclick="window.location='import.php'"/>
<input type="button" class="btn myfont" value="INVENTORY" onclick="window.location='inventory.php'"/>
<input type="button" class="btn myfont" value="CUSTOMER" onclick="window.location='customer.php'"/>
<input type="button" class="btn myfont" value="RATE CARD" onclick="window.location='rate_card.php'"/>
<input type="button" class="btn myfont" value="ORDERS" onclick="window.location='order.php'"/>
<input type="button" class="btn myfont" value="ABOUT"/>
</span>
</span>
</span>
<div class="d-flex flex-row-reverse bd-highlight pt-4">
<button class="btn px-4 mx-2 btn-primary" data-toggle="modal" data-target="#add" >ADD DRAWING</button>
<?php
if($_SESSION["login"]==0){
?>
<button class="btn px-4" style="background-color: #00e600;" data-toggle="modal" data-target="#admin_login" >ADMIN LOG IN</button>
<?php
}
else{
?>
<button class="btn px-4" style="background-color: #00e600;" onclick="location.href='logout.php'">LOGOUT</button>
<?php
}
?>
</div>
<h1 class="display-5 text-center" style="padding-top: 10%; font-size:70px;">RATE CARD</h1>
<table class="table table-striped w-75 mx-auto text-center">
<thead>
<tr>
<th scope="col">Drawing Number</th>
<th scope="col">Price</th>
<th scope="col">Update</th>
<th scope="col">Delete</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $row["drawing_no"]; ?></td>
<td><?php echo $row["price"]; ?></td>
<td><button class="btn btn-warning" onclick="document.getElementById('UpdateDrawingNo').value='<?php echo $row["drawing_no"]?>'" data-toggle="modal" data-target="#upd">UPDATE</button></td>
<td style="padding-right: 70px;"><button class="btn btn-danger" data-toggle="modal" onclick="document.getElementById('DeleteDrawingNo').value='<?php echo $row["drawing_no"]?>'" data-target="#del">DELETE</button></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<center>
<div class="justify-text-center">
<table>
<tr>
<td style="padding-right: 70px"></td>
<td></td>
</div>
</tr>
</table>
</div>
</center>
<!-- Modal -->
<div class="modal fade" id="add">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Drawing</h5>
<button type="button" class="close" data-dismiss="modal">
<span>×</span>
</button>
</div>
<div class="modal-body">
<form method="POST" action="rate_api.php" >
<table>
<tr>
<td><label>Drawing No. </label></td>
<td><input class="form-control" type="text" id="AddDrawingNo" name="DrawingNo" placeholder="Drawing No." title="xxx-x-xxx [Only Numbers]" pattern = "[0-9]{3}-[0-9]-[0-9]{3}" required></td>
</tr>
<tr>
<td><label>Price</label></td>
<td><input class="form-control" type="text" id="AddPrice" name="Price" placeholder="Price" title=" Only Numbers " pattern = "[0-9]{1,10}" required></td>
</tr>
</table>
<br/>
<div class="modal-footer">
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="Close">
<input type="submit" class="btn btn-primary" <?php echo $disable; ?> value="Add Drawing">
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="del">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Delete</h5>
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form method="POST" action="rate_api.php">
<input type="hidden" name="_method" value="delete">
<table>
<tr>
<td><label>Drawing No.</label></td>
<td><input type="text" class="form-control" id="DeleteDrawingNo" name="DrawingNo" placeholder="Drawing No." title="xxx-x-xxx [Only Numbers]" pattern = "[0-9]{3}-[0-9]-[0-9]{3}" readonly required ></td>
</tr>
</table>
<br/>
<div class="modal-footer">
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="Close">
<input type="submit" class="btn btn-danger" <?php echo $disable; ?> value="Delete">
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="upd">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Update</h5>
<button type="button" class="close" data-dismiss="modal">
<span>×</span>
</button>
</div>
<div class="modal-body">
<form method="POST" action="rate_api.php">
<input type="hidden" name="_method" value="put">
<table>
<tr>
<td><label>Drawing No. </label></td>
<td><input type="text" class="form-control" id="UpdateDrawingNo" name="DrawingNo" placeholder="Drawing No." title="xxx-x-xxx [Only Numbers]" pattern = "[0-9]{3}-[0-9]-[0-9]{3}" readonly required></td>
</tr>
<tr>
<td><label>Price</label></td>
<td><input type="text" class="form-control" id="UpdatePrice" name="Price" title="Numbers Only" placeholder="Price" pattern = "[0-9]{1,10}" required></td>
</tr>
</table>
<br/>
<div class="modal-footer">
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="Close">
<input type="submit" class="btn btn-warning" <?php echo $disable; ?> value="Update">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="admin_login">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Log In</h5>
<button type="button" class="close" data-dismiss="modal">
<span>×</span>
</button>
</div>
<div class="modal-body">
<form method="POST" action="login.php" >
<table>
<tr><label> Enter Admin Password</label></tr>
<tr> <input class="form-control" type="password" name="pwd" value="" placeholder="Password" required></tr>
</table>
<br/>
<div class="modal-footer">
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="Close">
<input type="submit" class="btn btn-success" value="Login">
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>