Current File : //home/obabain/khb_obaba_in/MenuCreation.jsp |
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page language="java" import="javax.sql.*"%>
<%@ include file="Connection.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@include file="master.jsp" %>
<form method="post" action="MenuCreationDA.jsp">
<div class="content">
<div class="row">
<div class="col-md-9">
<div class="panel panel-default" >
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Menu Creation</h3>
</div>
<table class="table" style="width:50%;background-color:white;">
<tr>
<td>
Menu Name</td>
<td>
<input type="text" name="mname" class="form-control">
</td>
</tr>
<tr>
<td>
Menu Parent</td>
<td>
<select name="mparent" class="form-control">
<option value="0">--Select--</option>
<%
Statement stmt=con.createStatement();
ResultSet r=stmt.executeQuery("select * from ip_menu_creation where menu_parent_id=0 ");
while(r.next())
{
%>
<option value="<%=r.getString("id") %>"><%=r.getString("menu_name") %></option>
<%} %>
</select>
</td>
</tr>
<tr>
<td>
Status</td>
<td>
<select name="status" class="form-control"><option value="0">Active</option>
<option value="1">Inactive</option>
</select>
</td>
</tr>
<tr>
<td>
Redirection</td>
<td>
<input type="text" name="redirect" class="form-control">
</td>
</tr>
<tr>
<td>
Sort Order</td>
<td>
<input type="text" name="sorder" class="form-control">
</td>
</tr>
<tr>
<td>
<input type="submit" name="save" class="btn btn-success">
</td>
</tr>
</table>
</div>
</div>
<div class="col-md-2"></div>
<div class="col-md-9" style="background-color:white;padding-top:10px; margin:0px 0px 0px 25px; width:73%;">
<div class="col-md-12">
<input class="form-control" type="text" placeholder="Filters users..." name="filter" id="myInput" onkeyup="myFunction()">
</div>
<table class="table" id="datatable-responsive">
<thead>
<tr>
<th></th>
<th>Menu Name</th>
<th>Menu Parent</th>
<th>SortOrder</th>
<th>Redirection</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<%
ResultSet rsm=null;
Statement stm=con.createStatement();
String filt=request.getParameter("filter");
if(filt==null)
{
rsm=stm.executeQuery("SELECT tb.*,(case when tb.status=0 then 'img/bullet_ball_glass_green.png' else 'img/orange.png' end)img FROM ip_menu_creation tb");
}
else
{
rsm=stm.executeQuery("select tb.*,(case when tb.status=0 then 'img/bullet_ball_glass_green.png' else 'img/orange.png' end)img from ip_menu_creation tb where menu_name like '"+filt+"%' ");
}
while(rsm.next())
{
%>
<tr>
<td><%=rsm.getString("id") %></td>
<td><%=rsm.getString("menu_name") %></td>
<td><%=rsm.getString("menu_parent_id") %></td>
<td><%=rsm.getString("sortorder") %></td>
<td><%=rsm.getString("redirection_page") %></td>
<td>
<img src="<%=rsm.getString("img") %>"></img>
</td>
<td><a href="editmenu.jsp?Id=<%=rsm.getString("id") %>"><span class="glyphicon glyphicon-pencil"></span></a></td>
</tr>
<%} %>
</tbody>
</table>
</div>
</div>
</div>
<%@include file="footer.jsp" %>
</form>
<script>
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("datatable-responsive");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
</body>
</html>