-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreets.php
161 lines (160 loc) · 8.06 KB
/
streets.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
<?php
include "check_auth.php";
include "backend_config.php";
$b=new Backend();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>My Taxi | Streets</title>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<style>
.alert{
position: absolute;
top: 80px;
right: 10px;
}
</style>
</head>
<body>
<?php include "navbar.php";?>
<div class="container">
<?php include "message.php"?>
<div class="page-header">
<h4>Streets</h4>
</div>
<div class="row">
<div class="col-sm-8">
<h5>All Streets</h5>
<table class="table table-hover">
<tr>
<th>ID</th>
<th>Quarters</th>
<th>Streets</th>
<th>Actions</th>
</tr>
<?php
$streets=$b->getStreets();
foreach ($streets as $s):
?>
<tr>
<td><?php echo $s['id']?></td>
<td><?php echo $s['quarter_name']?></td>
<td><?php echo $s['street_name']?></td>
<td>
<a data-toggle="modal" data-target="#e<?php echo $s['id']?>" href="#"><i class="glyphicon glyphicon-edit"></i> </a>
<a data-toggle="modal" data-target="#d<?php echo $s['id']?>" href="#" class="text-danger"><i class="glyphicon glyphicon-remove-circle"></i> </a>
<!--edit modal-->
<div id="e<?php echo $s['id']?>" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form method="post" action="update_street.php">
<input type="hidden" name="street_id" value="<?php echo $s['id'] ?>">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Edit Street.</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="street_name">Street Name</label>
<input type="text" name="street_name" id="street_name" class="form-control" value="<?php echo $s['street_name'] ?>">
</div>
<div class="form-group">
<label for="quarter_id">Quarter</label>
<select name="quarter_id" id="quarter_id" class="form-control">
<?php
$sql=$b->getQuarters();
foreach ($sql as $q){
?>
<option <?php if($q['id']==$s['quarter_id']){echo "selected ";}?>value="<?php echo $q['id']?>"><?php echo $q['quarter_name']?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save Change</button>
</div>
</div><!-- /.modal-content -->
</form>
</div><!-- /.modal-dialog -->
</div><!-- /.end edit modal -->
<!--remove modal-->
<div id="d<?php echo $s['id']?>" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Confirm.</h4>
</div>
<div class="modal-body">
<div class="text-danger text-center">
<i class="glyphicon glyphicon-warning-sign"></i>
<p>
The <strong><?php echo $s['street_name']?></strong> from <strong><?php echo $s['quarter_name']?></strong>
will delete from database.
</p>
</div>
</div>
<div class="modal-footer">
<a href="remove_street.php?street_id=<?php echo $s['id']?>">Agree</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.end remove modal -->
</td>
</tr>
<?php
endforeach;
?>
</table>
</div>
<div class="col-sm-4">
<h5>New Street</h5>
<div class="panel panel-default">
<div class="panel-body">
<form method="post" action="new_street.php">
<div class="form-group">
<label for="street_name">Street Name</label>
<input type="text" name="street_name" id="street_name" class="form-control">
</div>
<div class="form-group">
<label for="quarter_id">Quarter</label>
<select name="quarter_id" id="quarter_id" class="form-control" required>
<?php
$qtrs=$b->getQuarters();
foreach ($qtrs as $q){
?>
<option value="<?php echo $q['id']?>">
<?php echo $q['quarter_name']?>
</option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script>
$(function () {
setTimeout(function () {
$(".alert").fadeOut();
},2000)
})
</script>
</body>
</html>