-
Notifications
You must be signed in to change notification settings - Fork 0
/
sellerpage.php
281 lines (241 loc) · 11.4 KB
/
sellerpage.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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!doctype html>
<html lang="en">
<?php
session_start();
$user = $_SESSION["username"];
//$user = "Rajesh";
require_once("dbConnect.php");
$query ="select * from Seller where Seller_UserName = \"$user\";";
$result = mysqli_query($conn,$query);
$row = $result->fetch_array();
$password = $row["Password"];
$road = $row["Road"];
$city = $row["City"];
$state = $row["State"];
$pincode = $row["Pincode"];
?>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Profile</title>
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'
integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'>
<script src='https://code.jquery.com/jquery-3.3.1.slim.min.js'
integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'>
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js'
integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'>
</script>
<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'
integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'>
</script>
<link rel='stylesheet' type='text/css' href='css/style.css'>
</head>
<body>
<div class="container">
<div>
<div class="d-flex flex-row-reverse bd-highlight">
<div class="p-2 bd-highlight">
<a href="logout.php">log out</a>
</div>
</div>
</div>
<br><br><br>
<h2 style="text-align: center;">Your Profile</h2>
<br><br><br>
<div class="row">
<div class="col-4">
<div class="list-group" id="list-tab" role="tablist">
<a class="list-group-item list-group-item-action active" id="list-home-list" data-toggle="list" href="#list-home" role="tab" aria-controls="home">Home</a>
<a class="list-group-item list-group-item-action" id="list-profile-list" data-toggle="list" href="#list-profile" role="tab" aria-controls="profile">Address</a>
<a class="list-group-item list-group-item-action" id="list-messages-list" data-toggle="list" href="#list-messages" role="tab" aria-controls="messages">Phone Numbers</a>
<a class="list-group-item list-group-item-action" id="list-settings-list" data-toggle="list" href="#list-settings" role="tab" aria-controls="settings">Settings</a>
</div>
</div>
<div class="col-8">
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">
<br>
<h2>Name: <span id="name"><?php echo $row["Name"] ?></span></h2>
<br><br>
</div>
<div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">
<br>
<h3 id="address1">
<?php echo "Road".$row["Road"] ?>
</h3>
<h3 id="city">
<?php echo "City".$row["City"] ?>
</h3>
<h3 id="state">
<?php echo "State".$row["State"] ?>
</h3>
<h3 id="pin">
<?php echo "Pincode".$row["Pincode"] ?>
</h3>
</div>
<div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">
<div>
<table class="table">
<thead>
<th>Phone Numbers</th>
</thead>
<tbody id="list">
<?php
$sql = "SELECT * FROM Seller_Phone_Number WHERE Seller_UserName = \"$user\";";
$res = mysqli_query($conn,$sql);
while( $row = $res->fetch_array()){
$num = $row["Phone_Number"];
echo "<tr><td>$num<td></tr>";
}
?>
</tbody>
</table>
<button type="button" class="btn btn-outline-primary" aria-label="Add" data-toggle="modal"
data-target="#formModal">
Add number
</button>
<!-- Modal -->
<div class="modal fade" id="formModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<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>
</div>
<form action="addPhoneNumber.php" method="POST">
<div class="modal-body">
<input type="text" value="<?php echo $user; ?>" hidden>
<div class="form-group">
<label>Number</label>
<input type="number" name="number" id="price" class="form-control" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button class="btn btn-success" type="submit">
Add
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">
<br><br>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#exampleModal"> Edit Details</button>
<div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="sellerupdate.php" method="POST">
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="password" value="<?php echo $password; ?>">
</div>
<div class="form-group">
<label for="inputAddressLine2" class="col-sm-2 control-label">Road</label>
<input type="text" class="form-control" id="inputAddressLine1" name="road" placeholder="Address Line 1" value="<?php echo $road; ?>">
</div>
<div class="form-group">
<label for="inputCityTown" class="col-sm-2 control-label">City</label>
<input type="text" class="form-control" id="inputCityTown" name="city" placeholder="City/Town" value="<?php echo $city; ?>">
</div>
<div class="form-group">
<label for="inputStateProvinceRegion" class="col-sm-2 control-label">State</label>
<input type="text" class="form-control" id="inputStateProvinceRegion" name="state"
placeholder="State" value="<?php echo $state; ?>">
</div>
<div class="form-group">
<label for="inputZipPostalCode" class="col-sm-2 control-label">Postal Code</label>
<input type="text" class="form-control" id="inputpin" name="pincode" placeholder="PIN" value="<?php echo $pincode; ?>">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" >Save changes</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='container'>
<br><br>
<h3>Products on sale</h3>
<?php
$sql = "SELECT * FROM Seller_sells INNER JOIN Product ON Product.productID = Seller_sells.productID WHERE Seller_UserName = \"$user\"";
$res2 = mysqli_query($conn,$sql);
while($row2 = $res2->fetch_array()){
$pname = $row2["ProductName"];
$pid = $row2["productID"];
$q = $row2["Product_Quantity"];
$p = $row2["Price"]*$q;
echo " <hr> <div class='row m-2'>
<div class='col'>
$pname
</div>
<div class='col'>
Quantity: $q
</div>
<div class='col'>
Amount: Rs. $p
</div>
</div>";
}
?>
<br><br>
<center>
<a href="/add.php" class="border rouded p-4 bg-success text-light" > Add new Item </a>
</center>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript">
function add() {
var price = $('#price').val();
var newLine = '<tr>' +
'<td>' + price + '</td>' +
'</td>' +
'</tr>';
$('#list').append(newLine);
$('#formModal').modal('hide');
}
function details(){
var name = $('#Input1').val();
var age = $('#Input2').val();
var add1 = $('#inputAddressLine1').val();
var city = $('#inputCityTown').val();
var state = $('#inputStateProvinceRegion').val();
var pin = $('#inputpin').val();
$('#name').html(name);
$('#age').html(age);
$('#address1').html(add1);
$('#city').html(city);
$('#state').html(state);
$('#pin').html(pin);
$('#exampleModal').modal('hide');
}
</script>
</body>
</html>