<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<?php 
$validation =  \Config\Services::validation();
use App\Libraries\MyEncrypt;

$this->db = db_connect();
$session= \Config\Services::session();
$uusersid = $session->get('uusersid');
echo view('user/common_style1');?>
</head>
<body>
<?php echo view('user/common_header');
$user_strategy = $this->db->query("SELECT * from user_strategy where strategy_id = '".$trade->id."' and uusersid = '".$uusersid."'")->getRow();






?>
 
<link rel="stylesheet" href="<?php echo base_url();?>/styles/fonts/Socialico/stylesheet.css">
<link rel="stylesheet" href="<?php echo base_url();?>/styles/css/set1.css">
<script type="text/javascript" src="<?php echo base_url('/assets/js/core/libraries/bootstrap.min.js')?>"></script>
<script src="<?php echo base_url();?>/styles/js/modernizr.js"></script>
 <style>
  .contact_one .contact_left_content form input[type="text"]{border:0px;}
  .prfledit label, .prfledit label {
  padding-top: 10px;
}

.help-block {
    color: #eb5055;
    margin: 0em 0em 0em !important;
}
p.frgtpwd {
text-transform: none;
}
.profilesub ul li label{
display: inline;
color: #eb5055;
}
.h6
{
  font-size: 17px;
}
.preca-bg {
    padding: 20px 10px 10px 20px;
}
.mont
{
    font-size: 15px;
}
.mont1
{
    font-size: 13px;
}
h6.mont1
{
    font-size: 12px;
}

</style>

        

</head>
  <body>
      <?php
        $currency_info = defaultcurrency();

    $session= \Config\Services::session();
 $uusersid=SESSION('uusersid');
      ?>

 <?php 
       $session = \Config\Services::session();

        if($session->getFlashData('success_message')) 
        {
           $success = 1;
       } 
        elseif ($session->getFlashData('error_message')) 
          {
            $success = "2";

          } 
           else {
               $success = "";
            }
?>          
<section class="trading-bg">
  <div class="container-fluid">
    
    <div class="row">
      <div class="">
        <div class="trading_pairbg bg-white inner-box mt-3 px-3 py-4">
          <div class="inner-title pb-3">
        <center>
        <h5 style="margin-top: 30px;"><i class="far fa-compass"></i> <b><?php echo "MYCIRCLE INFORMATION :";?></b></h5>
     
        <br>
</center>
      <div class="container col-lg-8" style="border:3px solid ; ">
        <div class="col-lg-8 offset-lg-1"> 
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist"  style="padding-top:40px;font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Strategy Name :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->stratgy?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>

        <br>

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Profit :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->profit?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>

        <br>
<!-- 
        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Admin Fees :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->admin_fee?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>

        <br>
 -->
       <!--  <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Duration :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->duration?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>

        <br> -->

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Description :";?></b></h6>
                </li>
                <li class="col-lg-6">
                 <span><?php echo $trade->description?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>

        <br>

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Address :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->address?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      <br>
      
        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Amount :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->amount?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
      <br>       

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "First Buyin Amount :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->first_buy_amount?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
        <br>

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Open Position Doubled :";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->open_position_doubled?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
        

         <br>       

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Margin Column Limit:";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->margin_column_limit?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
        <br>

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Whole position take Profit Ratio:";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->whole_profit_ratio?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
        <br>


        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Whole position take Profit Callback:";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->whole_profit_callback?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      
        <br>

        <div class="col-lg-8 offset-lg-1">
          <div class="pair-tab">
            <div class="trading-tab">
              <ul class="nav nav-pills " id="pills-tab" role="tablist" style="padding-bottom:40px;font-size: 15px;">
                <li class="nav-item col-lg-6" role="presentation">
                  <h6 class="mont"><b><?php echo "Buy In Callback:";?></b></h6>
                </li>
                <li class="col-lg-6">
                  <span><?php echo $trade->buyin_callback?></span>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
       </div> 

         <br>  

  <form class="modal fade" id="exampleModal1" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" method="post" action="<?php echo base_url().'/mycircle/strategy_table/'.$trade->id;?>" enctype="multipart/form-data">

  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Transaction Setting</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">


<div class="row">

    <h6 class="span">Trading Pair</h6>

    <div id="bg_color" class="col-lg-6">
    <select id="userlist" class="form-select" name="active_list"  style="width:100%;" placeholder="To select users">

    <option value="" required>--select--</option>
    <?php
    $session= \Config\Services::session();
    $uusersid=SESSION('uusersid');
    $this->db = db_connect();
    $get_active = $this->db->query("SELECT * from trade_process where  trade_status='0' or trade_status='1' and uusersid='".$uusersid."' ")->getResult();
    foreach ($get_active as $keys) 
    {
    ?>

    <option value="<?php echo $keys->pair;?>"> <?php echo $keys->pair;?></option>

    <?php
    }
    ?>

    </select>
    </div>
   </div>
    <br>
    <br>

        <div class="row">

  

          <div class="col-lg-3">
            <div class="modal-form mb-4">
              <label class="">First order amount</label>
              <input type="hidden" name="id" id="id" value="<?php echo $trade->id;?>">
              <input type="text" class="form-control mt-1" placeholder="3" name="fbm" value="<?php echo $trade->first_buy_amount?>" disabled>
            </div>
            <?php
                $on='ON';
                 $off='OFF';
            ?>
             <div class="modal-form mb-4">
              <label class="">Double open position</label>
            <div class="form-check form-switch form-switch-lg mb-3" dir="ltr">
            <input type="checkbox" class="form-check-input" data-on-text="<?php echo $on;?>" data-off-text="<?php echo $off; ?>" data-on-color="primary" data-off-color="default" name="open_position_doubled"<?php if($trade->open_position_doubled==='on'){ echo 'checked="checked"'; }   ?> disabled>
            </div>
            </div>
            <div class="modal-form mb-4">
              <label class="">Replenishment times</label>
              <input type="text" class="form-control mt-1" id="replenishment_time" name="replenishment_time" placeholder="7" value="<?php echo $trade->margin_column_limit?>" disabled>
            </div>
            <div class="modal-form mb-4">
              <label class="">Whole position take profit ratio</label>
              <div class="input-group">
                <input type="text" class="form-control mt-1" placeholder="1" value="<?php echo $trade->whole_profit_ratio?>" disabled>
                <span class="input-group-text mt-1">% </span> </div>
            </div>
            <div class="modal-form mb-4">
              <label class="">Whole position take profit Callback</label>
              <div class="input-group">
                <input type="text" class="form-control mt-1" placeholder="1" value="<?php echo $trade->whole_profit_callback?>" disabled>
                <span class="input-group-text mt-1">% </span> </div>
            </div>
            <div class="modal-form mb-4">
              <label class="">Buy in callback</label>
              <div class="input-group">
                <input type="text" class="form-control mt-1" placeholder="1" value="<?php echo $trade->buyin_callback?>" disabled>
                <span class="input-group-text mt-1">% </span> </div>
            </div>
            <div class="modal-form mb-4" id="subposition">
              <label class="">Sub-Position take-profit callback</label>
              <div class="input-group">
                <input type="text" class="form-control mt-1" placeholder="1" name="sub_position_callback" value="<?php echo $qry->sub_position_callback;?>" disabled>
                <span class="input-group-text mt-1">% </span> </div>
            </div>
          </div>
          <div class="col-lg-6">
            <div class="modal-head">
              <h6 class="mont">Margin Configuration</h6>
            </div>
            <div class="row">
              <div class="col-lg-6">
                <div class="modal-head">
                  <h5 class="text-black mont">Margin Call drop</h5>
                </div>
              <span id="ex_demo1"></span>
              </div>
              <div class="col-lg-6">
                <div class="modal-head">
                  <h5 class="text-black mont">Multiply Buy in ratio</h5>
                </div>
                <span id="ex_demo2"></span>
              </div>
            </div>
          </div>
          <div class="col-lg-3">
            <div class="modal-head">
              <h6 class="mont">Distributed and take profit Allocation</h6>
              <h5 class="text-black mont">Percentage of spilt-to-profit</h5>
            </div>
            <span id="ex_demo"></span>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <div class="row">
          <div class="col-lg-12">
             <button type="button" id="exampleModal1_clr" class="btn btn-secondary">Clear Data</button>
          </div>
        </div>
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="Submit" class="btn btn-primary"><a href="<?php echo base_url().'/mycircle/strategy_table/'.$trade->id;?>">Submit</a></button>
      </div>
    </div>
  </div>
</form>   



      <center>
        <div class="pair-tab">
          <div class="trading-tab">
            <div> 
          <!--       <button class="btn btn-primary" type="button" role="tab"  data-bs-toggle="modal" data-bs-target="#exampleModal1" data-bs-whatever="@fat" style="margin-top:30px;"><a style="color:white;">Sync Strategy</a> -->
            <?php if($user_strategy->sync_strategy_status == 0) { ?>
                   <button type="Submit" class="btn btn-primary"><a style="color:white;" href="<?php echo base_url().'/mycircle/strategy_table/'.$trade->id;?>">Sync Strategy</a></button>
                 <?php } else { ?>
 <button type="Submit" class="btn btn-primary"><a style="color:white;" href="<?php echo base_url().'/mycircle/cancel_sync/'.$trade->id;?>">Cancel Sync</a></button>
                 <?php } ?>
                  <!-- href="<?php echo base_url().'/circle/strategy_payment/'.$trade->id;?>" -->
                </button>             
            </div>
          </div>
        </div>
      </center>
    </div>
  </div>
    </div>
  </div>
</div>
</section>
<br>

</body>


<script src="<?php echo base_url();?>/styles/new_style/js/jquery-2.1.4.min.js"></script>
<script src="<?php echo base_url();?>/styles/new_style/js/bootstrap.min.js"></script>
<script src="<?php echo base_url();?>/styles/new_style/js/owl.carousel.min.js"></script>
<script src="<?php echo base_url();?>/styles/new_style/js/script.js"></script>
<script src="<?php echo base_url();?>/styles/new_style/js/wow.min.js"></script>
<script src="<?php echo base_url();?>/assets/boots/js/select_min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/assets/boots/css/select2.css">

<?php
  echo view('user/footer1');
  echo view('user/common_script');
?> 
 <script src="<?php echo base_url()?>/styles/new_style/js/notify.js"></script>

<script type="text/javascript">
   $(document).ready(function() {
    var a = '<?php echo $success; ?>';
   if(a == 1)
   {
   $.notify(' <i class="fas fa-thumbs-up"></i> Trader Settings Updated Successfully', 'success');
   }
   else if(a == 2){
    $.notify(' <i class="fas fa-exclamation-triangle"></i>&nbsp; You cannot sync multiple circle at same time', 'error');
   }
});
</script>

<script type="text/javascript">
     $(document).ready(function() {

    $('#subposition').css('display', 'none');

        var num = $('#replenishment_time').val();

      if(num >= 5)
        {

          $('#subposition').css('display', 'block');
        }
        else
        {
          $('#subposition').css('display', 'none');
        }

        });
</script>
<script>
     function doalert(obj) {
        $('#Cstartegy').css('display','none');
        $('#Ostartegy').css('display','inline-block');
        var a = $('#Ostartegy_Name').text();
        $('#crypto-strategy').html(a);
    }

     function Ooalert(obj) {
        $('#Cstartegy').css('display','inline-block');
        $('#Ostartegy').css('display','none');
        var b = $('#Cstartegy_Name').text();
        $('#crypto-strategy').html(b);
    }

    

$('#exampleModal1_clr').on('click', function() {
    
    var num = 7;
    var id= $('#id').val();
    $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time1");?>',
    data : {'number1':num},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
    if(msg)
    {
    $('#ex_demo1').html(msg);
    }
    }
    });

    $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time2");?>',
    data : {'number1':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
    if(msg)
    {
    $('#ex_demo2').html(msg);
    }
    }
    });

    $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time");?>',
    data : {'number':num},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
    if(msg)
    {
    $('#ex_demo').html(msg);
    }
    }
    });

});


$('#replenishment_time').keyup(function(){
var id= $('#id').val();
var num = $('#replenishment_time').val();

if(num>=5)
{
              $.ajax({
              type: 'post',
              dataType:'html',
              url : '<?php echo base_url("/mycircle/replenishment_time");?>',
              data : {'number':num,'id':id},
              headers: {'X-Requested-With': 'XMLHttpRequest'},
              success : function(msg)
              {
                if(msg)
                {
                $('#ex_demo').html(msg);
                }
              }
              });

}
else
{
   $('#ex_demo').html("");
}
});


$('#replenishment_time').keyup(function(){

var num = $('#replenishment_time').val();
var id= $('#id').val();
if(num>0)
{
  $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time1");?>',
    data : {'number1':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
      if(msg)
      {
      $('#ex_demo1').html(msg);
      }
    }
  });

}

});


$('#replenishment_time').keyup(function(){

var num = $('#replenishment_time').val();
var id= $('#id').val();
if(num >= 5)
        {

          $('#subposition').css('display', 'block');
        }
        else
        {
          $('#subposition').css('display', 'none');
        }
        
if(num>0)
{
  $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time2");?>',
    data : {'number2':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
      if(msg)
      {
      $('#ex_demo2').html(msg);
      }
    }
  });

}
});
$(document).ready(function(){

var num = $('#replenishment_time').val();
var id= $('#id').val();
$('#subposition').css('display', 'none');
      if(num >= 5)
        {

          $('#subposition').css('display', 'block');
        }
        else
        {
          $('#subposition').css('display', 'none');
        }

  $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time1");?>',
    data : {'number1':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
      if(msg)
      {
      $('#ex_demo1').html(msg);
      }
      }
    });

  $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time2");?>',
     data : {'number2':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
    if(msg)
    {
    $('#ex_demo2').html(msg);
    }
    }
  });

  $.ajax({
    type: 'post',
    dataType:'html',
    url : '<?php echo base_url("/mycircle/replenishment_time");?>',
    data : {'number':num,'id':id},
    headers: {'X-Requested-With': 'XMLHttpRequest'},
    success : function(msg)
    {
    if(msg)
    {
    $('#ex_demo').html(msg);
    }
    }
  });

});
</script>

</html>

        
        