-
Notifications
You must be signed in to change notification settings - Fork 1
/
addProduct.php
397 lines (313 loc) · 20.8 KB
/
addProduct.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Product | mkshop</title>
<link rel="stylesheet" href="bootstrap.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" />
<link rel="stylesheet" href="style.css" />
<link rel="icon" href="resourses/logo.svg" />
</head>
<body>
<div class="container-fluid">
<div class="row gy-3">
<?php
session_start();
include "header.php";
if (isset($_SESSION["u"])) {
?>
<div class="col-12">
<div class="row">
<div class="col-12 text-center">
<h2 class="h2 text-primary fw-bold">Add New Product</h2>
</div>
<div class="col-12">
<div class="row">
<div class="col-12 col-lg-4 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Select Product Category</label>
</div>
<div class="col-12">
<select class="form-select text-center" id="category" onchange="loadBrands();">
<option value="0">Select Category</option>
<?php
require "connection.php";
$category_rs = Database::search("SELECT * FROM `category`");
$category_num = $category_rs->num_rows;
for ($x = 0; $x < $category_num; $x++) {
$category_data = $category_rs->fetch_assoc();
?>
<option value="<?php echo $category_data["cat_id"]; ?>"><?php echo $category_data["cat_name"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-12 col-lg-4 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Select Product Brand</label>
</div>
<div class="col-12">
<select class="form-select text-center" id="brand">
<option value="0">Select Brand</option>
<?php
$brand_rs = Database::search("SELECT * FROM `brand`");
$brand_num = $brand_rs->num_rows;
for ($x = 0; $x < $brand_num; $x++) {
$brand_data = $brand_rs->fetch_assoc();
?>
<option value="<?php echo $brand_data["brand_id"]; ?>"><?php echo $brand_data["brand_name"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-12 col-lg-4 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Select Product Model</label>
</div>
<div class="col-12">
<select class="form-select text-center" id="model">
<option value="0">Select Model</option>
<?php
$model_rs = Database::search("SELECT * FROM `model`");
$model_num = $model_rs->num_rows;
for ($x = 0; $x < $model_num; $x++) {
$model_data = $model_rs->fetch_assoc();
?>
<option value="<?php echo $model_data["model_id"]; ?>"><?php echo $model_data["model_name"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">
Add a Title to your Product
</label>
</div>
<div class="offset-0 offset-lg-2 col-12 col-lg-8">
<input type="text" class="form-control" id="title"/>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-12 col-lg-4 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Select Product Condition</label>
</div>
<div class="col-12">
<div class="form-check form-check-inline mx-5">
<input class="form-check-input" type="radio" id="b" name="c" checked />
<label class="form-check-label fw-bold" for="b">Brandnew</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" id="u" name="c" />
<label class="form-check-label fw-bold" for="u">Used</label>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-4 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Select Product Colour</label>
</div>
<div class="col-12">
<select class="col-12 form-select" id="clr">
<option value="0">Select Colour</option>
<?php
$clr_rs = Database::search("SELECT * FROM `color`");
$clr_num = $clr_rs->num_rows;
for ($x = 0; $x < $clr_num; $x++) {
$clr_data = $clr_rs->fetch_assoc();
?>
<option value="<?php echo $clr_data["clr_id"]; ?>"><?php echo $clr_data["clr_name"]; ?></option>
<?php
}
?>
</select>
</div>
<div class="col-12">
<div class="input-group mt-2 mb-2">
<input type="text" class="form-control" placeholder="Add new Colour" id="clr_in"/>
<button class="btn btn-outline-primary" type="button" id="button-addon2">+ Add</button>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Add Product Quantity</label>
</div>
<div class="col-12">
<input type="number" class="form-control" value="0" min="0" id="qty"/>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-6 border-end border-success">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Cost Per Item</label>
</div>
<div class="offset-0 offset-lg-2 col-12 col-lg-8">
<div class="input-group mb-2 mt-2">
<span class="input-group-text">Rs.</span>
<input type="text" class="form-control" id="cost"/>
<span class="input-group-text">.00</span>
</div>
</div>
</div>
</div>
<div class="col-6">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Approved Payment Methods</label>
</div>
<div class="col-12">
<div class="row">
<div class="offset-0 offset-lg-2 col-2 pm pm1"></div>
<div class="col-2 pm pm2"></div>
<div class="col-2 pm pm3"></div>
<div class="col-2 pm pm4"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Delivery Cost</label>
</div>
<div class="col-12 col-lg-6 border-end border-success">
<div class="row">
<div class="col-12 offset-lg-1 col-lg-3">
<label class="form-label">Delivery cost Within Colombo</label>
</div>
<div class="col-12 col-lg-8">
<div class="input-group mb-2 mt-2">
<span class="input-group-text">Rs.</span>
<input type="text" class="form-control" id="dwc"/>
<span class="input-group-text">.00</span>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="row">
<div class="col-12 offset-lg-1 col-lg-3">
<label class="form-label">Delivery cost out of Colombo</label>
</div>
<div class="col-12 col-lg-8">
<div class="input-group mb-2 mt-2">
<span class="input-group-text">Rs.</span>
<input type="text" class="form-control" id="doc"/>
<span class="input-group-text">.00</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Product Description</label>
</div>
<div class="col-12">
<textarea cols="30" rows="15" class="form-control" id="desc"></textarea>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<div class="row">
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Add Product Images</label>
</div>
<div class="offset-lg-3 col-12 col-lg-6">
<div class="row">
<div class="col-4 border border-primary rounded">
<img src="resourses/addproductimg.svg" class="img-fluid" style="width: 250px;" id="i0"/>
</div>
<div class="col-4 border border-primary rounded">
<img src="resourses/addproductimg.svg" class="img-fluid" style="width: 250px;" id="i1"/>
</div>
<div class="col-4 border border-primary rounded">
<img src="resourses/addproductimg.svg" class="img-fluid" style="width: 250px;" id="i2"/>
</div>
</div>
</div>
<div class="offset-lg-3 col-12 col-lg-6 d-grid mt-3">
<input type="file" class="d-none" id="imageuploader" multiple />
<label for="imageuploader" class="col-12 btn btn-primary" onclick="changeProductImage();">Upload Images</label>
</div>
</div>
</div>
<div class="col-12">
<hr class="border-success" />
</div>
<div class="col-12">
<label class="form-label fw-bold" style="font-size: 20px;">Notice...</label><br />
<label class="form-label">
We are taking 5% of the product from price from every
product as a service charge.
</label>
</div>
<div class="offset-lg-4 col-12 col-lg-4 d-grid mt-3 mb-3">
<button class="btn btn-success" onclick="addProduct();">Save Product</button>
</div>
</div>
</div>
</div>
</div>
<?php
} else {
header("Location:home.php");
}
?>
<?php include "footer.php"; ?>
</div>
</div>
<script src="bootstrap.bundle.js"></script>
<script src="script.js"></script>
</body>
</html>