<?php $profile = $this->common->getsData("user",array("profileid"=>$this->profileid),'user_photo,name'); ?>
<div class="order-detail mb-5 mb-md-0">
    <form method="post" action="<?php echo base_url("profile/updateProfilePhoto"); ?>" id="profileForm1" enctype="multipart/form-data">
        <input type="hidden" name="name" value="<?php echo $profile['name']; ?>">
        <div class="user-img form-group text-center">
            <?php if($profile['user_photo']!=''){ ?>
                <img src="<?php echo base_url($profile['user_photo']); ?>" alt="user image">
            <?php }else{ ?>
                <img src="<?php echo base_url(); ?>assets/ecommerce/img/profile-user.png" alt="user image">
            <?php } ?> 
            <button type="button" onclick="chooseFile();"><i class="fa fa-edit"></i></button>
            <input type="file" accept="image" id="fileInput" name="user_photo" class="form-control">
        </div>
    </form>
   <div class="profile-link">
        <ul class="list-unstyled">
            <li><a href="<?php echo base_url("user-profile"); ?>" class="<?php echo($active==1)?'active':''; ?>"><img src="<?php echo base_url(); ?>assets/ecommerce/img/user.webp" alt="user icon" class="me-3"> PROFILE</a></li>
            <li><a href="<?php echo base_url("all-orders"); ?>" class="<?php echo($active==2)?'active':''; ?>"><img src="<?php echo base_url(); ?>assets/ecommerce/img/cart.webp" alt="cart icon" class="me-3" width="20"> ORDERS</a></li>
            <!-- <li><a href="user-rewards.html"><img src="<?php //echo base_url(); ?>assets/ecommerce/img/rewards.webp" alt="reward icon" class="me-3" width="20"> REWARDS</a></li> -->
        </ul>
   </div>
    <div class="other-links mt-3">
       <ul class="list-unstyled">
            <li><a href="<?php echo base_url("user-edit-profile"); ?>" class="<?php echo($active==4)?'active':''; ?>">Edit Profile</a></li>
            <li><a href="<?php echo base_url('user-change-password'); ?>" class="<?php echo($active==5)?'active':''; ?>">Change Password</a></li>
            <li><a href="<?php echo base_url('logout'); ?>">Logout</a></li>
       </ul>
    </div>
</div>
<script>
   function chooseFile() {
      $("#fileInput").click();
   }
   $('#fileInput').on('change', function () {
       $('#profileForm1').submit();
   });
</script> 