-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.php
801 lines (731 loc) · 33.4 KB
/
settings.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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
<?php
//include auth.php file on all secure pages
require("php/connect.php");
require("php/auth.php");
$sql2 = "SELECT * FROM users WHERE id = '".$_SESSION['user_id']."' LIMIT 1";
$res2 = mysqli_query($conn, $sql2);
if (!$res2) {
die("No results from the table");
}
$row2=mysqli_fetch_assoc($res2);
foreach ($row2 as $key => $value) {
$type = $row2[type];
}
date_default_timezone_set('UTC');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="msapplication-tap-highlight" content="no">
<title>Settings Page | Admin Dashboard | Bofik Nigeria Limited.</title>
<!-- CORE CSS-->
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- JQUERY CSS -->
<link rel="stylesheet" href="css/jquery-ui.min.css">
<link rel="stylesheet" href="css/jquery-ui.theme.min.css">
<!-- Custome CSS-->
<link href="css/custom/custom-style.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
<link href="js/plugins/prism/prism.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="js/plugins/data-tables/css/jquery.dataTables.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="js/plugins/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="js/plugins/chartist-js/chartist.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<link rel="shortcut icon" href="images/bofik_logo.png" type="image/x-icon">
<!-- fonts -->
<link href="https://fonts.googleapis.com/css?family=Varela|Varela+Round" rel="stylesheet">
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- stylesheets for older browsers -->
<!-- ie6/7 micro clearfix -->
<!--[if lte IE 7]>
<style>
.grouping {
*zoom: 1;
}
</style>
<![endif]-->
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style media="screen">
.brand_search_details {
position: relative;
left: 50%;
transform: translateX(-50%);
margin-top: 30px;
}
.hide_side_nav {
cursor: pointer;
width: 50px;
margin-left: 10px;
}
/*.set_well > td {*/
/* padding: 10px 10px !important;*/
/* border-bottom: 0.5px solid #111 !important;*/
/*}*/
.header-search-wrapper {
display: none !important;
}
table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, table.dataTable.display tbody th, table.dataTable.display tbody td {
border-top: 1px solid transparent !important;
padding: 10px 10px !important;
border-bottom: 0.5px solid #111 !important;
}
.divider {
background-color: #311b92;
}
input#download_data_month, input#download_data {
padding: 20px;
width: auto;
}
</style>
</head>
<body>
<!-- Start Page Loading -->
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
<!-- End Page Loading -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START HEADER -->
<header id="header" class="page-topbar">
<!-- start header nav-->
<div class="navbar-fixed">
<nav class="navbar-color deep-purple darken-4">
<div class="nav-wrapper">
<ul class="left">
<li>
<i class="mdi-navigation-menu hide-on-med-and-down hide_side_nav waves-effect waves-light deep-purple darken-4"></i>
<!-- <a href="#" data-activates="slide-out" class="sidebar-collapse btn-floating btn-medium waves-effect waves-light hide-on-med-and-down hide_side_nav deep-purple darken-4"><i class="mdi-navigation-menu"></i></a> -->
</li>
<li><h1 class="logo-wrapper"><a href="index.html" class="brand-logo darken-1"> <h6>Bofik Nigeria Limited</h6> </a></h1></li>
</ul>
<div class="header-search-wrapper hide-on-med-and-down">
<i class="mdi-action-search"></i>
<input type="text" name="Search" class="header-search-input z-depth-2" placeholder="Search..."/>
</div>
</div>
</nav>
</div>
<!-- end header nav-->
</header>
<!-- END HEADER -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START MAIN -->
<div id="main">
<!-- START WRAPPER -->
<div class="wrapper">
<!-- START LEFT SIDEBAR NAV-->
<aside id="left-sidebar-nav">
<ul id="slide-out" class="side-nav fixed leftside-navigation">
<li class="user-details deep-purple darken-4 darken-2">
<div class="row">
<div class="col col s4 m4 l4">
<img src="images/bofik_logo.png" alt="" class="circle responsive-img valign profile-image">
</div>
<div class="col col s8 m8 l8">
<ul id="profile-dropdown" class="dropdown-content">
<!-- <li><a href="#"><i class="mdi-action-face-unlock"></i> Profile</a>
</li>
<li><a href="#"><i class="mdi-action-settings"></i> Settings</a>
</li> -->
<!-- <li class="divider"></li> -->
<li><a href="#"><i class="mdi-hardware-keyboard-tab"></i> Logout</a>
</li>
</ul>
<?php
if (isset($_SESSION['username'])) {
echo '<a class="btn-flat dropdown-button waves-effect waves-light white-text profile-btn" href="#" data-activates="profile-dropdown">' .$_SESSION['username'].'<i class="mdi-navigation-arrow-drop-down right"></i></a>';
}
?>
</div>
</div>
</li>
<li class="bold"><a href="dashboard.php#" class="waves-effect waves-deep-purple darken-4"><i class="mdi-action-dashboard"></i> Dashboard</a>
</li>
<li class="li-hover"><div class="divider"></div></li>
<li class="li-hover"><p class="ultra-small margin more-text">INVENTORY</p></li>
<li class="bold"><a href="dashboard.php#create_inv" class="waves-effect waves-deep-purple darken-4 "><i class="mdi-content-add-box"></i> Create Inventory</a>
</li>
<?php
if($type === 'superadmin'){
echo '<li class="bold"><a href="#search_inv" class="waves-effect waves-deep-purple darken-4"><i class="mdi-action-search"></i> Search Inventory</a>
</li>';
}
?>
<li class="bold"><a href="dashboard.php#running_inv" class="waves-effect waves-deep-purple darken-4"><i class="mdi-action-input"></i> Inventory Running</a>
</li>
<?php
if($type === 'superadmin'){
echo '<li class="bold"><a href="dashboard.php#bulk_inv" class="waves-effect waves-deep-purple darken-4 "><i class="mdi-action-receipt"></i> Bulk Purchase Input</a>
</li>
<li class="bold"><a href="dashboard.php#download_inv" class="waves-effect waves-deep-purple darken-4 "><i class="mdi-communication-call-received"></i> Download Data</a>
</li>
<li class="bold"><a href="dashboard.php#download_month" data-navid="8" class="waves-effect waves-deep-purple darken-4 dash_click"><i class="mdi-action-event"></i> Download Monthly Data <span class="new badge"></span></a>
</li>';
}
?>
<li class="li-hover"><div class="divider"></div></li>
<li class="li-hover"><p class="ultra-small margin more-text">SETTINGS</p></li>
<?php
if($type === 'superadmin'){
echo '
<li class="bold"><a href="#" class="waves-effect waves-deep-purple darken-4 "><i class="mdi-action-settings"></i> Settings</a>
</li>';
}
?>
<li><a href="change_password.php"><i class="mdi-action-lock-outline"></i> Change Password</a>
</li>
<li><a href="php/logout.php"><i class="mdi-action-launch"></i> Sign Out</a>
</li>
</ul>
<a href="#" data-activates="slide-out" class="sidebar-collapse btn-floating btn-medium waves-effect waves-light hide-on-large-only deep-purple darken-4"><i class="mdi-navigation-menu"></i></a>
</aside>
<!-- END LEFT SIDEBAR NAV-->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START SETTINGS CONTENT -->
<section id="settings" class="settings">
<!--breadcrumbs start-->
<div id="breadcrumbs-wrapper">
<!-- Search for small screen -->
<div class="header-search-wrapper grey hide-on-large-only">
<i class="mdi-action-search active"></i>
<input type="text" name="Search" class="header-search-input z-depth-2" placeholder="Search...">
</div>
<div class="container">
<div class="row">
<div class="col s12 m12 l12">
<h5 class="breadcrumbs-title">Settings Page</h5>
<ol class="breadcrumbs">
<li><a href="index.html">Settings Page</a></li>
</ol>
</div>
</div>
</div>
</div>
<!--breadcrumbs end-->
<!--start container-->
<div class="container">
<div class="section">
<p class="caption">Settings Page.</p>
<div class="divider"></div>
<div class="row margin">
<div class="input-field col s6">
<select name="settings_select" id="select">
<option value="" disabled>Choose Settings Action</option>
<option data-navid="1" value="1" selected>Add/Edit Email</option>
<option data-navid="2" value="2">Add/Edit New Account</option>
<option data-navid="3" value="3">Add Product Name</option>
</select>
</div>
</div>
<div class="divider"></div>
<section id="add_email" data-navitem="1" class="sections">
<div class="center-align card teal darken-3" style="padding:10px; color:#fff;"><h5>ADD EMAILS TO RECEIVE ALERTS</h5></div>
<form class="" action="php/add_email.php" method="post">
<!--######################## CREATE EMAIL #############################3 -->
<!-- Company Name -->
<div class="row company valign-wrapper">
<div class="col s6 offset-s3">
<div class="row">
<div class="input-field col s12 center-align">
<i class="mdi-communication-email prefix"></i>
<input type="email" placeholder="Add Email" id="" name="add_email" class="" required>
<!-- <label for="autocomplete-input">Company Name :</label> -->
</div>
</div>
</div>
</div>
<!-- End Purchase Date -->
<!--###### SUBMIT BUTTON ########-->
<div class="row">
<div class="col s12 m6 offset-m3">
<button type="submit" class="btn full_btn waves-effect waves-light btn-large teal darken-4" name="submit_email">Add Email</button>
</div>
</div>
<!--###### END SUBMIT BUTTON ########-->
<!--######################## END CREATE EMAIL #############################3 -->
</form>
<div class="divider"></div>
<div class="container col s12 m12 l12 search_result">
<table id="data-table-simple" class="display demo2 responsive-table edit_table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Email</th>
<th>Date Added</th>
<th>Edit</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Email</th>
<th>Date Added</th>
<th>Edit</th>
</tr>
</tfoot>
<tbody>
<?php
$sqlcomp = "SELECT * FROM add_email";
$resultcomp = mysqli_query($conn, $sqlcomp);
while($rowcompany=mysqli_fetch_assoc($resultcomp)){
$id = $rowcompany['id'];
$add_email = $rowcompany['add_email'];
$date = $rowcompany['date'];
echo '<tr>';
echo '<td>'.$add_email.'</td>';
echo '<td>'.$date.'</td>';
echo '<td>
<a href="javascript:delete_id('.$id.')" class="waves-effect waves-light btn-floating"><i class="mdi-content-content-cut left"></i>Delete</a>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</section>
<br><br>
<div class="divider"></div>
<section id="add_account" data-navitem="2" class="sections" style="display:none;">
<div class="center-align card blue" style="padding:10px; color:#fff;"><h5>ADD/EDIT NEW ACCOUNT</h5></div>
<div class="col s12">
<form class="container formValidate" id="formValidate" name="RegForm" method="post" action="php/add_account.php" style="width:500px;">
<div class="row">
<div class="input-field col s12 center">
<p class="center">Add new admin here !</p>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-social-person-outline prefix"></i>
<input id="username" name="username" type="text" required data-error=".errorTxt1">
<div class="errorTxt1"></div>
<label for="username" class="center-align">Username</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-communication-email prefix"></i>
<input id="email" name="email" type="email" required data-error=".errorTxt2">
<div class="errorTxt2"></div>
<label for="email" class="center-align">Email</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-action-lock-outline prefix"></i>
<input id="password" name="password" type="password" required data-error=".errorTxt3">
<div class="errorTxt3"></div>
<label for="password">Password</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-action-lock-outline prefix"></i>
<input id="password-again" name="password-again" type="password" required data-error=".errorTxt4">
<div class="errorTxt4"></div>
<label for="password-again">Password again</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<select name="admin_type">
<option value="" disabled selected>Choose admin type</option>
<option value="admin">Admin</option>
<option value="superadmin">Super Admin</option>
<option value="user">User</option>
</select>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<button id="reg_button" type="submit" name="reg_button" class="btn waves-effect waves-light col s12">Register Admin</button>
</div>
</div>
<div class="row">
<div class="col 12 message_box" style="margin:10px 0px;"></div>
</div>
</form>
</div>
<div class="divider"></div>
<div class="container col s12 m12 l12 search_result">
<table id="data-table-row-grouping" class="display demo2 responsive-table edit_table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Type</th>
<th>Username</th>
<th>Type</th>
<th>Email</th>
<th>Edit</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Type</th>
<th>Username</th>
<th>Type</th>
<th>Email</th>
<th>Edit</th>
</tr>
</tfoot>
<tbody>
<?php
$sqlcomp = "SELECT * FROM users";
$resultcomp = mysqli_query($conn, $sqlcomp);
while($rowcompany=mysqli_fetch_assoc($resultcomp)){
$id = $rowcompany['id'];
$type = $rowcompany['type'];
$username = $rowcompany['username'];
$admin_email = $rowcompany['email'];
$str = "id={$id}&type={$type}";
echo '<tr>';
echo '<td>'.$type.'</td>';
echo '<td>'.$username.'</td>';
echo '<td>'.$type.'</td>';
echo '<td>'.$admin_email.'</td>';
echo '<td>
<a href="javascript:delete_acc('.$id.')" class="waves-effect waves-light btn-floating"><i class="mdi-content-content-cut left"></i>Delete</a>
</td>';
echo '</tr>';
}
?>
<!--<a href="php/edit_acc.php?edit_acc='.$str.'" class="waves-effect waves-light btn-floating"><i class="mdi-action-swap-horiz left"></i>Edit</a>-->
</tbody>
</table>
</div>
</section>
<div class="divider"></div>
<section id="add_product_name" data-navitem="3" class="sections" style="display:none;">
<div class="center-align card yellow darken-4" style="padding:10px; color:#fff;"><h5>ADD/EDIT PRODUCT DETAILS</h5></div>
<div class="col s12">
<form class="container formValidate" id="formValidate2" name="RegForm" method="post" action="php/add_product.php" style="width:500px;">
<div class="row">
<div class="input-field col s12 center">
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-social-person-outline prefix"></i>
<input id="comp_name" name="comp_name" type="text" required data-error=".errorTxt1">
<div class="errorTxt1"></div>
<label for="comp_name" class="center-align">Add Company Name</label>
</div>
</div>
<div class="row margin">
<div class="input-field col s12">
<i class="mdi-communication-email prefix"></i>
<input id="brand_name" name="brand_name" type="text" required data-error=".errorTxt2">
<div class="errorTxt2"></div>
<label for="brand_name" class="center-align">Add Brand Name</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<button id="add_prod" type="submit" name="add_prod" class="btn waves-effect waves-light col s12">Add Product</button>
</div>
</div>
<div class="row">
<div class="col 12 message_box" style="margin:10px 0px;"></div>
</div>
</form>
</div>
<div class="divider"></div>
<div class="container col s12 m12 l12 search_result">
<table id="data-table-row-grouping2" class="display demo2 responsive-table edit_table" cellspacing="0" width="100%">
<thead>
<tr>
<th>Company Name</th>
<th>Brand Name</th>
<th>Company Name</th>
<th>Delete</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Company Name</th>
<th>Brand Name</th>
<th>Company Name</th>
<th>Delete</th>
</tr>
</tfoot>
<tbody>
<?php
$sqlcomp = "SELECT * FROM add_product_name";
$resultcomp = mysqli_query($conn, $sqlcomp);
while($rowcompany=mysqli_fetch_assoc($resultcomp)){
$id = $rowcompany['id'];
$company_name = $rowcompany['company_name'];
$brand_name = $rowcompany['brand_name'];
echo '<tr>';
echo '<td>'.$company_name.'</td>';
echo '<td>'.$brand_name.'</td>';
echo '<td>'.$company_name.'</td>';
echo '<td>
<a href="javascript:delete_prod('.$id.')" class="waves-effect waves-light btn-floating"><i class="mdi-action-delete left"></i>Delete</a>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</section>
<!-- Floating Action Button -->
<div class="fixed-action-btn" style="bottom: 50px; right: 19px;">
<a class="btn-floating btn-large">
<i class="mdi-action-wallet-travel deep-purple darken-4 darken-4"></i>
</a>
<ul>
<li><a href="#create_inv" class="btn-floating deep-purple darken-4 darken-4"><i class="large mdi-content-add-box"></i></a></li>
<li><a href="#search_inv" class="btn-floating yellow darken-1"><i class="large mdi-action-search"></i></a></li>
<li><a href="#running_inv" class="btn-floating green"><i class="large mdi-action-input"></i></a></li>
<!-- <li><a href="app-email.html" class="btn-floating blue"><i class="large mdi-communication-email"></i></a></li> -->
</ul>
</div>
<!-- Floating Action Button -->
</div>
<!--end container-->
</section>
<!-- END SETTINGS CONTENT -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
</div>
<!-- END WRAPPER -->
</div>
<!-- END MAIN -->
<!-- //////////////////////////////////////////////////////////////////////////// -->
<!-- START FOOTER -->
<footer class="page-footer">
<div class="footer-copyright">
<div class="container">
<span>© 2018 Bofik Nigeria Limited.</span>
</div>
</div>
</footer>
<!-- END FOOTER -->
<!-- ================================================
Scripts
================================================ -->
<!-- jQuery Library -->
<script type="text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
<!--<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>-->
<!-- JQUERY UI JS -->
<!-- <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script> -->
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="js/materialize.js"></script>
<!-- data-tables -->
<script type="text/javascript" src="js/plugins/data-tables/js/jquery.dataTables.min.js"></script>
<!--<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>-->
<script type="text/javascript" src="js/plugins/data-tables/data-tables-script.js"></script>
<!--editabletable-->
<script type="text/javascript" src="js/plugins/editable-table/mindmup-editabletable.js"></script>
<script type="text/javascript" src="js/plugins/editable-table/numeric-input-example.js"></script>
<!--prism
<script type="text/javascript" src="js/prism/prism.js"></script>-->
<!--scrollbar-->
<!-- <script type="text/javascript" src="js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script> -->
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="js/plugins.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="js/custom-script.js"></script>
<script>
$('#select').change(function(){
// console.log('Hey');
var id= $(this).val();
$(".sections").fadeOut("300");
showSection(id);
// console.log(id);
});
</script>
<script type="text/javascript">
var brand = $('.brand input');
var subBrand = $('.sub_brand');
$(brand).on('blur click',function() {
if ($(this).val() !== "") {
subBrand.css({display : 'block', background : 'rgba(204, 204, 204, 0.18)', padding : '10px'});
}else {
subBrand.css({display : 'none', background : 'rgba(204, 204, 204, 0.18)', padding : '5px'});
}
});
</script>
<script type="text/javascript">
// AUTOCOMPLETE FEATURE
var company = ["Dangote",
"Golden Penny",
"Crown Flour Mills",
"Pure Flour Mills",
"Honeywell Flour Mills"];
$('.autocompleteCompany').autocomplete( {source : company});
</script>
<script type="text/javascript">
// SHOW OTHER SECTIONS
// var a = $('#left-sidebar-nav ul li');
// console.log(a);
$(".dash_click").click(function() {
var b = $(this).data('navid');
// console.log(b);
$(".sections").fadeOut("300");
showSection(b);
// console.log(this);
});
function showSection(b){
var element = $('section[data-navitem="'+b+'"]');;
element.fadeIn(2000);
element.addClass('active');
}
</script>
<script type="text/javascript">
$('.allbuttons').on('click', function (e) {
e.preventDefault();
});
</script>
<script>
// FOR COUNTER EFFECT
(function(){
$('.counter').each(function(){
var counter = $(this).text();
var showCounter = $('.showCounter');
var counterDate = Date.parse(counter);
var now = new Date().getTime();
var distance = counterDate - now;
var d = new Date(distance);
var getMonth = d.getMonth() + 1;
var showError = $('.show_alert_error');
// setInterval(function() {
// showCounter.text(getMonth + " Months to expire");
// }, 1000);
if (getMonth === $('.alert_time').val()) {
showCounter.css({color:"#fff", background:"red"});
}
});
})();
// FOR SIDE NAV TOGGLE
(function(){
$('#left-sidebar-nav').addClass('active');
$('.hide_side_nav').on('click', function() {
$('#left-sidebar-nav').slideToggle(1000, function() {
$('#main, .page-footer').css({paddingLeft:"0px"});
$(this).toggleClass('active');
if ($('#left-sidebar-nav').hasClass('active')) {
$('#main, .page-footer').css({paddingLeft:"240px"});
}
});
});
})();
</script>
<script src="js/jquery.table2excel.js"></script>
<script>
$(".download_csv").click(function(){
var showDate = new Date();
// showDate.toDateString()
// alert("yes");
$(".data-table-simple").table2excel({
// exclude CSS class
exclude: ".noExl",
name: "Excel Document Name",
filename: "Bofik Inventory Table on " + showDate,
fileext: ".xls",
exclude_img: true,
exclude_links: true,
exclude_inputs: true
});
// $("#data-table-simple").table2excel({
// // exclude CSS class
// exclude: ".noExl",
// name: "Excel Document Name",
// filename: "Bofik Inventory Table on " + showDate,
// fileext: ".xls",
// exclude_img: true,
// exclude_links: true,
// exclude_inputs: true
// });
});
function getNodes(value){
if(this.value == ""){
$("#resulting").html("Enter a search query");
}else{
$.post("search.php",{partialNode:value},function(data){
$("#resulting").html(data);
});
}
}
$('#data-table-row-grouping').editableTableWidget().numericInputExample().find('td:first').focus();
</script>
<script>
$("#resulting tr td").click(function(){
$(this).replaceWith('<input type="text" />');
});
</script>
<script type="text/javascript">
function insertBulk() {
var company_name=$("#company_name").val();
var brand_name=$("#brand_name").val();
var sub_name=$("#sub_name").val();
var pur_order_no=$("#pur_order_no").val();
var pur_quantity=$("#pur_quantity").val();
var pur_date=$("#pur_date").val();
// AJAX code to send data to php file.
$.ajax({
type: "POST",
url: "php/bulk_inv.php",
data: {company_name:company_name,brand_name:brand_name,sub_name:sub_name,pur_order_no:pur_order_no,pur_quantity:pur_quantity,pur_date:pur_date},
dataType: "JSON",
success: function(data) {
$("#message").html(data);
$("p").addClass("alert alert-success");
},
error: function(err) {
alert(err);
}
});
}
</script>
<script type="text/javascript">
function delete_id(id)
{
if(confirm('Sure To Remove This Mail ?'))
{
window.location.href='php/delete_mail.php?delete_id='+id;
}
}
</script>
<script type="text/javascript">
function delete_inv(id)
{
if(confirm('Sure To Remove This Record ?'))
{
window.location.href='php/delete.php?delete_inv='+id;
}
}
</script>
<script type="text/javascript">
function delete_prod(id)
{
if(confirm('Sure To Remove This Product Details ?'))
{
window.location.href='php/delete_prod.php?delete_prod='+id;
}
}
function delete_acc(id)
{
if(confirm('Sure To Remove This Account ?'))
{
window.location.href='php/delete_acc.php?delete_acc='+id;
}
}
function edit_acc(str)
{
if(confirm('Sure To Edit This Account ?'))
{
window.location.href='php/edit_acc.php?edit_acc='+str;
}
}
</script>
</body>
</html>