<?php include('../config/setup.php');?>
<?php 

if(isset($_POST['offline_edit'])){
    $id = $_POST['offline_id'];
    $mode = $_POST['offline_mode'];
    $status = $_POST['offline_status'];
    $sql = "UPDATE offline_payment_setting SET offline_mode = '$mode',offline_status = '$status' WHERE offline_id = '$id' ";
    if($config->query($sql) === TRUE){
        echo "<script>window.location.href='offline_payment.php'</script>" ;
    }else{
        echo "<script>window.location.href='offline_payment.php?err'</script>" ;
    }
}



if(isset($_POST['Edit_offline_image'])){
    $id = $_POST['offline_image_id'];
    echo $id;
    echo $image;
    $image = $_FILES['offline_image']['name'];
    move_uploaded_file($_FILES['offline_image']['tmp_name'],'../../img/pay/'.$image);
    $sql = "UPDATE offline_payment_setting SET offline_img = '$image' WHERE offline_id = '$id' ";
    if($config->query($sql) === TRUE){
        echo "<script>window.location.href='offline_payment.php?msg'</script>" ;
    }else{
        echo "<script>window.location.href='offline_payment.php?err'</script>" ;
    }
}

if(isset($_POST['Edit_offline_detail'])){
    $id = $_POST['offline_detail_id'];
    $detail = $_POST['offline_detail'];
    // $image = $_FILES['offline_image']['name'];
    // move_uploaded_file($_FILES['offline_image']['tmp_name'],'../../img/pay/'.$image);
    $sql = "UPDATE offline_payment_setting SET offline_details = '$detail' WHERE offline_id = '$id' ";
    if($config->query($sql) === TRUE){
        echo "<script>window.location.href='offline_payment.php?msg'</script>" ;
    }else{
        echo "<script>window.location.href='offline_payment.php?err'</script>" ;
    }
}


?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title><?php 
            
            $leename=mysqli_query($config,"select Name,Name_status from lee_master");
            while($lee=mysqli_fetch_array($leename))
            {
                 $namestatus=$lee[1];
if($namestatus == 1)
{
    echo  $lee[0];
}else{
    echo "Need Name";

}

            }
            
            ?> </title>
	<meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport' />
	<link rel="icon" href="<?php 
            
            $inro_logo=mysqli_query($config,"select Logo_Path,logo_status from lee_master");
            while($logo=mysqli_fetch_array($inro_logo))
            {
                 $logstatus=$logo[1];
if($logstatus == 1)
{
	
	 $ms=substr($logo[0],3);
	 echo "../../img/logo/favicon.ico";
     
}else{
    echo "../../img/logo/no_logo.png";

}

            }
            
            ?>" type="image/x-icon"/>
	
	<!-- Fonts and icons -->
	<script src="../assets/js/plugin/webfont/webfont.min.js"></script>
	<script>
		WebFont.load({
			google: {"families":["Lato:300,400,700,900"]},
			custom: {"families":["Flaticon", "Font Awesome 5 Solid", "Font Awesome 5 Regular", "Font Awesome 5 Brands", "simple-line-icons"], urls: ['../assets/css/fonts.min.css']},
			active: function() {
				sessionStorage.fonts = true;
			}
		});
	</script>

	<!-- CSS Files -->
	<link rel="stylesheet" href="../assets/css/atlantis.min.css">
	<!-- CSS Just for demo purpose, don't include it in your project -->
	<link rel="stylesheet" href="../assets/css/demo.css">
	<script src="../assets/angular/angular.min.js"></script> 
    <script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

    <link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-bs4.min.js"></script>
	<link rel="stylesheet" href="../assets/css/bootstrap.min.css">

</head>
<body>
	<div class="wrapper">
		<div class="main-header">
			<!-- Logo Header -->
	 		<?php include('logo.php');?>
			<!-- End Logo Header -->
			<!-- Navbar Header -->
			<?php include('topbar.php');?>
			 <!-- End Navbar -->
		</div>
		<!-- Sidebar -->
		<?php include('sidebar.php');?>
		
		<div class="main-panel">
			<div class="content">
				<div class="page-inner">
					<div class="page-header">
						<h4 class="page-title">Offline Payment Setting Master</h4> 
					</div>
					<div class="row">
						<div class="col-md-12">
							<div class="card">
								<div class="card-body">
								<!-- <div class="d-flex justify-content-center">-->
								<!--	<button type="button" class="btn btn-success" data-toggle="modal" data-target="#exampleModal">-->
        <!--                            	<i class="fas fa-plus"></i>   Add New-->
								<!--	</button>-->
								<!--</div> -->
									<div class="table-responsive">
										<table id="basic-datatables" class="display table table-striped table-hover" >
											<thead>
												<tr>
													<th>S.No</th>
													<th>Offline Payment Mode</th>
													<th>Icon</th>
													<th>Offline Payment Detail</th>
													<th>Status</th>
													<th>Action</th>
												</tr>
											</thead>
											 
											<tbody>
												<?php 
													$pro=1;
													$pro_photo=mysqli_query($config,"select * from offline_payment_setting");
													while($propt=mysqli_fetch_object($pro_photo))
													{
												?>
												<tr>
													<td><?php echo $pro;?></td>
													<td><?php echo $propt->offline_mode;?></td>
													<td><img src="../../img/pay/<?php echo $propt->offline_img;?>" style="width: 180px;height: 102px; padding: 10px 0;"></td>
													<td><?php echo $propt->offline_details;?></td>
													<td><?php 
															$enablestatus=$propt->offline_status;
															if($enablestatus== 1)
															{ ?>
															<label class="btn btn-success">Active</label>
															<?php														
																}else{
																	?>
																	<label class="btn btn-danger">In-Active</label>
																	<?php
																}
														?>
													</td>
													<td>
														<a href="" class="btn btn-primary" data-toggle="modal" data-target="#<?php echo $pro;?>">
														 	<i class="fas fa-pencil-alt"></i>  
														</a>
														<!-- <a href="Function/slider_delete.php?delproid=<?php #echo $propt->slider_id;?>&delprocat=700" class="btn btn-danger" onclick="return confirm('Are you confirm to delete this Slider?');">
														 	<i class="fas fa-trash"></i>  
														</a> -->
													</td>

<!-- Modal -->
<div class="modal fade" id="<?php echo $pro;?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Edit  </h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
		<?php if($pro){ ?>
	    <form action="offline_payment.php" method="post">
		    <h4>line break use &lt;br&gt; </h4>
			<div class="form-group">
			    <label for="email2">Offline Mode</label>
			    <input type="hidden" class="form-control" id="email2" name="offline_id"  value="<?php echo $propt->offline_id;?>">
			    <input type="text" class="form-control" id="email2" name="offline_mode"  value="<?php echo $propt->offline_mode;?>">
 			</div>
			<div class="form-group">
				<label for="exampleFormControlSelect1">Active Status</label>
				<select class="form-control" id="exampleFormControlSelect1" name="offline_status">
				<?php 

					$cate_enablestatus=$propt->offline_status;
					
					if($cate_enablestatus == 1)
					{ ?>
				
					<option value="1" selected>Active</option>
					<option value="0">In-Active</option>
					<?php }else if($cate_enablestatus == 0){?>

						<option value="1" >Active</option>
					<option value="0" selected>In-Active</option>
					<?php }else{ ?>
					<option value="1" >Active</option>
					<option value="0" >In-Active</option>
					
					
					<?php } ?>
				
				</select>
			</div>			
		    <div class="form-group">
				<button class="btn btn-success" type="submit" name="offline_edit">Submit</button>
 			</div>
		</form>
			<?php }?>
			<div class="modal-body">
			    <form action="offline_payment.php" method="post" enctype="multipart/form-data" >
	        <div class="form-group">
			    <label for="email2">Payment Details</label>
				<input type="hidden" class="form-control" id="email2" name="offline_detail_id"  value="<?php echo $propt->offline_id;?>">
				<textarea type="text"  id="summernote<?php echo $pro; ?>" name="offline_detail"  > <?php echo $propt->offline_details;?></textarea>
				</div>
		    <div class="form-group">
				<button class="btn btn-success" type="submit" name="Edit_offline_detail">Submit</button>
 			</div>
		</form>	
	    <form action="offline_payment.php" method="post" enctype="multipart/form-data" >
    		<div class="d-flex justify-content-center">
    			<h4 class="modal-title" id="exampleModalLabel">Change Image</h4>
    		</div> 
	        <div class="form-group">
			    <label for="email2">Change  Image here (Image size 1920px X 600px )</label>
				<input type="hidden" class="form-control" id="email2" name="offline_image_id"  value="<?php echo $propt->offline_id;?>">
			    <input type="file" class="form-control" id="offline_image" name="offline_image" placeholder="Main CategoryName" >
			</div>
		    <div class="form-group">
				<button class="btn btn-warning" type="submit" name="Edit_offline_image">Submit</button>
 			</div>
		</form>	
	    
			
      </div>
			
      </div>
	  
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
         
      </div>
    </div>
  </div>
</div>
													
													 
												</tr>
											 <script type="text/javascript">
 $('#summernote<?php echo $pro; ?>').summernote({
        placeholder: 'Hello Bootstrap 4',
        tabsize: 2,
        height: 100
      });
        
  </script>
				
											<?php $pro++;} ?>
												
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
	</div>
				</div>
			</div>
			
			<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body" >
	  
        <form action="Function/Add_slider.php " method="post" enctype="multipart/form-data"   >
         
			<div class="form-group">
			    <label for="offline_title">Offline Mode</label>
				<input type="text" class="form-control" id="offline_title" name="offline_title"  value="">

 			</div>
	        <div class="form-group">
    			<label for="offline_image">Icon</label>
    			<input type="file" name="offline_image" id="offline_image"  class="form-control">
			</div>
	 		
		    <div class="form-group">
    			<label for="email2">offline Payment Details</label>
    			<select class="form-control" id="payment_details" name="Add_status">
            		<option value="2">QR-Code</option>
            		<option value="1">UPI</option>
            		<option value="0">Bank Details</option>
		        </select>
		        
    			<input type="hidden" name="Add_slider_display_order"   class="form-control" maxlength="2"  placeholder=" Display Order" pattern="/^-?\d+\.?\d*$/" onKeyPress="if(this.value.length==2) return false;">
    			<input type="hidden" name="Add_slider_display_order"   class="form-control" maxlength="2"  placeholder=" Display Order" pattern="/^-?\d+\.?\d*$/" onKeyPress="if(this.value.length==2) return false;">
			</div>
		
			 <div class="form-group">
        		<label for="exampleFormControlSelect1">Active Status</label>
        		<select class="form-control" id="exampleFormControlSelect1" name="Add_status">
            		<option value="1">Active</option>
            		<option value="0">In-Active</option>
		        </select>
			</div>	
		
		    <div class="form-group">
				<button class="btn btn-success" type="submit" name="offline_add">Add New</button>
 			</div>	 
			
			
			</form>
	
      </div>
      
    </div>
  </div>
</div>
			
			
			
			
			
			
			
			
			
			
			
			
			
		 <?php include('footer.php');?>
		</div>
		
		 
		<!-- End Custom template -->
	</div>
	<!--   Core JS Files   -->
	<script type="text/javascript" src="richtext.js"></script> 
	
 	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
	<script src="../assets/js/core/jquery.3.2.1.min.js"></script>
	<script src="../assets/js/core/popper.min.js"></script>
	<script src="../assets/js/core/bootstrap.min.js"></script>
	<!-- jQuery UI -->
	<script src="../assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
	<script src="../assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>
	
	<!-- jQuery Scrollbar -->
	<script src="../assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
	<!-- Datatables -->
	<script src="../assets/js/plugin/datatables/datatables.min.js"></script>
	<!-- Atlantis JS -->
	<script src="../assets/js/atlantis.min.js"></script>
	<!-- Atlantis DEMO methods, don't include it in your project! -->
	<script src="../assets/js/setting-demo2.js"></script>
	<script >
		$(document).ready(function() {
			$('#basic-datatables').DataTable({
			});

		 
 
			 
		});
	</script>
	<script>
 $(document).ready(function(){
    $('#image_file').on('change',function(){
        $('#upload_form').ajaxForm({           
            target:'#uploaded_images_preview',
            beforeSubmit:function(e){
                $('.file_uploading').show();
            },
            success:function(e){
                $('.file_uploading').hide();
            },
            error:function(e){
            }
        }).submit();
    });
});  </script>
</body>
</html>















