<!DOCTYPE html>
<html lang="en">
<head>
<!-- header -->
<?php

helper('form');
$session = \Config\Services::session();
$validation = \Config\Services::validation();

echo view('admin/common_header'); ?>
<!-- /header -->

<!-- file upload JS files -->
<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/uploaders/fileinput.min.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>


<!-- 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>
<!-- /select box JS files -->

</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">Trading Pool Interest Level  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">Trading Pool Interest Level 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>
<?php //print_r(defaultcurrency()->currency_name);?>
<?php $currency_info = defaultcurrency();?>
<div class="panel-body">
<form class="form-horizontal form-withdraw" action="<?=site_url($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
}
?>


<!-- //  start -->
	<div class="section row mb10" id="levelcommissiondivp">
	<label for="levelcommission" class="control-label col-lg-3 text-semibold">Level Commission Set ( % )<sup style="color: red;">*</sup></label>

	<div class="col-sm-3 ph10" style="margin-bottom: 13px;">
	<input type='button' value='+' id='addlvlButton'  class="btn btn-bordered btn-primary"  />
	<input type='button' value='-' id='removelvlButton' class="btn btn-bordered btn-primary" / style="margin-right: 40px;">
	</div>  

	<?php echo $validation->getError('levelcommission[]');?>
	</div>

	<?php
	$commissions = $this->data['pool_invest_level'];
	$explode = explode(',',$commissions);
	for($i=0;$i<count($explode);$i++)
	{
	$lvl=$i+1;
	?>


	<div class="section row mb10" id="levelcommissiondivp<?php echo $lvl;?>">
	<label for="levelcommission<?php echo $lvl;?>" class="control-label col-lg-3 text-semibold">
	</label>

	<div class="col-sm-4 ph10 md10 " >
	<input type="text" name="levelcommission[]" id="levelcommission<?php echo $lvl;?>" class="form-control" placeholder="<?php echo  ucwords('level');echo" 1 ".  ucwords('Commission'); ?>"
	class="gui-input" value="<?php echo $explode[$i];?>" style="margin-bottom: 14px;"  >
	</div>

	</div>

	<?  
	}?>

	<div class="section row mb10" id="levelcommissiondiv">
	<div class="col-sm-7 ph10"></div>
	<label for="levelcommission" class="field prepend-icon col-sm-5 ">
	</label>
	</div>

	<?php
	$counts = count($explode)+1;
	?>
	<input type="hidden" id="lvlprtcount" name="lvlprtcount" value="<?php echo $counts;?>">




<div class="text-right col-lg-7">
<button 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();?>
<!-- &amp;copy; 2015. <a href="#">Limitless Web App Kit</a> by <a href="http://themeforest.net/user/Kopyov" target="_blank">Eugene Kopyov</a> -->
</div>
<!-- /footer -->

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

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

$(document).ready(function() {


	// 1 start

	var counter =$('#lvlprtcount').val();

	$("#addlvlButton").click(function () {

	if(counter>15){
	alert("Only 15 textboxes allow");
	return false;
	}   

	var levelcommissiondiv = $(document.createElement('div'))
	.attr("id", 'levelcommission' + counter).attr("class", 'section row mb10');

	levelcommissiondiv.after().html('<label class="col-sm-3 ph10 "></label><div class="col-sm-4 ph10 mb10"><input type="text" name="levelcommission[]" placeholder="Level '+ counter+' Commission" id="levelcommission'+ counter+'" value="" class="form-control mb-3" style="margin-bottom:15px;" ></div>');

	levelcommissiondiv.appendTo("#levelcommissiondiv");


	counter++;
	});

	$("#removelvlButton").click(function () {
	if(counter==2){
	alert("No more textbox to remove");
	return false;
	}   

	counter--;

	$("#levelcommission" + counter).remove();

	});

	$("#getButtonValue").click(function () {

	var msg = '';
	for(i=1; i<counter; i++){
	msg += "\n levelcommissiondiv #" + i + $('#levelcommissiondiv' + i).val();
	}
	alert(msg);
	});


	// 1 end


$.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 } ?>

$('.form-withdraw').formValidation({
framework: 'bootstrap',
excluded: [':disabled'],
icon: {
// valid: 'glyphicon glyphicon-ok',
// invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
levelcommission: {
message: 'Enter Robot Fee',
validators: {
notEmpty: {
message: 'Enter Robot Fee'
},
regexp: {
regexp: /^[0-9.]+$/,
message: 'Enter Robot Fee Contain Only Number Format'
}
}
},

}
})
});

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

});
})(jQuery);


</script>

</body>
</html>
