-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategories.php
167 lines (152 loc) · 4.95 KB
/
categories.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
<?php session_start();
if (!isset($_SESSION['user'])) {
header("location:vendor.php");
}
?>
<?php include_once("./templates/top.php"); ?>
<?php include_once("./templates/navbar.php"); ?>
<div class="container-fluid">
<div class="row">
<?php include "./templates/sidebar.php";
$admin = $_SESSION['user'];
?>
<script type="text/javascript">
var admin = '<?php echo $_SESSION["user"]; ?>';
//console.log(admin);
</script>
<?php
if($admin !='malbok@gmail.com'){
?>
<div class="row">
<div class="col-10">
<h2>Available Categories</h2>
</div>
<!-- <div class="col-2">
<a href="#" data-toggle="modal" data-target="#add_category_modal" class="btn btn-primary btn-sm">Add Category</a>
</div> -->
</div>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<!-- <th>Action</th> -->
</tr>
</thead>
<tbody id="category_list">
<!-- <tr>
<td>1</td>
<td>ABC</td>
<td>FDGR.JPG</td>
<td>122</td>
<td>eLECTRONCS</td>
<td>aPPLE</td>
<td><a class="btn btn-sm btn-info"></a><a class="btn btn-sm btn-danger">Delete</a></td>
</tr> -->
</tbody>
</table>
</div>
<?php
}
else{
?>
<div class="row">
<div class="col-10">
<h2>Available Categories</h2>
</div>
<div class="col-2">
<a href="#" data-toggle="modal" data-target="#add_category_modal" class="btn btn-primary btn-sm">Add Category</a>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Action</th>
</tr>
</thead>
<tbody id="category_list">
<!-- <tr>
<td>1</td>
<td>ABC</td>
<td>FDGR.JPG</td>
<td>122</td>
<td>eLECTRONCS</td>
<td>aPPLE</td>
<td><a class="btn btn-sm btn-info"></a><a class="btn btn-sm btn-danger">Delete</a></td>
</tr> -->
</tbody>
</table>
</div>
<?php
}
?>
</main>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="add_category_modal" 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">Add Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="add-category-form" enctype="multipart/form-data">
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Category Name</label>
<input type="text" name="cat_title" class="form-control" placeholder="Enter Category Name">
</div>
</div>
<input type="hidden" name="add_category" value="1">
<div class="col-12">
<button type="button" class="btn btn-primary add-category">Add Category</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal -->
<!--Edit category Modal -->
<div class="modal fade" id="edit_category_modal" 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">Add Category</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="edit-category-form" enctype="multipart/form-data">
<div class="row">
<div class="col-12">
<input type="hidden" name="cat_id">
<div class="form-group">
<label>Category Name</label>
<input type="text" name="e_cat_title" class="form-control" placeholder="Enter Brand Name">
</div>
</div>
<input type="hidden" name="edit_category" value="1">
<div class="col-12">
<button type="button" class="btn btn-primary edit-category-btn">Update Category</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Modal -->
<?php include_once("./templates/footer.php"); ?>
<script type="text/javascript" src="./js/categories.js"></script>