-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.php
354 lines (290 loc) · 14.9 KB
/
product.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?php require_once 'php_action/db_connect.php' ?>
<?php require_once 'includes/header.php'; ?>
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="dashboard.php">Home</a></li>
<li class="active">Product</li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<div class="page-heading"> <i class="glyphicon glyphicon-edit"></i> Manage Product</div>
</div> <!-- /panel-heading -->
<div class="panel-body">
<div class="remove-messages"></div>
<div class="div-action pull pull-right" style="padding-bottom:20px;">
<button class="btn btn-default button1" data-toggle="modal" id="addProductModalBtn" data-target="#addProductModal"> <i class="glyphicon glyphicon-plus-sign"></i> Add Product </button>
</div> <!-- /div-action -->
<table class="table" id="manageProductTable">
<thead>
<tr>
<th style="width:10%;">Photo</th>
<th>Product Name</th>
<th>Rate</th>
<th>Quantity</th>
<th>Brand</th>
<th>Category</th>
<th>Status</th>
<th style="width:15%;">Options</th>
</tr>
</thead>
</table>
<!-- /table -->
</div> <!-- /panel-body -->
</div> <!-- /panel -->
</div> <!-- /col-md-12 -->
</div> <!-- /row -->
<!-- add product -->
<div class="modal fade" id="addProductModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal" id="submitProductForm" action="php_action/createProduct.php" method="POST" enctype="multipart/form-data">
<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"><i class="fa fa-plus"></i> Add Product</h4>
</div>
<div class="modal-body" style="max-height:450px; overflow:auto;">
<div id="add-product-messages"></div>
<div class="form-group">
<label for="productImage" class="col-sm-3 control-label">Product Image: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<!-- the avatar markup -->
<div id="kv-avatar-errors-1" class="center-block" style="display:none;"></div>
<div class="kv-avatar center-block">
<input type="file" class="form-control" id="productImage" placeholder="Product Name" name="productImage" class="file-loading" style="width:auto;"/>
</div>
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="productName" class="col-sm-3 control-label">Product Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="productName" placeholder="Product Name" name="productName" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="quantity" class="col-sm-3 control-label">Quantity: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="quantity" placeholder="Quantity" name="quantity" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="rate" class="col-sm-3 control-label">Rate: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="rate" placeholder="Rate" name="rate" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="brandName" class="col-sm-3 control-label">Brand Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" id="brandName" name="brandName">
<option value="">~~SELECT~~</option>
<?php
$sql = "SELECT brand_id, brand_name, brand_active, brand_status FROM brands WHERE brand_status = 1 AND brand_active = 1";
$result = $connect->query($sql);
while($row = $result->fetch_array()) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";
} // while
?>
</select>
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="categoryName" class="col-sm-3 control-label">Category Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select type="text" class="form-control" id="categoryName" placeholder="Product Name" name="categoryName" >
<option value="">~~SELECT~~</option>
<?php
$sql = "SELECT categories_id, categories_name, categories_active, categories_status FROM categories WHERE categories_status = 1 AND categories_active = 1";
$result = $connect->query($sql);
while($row = $result->fetch_array()) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";
} // while
?>
</select>
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="productStatus" class="col-sm-3 control-label">Status: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" id="productStatus" name="productStatus">
<option value="">~~SELECT~~</option>
<option value="1">Available</option>
<option value="2">Not Available</option>
</select>
</div>
</div> <!-- /form-group-->
</div> <!-- /modal-body -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"> <i class="glyphicon glyphicon-remove-sign"></i> Close</button>
<button type="submit" class="btn btn-primary" id="createProductBtn" data-loading-text="Loading..." autocomplete="off"> <i class="glyphicon glyphicon-ok-sign"></i> Save Changes</button>
</div> <!-- /modal-footer -->
</form> <!-- /.form -->
</div> <!-- /modal-content -->
</div> <!-- /modal-dailog -->
</div>
<!-- /add categories -->
<!-- edit categories brand -->
<div class="modal fade" id="editProductModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<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"><i class="fa fa-edit"></i> Edit Product</h4>
</div>
<div class="modal-body" style="max-height:450px; overflow:auto;">
<div class="div-loading">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<span class="sr-only">Loading...</span>
</div>
<div class="div-result">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#photo" aria-controls="home" role="tab" data-toggle="tab">Photo</a></li>
<li role="presentation"><a href="#productInfo" aria-controls="profile" role="tab" data-toggle="tab">Product Info</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="photo">
<form action="php_action/editProductImage.php" method="POST" id="updateProductImageForm" class="form-horizontal" enctype="multipart/form-data">
<br />
<div id="edit-productPhoto-messages"></div>
<div class="form-group">
<label for="editProductImage" class="col-sm-3 control-label">Product Image: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<img src="" id="getProductImage" class="thumbnail" style="width:250px; height:250px;" />
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editProductImage" class="col-sm-3 control-label">Select Photo: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<!-- the avatar markup -->
<div id="kv-avatar-errors-1" class="center-block" style="display:none;"></div>
<div class="kv-avatar center-block">
<input type="file" class="form-control" id="editProductImage" placeholder="Product Name" name="editProductImage" class="file-loading" style="width:auto;"/>
</div>
</div>
</div> <!-- /form-group-->
<div class="modal-footer editProductPhotoFooter">
<button type="button" class="btn btn-default" data-dismiss="modal"> <i class="glyphicon glyphicon-remove-sign"></i> Close</button>
<!-- <button type="submit" class="btn btn-success" id="editProductImageBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-ok-sign"></i> Save Changes</button> -->
</div>
<!-- /modal-footer -->
</form>
<!-- /form -->
</div>
<!-- product image -->
<div role="tabpanel" class="tab-pane" id="productInfo">
<form class="form-horizontal" id="editProductForm" action="php_action/editProduct.php" method="POST">
<br />
<div id="edit-product-messages"></div>
<div class="form-group">
<label for="editProductName" class="col-sm-3 control-label">Product Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="editProductName" placeholder="Product Name" name="editProductName" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editQuantity" class="col-sm-3 control-label">Quantity: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="editQuantity" placeholder="Quantity" name="editQuantity" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editRate" class="col-sm-3 control-label">Rate: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<input type="text" class="form-control" id="editRate" placeholder="Rate" name="editRate" autocomplete="off">
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editBrandName" class="col-sm-3 control-label">Brand Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" id="editBrandName" name="editBrandName">
<option value="">~~SELECT~~</option>
<?php
$sql = "SELECT brand_id, brand_name, brand_active, brand_status FROM brands WHERE brand_status = 1 AND brand_active = 1";
$result = $connect->query($sql);
while($row = $result->fetch_array()) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";
} // while
?>
</select>
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editCategoryName" class="col-sm-3 control-label">Category Name: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select type="text" class="form-control" id="editCategoryName" name="editCategoryName" >
<option value="">~~SELECT~~</option>
<?php
$sql = "SELECT categories_id, categories_name, categories_active, categories_status FROM categories WHERE categories_status = 1 AND categories_active = 1";
$result = $connect->query($sql);
while($row = $result->fetch_array()) {
echo "<option value='".$row[0]."'>".$row[1]."</option>";
} // while
?>
</select>
</div>
</div> <!-- /form-group-->
<div class="form-group">
<label for="editProductStatus" class="col-sm-3 control-label">Status: </label>
<label class="col-sm-1 control-label">: </label>
<div class="col-sm-8">
<select class="form-control" id="editProductStatus" name="editProductStatus">
<option value="">~~SELECT~~</option>
<option value="1">Available</option>
<option value="2">Not Available</option>
</select>
</div>
</div> <!-- /form-group-->
<div class="modal-footer editProductFooter">
<button type="button" class="btn btn-default" data-dismiss="modal"> <i class="glyphicon glyphicon-remove-sign"></i> Close</button>
<button type="submit" class="btn btn-success" id="editProductBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-ok-sign"></i> Save Changes</button>
</div> <!-- /modal-footer -->
</form> <!-- /.form -->
</div>
<!-- /product info -->
</div>
</div>
</div> <!-- /modal-body -->
</div>
<!-- /modal-content -->
</div>
<!-- /modal-dailog -->
</div>
<!-- /categories brand -->
<!-- categories brand -->
<div class="modal fade" tabindex="-1" role="dialog" id="removeProductModal">
<div class="modal-dialog">
<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"><i class="glyphicon glyphicon-trash"></i> Remove Product</h4>
</div>
<div class="modal-body">
<div class="removeProductMessages"></div>
<p>Do you really want to remove ?</p>
</div>
<div class="modal-footer removeProductFooter">
<button type="button" class="btn btn-default" data-dismiss="modal"> <i class="glyphicon glyphicon-remove-sign"></i> Close</button>
<button type="button" class="btn btn-primary" id="removeProductBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-ok-sign"></i> Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- /categories brand -->
<script src="custom/js/product.js"></script>
<?php require_once 'includes/footer.php'; ?>