<!DOCTYPE html>
<html lang="en">
<head>
<!-- header -->
<?php 
$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/formValidation.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 -->

<!-- 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>
<style>
select.form-control{
width: 300px;
height: 38px;
}
</style>


</head>

<body class="navbar-top-md-md">

<!-- 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 -->
<div class="page-header">
<div class="page-header-content">
<div class="page-title">
<h4><i id="icon-bck" class="icon-arrow-left52 position-left"></i> <span class="text-semibold"><?php echo lang('Trading Settings'); ?></span></h4>

<ul class="breadcrumb breadcrumb-caret position-right">
<?php foreach ($breadcrumbs as $breadcrumb) { if(isset($breadcrumb['href'])){?>
<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
<?php } else { ?> <li><?php echo $breadcrumb['text']; ?></li><?php } } ?>
</ul>
</div>
<?php echo view('admin/'.$module_name.'_header'); ?>

</div>
</div>	
<!-- /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"><?php echo lang('Trading Settings'); ?></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>

<div class="panel-body">
<form class="form-horizontal form-account" id="adminsettings" action="<?= site_url($action);?>" method="post" enctype="multipart/form-data">
<?php 
$validation = \Config\Services::validation();
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
}
?>
<?php
$this->db = db_connect();
$one=$this->db->query("SELECT * FROM adminsettings");
$two=$one->getResult();
$res=$two[0];
?>

<div class="form-group  has-feedback <?php if($validation->getError('activation_cost')) echo "has-error";?>">
	<label class="control-label col-lg-3 text-semibold">Membership Amount (USDT)<span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="activation_cost" class="form-control"  value="<?php echo $res->activation_cost; ?>" placeholder="Activation cost" /><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>
		
	    </div>
	    <?php echo $validation->getError('activation_cost', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div><span>USDT</span>
</div>



<div class="form-group has-feedback">
    <label class="control-label col-lg-3 text-semibold">Subscription Type</label>
    <div class="col-lg-4">
		<div style="width:409px;" class="input-group">
				<select class="form-control" name="subs_type" id="subs_type">
			<option />None Selected</option>
				<option id="onetime" name="onetime" value="onetime" <?php if($res->subs_type=='onetime'){ echo "selected" ;}?> />One Time</option>
				<option  id="monthly" name="monthly" value="monthly" 
				<?php if($res->subs_type=='monthly'){ echo "selected" ;}?> />Monthly</option> 
				<option  id="yearly" value="yearly" name="yearly" <?php if($res->subs_type=="yearly"){ echo "selected" ;}?> />Yearly</option> 
				</select>
			
		</div>
	</div>
</div>


<div class="form-group  has-feedback" id="duration" style="display:<?php if($res->subs_type!=='onetime')
	{
		echo 'none';}
		else{
			echo 'none';}
			?>" >
	<label class="control-label col-lg-3 text-semibold">Duration  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		  <input type="text" name="duration" class="form-control"  value="<?php echo $res->duration ?>" placeholder="Duration">
		
	    </div>
	    <?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 class="form-group  has-feedback" id="renewal_amt" style="display:<?php if($res->subs_type!=='onetime')
	{
		echo 'none';}
		else{
			echo 'none';}
			?>">
	<label class="control-label col-lg-3 text-semibold">Renewal Amount  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="renewal_amt"  class="form-control" value="<?php echo $res->renewal_amt ?>" placeholder="Renewal Amount">
		
	    </div>
	    <?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 class="form-group  has-feedback <?php if($validation->getError('min_fuel_fee')) echo "has-error";?>">
	<label class="control-label col-lg-3 text-semibold"><?php echo lang('language_lang.min_fuel_fee')."(%)"; ?>  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="min_fuel_fee" class="form-control" value="<?php echo $res->min_fuel_fee; ?>" placeholder="min_fuel_fee">
		
	    </div>
	    <?php echo $validation->getError('min_fuel_fee', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div><span>USDT</span>
</div>


<div class="form-group  has-feedback <?php if($validation->getError('min_fuel')) echo "has-error";?>">
	<label class="control-label col-lg-3 text-semibold">Minium Gas Fee wallet  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="min_fuel" class="form-control" value="<?php echo $res->min_fuel; ?>" placeholder="min_fuel_fee">
		
	    </div>
	    <?php echo $validation->getError('min_fuel', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div><span>USDT</span>
</div>

								
<!-- <div class="form-group has-feedback">
    <label class="control-label col-lg-3 text-semibold"><?php echo lang('language_lang.ded_typ'); ?></label>
    <div class="col-lg-4">
		<div style="width:409px;" class="input-group">
				<select class="form-control" name="deduction_type">
				<option id="hours" <?php if($res->deduction_type=='Hours'){ echo "selected" ;}else{}?> name="hours" value="Hours"/>Hours</option>
				<option <?php if($res->deduction_type=='Trading'){ echo "selected" ;}?> id="trading" value="Trading" name="trading"/>Trading</option> 
				</select>
			
		</div>
	</div>
</div> -->

<!-- <div class="form-group  has-feedback <?php if($validation->getError('no_of_hours')) echo "has-error";?>" id="no_of_hours" style="display:<?php if($res->deduction_type=='Hours'){echo "block";}else {echo "none";}?>;">
	<label class="control-label col-lg-3 text-semibold"><?php echo lang('language_lang.no_of_hours'); ?>  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text"  name="no_of_hours" class="form-control" value="<?php echo $res->no_of_hours; ?>" placeholder="no_of_hours">
		</span>
	    </div>
	    <?php echo $validation->getError('no_of_hours', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div>
</div>

<div class="form-group  has-feedback <?php if($validation->getError('no_of_trading')) echo "has-error";?>" id="no_of_trading" style="display:<?php if($res->deduction_type=='Trading'){echo "block";}else {echo "none";}?>;">
	<label class="control-label col-lg-3 text-semibold"><?php echo lang('language_lang.no_of_trading'); ?>  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="no_of_trading" class="form-control"  value="<?php echo $res->no_of_trading; ?>" placeholder="no_of_trading">
		
	    </div>
	    <?php echo $validation->getError('no_of_trading', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div>
</div> -->

		                    <div class="form-group ">
								<label class="control-label col-lg-3 text-semibold"><?php echo "Circle Using Trading Profit ?"; ?></label>
				                <div class="col-lg-6">
							       <div class="checkbox checkbox-switch">
	                                    <label>
									        <input type="checkbox" class="switch" data-on-text="<?php echo lang('language_lang.On'); ?>" data-off-text="<?php echo lang('language_lang.Off'); ?>" data-on-color="primary" data-off-color="default" name="circle_profit_status" <?php if($res->circle_profit_status ==='on'){ echo 'checked="checked"'; }   ?>>
									    </label>
						           </div>
						        </div>
						    </div>
<div class="form-group  has-feedback <?php if($validation->getError('amount')) echo "has-error";?>"  id="amount">
	<label class="control-label col-lg-3 text-semibold"><?php echo "Total Profit ".lang('language_lang.amount').' (USDT)'; ?>  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    
		    <input type="text" name="amount" class="form-control" value="<?php echo $res->amount; ?>" placeholder="amount">
		</span>
	    </div>
	    <?php echo $validation->getError('amount', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div><span>USDT</span>
</div>

<div class="form-group  has-feedback <?php if($validation->getError('global_dividend')) echo "has-error";?>"  id="global_dividend">
	<label class="control-label col-lg-3 text-semibold"><?php echo "Global Dividend Share(%)"; ?>  <span class="text-danger">*</span></label>
    <div class="col-lg-3">
	    <div style="width:409px;" class="input-group">
	    <input type="text" name="global_dividend" class="form-control" value="<?php echo $res->global_dividend; ?>" placeholder="Enter Your Percentage">
		</span>
	    </div>
	    <?php echo $validation->getError('global_dividend', '<div class="form-control-feedback"><i class="icon-cancel-circle2"></i></div><span class="help-block">', '</span>'); ?>
    </div><span>USDT</span>
</div>

<div class="text-right col-lg-6">
<input type="hidden" value="<?php echo $session->get('userid'); ?>" name="id">
	<button style=" padding-right: 14px; margin-right: 205px;" type="submit" class="btn btn-primary"><?php echo lang('language_lang.button_update'); ?> <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() {

$.jGrowl.defaults.closer = false;

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

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


});
$('#adminsettings').formValidation({
framework: 'bootstrap',
excluded: [':disabled'],
icon: {
// valid: 'glyphicon glyphicon-ok',
// invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
activation_cost: {
validators: {
notEmpty: {
message: 'Enter Activation Cost'
}
}
},
min_fuel_fee: {
validators: {
notEmpty: {
message: 'Enter Minimum Fuel Fee'
}
}
},
min_fuel: {
validators: {
notEmpty: {
message: 'Enter Minimum Gas wallet fuel'
}
}
},
amount: {
validators: {
notEmpty: {
message: 'Enter Amount'
}
}
},

subs_type:{
validators:{
notEmpty:{
message: 'Select Subcription Type'
}
}
}


}
})
//window.onload = function() {
// document.getElementById('no_of_hours').style.display = 'none';
//document.getElementById('amount').style.display = 'none';
//document.getElementById('no_of_trading').style.display = 'none';

//}

$(document).on("click", '#hours', function() {


document.getElementById('no_of_hours').style.display = 'block';
document.getElementById('amount').style.display = 'block';
document.getElementById('no_of_trading').style.display = 'none';

});
$(document).on("click", '#trading', function() {

document.getElementById('no_of_hours').style.display = 'none';
document.getElementById('no_of_trading').style.display = 'block';
document.getElementById('amount').style.display = 'block';


});


$("#subs_type").change(function () {

var value=this.value;

//alert(value);

if(value=="monthly"||"yearly")
{
document.getElementById("duration").style.display="none";
document.getElementById("renewal_amt").style.display="none";
}
if(value=="onetime")
{

document.getElementById("duration").style.display="none";
document.getElementById("renewal_amt").style.display="none";

}
});




/*
$(document).ready(function() {
select=$('#select option:selected').val();
hour=$('#hours option:selected').val();
trade=$('#trading option:selected').val();
if(select==hour)
{
document.getElementById('no_of_hours').style.display = 'block';
document.getElementById('amount').style.display = 'block';
document.getElementById('no_of_trading').style.display = 'none';
}
else
{
document.getElementById('no_of_hours').style.display = 'none';
document.getElementById('no_of_trading').style.display = 'block';
document.getElementById('amount').style.display = 'block';
}
});
*/

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

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


});
})(jQuery);

</script>