<?php include('header.php');?>

<!-- start main -->
<section class="inner-section single-banner">
	<div class="container">
		<h2>my profile</h2>
		<ol class="breadcrumb">
			<li class="breadcrumb-item"><a href="index.php">Home</a></li>
			<li class="breadcrumb-item active" aria-current="page">profile</li>
		</ol>
	</div>
</section>
<section class="inner-section profile-part">
	<div class="container">
		<div class="row">
               <div class="col-lg-10 mx-auto">
                  <div class="row no-gutters">
                     <div class="col-md-4">
                        <div class="card account-left mb-2 bg-me2">
                           <div class="user-profile-header">
                               <div class="profile-pic-img"> 
                            <form action="<?=base_url('profile/edit_profile_img');?>" enctype="multipart/form-data" method="POST">
                                <br>
                                <?php if(empty($customer['cust_image'])){?>
                            <img id="blah" src="<?=base_url('uploads/website/customer/user.png');?>" alt="your image" class="brround">
                            <?php }else{
                                ?>
                                <img id="blah" src="<?=base_url('uploads/website/customer/'.$customer['cust_image']);?>" alt="your image" class="brround">
                                <?php
                            }
                            ?>
                            <i class="fa fa-camera pencile"></i>
                            <input class="input-op0" type="file" title=" " name="photo" accept="image/gif, image/jpeg, image/png" onchange="readURL(this);">
                            <input type="hidden" name="url">
                            </form>
                            </div>
                              <h5 class="mb-1"><strong>Hi </strong> <?php echo $customer['cust_name']; ?></h5>
                              <p class="text-white"><?php echo '+91 '.$customer['cust_phone']; ?></p>
                           </div>
                           <div class="list-group">
                              <a href="<?=base_url('profile/');?>" class="list-group-item list-group-item-action active"><i aria-hidden="true" class="fa fa-user"></i>  My Profile</a>
                              <a href="<?=base_url('orderlist');?>" class="list-group-item list-group-item-action "><i aria-hidden="true" class="fa fa-list"></i>  Order List</a> 
                              <a href="<?=base_url('profile/customer_password_update');?>" class="list-group-item list-group-item-action"><i aria-hidden="true" class="fa fa-key"></i>  Password Update</a> 
                              <a href="<?=base_url('login/logout');?>" class="list-group-item list-group-item-action"><i aria-hidden="true" class="fa fa-lock"></i>  Logout</a> 
                           </div>
                        </div>
                     </div>
                     
                     <div class="col-md-8">
                         <div class="user-form-card">
                             <div class="user-form-title">
                                <h2> My Profile </h2>
                                <p>Make sure your profile is updated.</p>
                             </div>
                              <form action="<?=base_url('profile/edit_profile');?>" class="user-form" method="post">
                                 <div class="row">
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">First Name <span class="required">*</span></label>
                                         <input type="text" class="form-control border-form-control" name="cust_name" value="<?php echo $customer['cust_name']; ?>">
                            
									  </div>
                                    </div>
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">Email Address <span class="required">*</span></label>
                                       <input type="email" class="form-control border-form-control" name="" value="<?php echo $customer['cust_email']; ?>" >
                            
									  </div>
                                    </div>
                                
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">Phone <span class="required">*</span></label>
                                         <input type="number" class="form-control border-form-control" name="cust_phone" value="<?php echo $customer['cust_phone']; ?>">
                           
									  </div>
                                    </div>
                                    
                               
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">State <span class="required">*</span></label>
										  
										    <select onchange="getdt()" id="statef" name="cust_state" class="form-control border-form-control">
                                                <option value="">Select State</option>
                                                <?php  
                                                $statement9 = $this->db->query("SELECT * FROM tbl_state");
                                                $result9 = $statement9->result_array();                            
                                                foreach ($result9 as $row) {
                                                ?>
                                                <option value="<?php echo $row['id']; ?>" <?php if($row['id'] == $customer['cust_state']) {echo 'selected';} ?>><?php echo $row['state']; ?></option>   
                                                <?php }
                                                ?> 
                                            </select>  
                                       </div>
                                    </div>
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">City <span class="required">*</span></label>
                                          <select name="cust_city" id="distgg" class="form-control border-form-control" value="<?php if(isset($_SESSION['cust_city'])){echo $_SESSION['cust_city'];} ?>">
                                                <option value="">Select City</option>
                                                <?php  
                                                if(isset($customer['cust_state']) && !empty($customer['cust_state'])){
                                                $state1 = $customer['cust_state'];
                                                $statement91 = $this->db->query("select * from tbl_district where state = $state1");
                                                $result91 = $statement91->result_array();                            
                                                foreach ($result91 as $row) {
                                                ?>
                                                <option value="<?php echo $row['id']; ?>" <?php if($row['id'] == $customer['cust_city']) {echo 'selected';} ?>><?php echo $row['district']; ?></option>   
                                                <?php }
                                                }
                                                ?>
                                    </select> 
                                       </div>
                                    </div>
                                
                                    <div class="col-sm-6 col-12">
                                       <div class="form-group">
                                          <label class="control-label">Zip Code <span class="required">*</span></label>
                                        <input type="text" class="form-control border-form-control" name="cust_zip" value="<?php echo $customer['cust_zip']; ?>">
                           
									  </div>
                                    </div>
                                   
                                 </div>
                                 <!--<div class="row">
                                    <div class="col-sm-12">
                                       <div class="form-group">
                                          <label class="control-label">Address <span class="required">*</span></label>
										       <textarea name="cust_address" class="form-control border-form-control" cols="30" rows="10" style="height:70px;"><?php echo $customer['cust_address']; ?></textarea>
                           
                                       </div>
                                    </div>
                                 </div>-->
                                 <div class="row">
                                    <div class="col-sm-12 text-right">
                                        <div class="form-button"><button type="submit" name="form1">Save Changes</button></div>
                                    </div>
                                 </div>
                              </form>
                         </div>
                     </div>
                     
                  </div>
               </div>
            </div>
         </div>
      </section>
      
      
	<script>  
	 function getdt(){
    var state  =$("#statef").val();
   

        $.ajax({
                url:"<?=base_url('profile/get_district');?>",
                 type:"POST",
                 data:{state:state},
                // dataType: 'json',
                 success:function(data)
                 {
           $("#distgg").html(data);
                 }
                     
                 })

	 }      
</script> 
     <?php require('footer.php');?>