<!DOCTYPE html>
<html lang = "en">
<head>
<?php   include('conn.php');
$page='Customer profile';
include 'common/head_online.php'; ?>
 
</head>



<?php 
if(isset($_POST['submit'])){
 
  $fname=addslashes($_POST['name']);
   $number=$_POST['number'];
   $location=$_POST['address'];
   $cu_id=$_POST['customer_id'];
  


 


        // Image db insert sql
  $sql1 = "UPDATE `customers` SET `fname`='$fname',`number`='$number',`location`='$location' WHERE customer_id='$cu_id'";
  if(mysqli_query($conn,$sql1)){

    echo"<script>alert('Details updated');window.location.href='online_profile'</script>";

  }
  else{
    echo 'Error: '.mysqli_error($conn);
  }

}
?>

<body>
<div  class="container p-0 ">
<!---side nav bar end-->
<?php include("common/tittle_online.php")?>
            <!--Nav menu end-->
            <?php include("common/cat.php")?>
<!-- Ads Start -->




 <!-- Ads End -->


 <div class="card container m-0">
        <div class="row py-2">

        <div class="col-sm-6">

        
            <div class="pro bg-light text-center">
            <h4 class="p-2 text-uppercase"><?php echo $fname?></h4>
            <div class="d">
                <button class="m-1  btn btn-outline-secondary"><i class="fa fa-phone-square" ></i> <?php echo $number?></button>

                <button class="m-1 btn btn-outline-secondary"><i class="fa fa-map-marker" ></i> <?php echo $address?></button>
            </div>
          
            </div>
        </div>
            <div class="col-sm-6">
            <div class="summary bg-light rounded-2">
                <h4 class="p-2">Edit Profile</h4>
              <div class="form">
                <form method="post">
                  <div class="row">
                  <div class="col-sm-6">
    <label class="m-1"for="number">User Name:</label>
                <div class=" d-flex col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-person text-success"></i></span>
                    <input  type="text" class="form-control "value="<?php echo $fname?>" aria-label="fname" name="name" aria-describedby="addon-wrapping">
                    <input type="hidden" name="customer_id" value="<?php echo $cus_id?>">
                  </div>
    </div>

    <div class="col-sm-6">
    <label class="m-1"for="number">Contact:</label>
                <div class="d-flex col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-telephone"></i></span>
                    <input  type="text" class="form-control "value="<?php echo $number?>" aria-label="fname" name="number" aria-describedby="addon-wrapping">
                  </div>
    </div>

    <div class="col-sm-12">
    <label class="m-1"for="number">Address:</label>
                <div class="d-flex col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-geo-alt"></i></span>
                    <input  type="text" class="form-control "value="<?php echo $address?>" aria-label="fname" name="address" aria-describedby="addon-wrapping">
                  </div>

                  <button  name="submit" style="background-color:#982BAD;" id="payBtn"  class="btn   text-white my-2">Submit</button>     
    </div>
   
                  </div>
                </form>
              </div>
                
                
            </div>

            </div>
          
        </div>
    </div>

 
<!-- Ads Start -->

<div class="container-fluid py-0 mb-4 wow fadeInUp" data-wow-delay="0.1s">
        <div class="container py-0">
            <div class="row">

            <div class="  wow col-sm-12 text-center fadeInUp" data-wow-delay="0.6s">
              <a href="#">
                <div class="ads-item  my-0">
                <img class="img-fluid" src="logo/restaurant_delivery.jpg" alt="banner">
                
                </div>
             </a>

            </div>
            </div>
           
        </div>
    </div>
<!---ads end--->

<!--item added to added to cart notification--->
<div class="bg-success text-white rounded  w-25" id="popUp" style="display: none;"> Item added to cart <i class="fa fa-check-square-o" aria-hidden="true"></i></div>
<!--item added to added to cart notification end--->
    <div class="pad p-4">

    </div>
 <!-- Ads End -->
 <?php include('online_button_nav.php')?>

</div>




<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>
<script src="js/script.js"></script>
    <!-- JavaScript Libraries -->
    <script src="lib/owlcarousel/owl.carousel.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() { /// Wait till page is loaded
setInterval(timingLoad, 3000);
function timingLoad() {
$('#main').load('property-detailed.php #main', function() {
/// can add another function here
});
}
}); //// End of Wait till page is loaded
</script>
<script>


   $(document).ready(function(){
setInterval(function(){
      $(".refreeshmes").load(window.location.href + " .refreeshmes" );
}, 3000);
});

 function reply_click(obj)
  {

    var id = obj.id;
    document.getElementById(id).style.visibility = "hidden";
      $( "#popUp" ).show(); 
   setTimeout(function() {
      $( "#popUp" ).hide();
      $( id ).hide();
    }, 2000);
  }






// quick search regex
var qsRegex;
var buttonFilter;

// init Isotope
var $grid = $('.grid').isotope({
  itemSelector: '.element-item',
  layoutMode: 'fitRows',
  filter: function() {
    var $this = $(this);
    var searchResult = qsRegex ? $this.text().match( qsRegex ) : true;
    var buttonResult = buttonFilter ? $this.is( buttonFilter ) : true;
    return searchResult && buttonResult;
  }
});

$('#filters').on( 'click', 'button', function() {
  buttonFilter = $( this ).attr('data-filter');
  $grid.isotope();
});

// use value of search field to filter
var $quicksearch = $('#quicksearch').keyup( debounce( function() {
  qsRegex = new RegExp( $quicksearch.val(), 'gi' );
  $grid.isotope();
}) );


  // change is-checked class on buttons
$('.button-group').each( function( i, buttonGroup ) {
  var $buttonGroup = $( buttonGroup );
  $buttonGroup.on( 'click', 'button', function() {
    $buttonGroup.find('.is-checked').removeClass('is-checked');
    $( this ).addClass('is-checked');
  });
});
  

// debounce so filtering doesn't happen every millisecond
function debounce( fn, threshold ) {
  var timeout;
  threshold = threshold || 100;
  return function debounced() {
    clearTimeout( timeout );
    var args = arguments;
    var _this = this;
    function delayed() {
      fn.apply( _this, args );
    }
    timeout = setTimeout( delayed, threshold );
  };
}




</script>
</body>
</html>
