-
Notifications
You must be signed in to change notification settings - Fork 9
/
cat.php
143 lines (135 loc) · 4.95 KB
/
cat.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
<?php
require 'config.php';
$conn = connection();
$sql = "SELECT * FROM category order by cat_name ASC";
$data = $conn->query($sql);
$conn=null;
?>
<div id="form-bp1" tabindex="-1" role="dialog" class="modal fade colored-header colored-header-danger">
<div class="modal-dialog custom-width">
<div class="modal-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" aria-hidden="true" class="close md-close"><span class="mdi mdi-close"></span></button>
<h3 class="modal-title"><strong>ADD NEW CATEGORY</strong></h3>
</div>
<div class="modal-body">
<div class="form-group">
<label>Category Name</label>
<input type="text" id="acat_name" placeholder="enter category name" required="" class="form-control input-xs parsley-error">
</div>
<div class="form-group">
<label>Category Description</label>
<textarea class="form-control input-xs" id="acat_des" placeholder="enter category description..."></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default md-close">Cancel</button>
<button type="submit" onclick="add_cat();" data-dismiss="modal" class="btn btn-danger md-close">Proceed</button>
</div>
</div>
</div>
</div>
<!-- MODAL CLOSE -->
<div class="col-md-12">
<div class="col-md-12">
<div class="panel panel-full-color panel-full-success">
<div class="panel-heading panel-heading-contrast" style="background-color: #2e1114;"><strong>CATEGORY DETAILS</strong>
<div class="tools"><span class="icon mdi"></span></div><span class="panel-subtitle"></span>
</div>
<div class="panel-body" style="background-color: #501b1d">
<div class="col-md-4">
<label class="control-label panel-subtitle" style="color:white;font-size:20px;">Search by Name</label>
<input type="text" id="scat_name" onkeyup="srch_cat();" placeholder="Enter Name..." class="form-control input-xs">
</div>
<div class="col-md-4">
<label class="control-label panel-subtitle" style="color:white;font-size:20px;">Search by Description</label>
<input type="text" id="scat_des" onkeyup="srch_cat();" placeholder="Enter description..." class="form-control input-xs">
</div>
<div class="col-md-4">
<label class="control-label "> </label><br>
<div class="btn-group btn-space">
<button data-toggle="modal" data-target="#form-bp1" class="btn btn-space md-trigger btn-danger"><i class="icon icon-left mdi mdi-receipt"></i> ADD CATEGORY</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="panel panel-default panel-table">
<div class="panel-heading"><strong>CATEGORY TABLE</strong>
</div>
<div class="panel-body">
<span id="srch_cat">
<table class="table table-condensed table-hover table-bordered table-striped">
<thead>
<tr>
<th><center>S. no.</center></th>
<th><center>Name</center></th>
<th><center>Description</center></th>
<!-- <th><center>Status</center></th> -->
</tr>
</thead>
<tbody style="color:black;">
<?php $s=0;
foreach ($data as $row){ $s++; ?>
<tr>
<td><center><?php echo $s; ?></center></td>
<td><?php echo ucwords($row['cat_name']); ?></td>
<td><?php echo ucwords($row['cat_des']); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</span>
</div>
</div>
</div>
</div>
<script>
function callPro(id)
{
var pro = id;
// alert(id);
$.ajax({
type: "POST",
url: 'nav.php',
data: {pro:pro},
success:function(msg) {
// alert(msg);
$('#output').html(msg);
}
});
}
</script>
<script>
function add_cat()
{
var name = $('#acat_name').val();
var des = $('#acat_des').val();
$.ajax({
type: "POST",
url: 'cat_add.php',
data: {name:name,des:des},
success:function(msg) {
//alert(msg);
$('#srch_cat').html(msg);
}
});
}
</script>
<script>
function srch_cat()
{
var sname = $('#scat_name').val();
var sdes = $('#scat_des').val();
$.ajax({
type: "POST",
url: 'srch_cat.php',
data: {sname:sname,sdes:sdes},
success:function(msg) {
//alert(msg);
$('#srch_cat').html(msg);
}
});
}
</script>