<!DOCTYPE html>
<html lang="en">
<head>
	<!-- Main navbar -->
		<?php
		use App\Libraries\MyEncrypt;
         $session = session();
		 echo view('admin/common_header'); ?>
	<!-- /main navbar -->

	<!-- Theme JS files -->
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/tables/datatables/datatables.min.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/tables/datatables/extensions/responsive.min.js');?>"></script>
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/forms/selects/select2.min.js');?>"></script>

	<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/datatables_responsive.js');?>"></script>
	<!-- /theme JS files -->

	<!-- notify JS files -->
    <script type="text/javascript" src="<?php echo base_url('assets/js/plugins/notifications/jgrowl.min.js');?>"></script>
    
    <link href="<?php echo base_url('assets/css/icons/fontawesome/styles.min.css');?>" rel="stylesheet" type="text/css">

    <!-- Theme JS files -->
	
	<script type="text/javascript" src="<?php echo base_url('assets/js/plugins/forms/selects/bootstrap_select.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 -->


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


		<!-- 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>

</head>
<style>
.icons-list > li {
    display: inline-block;
    font-size: 26px;
    }
    .heading-elements .icons-list {
    margin-top: 5px;
}
.btns
{
	
         font-size: 13px;
         border: 1px solid #0084b5;
         background: #0084b5;
         border-radius: 7px;
         color: #fff;
         padding: 5px;
         
}
</style>
<body class="navbar-top-md-md pace-done">

	<!-- 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 -->
 
	<style>
		.coin_image
		{
			width:70px;
			height:70px;
		}
	</style>

	<!-- 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">API Binding List</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">

				<!-- Basic responsive configuration -->
				<div class="panel panel-flat">
					<div class="panel-heading">
						<h5 class="panel-title">API Binding List</h5>
						<div class="heading-elements">
						    <ul class="icons-list">
								<!-- <li><a href="<?php //echo base_url('admin/news/add');?>" class="icon-plus-circle2"></a></li> -->
		                		<li><a data-action="collapse"></a></li>
		                		<li><a data-action="reload"></a></li>
		                		<li><a data-action="close"></a></li>
		                	</ul>
	                	</div>
					</div>

					<table class="table datatable-responsive-row-control table-hover">
					<colgroup>
					
						<col width="10%">
						<col width="25%">
						<col width="25%">
						<col width="25%">
			


					</colgroup>
						<thead>
							<tr>
								<th></th>
								<th class="text-center">Sno</th>
								<th class="text-center">Coin</th>
							
								<th class="text-center">Ip Address</th>
								
								<th class="text-center"><?php echo lang('language_lang.news_status');?></th>
								
							</tr>
						</thead>
						<tbody>
						<?php 

						if($exchange_list)
						{
                        $i=0;
                         foreach($exchange_list as $row)
                         {
                            $i++;
                            $myencrypt = new MyEncrypt;

                            if($row->status=='1'){
                                $label_status = 'label-success';
                                $status = lang('language_lang.active');
                            } else {
                                $label_status = 'label-danger';
                                $status = lang('language_lang.in_active');
                            }
                        ?>
							
							<tr style="text-align:center">
                                <td></td>
                                <td class=""><?php echo $i;?></td>
								<td class=""><img src="<?php echo base_url();?>/styles/new_style/images/<?php echo $row->image; ?>" class="coin_image"> &nbsp; <?php echo ucfirst($row->coin);?></td>
								<td style="">
									<?php echo $row->ip_address;?>&nbsp;
									<a class="btns"  data-toggle="modal" data-target="#modal_theme_primary<?php echo $row->id;?>" href="javascript:void(0);"><i class="fa fa-edit"></i></a>
							    </td>
                                <?php if($row->status=='1'){ ?>
								         <td class="text-center"><span class="label <?php echo $label_status;?>"><a style="color:#fff;text-transform:none;font-size:13px;" onclick="changeStatus('<?php echo $myencrypt->encode($row->id); ?>')" href="javascript:void(0)"><?php echo $status;?></a></span></td>
								<?php } else {?>
 								         <td class="text-center"><span class="label <?php echo $label_status;?>"><a style="color:#fff;text-transform:none;font-size:13px;" onclick="changeActiveStatus('<?php echo $myencrypt->encode($row->id); ?>')" href="javascript:void(0)"><?php echo $status;?></a></span></td>
                                <?php } ?>
                               
								
								
								
							</tr>
						<?php 

								}
							}  else { 

						?>
							<?php } ?>
						</tbody>
					</table>
					
				</div>
				<!-- /basic responsive configuration -->


<!-- Basic modal -->
<?php foreach ($exchange_list as $row) { ?>
				<div id="modal_theme_primary<?php echo $row->id;?>" class="modal fade" >
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header bg-primary">
								<button type="button" class="close" data-dismiss="modal">&times;</button>
								<h5 class="modal-title"><b>EDIT IP ADDRESS</b></h5>
							</div>
							<form action="<?php echo base_url();?>/admin/apibind/ipchange" method="post" id="ipvalid">
						
                           
                           
                  
							<div style="" class="modal-body">

							
                            <label for="ip_address" class="form-label">Enter Ip address</label>
							<input type="text" name="ip_address" id="ip_address" placeholder="(Ex: 192.168.2.116)" class="form-control" required>
							<input type="hidden" name="id" value="<?php echo $row->id;?>">
							</div>

							<div class="modal-footer">
							<button type="submit" class="btn btn-primary">Save</button>
								<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
							</div>
							</form>
								
						
						</div>
					</div>
				</div>
				<?php } ?>
				<!-- /basic modal -->




      
		<!-- /page content -->


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

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

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



	    $(document).ready(function() {

	    	$.jGrowl.defaults.closer = false;

				<?php if($session->getFlashData('error_message')) { ?>
					$.jGrowl("<?php echo $session->getFlashData('error_message');?>", {
			            header: '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 } ?>

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

				// $('#ipvalid').formValidation({
			    // 	framework: 'bootstrap',
			    // 	excluded: [':disabled'],
			    //     icon: {
			    //         validating: 'glyphicon glyphicon-refresh'
			    //     },
			    //     fields: {
			    //         ip_address: {
			    //             message: 'Ip address is required',
			    //             validators: {
			    //                 notEmpty: {
			    //                     message: '<?php echo 'Ip address is required';?>'
			    //                 },
							
			    //             }
			    //         },

				// 	}
				// });

				

				// $('#language_change').on('change', function() {
				//     console.log($this.val);
				// });
		});

	})(jQuery);
	
	function changeStatus(valus) {
         swal({
            title: "<?php echo lang('language_lang.confirm_status_change');?>",
            showCancelButton: true,
            closeOnConfirm: false,
            confirmButtonColor: "#2196F3",
            showLoaderOnConfirm: true
        },
       function(inputValue) {
            if(inputValue === true){
             window.location.href = "<?php echo base_url('admin/apibinding/changeStatus/');?>"+'/'+valus;
            }
            else {
              return false;
            }
		
		});
	}
	function changeActiveStatus(valus) {
		swal({
            title: "<?php echo lang('language_lang.confirm_status_change');?>",
            showCancelButton: true,
            closeOnConfirm: false,
            confirmButtonColor: "#2196F3",
            showLoaderOnConfirm: true
        },
       function(inputValue) {
            if(inputValue === true){
             window.location.href = "<?php echo base_url('admin/apibinding/changeActiveStatus/');?>"+'/'+valus;
            }
            else {
              return false;
            }
		
		});
	}


	
	</script>

</body>
</html>
