<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start();
$ver = $_SESSION['distributor_user_id'];
$user_role= $_SESSION['user_role']; 
if(!isset($_SESSION["distributor_user_id"])){
   header('location:https://tarkashcorp.appexperts.net/index.php');
}

if(isset($_POST['sub']))
{   
    $customer_name=$_POST['customer_name'];
	$email_address=$_POST['email_address'];
	$cust_pass=$_POST['cust_pass'];
	$customer_phone=$_POST['customer_phone'];
	$customer_address=$_POST['customer_address'];
}

$id=$_GET['id1'];
?>


<!DOCTYPE html>
<html lang="en">
    <head>
      <?php include("link_head.php");?>  
    <!-- END HEAD -->
			<script>
			function myFunction() {
				var txt;
				var r = confirm("Are you sure to cancel!");
				if (r == true) {
					window.location.href="category-detail.php";
				} 
			}
			</script>
	<style>
	::-webkit-scrollbar {
		display: none;
		overflow: hidden;
	}
	</style>
	<script>
	window.onscroll = function () {
	window.scrollTo(0,0);
	}
	</script>		
	</head>
	
    <body class="">
        <!-- BEGIN HEADER -->
		<?php include("header.php");?>
        <!-- END HEADER -->
		
        <!-- BEGIN CONTAINER -->
        <div class="container-fluid">
            <div class="page-content page-content-popup">
                
                <div class="page-sidebar-wrapper">
                    <!-- BEGIN SIDEBAR -->
                    <?php include("menu.php");?> 
				    <!-- END SIDEBAR -->
                </div>
                <div class="page-fixed-main-content">
                        <div class="row">
                            <div class="col-md-12">
                                <!-- BEGIN SAMPLE TABLE PORTLET-->
                                <div class="portlet">
                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-bell-o"></i> Edit Customer Detail Confirmation
										</div>
                                    </div>
									
                                    <div class="portlet-body form" >
                                        <form method="post" name="form1">
                                            <div class="form-body">
											<div class="form-group">										
											<div class="col-md-4">
											 <label>Customer Name</label>
											 <input type="text" value="<?=$customer_name; ?>" class="form-control" placeholder="CUSTOMER NAME" readonly name="customer_name">
											</div>
                                            
											
											<div class="col-md-4">
											<label>Email ID</label>
                                              <input type="text" value="<?=$email_address; ?>" class="form-control" placeholder="Email ID"  name="email_address" readonly>
											</div>

											<div class="col-md-4">
											<label>Password</label>
                                             <input type="text" value="<?=$cust_pass; ?>" class="form-control" name="cust_pass" readonly> 
											</div>
											
											</div>
											<br clear="all"><br>
											
											<div class="form-group">
											
											<div class="col-md-4">
											<label>Phone Number</label>
                                             <input type="text" value="<?=$customer_phone; ?>" class="form-control" readonly placeholder="Phone Number" name="customer_phone">
											</div>											
											
											<div class="col-md-4">
											<label>Address</label>
                                             <input type="text" value="<?=$customer_address; ?>" class="form-control" readonly placeholder="Address" name="customer_address">
											</div>

											</div>
											<br clear="all"><br>
                                            </div>
										
                                            <div class="form-actions">
											<?php if($user_role=="Admin") { ?>
                                                <p>Are you sure to edit category detail!</p> 
											   <button type="submit" name="sub1" class="btn blue">Ok</button>
											   <button type="submit" name="sub11" class="btn blue">Back</button>
												<button type="submit" name="subcancel" class="btn blue" onClick="return confirm('Are you sure to cancel!')">Cancel</button>
											<?php } ?>
                                            </div>
                                        </form>
										
										<?php
										
										if(isset($_POST['sub11']))
										{ 
										$id=$_GET['id1'];
										header("location:edit-customer-detail.php?id=".$id);
										}
										if(isset($_POST['subcancel']))
										{ 
										header("location:customer-master.php");
										}
										if(isset($_POST['sub1']))
										{
											$pid=$_GET['id1'];
											$customer_name=$_POST['customer_name'];
											$email_address=$_POST['email_address'];
											$cust_pass=$_POST['cust_pass'];
											$customer_phone=$_POST['customer_phone'];
											$customer_address=$_POST['customer_address'];
											
											date_default_timezone_set('Asia/Calcutta');
											$cdate  = date("Y-m-d H:i:sa");
					     					$scro=date("Y-m-d");
  											$scri=date('H:i:s');		
											
											$update_customer_detail=mysqli_query($con,"UPDATE tbl_master_customer set customer_name='$customer_name', email_address='$email_address', password='$cust_pass', customer_phone='$customer_phone',customer_address='$customer_address', status='Active', update_datetime='$cdate' where customer_id='$pid'");
											  
											if($update_customer_detail)
											{
											   header("location:customer-master.php");
											}
										
										}
										?>
								    </div>
									
                                </div>
                                <!-- END SAMPLE TABLE PORTLET-->
                            </div>
						</div>
                    </div>
                    <div class="clearfix"></div>
                    <!-- END DASHBOARD STATS 1-->
                    <!-- END PAGE BASE CONTENT -->
                </div>
			<div class="copyright-v2" style="padding:3px; margin-top:-18px;">
		    <?=date("Y")?> &copy; Tarkashcorp Developed By <a target="_blank" href="http://www.belltechnology.in">Bell Technology</a>
			</div>
		    <!-- END CONTAINER -->
            <!-- BEGIN FOOTER -->
			<a href="#index" class="go2top">
                    <i class="icon-arrow-up"></i>
                </a>
                <!-- END FOOTER -->
            </div>
        </div>
        <!-- END CONTAINER -->
        <!-- BEGIN QUICK SIDEBAR -->
        <a href="javascript:;" class="page-quick-sidebar-toggler">
            <i class="icon-login"></i>
        </a>
        
        <!-- END QUICK SIDEBAR -->
        <!-- BEGIN QUICK NAV -->
        
        <div class="quick-nav-overlay"></div>
        <!-- END QUICK NAV -->
        
        <!-- BEGIN CORE PLUGINS -->
        <?php include("link_script.php");?>  
        <!-- END THEME LAYOUT SCRIPTS -->
        <script>
            $(document).ready(function()
            {
                $('#clickmewow').click(function()
                {
                    $('#radio1003').attr('checked', 'checked');
                });
            });
        </script>
    </body>
</html>