<?php
include('dashboard_desk.php');
require_once('convert_marathi.php');
$username = $_SESSION['User_Name']; 
?>
<html> 
<head>  
<script type="text/javascript" src="js/adduser.js"></script> 
<style type="text/css">
.trst{
   height:40px;
    }
.tdwd{
width:180px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
		 $(".name").hide();
		 $(".othername").hide();
		 $(".dismethod").hide();
		 $(".jatan").hide();
		 
        $('input[type="radio"]').click(function(){
            if($(this).attr("value")=="same"){
                $(".name").show();
				$(".othername").hide();
				 $(".dptlist").hide();	
				$(".desklist").hide();
				$(".dismethod").show();
				$(".jatan").show();

				$(".waitop").hide();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
				flag=1;
            }
            if($(this).attr("value")=="other"){
                $(".othername").show();
				 $(".name").hide();
				  $(".dptlist").hide();	
				 $(".desklist").hide();
				 $(".dismethod").show();
				 $(".jatan").show();

				 $(".waitop").hide();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
				 flag=2;
		 }
                   });
    });
	
</script>
<script type="text/javascript">
    $(document).ready(function(){
		 $(".address").hide();
                $(".email").hide();
				$(".sameaddress").hide();
                $(".sameemail").hide();
				$(".par").show();
        $('input[type="radio"]').click(function(){
            if($(this).attr("value")=="email" && flag==1){
               
                $(".sameemail").show();
				$(".sameaddress").hide();
				$(".address").hide();
                $(".email").hide();
				$(".par").show();
            }
            if($(this).attr("value")=="post" && flag==1){
               
               
				$(".sameemail").hide();
				 $(".sameaddress").show();
				$(".address").hide();
                $(".email").hide();
				$(".par").show();
            }
			if($(this).attr("value")=="emailpost" && flag==1){
				$(".sameemail").show();
                $(".sameaddress").show();
				$(".address").hide();
                $(".email").hide();
				$(".par").show();
            }
			
			if($(this).attr("value")=="email" && flag==2){
				$(".email").show();
                $(".sameemail").hide();
				$(".sameaddress").hide();
				$(".address").hide();
				$(".par").show();
                
				
            }
            if($(this).attr("value")=="post" && flag==2){
               
               
				$(".address").show();
                $(".email").hide();
				 $(".sameaddress").hide();
				$(".sameemail").hide();
				$(".par").show();
            }
			if($(this).attr("value")=="emailpost" && flag==2){
				$(".sameemail").hide();
                $(".sameaddress").hide();
				$(".address").show();
                $(".email").show();
				$(".par").show;
            }
                   });
    });
	
</script>
<script type="text/javascript">
    $(document).ready(function(){
		$(".par").hide();
		 $(".dptlist").hide();	
		 $(".desklist").hide();	
		 $(".selectuser").hide();
		 $(".dismethod").hide();		 
        $('input[type="radio"]').click(function(){
            if($(this).attr("value")=="permanent"){
                /*$(".dptlist").hide();
				$(".desklist").hide();	
				$(".selectuser").show();
				$(".jatan").hide();*/

				 $(".dptlist").hide();
				$(".desklist").hide();	
				$(".selectuser").show();
				$(".jatan").hide();
				$(".name").hide();
				$(".othername").hide();
				
				$(".waitop").hide();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
            }
            if($(this).attr("value")=="department"){
				$(".par").hide();
                $(".dptlist").show();
				$(".desklist").hide();	
				$(".selectuser").hide();
				$(".dismethod").hide();
				$(".sameemail").hide();
                $(".sameaddress").hide();
				$(".address").hide();
                $(".email").hide();
				$(".jatan").hide();
				$(".othername").hide();
				$(".name").hide();

				$(".waitop").hide();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
		 }
		 if($(this).attr("value")=="desk"){
				$(".par").hide();
                $(".dptlist").hide();
				$(".desklist").show();	
				$(".selectuser").hide();
				$(".dismethod").hide();
				$(".sameemail").hide();
                $(".sameaddress").hide();
				$(".address").hide();
                $(".email").hide();
				$(".jatan").hide();
				$(".othername").hide();
				$(".name").hide();

				$(".waitop").hide();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
				
		 }
		 if($(this).attr("value")=="wait"){
				$(".par").hide();
                $(".dptlist").hide();
				$(".desklist").hide();	
				$(".selectuser").hide();
				$(".dismethod").hide();
				$(".sameemail").hide();
                $(".sameaddress").hide();
				$(".address").hide();
                $(".email").hide();
				$(".jatan").hide();
				$(".name").hide();
				$(".othername").hide();

				$(".waitop").show();
				$(".otherop").hide();
				$(".sameop").hide();
				$('#rwaits').prop("checked", false);
				$('#rwaito').prop("checked", false);
		 }
		 
                   });
    });
	
</script>
<script>
$(document).ready(function ()
{
	$('#rwaits').click(function(){
		$(".otherop").hide();
		$(".sameop").show();
	});

	$('#rwaito').click(function(){
		$(".otherop").show();
		$(".sameop").hide();
	});
});
</script>
</head>
<body>
<div class="mainwrapper">
	<div class="rightpanel">
        <ul class="breadcrumbs">
            <li><a href="dashboard_desk.php"><i class="iconfa-home"></i></a> <span class="separator"></span></li>
            <li>पत्र पाठवायची माहिती भरा</li> 
        </ul>
        <div class="pageheader">
            <div class="pageicon"><span class="iconfa-pencil"></span></div>
            <div class="pagetitle">
                <h5>Forms</h5>
                <h1>पत्र पाठवायची माहिती भरा</h1>
            </div>
        </div><!--pageheader-->
        <div class="maincontent">
            <div class="maincontentinner">
				<div class="widget">
					<h4 class="widgettitle">पत्र पाठवायची माहिती भरा</h4>
					<div class="widgetcontent">
						<?php 
						 $id=$_GET['num'];
						// echo $ltrtype."xxxx";
						//echo "id is".$id;
						echo "<form enctype='multipart/form-data' class='stdform' action='./connection/dispatchdb.php?no=$id' method='post' name='myform'>";
						?>
							<input type="hidden" name="vargawari" value="<?php echo $ltrtype; ?>" >
							<table>
							<tr class="trst">
								<td class="tdwd">
									<label>पाठवणीचा  प्रकार  : </label>
								</td>
								
								<td class="tdwd">
									<label><input type="radio" name="dispatchmethod" value="same"/>अर्जदार </label>
								</td>
								<td class="tdwd">
									<label><input type="radio" name="dispatchmethod" value="other"/>इतर </label>
								</td>
								
								<td class="tdwd">
									<label style="width:130px;"><input type="radio" name="dispatchmethod" value="department"/>विभागास </label>
								</td>
								<td class="tdwd">
									<label style="width:130px;"><input type="radio" name="dispatchmethod" value="desk"/>इतर डेस्कला  </label>
								</td>
								<td class="tdwd">
									<label style="width:130px;"><input type="radio" name="dispatchmethod" value="wait"/>Await Register</label>
								</td>
							</tr>

							<tr class="waitop trst" hidden >
								<td class="tdwd">
									<label>निवडा1 : </label>
								</td>
								<td class="tdwd">
									<label style="width:130px;"><input type="radio" name="rwait" id="rwaits" value="SD"/>स्व विभागास </label>
								</td>

								<td class="tdwd">
									<label style="width:130px;"><input type="radio" name="rwait" id="rwaito" value="OD"/>इतर विभागास </label>
								</td>
							</tr>

							<tr class="sameop trst" hidden >
								<td class="tdwd">
									<label>विभाग निवडा1 : </label>
								</td>
								<td class="tdwd">
								<?php      
	                                convert_marathi();
									$query = "SELECT  * FROM department_master"; 
									$result = mysql_query ($query);
									echo "<select name='wait_dept' id='wait_dept' >";
									echo "<option value=''>विभाग निवडा1 </option>";
									while($row = mysql_fetch_array($result))
	                                    {
	                                       echo "<option value='".$row['dept_id']."' class=field >".$row['dept_nm']."</option>"; 
										}
	                              	echo "</select>";				    
								?>
								</td>
						</tr>

						<tr class="otherop trst" hidden >
								<td class="tdwd">
									<label>विभाग निवडा2 :</label>
								</td>
								<td class="tdwd">
								<?php      
	                                convert_marathi();
									$query = "SELECT  * FROM other_department"; 
									$result = mysql_query ($query);
									echo "<select name='wait_otherdept' id='wait_otherdept' >";
									echo "<option value=''>विभाग निवडा2 </option>";
									while($row = mysql_fetch_array($result))
	                                    {
	                                       echo "<option value='".$row['oid']."' class=field >".$row['oname']."</option>"; 
										}
	                              	echo "</select>";				    
								?>
								</td>
						</tr>

						<tr class="dptlist trst">
                          <td class="tdwd"><label style="width:130px;">विभाग निवडा : </label></td>
                          <td class="tdwd">
							<?php      
                                convert_marathi();
								$query = "SELECT  * FROM department_master"; 
								$result = mysql_query ($query);
								echo "<select name=deptid id=deptid>Dropdown</option>";
								echo "<option value=>विभाग निवडा </option>";
								while($row = mysql_fetch_array($result))
                                    {
                                       echo "<option value=$row[dept_id] class=field unicode lang=mr  onchange = desk_function(this)>".$row[dept_nm]."</option>"; 
									}
                              echo "</select>";				    
							?>
                          </td>
						</tr>

						<tr class="desklist trst">
                          <td class="tdwd"><label style="width:130px;">डेस्क निवडा : </label></td>
                          <td class="tdwd">
							<?php      
                                convert_marathi();
								$q=mysql_query ("SELECT dept_id FROM  login where login_id='$username'");
								$r=mysql_fetch_array($q);
								$dptid=$r['dept_id'];
								
								$query = "SELECT  * FROM desk_master where dept_id='$dptid' "; 
								$result = mysql_query ($query);
								echo "<select name=deskid id=deskid>Dropdown</option>";
								echo "<option value=>डेस्क निवडा </option>";
								while($row = mysql_fetch_array($result))
                                    {
                                       echo "<option value=$row[desk_id] class=field unicode lang=mr  onchange = desk_function(this)>".$row[desk_nm]."</option>"; 
									}
                              echo "</select>";				    
							?>
                          </td>
						</tr>
						
						
						
						<tr class="name trst">
						<?php 
						$qrynm=("Select * FROM incoming_letters_transaction,tapal_to_dpt_transaction,desk_transaction WHERE desk_transaction.desk_ltr_id='$id' AND tapal_to_dpt_transaction.ltr_id=incoming_letters_transaction.ltr_id AND tapal_to_dpt_transaction.dpt_ltr_id=desk_transaction.dpt_ltr_id ");
						$rsnm=mysql_query($qrynm)or die("fhfhgh".mysql_error());
						$rownm=mysql_fetch_array($rsnm)
					
						?>
						<!---------------- If Same User ----------------->
                        <td class="tdwd">
                            <label>नाव   : </label></td>
                            <td class="tdwd"><input type="text" name="name" class="input-medium" value="<?php echo $rownm['sender_name'];?>" readonly /></span>
						
					   </td>
						</tr>
						
                    	<!---------------- If Another User ----------------->
						<tr class="othername trst">
                        <td class="tdwd">
                            <label>नाव टाका  :  </label>
						</td>
						<td class="tdwd">
                            <input type="text" name="othername" class="input-medium unicode" lang="mr" placeholder="Name"/>
						</td>
					   </tr>
						
						<!---------- Select jatanprakar ------------>
						<tr class="jatan trst">
							<td><label>जतन प्रकार निवडा   : </label></td>
									<td><select id="category_faq" name="ltrtype">
										<option value="">जतन प्रकार </option>    
										<option value="अ">अ</option>
										<option value="ब">ब</option>
										<option value="क">क</option>
										<option value="क१">क१</option>
										<option value="ड">ड</option>
										</select>
									</td>
						</tr>
						
						<!------------------------------------ Select Dispatch Method ----------------------------------->
						<tr class="dismethod trst">
                        <td >
                            <label class="tdwd" >कायमस्वरूपी पाठवणीचा प्रकार  :  </label>
						</td>
                        <td class="tdwd">
							<label><input type="radio" name="dispatchtype" value="email"/>ई मेल  </label>
						</td>
						<td class="tdwd"> 
							<label><input type="radio" name="dispatchtype" value="post"/>पोस्ट</label>
						</td>
						<td class="tdwd"> 
							<label><input type="radio" name="dispatchtype" value="emailpost"/>ई मेल व पोस्ट</label>
						</td>
						</tr>
                        
                        
					<!-------------------------------- End Of Select Dispatch Method ------------------------------------->
					
					<!------------- if User is Another And Select Email Option -------------------->
						<tr class="email trst">
                        <td class="tdwd">
                            <label>ई मेल  आय. डी. टाका :  </label>
						</td>
						<td class="tdwd">
                           <input type="text" name="emailid" class="input-medium" placeholder="email id"/></span>
                        </td>
						</tr>
						<!------------- if User is Another And Select Post Option -------------------->
						<tr class="address trst">
						<td class="tdwd">
                            <label>पत्ता टाका :  </label>
						</td>
                        <td class="tdwd">
							<textarea cols="30" rows="2" lang="mr" class="span2 unicode" name="add"></textarea>
						</td>
                        </tr>
						
						<!------------- if User is Same And Select Email Option -------------------->
						<tr class="sameemail trst">
                        <td class="tdwd">
                            <label> ई मेल  आय. डी :  </label>
						</td>
                        <td class="tdwd">
						<input type="text" name="sameemailid" class="input-medium" value="<?php echo $rownm['email_id'];?>" placeholder="email id"  />
						</td>
                        </tr>

						
	<!------------- if User is Same And Select Post Option -------------------->
						<tr class="sameaddress trst">
						<td class="tdwd">
                            <label> पत्ता :  </label>
						</td>
						<td class="tdwd">
                            <input type="text" name="sameadd" class="input-medium unicode" lang="mr" value="<?php echo $rownm['address'];?>" readonly />
						</td>
                        </tr>
						
						<!---------------- Fetching Letter Id To Send on Next Page --------------------->
                            <div style="display:none">
								<label >dept_id: </label>
								<input type="text" name="curdeptid"  value="<?php echo $rownm['dept_id'];?>" readonly />
							</div>
							<div style="display:none">
								<label >desk_id: </label>
								<input type="text" name="curdeskid"  value="<?php echo $rownm['desk_id'];?>" readonly />
							</div>
		
						<p style="display:none;">
                            <label>ltr_id : </label>
                            <span class="field"><input type="text" name="ltrid" class="input-medium unicode" lang="mr" value="<?php echo $rownm['ltr_id'];?>" readonly /></span>
                        </p>
						<!-------------- 				upload image ------------------------------------->
						<tr class="par trst">
							<td class="tdwd"><label>कागदपत्र जोडा : </label></td>
							<td>
								<div class="fileupload fileupload-new" data-provides="fileupload">
									<div class="input-append">
										<div class="uneditable-input">
											<i class="iconfa-file fileupload-exists"></i>
											<span class="fileupload-preview"></span>
										</div>
										<span class="btn btn-file"><span class="fileupload-new">कागदपत्र निवडा </span>
										<span class="fileupload-exists">बदल करा</span>
										<input id="upload" type="file" name="uploadedimage" accept="image/jpeg,image/gif,image/png"/></span>
										<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">रद्द करा </a>
									</div>
								</div>
					</td>
						</tr>
						</table>
						<!---------------- End Fetching Letter Id To Send on Next Page -------------------->
						<div>                       
                            <p class="stdformbutton">
                               <center> <button class="btn btn-primary" name="dispatch" onclick="return validateDispatch()">पाठवा</button>
                                <button type="reset" class="btn">रद्द करा </button> </center>
                            </p>
						</div>
					</form>		
                <br/><br/>
			</div>
			</div>
            <?php include_once('footer.php'); ?> 
			
        </div><!--maincontentinner-->
    </div><!--maincontent-->
</div><!--rightpanel-->
</div><!--mainwrapper-->
</body>
</html>