<!DOCTYPE html>
<html lang="en">
<head>
	<!-- header -->
	<?php
		helper('form');
		$validation = \Config\Services::validation();
		use App\Libraries\MyEncrypt;        
        $this->session = \Config\Services::session();
		echo view('admin/common_header');
	?>
	<!-- /header -->
	
	<!-- Bootsrap form validation JS files -->
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/libraries/jquery_ui/interactions.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/libraries/jquery_ui/widgets.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/libraries/jquery_ui/effects.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/extensions/mousewheel.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/libraries/jquery_ui/globalize/globalize.js"></script>

	<!-- Bootsrap form validation JS files -->
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/formValidation.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/bootstrap.js"></script>

	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/forms/styling/uniform.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/notifications/pnotify.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/forms/selects/bootstrap_multiselect.js"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/forms/selects/bootstrap_select.min.js');?>"></script>
	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/app.js"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/pages/form_bootstrap_select.js');?>"></script>
	<!-- /theme JS files -->

	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/core/libraries/jquery_ui/interactions.min.js"></script>
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/forms/selects/select2.min.js"></script>

	<!-- select box theme JS files -->
	<script type="text/javascript" src="<?php echo base_url();?>/assets/js/plugins/forms/selects/bootstrap_select.min.js"></script>

    <!-- notify JS files -->
   
	<!-- /theme JS files -->
<script src="<?php echo base_url('assets/boots/js/bootstrap-switch.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap.js');?>"></script>
	

	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/core/app.js');?>"></script>
	<!-- /theme JS files -->

	<!-- select box theme JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/forms/selects/bootstrap_select.min.js');?>"></script>

    <!-- bootsrap switch checkbox JS files -->
    <script src="<?php echo base_url('assets/boots/js/bootstrap-switch.js');?>"></script>

    <!-- notify JS files -->
    <script type="text/javascript" src="<?php echo base_url('assets/js/plugins/notifications/jgrowl.min.js');?>"></script>

    <!-- select box JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/pages/form_bootstrap_select.js');?>"></script>
	<!-- Theme JS files -->

	<!-- /theme JS files -->

    <!-- notify JS files -->
	    
	<!-- /select box JS files -->
	
	<style type="text/css">
	    .has-error span.select2-container
	    {
	    	border:1px solid #d84315;
	    }

	    .has-success span.select2-container
	    {
	    	border:1px solid #43a047;
	    }

	     .multiselect-container {
	    	width:100% !important;
	    }

	    div.form-group  div.btn-group ul.multiselect-container.dropdown-menu {
	    	padding: 0px !important;
	    }	 
	    .form-horizontal .checkbox .checker, .form-horizontal .checkbox-inline .checker
	    {
 			top:0; 
		}   

		.multiselect-container > li > a .checker, .multiselect-container > li > a .choice {
  left: 12px;
  margin-top: 10px;
  top: 50%;
}
switch input[type="checkbox"] {
    position: absolute !important;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0;
    filter: alpha(opacity=0);
    position: absolute;
	margin-left: -20px;
	margin-top: 4px \9;
}
.switch {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 100px;
    cursor: pointer;
    display: inline-block;
    width: 44px;
    height: 22px;
    
}
.bootstrap-switch {
    display: inline-block;
    cursor: pointer;
    margin-top: -2px;
    margin-right: 7px;
    border-radius: 3px;
    border: 1px solid transparent;
    position: relative;
    text-align: left;
    overflow: hidden;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-transition: all ease-in-out 0.05s;
    -o-transition: all ease-in-out 0.05s;
    transition: all ease-in-out 0.05s;
}
.bootstrap-switch .bootstrap-switch-handle-off, .bootstrap-switch .bootstrap-switch-label {
    cursor: pointer;
    display: inline-block !important;
    height: 100%;
    padding: 7px 12px;
}
.bootstrap-switch-handle-off {
    border-bottom-right-radius: 2px;
    border-top-right-radius: 2px;
}
bootstrap-switch-handle-on.bootstrap-switch-primary, .bootstrap-switch-handle-off.bootstrap-switch-primary {
    color: #fff;
    background-color: #2196F3;
}
.bootstrap-switch .bootstrap-switch-handle-on, .bootstrap-switch .bootstrap-switch-handle-off, .bootstrap-switch .bootstrap-switch-label {
    cursor: pointer;
    display: inline-block !important;
    height: 100%;
    padding: 7px 12px;
}
.bootstrap-switch-handle-on {
    border-bottom-left-radius: 2px;
    border-top-left-radius: 2px;
}
.bootstrap-switch-label {
    text-align: center;
    z-index: 100;
    color: #333333;
    background-color: #fff;
    position: relative;
    -webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1) inset;
}
.bootstrap-switch .bootstrap-switch-label {
    cursor: pointer;
    display: inline-block !important;
    height: 100%;
    padding: 7px 12px;
}
element {
    width: 141px;
    margin-left: 0px;
}
	</style>
</head>

<body class="navbar-top-md-md">
	<!-- <div class="pre_loader"></div> -->
	<!-- Fixed navbars wrapper -->
	<div class="navbar-fixed-top">

		<!-- Main navbar -->
		<?php echo view('admin/mainnav'); ?>
		<!-- /main navbar -->


		<!-- Second navbar -->
		<?php echo view('admin/secondnav'); ?>
		<!-- /second navbar -->

	</div>
	<!-- /fixed navbars wrapper -->


	<!-- Page header -->
	<?php echo view('admin/'.$module_name.'_header'); ?>
	<!-- /page header -->



	<!-- Page container -->
	<div class="page-container">

		<!-- Page content -->
		<div class="page-content">

			<!-- Main content -->
			<div class="content-wrapper">

				<!-- Horizontal form -->
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title"><? echo "Trader Account"; ?></h5>
						<div class="heading-elements">
							<ul class="icons-list">
		                		<li><a data-action="collapse"></a></li>
		                		<li><a data-action="close"></a></li>
		                	</ul>
	                	</div>
                	</div>
                	<?php $currency_info = defaultcurrency();?>
					<div class="panel-body">
						<form class="form-horizontal trader_acc" id="trader" action="<?php echo $action;?>" method="post" enctype="multipart/form-data">
						
							<?php 
								if($validation->listErrors()) { 
									$form_err_data = str_replace('<p>', '', $validation->listErrors());
									$form_err_data = str_replace('</p>', '', $form_err_data);
									$form_err_data = str_replace('.', '', $form_err_data);
							?>
									
									<script type="text/javascript">
									
									(function( $ ) {
										$.jGrowl.defaults.closer = false;
								        var from_daa = '<?php $form_err_data;?>';
										$.jGrowl(from_daa, {
								            header: '<?php echo lang("language_lang.error");?>',
								            theme: 'bg-danger'
								        });
								    
									})(jQuery);

									</script>
							<?php
								}
							?>
							<input type="hidden" name="ijd" id="ijd" value="<?php echo $id;?>">
							<div class="form-group <?php if($validation->getError('trade_mode')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Trade Name" ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<input type="text" value="" name="trade_mode" class="form-control" id="trade_id" /><?php echo $validation->getError('trade_mode', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>


							<div class="form-group <?php if($validation->getError('coin_id')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "List Pairs"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<select name="coin_id" id="select_payer_id" class="select-search form-control" >
										<option value=""><?php echo lang('language_lang.none_selected'); ?></option>
					               		<?php
					               		// $market_currency = $this->db->query("select * from coin_info")->getResult();
                                     // $market_currency = $select_coin[0];
					               		  foreach ($required_pairs as $users) {  ?>

										<option value="<?php echo $users; ?>"><?php echo $users; ?> </option>

										<?php } ?>	
									</select>
									
									<?php echo $validation->getError('coin_id', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	
								</div>
							</div>



                            <div class="form-group  <?php if($validation->getError('stratgy')) echo "has-error";?>" id="stratgy">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Strategy Name" ?> <span class="text-danger">*</span> </label>
                                  	<div class="col-lg-3">
                                        <input type="text" value="" name="stratgy" class="form-control" />
                                        
                                        <?php echo $validation->getError('stratgy', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
                                    <div class="messageContainer"></div></div>
                                  
                            </div>


                            <div class="form-group <?php if($validation->getError('trade_image')) echo "has-error";?>">
	                          <label class="control-label col-lg-3 text-semibold"><?php echo "Trade Image";?> <span class="text-danger"> * </span> </label>
	                          <div class="col-lg-6">
	                              <input type="file"  class="file-input-extensions" name="trade_image" value="" id="trade_image"/>
	                              <span class="help-block"><?php echo lang('language_lang.site_logo_extension');?></span>
	                              <?php echo $validation->getError('trade_image', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
                                    <div class="messageContainer"></div>
	                          </div>
                        </div>

                              <?php
                              $trader;
                          
                              ?>

                            <div class="form-group  <?php if($validation->getError('strategy')) echo "has-error";?>" id="sel_strategy" style="display:none">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Strategy Name"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-4">
									<select name="stratgy1" id="strategy" class="select-search form-control" >
										<option ><?php echo lang('language_lang.none_selected'); ?></option>
					               		<?php foreach ($trader as $trade ) {?>
										<option value="<?php echo $trade->id; ?>" <?php if($trade){echo $trade->stratgy;}else{ echo '';}?>><?php echo ucfirst($trade->stratgy); ?></option>
										<?php } ?>	
									</select>
									<?php echo $validation->getError('stratgy1', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
									
								</div>
							</div>	
							

                            <div class="form-group " id="sel_acc" style="display:none">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Account Name"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
								<input id="ac_name"  type="text"  name="ac_name1"  class="form-control" readonly >
                                      <div class="messageContainer"></div>
									
								</div>
							</div>


                            <div class="form-group  <?php if($validation->getError('profit')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "profit (%)" ?>  <span class="text-danger">*</span></label>
                                <div class="col-lg-3">
                                    <input type="text" value="" name="profit" class="form-control" />
                                    <?php echo $validation->getError('profit', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
                                    <div class="messageContainer"></div>
                                </div>
                                  
                            </div>


							
<!-- 
							<div class="form-group  <?php if($validation->getError('duration')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Duration(Days)"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<div style="width:100%" class="input-group">
										<input type="text" name="duration" id="package_duration" class="form-control" placeholder="Trade Duration" value="">
										<?php echo $validation->getError('duration', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>

									</div>
									
								</div>
							</div>


                            <div class="form-group  <?php if($validation->getError('admin_fee')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Admin fees (%)" ?> <span class="text-danger">*</span> </label>
                                <div class="col-lg-3">
                                    <input type="text" value="" name="admin_fee" class="form-control" />
                                        <?php echo $validation->getError('admin_fee', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
                                    <div class="messageContainer"></div>
                                     
                                </div>
                            </div> -->



							<div class="form-group  <?php if($validation->getError('description')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Description"; ?> </label>
								<div class="col-lg-4">
									<div style="width:100%" class="input-group">
							        	<textarea class="" name="description" id="editor-readonly" style="width: 410px; height: 103px;" placeholder="Description"></textarea>
							        	<?php echo $validation->getError('description', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
									</div>

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('address')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Address" ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<input type="text" value="" name="address" id="address" class="form-control" /><?php echo $validation->getError('address', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('amount')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Amount" ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<input type="text" value="" name="amount" id="amount" class="form-control" /><?php echo $validation->getError('amount', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('facebook')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Facebook" ?></label>
								<div class="col-lg-3">
									<input type="text" value="" name="facebook" id="facebook" class="form-control" /><?php echo $validation->getError('facebook', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('twitter')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Twitter" ?></label>
								<div class="col-lg-3">
									<input type="text" value="" name="twitter" id="twitter" class="form-control" /><?php echo $validation->getError('twitter', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('youtube')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Youtube" ?> </label>
								<div class="col-lg-3">
									<input type="text" value="" name="youtube" id="youtube" class="form-control" /><?php echo $validation->getError('youtube', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>

							<div class="form-group <?php if($validation->getError('Telegram')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Telegram" ?></label>
								<div class="col-lg-3">
									<input type="text" value="" name="Telegram" id="Telegram" class="form-control" /><?php echo $validation->getError('Telegram', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	

								</div>
							</div>


							<div class="clearfix"><br></div>
							<div class="clearfix"><br></div>


							<div class="panel-heading">
								<h5 class="panel-title" style="margin-left:-15px;"><? echo "Trader Settings"; ?></h5>
								
		                	</div>


		                	<div class="clearfix"><br></div>


		                	<div class="form-group  <?php if($validation->getError('first_buy_amount')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "First Buy in Amount" ?> <span class="text-danger">*</span> </label><span>
                                <div class="col-lg-3">
                                    <input type="text" value="" name="first_buy_amount" id="first_buy_amount" class="form-control" /><span class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:258px;height:38px;width:50px;text-align-last: left;padding: 12px 10px;">USDT</span>
                                    <?php echo $validation->getError('first_buy_amount', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
                                    <div class="messageContainer"></div>
                                </div></span>
                            </div>


                             <?php
                             $query=$this->db->query("SELECT * FROM trader where id=1")->getResult();
                             $open_pos=$query[0];
                             $open_position_doubled=$open_pos->open_position_doubled;
                             ?>


                            <div class="form-group">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Open Position doubled" ?></label>
                                <div class="col-lg-8">
						            <div class="checkbox checkbox-switch" style="-webkit-box-sizing: border-box;-moz-box-sizing: border-box;">
						                	
										<label>
	                                            <?php
	                                            $on='ON';
	                                            $off='OFF';
	                                            ?>
								     		<input type="checkbox" class="switch" data-on-text="<?php echo $on?>" data-off-text="<?php echo $off; ?>" data-on-color="primary" data-off-color="default" name="open_position_doubled">
										</label>
										
								    </div>
                             	</div>
                        	</div>


                            <div class="form-group  <?php if($validation->getError('margin_column_limit')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Margin column limit" ?> <span class="text-danger">*</span> </label>
                                <div class="col-lg-3">
                                    <input type="text" value="" name="margin_column_limit" id="margin_column_limit" class="form-control" /><label class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:258px;height:38px;width:50px;text-align: left;padding: 12px 6px;">Times</label>
                                    <?php echo $validation->getError('margin_column_limit', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
								<div class="messageContainer"></div>
                                
                                     
                                </div>
                             </div>



                            <div class="form-group  <?php if($validation->getError('whole_profit_ratio')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Whole poistion take profit ratio" ?> <span class="text-danger">*</span> </label>
                                <div class="col-lg-3">

                             		<input type="text" name="whole_profit_ratio" class="form-control"  placeholder="Whole poistion take profit ratio" value="">

									<span class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:270px;height:38px;width:35px;padding: 12px 12px;">%</span>
									<?php echo $validation->getError('whole_profit_ratio', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
									<div class="messageContainer"></div>
                                     
                                </div>
                            </div>



                            <div class="form-group  <?php if($validation->getError('whole_profit_callback')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Whole poistion take profit callback" ?> <span class="text-danger">*</span> </label>
                                <div class="col-lg-3">

                             	<input type="text" name="whole_profit_callback" class="form-control"  placeholder="Whole poistion take profit callback" value="">

								<span class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:270px;height:38px;width:35px;text-align: left;padding: 12px 12px;">%</span>
								<?php echo $validation->getError('whole_profit_callback', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
								<div class="messageContainer"></div>
                                     
                                </div>
                            </div>
                            <div>
                                <label class="control-label col-lg-4 text-semibold" name="label_margin" id="label_margin"><?php echo "Margin Configuration" ?></label><br>
                            </div><br>
                    <div class="col-lg-12" id="label_call">
                        <div class="form-group col-lg-6" name="config_field" id="config_field">
                        	
                                
                            <div class="col-lg-6">
						        <div class="modal-head">
                                	<label class="control-label col-lg-11 text-semibold" ><?php echo "Margincall Drop" ?></label>
                                 </div> <br>                            
 									<span class="col-lg-10" id="ex_demo1"></span>     
                            </div>

                             
                            <div class="col-lg-6" >
						        <div class="modal-head">
                            	    <label class="control-label col-lg-11 text-semibold" id="label_ratio"><?php echo "Margin Buyin Ratio" ?></label>
                                </div><br>
                                  	<span class="col-lg-10" id="ex_demo2"></span>
                                   
                            </div>
                        </div>
                        <div class="form-group col-lg-6" name="config_field" id="config_field" >
                            <div class="col-lg-8">
						        <div class="modal-head">
						            <label class="control-label col-lg-12 text-semibold"><?php echo "Distributed and take profit Allocation" ?><br><?php echo "Percentage of spilt-to-profit"?></label>
						        </div>
						            <span class="col-lg-8" id="ex_demo" style="width:236px;"></span>
						    </div>
                        </div>
                    </div>
					<div class="form-group  <?php if($validation->getError('sub_position_callback')) echo "has-error";?>" id="subposition">
                        <label class="control-label col-lg-3 text-semibold"><?php echo "Sub-position take-profit callback" ?></label>
                        <div class="col-lg-3">
                            <input type="text" value="" name="sub_position_callback" id="sub_position_callback" class="form-control" /><label class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:258px;height:38px;width:50px;text-align: left;padding: 12px 6px;">Times</label>
                            <?php echo $validation->getError('sub_position_callback', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
						    <div class="messageContainer"></div>                                
                                     
                        </div>
                	</div>
                             
                            <div class="form-group  <?php if($validation->getError('buyin_callback')) echo "has-error";?>">
                                <label class="control-label col-lg-3 text-semibold"><?php echo "Buy in callback" ?> <span class="text-danger">*</span> </label>
                                <div class="col-lg-3">

                             	<input type="text" name="buyin_callback" class="form-control"  placeholder="Buy in callback" value="">

								<span class="input-group-addon col-lg-1" style="margin-top:-38px;margin-left:270px;height:38px;width:35px;padding: 12px 12px;">%</span>
								<?php echo $validation->getError('buyin_callback', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
								<div class="messageContainer"></div>
                                     
                                </div>
                             </div>

                             <div class="form-group <?php if($validation->getError('coin_id')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Strategy Mode"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<select name="strategy_mode" id="strategy_mode" class="select-search form-control" >
										<option value=""><?php echo lang('language_lang.none_selected'); ?></option>
					   
					               		
										<option value="1">Whole ware house mode</option>
										<option value="2">Subbin mode</option>
										<option value="3">Subbin Realtime Settlement mode</option>
										
									</select>
									
									<?php echo $validation->getError('coin_id', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	
								</div>
							</div>

							<div class="form-group <?php if($validation->getError('coin_id')) echo "has-error";?>">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Strategy Type"; ?> <span class="text-danger">*</span></label>
								<div class="col-lg-3">
									<select name="strategy_type" id="strategy_type" class="select-search form-control" >
										<option value=""><?php echo lang('language_lang.none_selected'); ?></option>
					               		<option value="Cycle Strategy">Cycle Strategy</option>
										<option value="Oneshot Strategy">Oneshot Strategy</option>
									</select>
									<?php echo $validation->getError('coin_id', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>	
								</div>
							</div>

                          	<input type="hidden" name="recid" value="<?php echo $coin; ?>" >

							<div class="clearfix"><br></div>

							<div class="text-right col-lg-7">
	                            <button id="btn" type="submit" class="btn btn-primary"><?php echo lang('language_lang.bonus_button'); ?> <i class="icon-arrow-right14 position-right"></i></button>
							</div>

						</form>
					</div>
				</div>
				<!-- /horizotal form -->

			</div>
			<!-- /main content -->

		</div>
		<!-- /page content -->
		

		<!-- Footer -->
		<div class="footer text-muted">
			<?php echo site_footer();?>
		</div>
		<!-- /footer -->

	</div>
	<!-- /page container -->

	<script type="text/javascript">
	jQuery.noConflict();
	(function( $ ) {
	$(function() {

		

		$(document).ready(function() {

			$('#label_margin').css('display', 'none');
			$('#label_call').css('display', 'none');
			$('#subposition').css('display', 'none');
			$.jGrowl.defaults.closer = false;

			<?php if($this->session->getFlashData('error_message')) { ?>
				$.jGrowl("<?php echo $this->session->getFlashData('error_message');?>", {
		            header: '<?php echo lang("language_lang.lbl_trade_error");?>',
		            theme: 'bg-danger'
		        });

            <?php } ?>
                    
            <?php if($this->session->getFlashData('success_message')) { ?>
                
                $.jGrowl("<?php echo $this->session->getFlashData('success_message');?>", {
		            header: '<?php echo lang("language_lang.lbl_trade_success");?>',
		            theme: 'bg-success'
		        });

            <?php } ?>

            $(document).on("keyup", '#margin_column_limit', function() {
    
								    // var num = 7;
				var num = $('#margin_column_limit').val();
				
				$('#label_margin').css('display', 'block');
				$('#label_call').css('display', 'block');
				if(num>=5)
				{
					$('#subposition').css('display', 'block');
				}
				else
				{
					$('#subposition').css('display', 'none');
				}

				$.ajax({

					type: 'post',
					dataType:'html',
					url : '<?php echo base_url();?>/admin/finance/config_field1',
					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();?>/admin/finance/config_field2',
				    data : {'number2':num},
				    headers: {'X-Requested-With': 'XMLHttpRequest'},
				    success : function(msg)
				    {
					    if(msg)
					    {
						    $('#ex_demo2').html(msg);
					    }
				    }
				});


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

			});

			$('.select-search').select2();

			
                    	
           

            $('#select_payer_id').change(function(){

      			var coin_id = $('#select_payer_id').val();
      			

      			if(coin_id) {
		        	$.ajax({
		                type: 'post',
		                url : '<?php echo base_url();?>/admin/finance/trader',
		                data : {'coin_id':coin_id, 'trade_mode':trade_mode},
		                success : function(msg)
		                {
		                   
		                }
		            });
				}
      
             });
 			$(".deposit_date").datepicker({
	            	dateFormat: 'yy-mm-dd',
	            	maxDate: 0
	            }).on('change', function(e) {
	            	$('.trader_acc').formValidation('revalidateField','deposit_date');
	            })

			});	
 			 


	 
		$('#icon-bck').on('click',function() {
			window.history.back();
		});

		$(".switch").bootstrapSwitch();

	});
	})(jQuery);


	</script>

	<script type="text/javascript">
            jQuery.noConflict();
            (function( $ ) {
                $(function() {

                    $(document).ready(function() {

                    
                    	
                    	//$validation = \Config\Services::validation();
                        $('.form-horizontal trader_acc').formValidation({
                            framework: 'bootstrap',
                            excluded: [':disabled'],
                            icon: {
                                // valid: 'glyphicon glyphicon-ok',
                                // invalid: 'glyphicon glyphicon-remove',
                                validating: 'glyphicon glyphicon-refresh'
                            },
                            fields: 
                            {
                                trade_mode: {
                                    message: 'Enter Trade name',
                                    validators: {
                                        notEmpty: {
                                            message: 'Trade name cannot be empty'
                                        },
                                        remote: {
                                        url: function(validator, $field, value) {
                                            
                                            return '<?php echo base_url();?>/admin/finance/trade_validuser'
                                        },
                                        type: 'POST',
                                        delay: 1000,
                                        message: 'Trader Name already exits'
                                    }
                                        
                                    }
                                },
                                
                                profit: {
					                validators: {
					                    notEmpty: {
					                        message: 'Enter Profit";?>'
					                    },
					                    regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits'
			                                    }
					                }
					            },
					          
                                duration: {
                                    message: '',
                                    validators: {
                                        notEmpty: {
                                            message: 'Duration cannot be empty'
                                        }
                                    }
                                },
                                admin_fee: {
                                    message: '',
                                    validators: {
                                        notEmpty: {
                                            message: 'Admin fees cannot be empty'
                                        }
                                    }
                                },
                                description: {
                                    message: '',
                                    validators: {
                                        notEmpty: {
                                            message: 'Description cannot be empty'
                                        }
                                    }
                                },
                                first_buy_amount: {
					                message: 'First buy amount is Required',
					                validators: {
					                    notEmpty: {
					                        message: 'Enter First buy amount'
					                    },
					                    regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits'
			                                    }
					                }
					            },
                                
                                margin_column_limit: {
                                    validators: {	
                                        notEmpty: {
                                            message: 'Margin column limit is Required'
                                        },
                                        regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits"; ?>'
			                            }
                                    }
                                },
                                whole_profit_ratio: {
                                    validators: {	
                                        notEmpty: {
                                            message: 'Whole profit ratio is Required'
                                        },
                                        regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits'
			                            }
                                    }
                                },
                                whole_profit_callback: {
                                    validators: {	
                                        notEmpty: {
                                            message: 'Whole position take profit callback is Required'
                                        },
                                        regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits'
			                            }
                                    }
                                },
                                buyin_callback: {
                                    validators: {	
                                        notEmpty: {
                                            message: 'Buy in callback is Required'
                                        },
                                        regexp: {
			                                        regexp: /^[0-9]+$/i,
			                                        message: 'This field only in digits'
			                            }
                                    }
                                }
                            }
                            
                        })
                        
                    });
                    
                   

                })(jQuery);
        </script>

</body>
</html>
