-
Notifications
You must be signed in to change notification settings - Fork 0
/
categoryshow.php
85 lines (81 loc) · 2.77 KB
/
categoryshow.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
<?php
session_start();
include_once "management/includes/pro_api_db.php";
$commonFunObj = new CommonFunctions();
$getCategory = $commonFunObj->getList("category");
?>
<script>
function editCategory(cid){
var category_id = cid;
alert(category_id);
}
function statusChange(cid){
var category_id = cid;
parameters = "category_id="+category_id+"&action=categoryStatus";
$.ajax({
type: "POST",
url: "ajax_status.php",
data: parameters,
success: function(response){
//alert(response);
if(response == "succ"){
showDataC();
$('#category').val("");
document.getElementById("msg").innerHTML="Update category status successfull...";
}
}
});
}
function deleteCategory(cid){
alert("Are you sure delete category.");
var category_id = cid;
var parameters = "";
parameters = "category_id="+category_id+"&action=categoryDel";
//alert(parameters);
$.ajax({
type: "POST",
url: "ajax_delete.php",
data: parameters,
success: function(response){
//alert(response);
if(response == "succ"){
showDataC();
$('#category').val("");
document.getElementById("msg").innerHTML="Delete category successfull...";
}
}
});
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="admintable">
<tr>
<th width="59" align="left" valign="middle">Sr.No.</th>
<th width="752" align="left" valign="middle">Category Name</th>
<th width="77" align="left" valign="middle">Status</th>
<th width="54" align="left" valign="middle">Edit</th>
<th width="71" align="left" valign="middle">Remove</th>
</tr>
<?php
if($getCategory>0){
$sn= 1;
foreach($getCategory as $showCategory){
$categoryId = $showCategory['id'];
if($showCategory['display_status']==1){
$status = "Active";
}else if($showCategory['display_status']==0){
$status = "Deactive";
}
?>
<tr>
<td align="left" valign="top"><?=$sn?></td>
<td align="left" valign="top"><?=$showCategory['category_name']?></td>
<td align="left" valign="top" onclick="statusChange(<?=$categoryId?>)"><strong><?=$status?></strong></td>
<td align="left" valign="top"><a href="edit_category.php?cid=<?=$categoryId?>">Edit</a></td>
<td align="center" valign="top" onclick="deleteCategory(<?=$categoryId?>)"><a href="#"><img src="images/icon-bin.jpg" alt="" width="25" height="25" border="0" align="absmiddle" /></a></td>
</tr>
<?php
$sn++;
}
}
?>
</table>