<!doctype html>
<html lang="en" translate="no" class="w-[640px] mx-auto md:w-full">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Transfer</title>
      <?php echo view('user/layout/head');?>
   </head>
   <style>
      .password-toggle-icon2 
         {
         position: absolute;
         top: 78%;
         right: 10px;
         color:#fff;
         transform: translateY(-50%);
         cursor: pointer;
         background:orange;
         border-radius:20px;
         }
         .btn { margin:5px;}
         label { font-size:13px; color:#fff !important; margin-bottom:10px;}

      .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;
         }
   </style>

   <body class="reg-overflow">
      <section class=" dash-banner-bg banner-bg referral profile">
         <div class="container">
         <!---header start---->
         <?php echo view('user/layout/header');?>
         <!---header end---->
         <!---banner start---->

         <div class="row">
               <div class="col-lg-12">
                  <div class="dash-wrap">
                     <div class="title text-center py-1">
                        <div class="row">
                            <div class="col-lg-2 ">
                            <a href="<?php echo base_url();?>/tradesettings/<?php echo $symbol;?>"  class="btn btn-primary" style="border-radius:20px">back</a>
                            </div>
                            <div class="col-lg-10">
                            <h2 class="text-primary">Margin Configuration</h2>
                            </div>
                        </div>
                     </div>

                     <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');
                     $this->form_validation =  \Config\Services::validation();
                     $list = \Config\Services::validation()->listErrors();
                     
                     helper('form_helper');
                     //echo view('user/common_header');
                     $us_data = userMinPass();
                     ?>
                     <div class="col-lg-12">
                    
                    
                <form action="<?php echo base_url();?>/margin-update" method="post" id="margin_validate" >              
                                 
                <div class="row mt-4">
                    <div class="col-sm-6">
                        <div class="form-block position-relative login-ico">
                            <label>Margin Call drop</label>
                            <hr>
                            <label id="ex_demo1"></label>
                        </div>
                    </div>

                    <!-- <div class="col-sm-6">
                        <div class="form-block position-relative login-ico">
                            <label>Multiply Buy in ratio</label>
                            <hr>
                            <span id="ex_demo2"></span>
                        </div>
                    </div>

                    <div class="col-sm-4">
                        <div class="form-block position-relative login-ico">
                            <label>Distributed and take profit Allocation</label>
                            <hr>
                              <span id="ex_demo"></span>
                        </div>
                    </div> -->
                </div>


                <input type="hidden" value="<?php echo $num;?>" name="magin_col_limit">
                <input type="hidden" value="<?php echo $symbol;?>" name="pair">
                
                <div align="center">
                         
                     <button type="button" id="submit_button" class="btn btn-primary" name="sub" value="sub">Submit</button>
               </div>

                  

                                
         
                  
                  
                  
                  
               </div>

               </form>

            </div>
         </div>
      </section>
      <?php echo view('user/layout/footer');?>
      <?php echo view('user/layout/footer-script');?>

      <script src="<?php echo base_url();?>/styles/new_style/js/notify.js"></script>
      
      <script>
          $(window).on('load', function () 
         {
           var num= "<?php if(!empty($num)) { echo $num; } else echo "";?>";
           if(num =="")
           num = 7;
         
           $.ajax({
           type: 'post',
           dataType:'html',
           url : '<?php echo base_url("/replenishment_time1");?>',
           data : {'number1':num,'pair':'<?php echo $symbol;?>'},
           headers: {'X-Requested-With': 'XMLHttpRequest'},
           success : function(msg)
           {
           if(msg)
           {
           $('#ex_demo1').html(msg);
           }
           }
           });
         
           $.ajax({
           type: 'post',
           dataType:'html',
           url : '<?php echo base_url("/replenishment_time2");?>',
           data : {'number2':num,'pair':'<?php echo $symbol;?>'},
           headers: {'X-Requested-With': 'XMLHttpRequest'},
           success : function(msg)
           {
           if(msg)
           {
           $('#ex_demo2').html(msg);
           }
           }
           });
         
           $.ajax({
           type: 'post',
           dataType:'html',
           url : '<?php echo base_url("/replenishment_time");?>',
           data : {'number':num,'pair':'<?php echo $symbol;?>'},
           headers: {'X-Requested-With': 'XMLHttpRequest'},
           success : function(msg)
           {
           if(msg)
           {
           $('#ex_demo').html(msg);
           }
           }
           });
         
         });

         $('#submit_button').click(function(){
          
         var empty = true;
         var flag = 1;
         $('#margin_validate input[type="text"]').each(function() {
          if ($(this).val() == '') {
         $flag = 0;
         empty = false;
         }
         });
         
         if(empty == false){
         $.notify(' <i class="fas fa-exclamation-triangle"></i> Some fields are empty', 'danger');
         }
         
           if(flag == 1 && empty == true){
             $('#margin_validate').submit();
             $.notify('<i class="fas fa-check"></i>  Set Successfully', 'success');
           }
             
         }); 

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