<!doctype html>
<html lang="en"  class="w-[640px]">
   <head>
   <?php echo view('user/layout/head');?>
   </head>
   <style>
      .notify {
      position: fixed;
      top: 10px;
      left: 10px;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      width: 350px;
      font-size: 14px;
      text-align: center;
      }
      /* Positions
      ========================================================================== */
      .notify-top-right,
      .notify-bottom-right {
      left: auto;
      right: 10px;
      }
      .notify-top-center,
      .notify-bottom-center {
      left: 50%;
      margin-left: -175px;
      }
      .notify-bottom-left,
      .notify-bottom-right,
      .notify-bottom-center {
      top: auto;
      bottom: 10px;
      }
      .notify button {
      -webkit-appearance: none;
      padding: 0;
      cursor: pointer;
      background: 0 0;
      border: 0;
      display: none;
      }
      /* Responsiveness
      ========================================================================== */
      /* Phones portrait and smaller */
      @media (max-width: 479px) {
      /*
      * Fit in small screen
      */
      .notify {
      left: 10px;
      right: 10px;
      width: auto;
      margin: 0;
      }
      }
      /* Sub-object: `notify-message`
      ========================================================================== */
      .notify-message {
      position: relative;
      cursor: pointer;
      }
      .notify .alert-default {
      background: #fff;
      border: 1px solid #e5e5e5;
      }
      .test
      {
      margin-left : 35px;
      }
   </style>
   <body class="section-overflow">
      <section class="banner-bg bg-grade1 position-relative">
         <ul class="added-banner-images list-unstyled mb-0">
            <li><img src="images/banner-number.png" alt=""></li>
            <li><img src="images/banner-trade.png" alt=""></li>
            <li><img src="images/banner-curve.png" alt=""></li>
            <li><img src="images/banner-statistics.png" alt=""></li>
         </ul>
         <!-- common-header start-->
         <div class="container">
         <?php echo view('user/layout/header');?>
            <!-- common-header end-->
         </div>
         <!-- wrapper-content start -->
         <section class="dash-wrap form-wrap">
            <div class="container">
               <div class="form-page">
                  <div class="row">

                  <?php 
                  use App\Libraries\MyEncrypt;
                  use App\Helpers\site_helper;
                  use App\Helpers\form_helper;
                  $this->db = db_connect();
                  $this->session = session();
                  $this->common_model = model('CommonModel');
                  helper('form_helper');
                  
                  $uusersid = $this->session->get('uusersid');
                  $user=$this->db->query("SELECT * FROM uusers WHERE uusersid='".$uusersid."'")->getRow();
                  
                   $country = $this->db->query("SELECT * FROM country WHERE iso_2='".$user->country."'")->getRow();

                  ?>

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

                     <form action="" method="post" id="edit-profile" >
                        
                        <div class="mb-2 form-block ">
                        
                           <input name="image" class="form-control" type="file" id="imageInput"/>

                        </div>

                        <div class="col-lg-4">
                           <button type="submit" class="btn btn-primary">Edit</button>
                        </div>
                      
                     </form>

                        <div class="mb-2 form-block ">
                           <label for="" class="form-label  text-white">Username</label>
                           <input name="username" class="form-control" type="text" id="username"  value="<?php echo $user->username;?>" readonly/>
                        </div>

                        <div class="mb-2 form-block ">
                           <label for="" class="form-label  text-white">Email</label>
                           <input name="email" class="form-control " type="text" id="email"  value="<?php echo $user->email;?>" readonly/>
                        </div>

                        <div class="mb-2 form-block ">
                           <label for="" class="form-label  text-white">Location</label>
                           <input name="location" class="form-control" type="text" id="location"  value="<?php isset($country->Country) ? $country->Country : '-';?>" readonly/>
                        </div>



                        <div class=" form-block position-relative mb-3 mt-3">
                           <label for="" class="form-label text-white">Pricing method  </label>
                           <select class="form-control ps-2 form-arrow" name="pricing_method">
                           <option value="USD" selected>USD</option>
                             
                           </select>
                        </div>

                        <div class=" form-block position-relative mb-3 mt-3">
                           <label for="" class="form-label text-white">Language</label>
                           <select class="form-control ps-2 form-arrow" name="lang">
                           <option value="USD" selected>English</option>
                             
                           </select>
                        </div>

                       
                       
                        
                     </div>
                  </div>
               </div>
            </div>
            </div>
         </section>
         <!-- wrapper-content end-->
         <?php echo view('user/layout/footer');?>
      </section>
     
      <?php echo view('user/layout/footer-script');?>
      <script src="<?php echo base_url()?>/styles/new_style/js/notify.js"></script>
      <script>
         AOS.init({
         });
      </script>
         <script>
         $(document).ready(function(){
         
         
            
         $('#edit-profile').submit(function(event) {
         event.preventDefault(); // Prevent the form from submitting normally
         
         var form = new FormData(this);
         $.ajax({
         url: '<?php echo base_url();?>/profile_update', 
         type: 'POST',
         data: form,
         processData: false,
         contentType: false,
         success: function(response) {
         
         if(response == '1')
         {
         
         $.notify(' <i class="fas fa-circle-check"></i>&nbsp;&nbsp;  Profile image updated successfully. ', 'success');
         
         }
         else if(response == '2')
         {
         $.notify(' <i class="fas fa-exclamation-triangle"></i>&nbsp;&nbsp; Please select profile image first. ', 'danger'); 
         }
         else
         {
         $.notify(' <i class="fas fa-exclamation-triangle"></i>&nbsp;&nbsp; Profile image updated failed. ', 'danger');
         }
         }
         
         });
         });
         
         });
         
         
      </script>
   </body>
</html>
