-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage-detail.php
416 lines (401 loc) · 20.8 KB
/
storage-detail.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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<?php
include "src/header.php";
$custParam = $_GET['cust_id'];
if(isset($custParam)) {
if($custParam != '') {
$listDepartment = "SELECT * FROM customer
INNER JOIN department ON customer.cust_id = department.cust_id
WHERE customer.cust_id='".$custParam."'";
$execListDepartment = mysqli_query($conn, $listDepartment);
} else {
echo "<script>";
echo "location.href = 'storage-user.php';";
echo "</script>";
}
} else {
echo "<script>";
echo "location.href = 'storage-user.php';";
echo "</script>";
}
?>
<!-- ============================================================== -->
<!-- Page wrapper -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="page-breadcrumb">
<div class="row">
<div class="col-7 align-self-center">
<h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Department List</h4>
<div class="d-flex align-items-center">
<nav aria-label="breadcrumb">
<ol class="breadcrumb m-0 p-0">
<li class="breadcrumb-item"><a href="storage-user.php" class="text-muted">Customer
Management</a></li>
<li class="breadcrumb-item text-muted active" aria-current="page">Department List</li>
</ol>
</nav>
</div>
</div>
<div class="col-5 align-self-center">
<div class="col-12 align-right">
<div class="customize-input float-right" data-toggle="modal" data-target="#add-department-modal">
<button id="btnPrint" class="btn btn-dark">Add Department</button>
</div>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Container fluid -->
<!-- ============================================================== -->
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Start Page Content -->
<!-- ============================================================== -->
<div class="row">
<!-- Start Production Table -->
<?php
$deptNum = 1;
foreach ($execListDepartment as $row) {
echo "<div class='col-12'>";
echo "<div class='card'>";
echo "<div class='card-body'>";
echo "<div class='customize-input row'>";
echo "<div class='col-md-8'>";
echo "<h4 class='card-title'>".$row["dept_name"]." <i class='fas fa-pencil-alt pencil-edit'";
echo "data-toggle='modal'";
echo 'data-target="#edit-department-modal" onclick="setDeptName(';
echo "'";
echo $row["dept_id"];
echo "'";
echo ",";
echo "'";
echo $row["dept_name"];
echo "'";
echo ",";
echo "'";
echo $row["dept_desc"];
echo "'";
echo ')"';
echo " data-placement='top' title='Edit Department'></i></h4>";
echo "</div>";
echo "<div class='col-md-4 text-right'>";
echo "<button disabled='' type='button' class='btn btn-sm btn-danger btn-rounded' data-toggle='modal'";
echo 'data-target="#directory-modal" onclick="setFolderName(';
echo "'";
echo $row["dept_id"];
echo "'";
echo ')" >';
echo "<i class='fas fa-trash-alt'></i> Department";
echo "</button> ";
echo "<button type='button' class='btn btn-sm btn-success btn-rounded' data-toggle='modal'";
echo 'data-target="#directory-modal" onclick="setFolderName(';
echo "'";
echo $row["dept_id"];
echo "'";
echo ')" >';
echo "<i class='fas fa-plus'></i> Directory";
echo "</button>";
echo "</div>";
echo "</div>";
echo "<br>";
echo "<div class='table-responsive'>";
echo "<table id='zero_config".$deptNum."' class='table table-striped table-bordered no-wrap'>";
echo "<thead>";
echo "<tr>";
echo "<th>No</th>";
echo "<th>Directory</th>";
echo "<th>Folder Name</th>";
echo "<th>Action</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$listDirectory = "SELECT * FROM folder
INNER JOIN department ON folder.dept_id = department.dept_id
INNER JOIN customer ON department.cust_id = customer.cust_id
WHERE customer.cust_id='$custParam' AND department.dept_id = '".$row['dept_id']."'";
$execListDirectory = mysqli_query($conn, $listDirectory);
$dirNum = 1;
foreach ($execListDirectory as $rowDir) {
echo "<tr>";
echo "<td>".$dirNum."</td>";
echo "<td>".$rowDir["folder_directory"]."</td>";
echo "<td>".$rowDir["folder_name"]."</td>";
echo "<td>";
echo "<button type='button' class='btn btn-sm btn-info btn-rounded'";
echo 'data-toggle="modal" data-target="#edit-directory-modal" onclick="setDirectoryName(';
echo "'";
echo $rowDir["folder_id"];
echo "'";
echo ",";
echo "'";
echo $rowDir["folder_directory"];
echo "'";
echo ",";
echo "'";
echo $rowDir["folder_name"];
echo "'";
echo ",";
echo "'";
echo $row["dept_id"];
echo "'";
echo ')" >';
echo "<i class='fas fa-pencil-alt'></i> Edit";
echo "</button>";
echo " ";
echo "<button disabled='' type='button' class='btn btn-sm btn-danger btn-rounded'>";
echo "<i class='fas fa-trash'></i> Delete";
echo "</button>";
echo "</td>";
echo "</tr>";
$dirNum++;
}
$deptNum++;
echo "</tbody>";
echo "</table>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
}
?>
<!-- End Production Table -->
</div>
<!-- ============================================================== -->
<!-- End PAge Content -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Right sidebar -->
<!-- ============================================================== -->
<!-- .right-sidebar -->
<!-- ============================================================== -->
<!-- End Right sidebar -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Container fluid -->
<!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Page wrapper -->
<!-- ============================================================== -->
<?php
include "src/footer.php";
?>
</body>
<!-- Add Department modal content -->
<div id="add-department-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 class="card-title">Add Department</h4>
</div>
<form action="#" class="pl-3 pr-3">
<div class="form-group">
<label for="">Department Name</label>
<input type="text" class="form-control" placeholder="Production" id="dept_name" name="dept_name"
required="" maxlength="255">
<div class="invalid-feedback" id="dept-name-error" style="display: none">
Department Name is required!
</div>
<div class="invalid-feedback" id="dept-name-error-exist" style="display: none">
Department Name already exist, please insert another Department Name.
</div>
</div>
<div class="form-group">
<label for="">Department Description</label>
<input type="text" class="form-control" placeholder="Description" id="dept_desc"
name="dept_desc" required="" maxlength="255">
<div class="invalid-feedback" id="dept-desc-error" style="display: none">
Department Description is required!
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-danger" type="button" data-dismiss="modal"
id="cancelAdd">Cancel</button>
<button class="btn btn-rounded btn-success" type="button" id="addDepartment">Add
Department</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Edit Department modal content -->
<div id="edit-department-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 class="card-title">Edit Department</h4>
</div>
<form action="#" class="pl-3 pr-3">
<div class="form-group">
<label for="">Department Name</label>
<input type="text" class="form-control" placeholder="Production" id="dept_name_edit" name="dept_name_edit"
required="" maxlength="255">
<div class="invalid-feedback" id="edit-dept-name-error" style="display: none">
Department Name is required!
</div>
<div class="invalid-feedback" id="edit-dept-name-error-exist" style="display: none">
Department Name already exist, please insert another Department Name.
</div>
</div>
<div class="form-group">
<label for="">Department Description</label>
<input type="text" class="form-control" placeholder="Description" id="dept_desc_edit"
name="dept_desc_edit" required="" maxlength="255">
<div class="invalid-feedback" id="edit-dept-desc-error" style="display: none">
Department Description is required!
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-danger" type="button" data-dismiss="modal"
id="cancelEditDept">Cancel</button>
<button class="btn btn-rounded btn-success" type="button" id="editDepartment">Save
Department</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Add Directory modal content -->
<div id="directory-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 class="card-title">Add directory</h4>
</div>
<form action="#" class="pl-3 pr-3">
<div class="form-group">
<label for="">Directory</label>
<input type="text" class="form-control" id="dir" name="dir" placeholder="/folder/dir">
<div class="invalid-feedback" id="dir-error" style="display: none">
Directory is required!
</div>
<div class="invalid-feedback" id="dir-error-exist" style="display: none">
Directory is already been used, please insert new directory.
</div>
</div>
<div class="form-group">
<label for="">Directory Name</label>
<input type="text" class="form-control" id="dir_name" name="dir_name" placeholder="Directory Name">
<div class="invalid-feedback" id="dir-name-error" style="display: none">
Directory Name Name is required!
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-danger" type="button" data-dismiss="modal" id="cancelAddDir">Cancel</button>
<button class="btn btn-rounded btn-success" type="button" id="addDirectory">Add Directory</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Edit Directory modal content -->
<div id="edit-directory-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 class="card-title">Edit directory</h4>
</div>
<form action="#" class="pl-3 pr-3">
<div class="form-group">
<label for="">Directory</label>
<input type="text" class="form-control" id="edit_dir" name="edit_dir" placeholder="/folder/dir">
<div class="invalid-feedback" id="edit-dir-error" style="display: none">
Directory is required!
</div>
<div class="invalid-feedback" id="edit-dir-error-exist" style="display: none">
Directory is already been used, please insert new directory.
</div>
</div>
<div class="form-group">
<label for="">Directory Name</label>
<input type="text" class="form-control" id="edit_dir_name" name="edit_dir_name" placeholder="Directory Name">
<div class="invalid-feedback" id="edit-dir-name-error" style="display: none">
Directory Name Name is required!
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-danger" type="button" data-dismiss="modal" id="cancelEditDir">Cancel</button>
<button class="btn btn-rounded btn-success" type="button" id="editDirectory">Save Directory</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Edit Customer Detail modal content -->
<div id="edit-customer-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 class="card-title">Edit customer detail</h4>
</div>
<form action="#" class="pl-3 pr-3">
<div class="form-body">
<label>Customer Name </label>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control" placeholder="Customer Name" id="cust_name" name="cust_name" required="" maxlength="255">
<div class="invalid-feedback" id="cust-name-error" style="display: none">
Customer Name is required!
</div>
</div>
</div>
</div>
<label>Customer Description </label>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="text" class="form-control" placeholder="Customer Description" id="cust_desc" name="cust_desc" required="" maxlength="64">
<div class="invalid-feedback" id="cust-desc-error" style="display: none">
Customer Description is required!
</div>
</div>
</div>
</div>
<label>Price per GB (RM) </label>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="number" class="form-control" placeholder="0.02 | 245.00" id="cust_price" name="cust_price" required="">
<div class="invalid-feedback" id="cust-price-error" style="display: none">
Price is required!
</div>
<div class="invalid-feedback" id="cust-price-error-value" style="display: none">
Price cannot be less than 0
</div>
</div>
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-danger" type="button" data-dismiss="modal" id="cancelEdit">Cancel</button>
<button class="btn btn-rounded btn-success" type="button" id="addCustomer">Save Customer</button>
</div>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="src/dist/js/ajaxForm/addDepartment.js"></script>
<script src="src/dist/js/ajaxForm/editDepartment.js"></script>
<script src="src/dist/js/ajaxForm/addDirectory.js"></script>
<script src="src/dist/js/ajaxForm/editDirectory.js"></script>
<script src="src/dist/js/ajaxForm/editCustomer.js"></script>
</html>