<?php
include('dashboard_bdo.php');
require_once('convert_marathi.php');
?>
<html> 
	<head>
		<script language="JavaScript" type="text/javascript">
			function filldata (form) { 
			value = form.deskid.value; //select Department
			alert(value);
			}
		</script>
		<script type="text/javascript" src="js/adduser.js"></script> 
		<script type="text/javascript"></script>
		<!-- Sript To Display Department Wise Desk In Dropdown-->	
		<script>
			$(document).ready(function() {
				$('#wait_1').hide();
				$('#drop_1').change(function(){
					$('#wait_1').show();
					$('#result_1').hide();
						$.get("newtrip.php", {
							func: "drop_1",
							drop_var: $('#drop_1').val()
						}, function(response){
						$('#result_1').fadeOut();
						setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400);
					});
				return false;
				});
			});
			function finishAjax(id, response) {
			$('#wait_1').hide();
			$('#'+id).html(unescape(response));
			$('#'+id).fadeIn();
			}
			function finishAjax_tier_three(id, response) {
			$('#wait_2').hide();
			$('#'+id).html(unescape(response));
			$('#'+id).fadeIn();
			}
		</script>
		<script>
			function showUser2(str)
			{
				if (str=="")
				{
					document.getElementById("txtHint").innerHTML="";
					return;
				} 
				if (window.XMLHttpRequest)
				{	// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp=new XMLHttpRequest();
				}
				else
				{	// code for IE6, IE5
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange=function()
				{
					if (xmlhttp.readyState==4 && xmlhttp.status==200)
					{
						document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
						
					}
				}
				xmlhttp.open("GET","func1.php?q="+str,true);
				xmlhttp.send();
			}
			
		</script>
	</head>
	<body>
		<div class="rightpanel">
			<?php
			$no=$_GET['no'];
			if($no==1)
			{
			#########################################################################
											//code to add desk
			#########################################################################
			 ?>	   
			<ul class="breadcrumbs">
				<li><a href="dashboard_bdo.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
				<li><a href="dashboard_bdo.php"></a> <span class="separator"></span></li>
				<li>नवीन डेस्क जोडा</li>
			</ul>
			<div class="pageheader">
				<div class="pageicon"><span class="iconfa-pencil"></span></div>
					<div class="pagetitle">
					<h1>नवीन डेस्क जोडा</h1>
				</div>
			</div><!--pageheader-->
			<div class="maincontent">
				<div class="maincontentinner">
					<div class="widget">
						<h4 class="widgettitle">नवीन डेस्क जोडा</h4>
						<div class="widgetcontent">
							<form class="stdform" action="./connection/addnewdesk.php" method="post" name="adddesk">
								<table>
									<tr>
										<td><label style="width:130px;">डेस्कचे नाव निवडा : </label></td>	
										<td><span class="field"><input type="text" name="desknm" class="input-medium unicode" placeholder="Desk Name" lang="mr"/></span>
										</td>
									</tr>
									<tr>
									<td><label style="width:130px;">विभाग निवडा : </label></td>
									<td><span class="field unicode" lang="mr">
									<?php
									$query = "SELECT  * FROM department_master"; 
									convert_marathi();
									$result = mysql_query ($query);
									echo "<select name=deptno>Dropdown</option><option value=>Select Department</option>";
									while($row = mysql_fetch_array($result))
                                      {
                                       echo "<option value=$row[dept_id]>".$row[dept_nm]."</option>"; 
                                      }
									echo "</select>";
									?>
									</span></td>
								</tr>     
								</table>
								<p class="stdformbutton">
							    <center> <button class="btn btn-primary" name="save" onclick="return validateaddDesk()">जतन करा </button>  
                                <button type="reset" class="btn">रद्द करा</button>
								</center>
                                </p>
							</form>
	<?php   }
							
							######################End Of Add Desk Code###############################
 else if($no==2)
			{
							#########################################################################
											//code to update desk
							#########################################################################
			?>  
				<ul class="breadcrumbs">
					<li><a href="dashboard_bdo.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
					<li><a href="dashboard_bdo.php"></a> <span class="separator"></span></li>
					<li> डेस्क अद्यावत करा</li>
				</ul>
				<div class="pageheader">
					<div class="pageicon"><span class="iconfa-pencil"></span></div>
						<div class="pagetitle">
							<h1>डेस्क अद्यावत करा</h1>
						</div>
				</div><!--pageheader-->
				<div class="maincontent">
					<div class="maincontentinner"> 
						<div class="widget">
							<h4 class="widgettitle">डेस्क अद्यावत करा</h4>
								<div class="widgetcontent">
									<form class="stdform" action="./connection/addnewdesk.php" method="post" name="updatedesk">
									<table>
										<tr>
										<td><label style="width:130px;">डेस्कचे नाव निवडा : </label></td>
										<td><span class="field unicode" lang="mr">
										<?php $query1 = "SELECT  * FROM desk_master"; 
										convert_marathi();
										$result1 = mysql_query ($query1);
										echo "<select onchange='showUser2(this.value)' name=deskno>Dropdown</option><option value=>डेस्कचे नाव निवडा</option>";
										while($row1 = mysql_fetch_array($result1))
											{
												echo "<option value=$row1[desk_id]>".$row1[desk_nm]."</option>"; 
											}
										echo "</select>";?>
										</td>
										</tr>
										<tr>
											<td><label style="width:130px;"> डेस्कचे नाव टाका : </label></td>
											<td><span class="field"><input type="text" name="desknm" class="input-medium unicode" placeholder="Desk Name" lang="mr"/></span></td>
										</tr>
										<tr>
										<td><label style="width:130px;">विभाग निवडा : </label></td>
										<td><span class="field unicode" lang="mr">
										<?php
										$query = "SELECT  * FROM department_master"; 
										convert_marathi();
										$result = mysql_query ($query);
										echo "<select name=deptno>Dropdown</option><option value=>विभाग निवडा</option>";
										while($row = mysql_fetch_array($result))
											{
												echo "<option value=$row[dept_id]>".$row[dept_nm]."</option>"; 
											}
										echo "</select>";
										?>
										</span>
									</td>  
									</tr>
									</table>
									<p class="stdformbutton">
										<center>
										<button class="btn btn-primary" name="saveup" onclick="return validateupdateDesk()">अद्यावात करा </button>
										<button type="reset" class="btn">रद्द करा</button>
										</center>
									</p>
									</form>
	<?php  }
					  ######################End Of Update Desk Code###############################
					  ?> 
					</div><!--widgetcontent-->
				</div><!--widget-->
                        <?php include_once('footer.php'); ?>
         </div><!--maincontentinner-->
    </div><!--maincontent-->
    </div><!--rightpanel-->
</div><!--mainwrapper-->
</body>
</html>