<?php
	include'session.php';
	include'connection.php';
	include'../Retailers/functions.php';
?>
<html>
<head>
	<title>Update Recharge</title>
	<!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
	<link rel="icon" href="images/logo.png" type="image/gif" sizes="16x16">
	
	<!-- Admin CSS File Link -->
	<link rel="stylesheet" href="css/style.css">
	
	<!-- User JAVA SCRIPT File Link -->
	<script type="text/javascript" src="js/script.js"></script>

	
	<!-- Font Awesome Icone -->
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	
	<style>
		.div1{
			background:;
			width:98%;
			margin:1%;
			padding:10px;
			overflow:auto;
		}
		.div1 input, .div1 select{
			height:35px;
			width:auto;
			font-size:15px;
			padding:4px 8px;
			border-radius:5px;
			border:solid #6b5127 1px;
			overflow:hidden;
			margin:0px;
		}
		input[type=submit]{
			background:#6b5127;
			color:white;
			transition:1s;
			cursor:pointer;
			float:right;
			width:150px;
			margin-right:100px;
		}
		input[type=checkbox]{
			width:150px;
		}
		input[type=submit]:hover{
			background:white;
			color:#6b5127;
			transition:1s;
		}
		.div1 table{
			width:96%;
			text-align:center;
			font-size:15px;
			border-collapse:collapse;
			padding:2px 10px;
			margin:2%;
		}
		table th{
			background:#6b5127;
			color:white;
			height:40px;
			border:solid white 1px;
			padding:2px 5px;
		}
		table td{
			background:white;
			height:50;
			border:solid black 1px;
			padding:5px 8px;
		}
		
		@media(max-width:768px)
		{
			.div1{
				background:;
				width:100%;
				height:auto;
				margin:10px 0 0 0;
				padding:0;
				text-align:center;
			}
			.div1 input, .div1 select{
				width:90%;
				margin:10px;
			}
			.div2{
				width:100%;
				margin:10px 0 0 0;
				padding:0px;
				text-align:center;
			}
		}
		#inpRef{display:none;}

	</style>
	
	<link rel="stylesheet" href="css/mediaStyle.css">
</head>
<body>
	<!--Header Divison-->
	<?php
		require'header.php';
	?>
	
	<!--Container Division-->
	<div class="container">
		<?php
			include'menu.php';
		?>
		<div class="content">
			<div class="head">
				<div class="title"><p>Update Recharge :-</p></div>
				<div class="msg"><marquee><?php include'msg.php'; ?></marquee></msg>
			</div><hr>
			<div class="data-content">
			    <script>
			        function response()
			        {
			            var rType = document.getElementById("responType").value;
			            
			            if(rType=="Transaction Successful, Contact Costumer Care With Reference Id")
			            {
			                document.getElementById("inpRef").style.display = "inline";
			            }
			            else
			            {
			                document.getElementById("inpRef").style.display = "none";
			            }
			        }
			    </script>
				<div class="div1">
<?PHP
	$rechId=$_GET['rechId'];
	
	    $query="SELECT * FROM recharge WHERE Id=$rechId";
	    $result=mysqli_query($con,$query);
	    $data=mysqli_fetch_array($result);
	    $operId=$data['Operatorid'];
	    $LapuNo=$data['LapuNo'];
	    $ApiBal=$data['ApiBal'];
	    $ApiDiff=$data['Diff'];
	    
	
	if(isset($_POST['submit']))
	{
	    $status=$_POST['status'];
	    $opId=$_POST['opId'];
	    $lapuNo=$_POST['lapuNo'];
	    $lapuBal=$_POST['lapuBal'];
	    $lapuDiff=$_POST['lapuDiff'];
	    
    	
	    $query4="UPDATE recharge SET Operatorid='$opId', ReHit='0', Status='$status', LapuNo='$lapuNo', ApiBal='$lapuBal', Diff='$lapuDiff' WHERE Id='$rechId' ";
		if(mysqli_query($con, $query4))
		{
		
		    echo "<div class='msg-div'>
				    <form method='post'>
					    <h3>Status Updated Successfully !</h3><br>
						<i class='fa fa-check-circle' aria-hidden='true' id='okIcon'></i><br><br>
						<a href='pending_recharge.php' class='btnPopup'>OK</a><br><br>
					</form>
				</div>";
	    }
	}						    
?>	
				    <form method="post">
					    <table cellpadding="20" border="2"> 
		    				<tr>
		    				    <th>Status</th>
		    				    <th>Operator Id</th>
		    				    <th>Lapu No.</th>
		    				    <th>Api Bal</th>
		    				    <th>Api Diff</th>
    						</tr>
                            <tr>
                                <td>
                                    <select name="status">
                                        <option>SUCCESS</option>
                                        <option>FAILED</option>
                                        <option>PENDING</option>
                                    </select>
                                </td>
                                <td><input type="text" Value="<?php echo $operId; ?>" name="opId"></td>
                                <td><input type="text" Value="<?php echo $LapuNo; ?>" name="lapuNo"></td>
                                <td><input type="text" Value="<?php echo $ApiBal; ?>" name="lapuBal"></td>
                                <td><input type="text" Value="<?php echo $ApiDiff; ?>" name="lapuDiff"></td>
			    		</table>
				    	<input type='submit' Value="Update Status" name='submit'>
					</form>
				</div>
			</div>
		</div>
	</div>
	<?php
		require'footer.php';
	?>
</body>
</html>