<!DOCTYPE html>
<html lang="en">
<head>
	<!-- Main navbar -->
		<?php 
		  use App\Libraries\MyEncrypt;
	      use App\Helpers\site_helper;
	      use App\Helpers\form_helper;
	      $this->db = db_connect();
	      $this->session = session();
	      $this->common_model = model('CommonModel');
	      $this->form_validation =  \Config\Services::validation();
		
		echo view('admin/common_header'); ?>
	<!-- /main navbar -->

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

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

	<script type="text/javascript" src="<?php echo base_url('styles/web3/bignumber.min.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('styles/web3/dist/web3-light.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('styles/web3/dist/web3.js');?>"></script>
<script type="text/javascript" src="<?php echo base_url('styles/web3/buffer.js');?>"></script>

<script src="https://cdn.rawgit.com/ethereumjs/browser-builds/2fb69a714afe092b06645286f14b94f41e5c062c/dist/ethereumjs-tx.js"></script>
    
    <style type="text/css">
	    .icons-list a[data-action="reload1"]:after {
		  content: '\e9fb';
		}
		.btns {
			padding: 5px;
		}
	</style>
</head>

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


	<!-- 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">
				
				<form method="post" id="pending_withdraw" action="<?php echo $action;?>">
					<!-- Basic responsive configuration -->
					<div class="panel panel-flat">
					
						<div class="panel-heading">
							<div class="col-md-11">
								<h5 class=""><?php echo $page_title; ?></h5>
							</div>
							<div style="clear:both;"><Br></div>


							<div id="data_load" style="color:red;" align="center"></div>

							<div class="log"></div>

							<!-- <div class="col-md-2">
								<div class="heading-elements">
									<ul class="icons-list">
										
				                		<li><a data-action="collapse"></a></li>
				                		<li><a data-action="reload"></a></li>
				                		<li><a data-action="close"></a></li>
				                	</ul>
			                	</div>
			                </div> -->

						</div>
						<?php $currency_info = defaultcurrency();?>
						<?php
						$withdraw_data = $this->common_model->GetSettingall('withdraw');

            			foreach ($withdraw_data as $row) 
            			{
							$withdata[$row->site_key] = $row->site_value;
						}
						
						
						?>
						
						<table class="table datatable-responsive-withdraw table-hover">
							<col width="1%">
							<col width="10%">
	  						<col width="12%">
	  						<col width="15%">
	  						<col width="15%">
	  						<col width="15%">
	  						<col width="13%">
	  						<col width="15%">
	  						<col width="10%">
							<thead>
								<tr>
									<th></th>
									<th style="display:none;"><input type="checkbox" id="checkall"></th>
									<th class=""><?php echo lang('language_lang.lbl_date');?></th>
									<th class=""><?php echo lang('language_lang.lbl_transaction_id');?></th>
									<th class=""><?php echo lang('language_lang.lbl_user_name');?></th>
									<th class=""><?php echo lang('language_lang.menu_bank_name');?></th>
									<th class=""><?php echo lang('language_lang.menu_bank_account');?></th>
									<th class=""><?php echo lang('language_lang.menu_bank_swift');?></th>
									
									<th class=""><?php echo lang('language_lang.lbl_amount');?></th>
									<th class=""><?php echo lang('language_lang.lbl_payment_gateway');?></th>
									<th class=""><?php echo lang('language_lang.lbl_options');?></th>
								</tr>
							</thead>
							<tbody>
							<?php 
								if($history) {
									
									$row_count = count($history);
									//$this->load->library('MyEncrypt');
									
									foreach ($history as $row) {

										$coinid=$row->currency;
									
										$condition = "coid ='".$coinid."'";
										$cointable = $this->common_model->GetRow('coin_info',$condition);
										$pay_mode=$cointable->pay_mode;


										/*if($cointable->coin_type=='1')
										{
											if($pay_mode=='')
												$payment_id=$pay_mode;
											else
												$payment_id='2';	
										}

										$pay_status=$cointable->pay_status;*/



										if($row->ac_mode=='1')
										{
											if($coinid < 6)
											{
												if($pay_mode=='5')
													$payment_id='7';
												else
													$payment_id=$coinid;
											}
											else
											{
												if($pay_mode=='5')
													$payment_id='7';
												else if($pay_mode=='6')
													$payment_id='8';

											}

											$condition = "payment_id ='".$payment_id."'";
											$payments = $this->common_model->GetResults("payment_controls",$condition);
											foreach ($payments as $payments)
											{
												$form_data[$payments->payment_key] = $payments->payment_value;
											}
											$private=$form_data['private_key'];

											$public=$form_data['public_key'];
											$from=$form_data['btc_address'];
											$to=$row->address;
											$condition = "payment_key in('status') AND payment_id = '".$payment_id."'";
											$this->finance_model = model('finance_model');
											$payment = $this->finance_model->PaymentName($condition);
											
											// echo $this->db->last_query();
											// exit();

											$payment_name=$payment->payment_name;
										}
										else
										{
											if($cointable->coin_type=='1')
												$payment_name="Wire transfer";
											else
												$payment_name='Wallet Address Pay';
										}
										

										

										$currency=$row->currency;

										$find_name=$this->db->query("select * from coin_info where coid='$currency'");
										$det=$find_name->getResult();

										if($row->bank_name=='')
											$bank_name='---';
										else
											$bank_name=$row->bank_name;

										if($row->account_number=='')
											$account_number='---';
										else
											$account_number=$row->account_number;

										if($row->swift_code=='')
											$swift_code='---';
										else
											$swift_code=$row->swift_code;

										$amount1=$row->amount*100000000;
										$usid=$row->uusersid;
										$referral1=$this->db->query("SELECT * FROM uusers WHERE uusersid='".$usid."'")->getResult();
    									$user=$referral1[0];

								?>
								<tr><?php $myencrypt = new MyEncrypt; ?>
									<td></td>
								    <td style="display:none;"><input class="case" type="checkbox" name="history[]" value="<?php echo $myencrypt->encode($row->historyid);?>"></td>
									<td class=""><?php echo date('Y-m-d H:i:s', strtotime($row->date));?></td>
									<td class=""><?php echo $row->transactionid;?></td>
									<td class=""><?php echo $user->email;?></td>
									<td class=""><?php echo ucfirst($bank_name);?></td>
									<td class=""><?php echo ucfirst($account_number);?></td>
									<td class=""><?php echo ucfirst($swift_code);?></td>
									<td class=""><?php echo number_format($row->amount, $det[0]->coin_decimal, '.', '').' '.strtoupper($det[0]->coin_symbol);?></td>
									<td class=""><?php echo ucfirst($payment_name);?></td>
									<td class="text-center">

										<?php
										if($row->ac_mode=='2')
										{
										?>
	                                		<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts('<?php echo $myencrypt->encode($row->historyid);?>')" ><i class="fa fa-thumbs-up"></i></a>
	                                	<?php
	                                	}
	                                	else
	                                	{
	                                		if($withdata['with_instant']=='0')
	                                		{
	                                		?>
	                                			<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts('<?php echo $myencrypt->encode($row->historyid);?>')" ><i class="fa fa-thumbs-up"></i></a>
	                                			
	                                		<?php
											}
	                                		else
	                                		{
	                                			if($coinid < 6)
											    {
											    	if($pay_mode=='5')
											    	{
											    		?>

											    			<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts('<?php echo $myencrypt->encode($row->historyid);?>')" ><i class="fa fa-thumbs-up"></i></a>

											    		<?php


											    	}
											    	else
											    	{
											    		?>
											    		<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts1('<?php echo $myencrypt->encode($row->historyid);?>','<?php echo $private;?>','<?php echo $public?>','<?php echo $from?>','<?php echo $to;?>','<?php echo $amount1;?>','<?php echo $payment_id?>')" ><i class="fa fa-thumbs-up"></i></a>
											    		<?php

											    	}
												}
												else
												{
													if($pay_mode=='2')
													{
														?>
														<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts2('<?php echo $myencrypt->encode($row->historyid);?>','<?php echo trim($private);?>','<?php echo trim($from);?>','<?php echo trim($to);?>','<?php echo trim($cointable->contract);?>','<?php echo $row->amount;?>')" ><i class="fa fa-thumbs-up"></i></a>
														<?php

													}
													else
													{
														?>
														<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_approve_withdraw');?>"  href="javascript:void(0)" onClick="payouts('<?php echo $myencrypt->encode($row->historyid);?>')" ><i class="fa fa-thumbs-up"></i></a>
														<?php 

													}


												}

	                                			
	                                		}	

	                                	}
	                                	?>
	                                	<a class="btns" data-popup="tooltip" title="<?php echo lang('language_lang.lbl_cancel_withdraw');?>"  href="javascript:void(0)" onClick="cancelpayouts('<?php echo $myencrypt->encode($row->historyid);?>')" ><i class="fa fa-thumbs-down"></i></a>
	                                </td>
								</tr>
							<?php 

									}
								}  else { 

							?>
								<?php } ?>
							</tbody>
						</table>
					
					</div>
				</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">
		
	(function($) {

	    $(document).ready(function() {

	    	$('.datatable-responsive-withdraw').DataTable({
		        responsive: {
		            details: {
		                type: 'column',
		                target: 'tr'
		            }
		        },
		        columnDefs: [
		            {
		                className: 'control',
		                orderable: false,
		                targets:   0
		            },
		            { 
		                width: "100px",
		                targets: [8]
		            },
		            { 
		                orderable: false,
		                targets: [8]
		            },
		            { 
		                orderable: false,
		                targets: [1]
		            }
		        ],
		        order: [2, 'asc']

		    });

	    	$.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.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.success");?>',
		            theme: 'bg-success'
		        });
            <?php } ?>

				

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

				$('#checkall').on('click', function() {
					if($('#checkall').prop('checked'))
						$(':checkbox').prop('checked', true);
					else
						$(':checkbox').prop('checked', false);
				})

				$('.panel [data-action=reload1]').click(function (e) {
			        e.preventDefault();
			        var block = $(this).parent().parent().parent().parent().parent();
			        jQuery.ajax({
			            url:'<?php echo base_url();?>admin/finance/pendingwithdraw',
			            beforeSend: function() {
				            $(block).block({ 
					            message: '<i class="icon-spinner2 spinner"></i>',
					            overlayCSS: {
					                backgroundColor: '#fff',
					                opacity: 0.8,
					                cursor: 'wait',
					                'box-shadow': '0 0 0 1px #ddd'
					            },
					            css: {
					                border: 0,
					                padding: 0,
					                backgroundColor: 'none'
					            }
					        });
					        $('.panel .panel-heading').find('.dataTables_wrapper').remove();
					        
					        $('#DataTables_Table_0_wrapper').remove();
				        },
				        complete: function() {
				            $(block).unblock();
				        },
			            success : function(resp)
			            {
			            	$('.panel .panel-heading').after(resp);
			            	location.reload();
			            }
			        });
			        
			    });
			    
		});

	})(jQuery);

	function PaySelected() {

	    if(jQuery('.case:checked').length) {
	    	jQuery.ajax({
	            type: 'post',
	            url : '<?php echo base_url('admin/masspayout/pendingwithdraw');?>',
	            // data : jQuery('#pending_withdraw').serialize(),
	            data : jQuery('input[type=\'checkbox\']'),

	            beforeSend: function(){

	            	$('.panel').block({ 
			            message: '<i class="icon-spinner2 spinner"></i>',
			            overlayCSS: {
			                backgroundColor: '#fff',
			                opacity: 0.8,
			                cursor: 'wait',
			                'box-shadow': '0 0 0 1px #ddd'
			            },
			            css: {
			                border: 0,
			                padding: 0,
			                backgroundColor: 'none'
			            }
			        });
				    
			   	},
	            success : function(resp)
	            {
	                if(resp) {

	                	console.log(resp);
	                	console.log({elapsed_time});
	                }
	            },
	            complete: function(){
			    	jQuery('.panel').unblock();
			   	}
	        }); 
	    } else {
	    	console.log('no box checked');
	    }
	}

	function payouts(id) {

				

		        document.getElementById('data_load').innerHTML='Please Wait Payment Processing.......';
		


		        $.ajax({
        url: "<?php echo base_url('admin/masspayout/singleuserpay');?>",
        type: "post",
        data: {'id':id} ,
        success: function (response) {
        	document.getElementById('data_load').innerHTML='';
		
        	location.reload();
           
        },
        error: function(jqXHR, textStatus, errorThrown) {
           console.log(textStatus, errorThrown);
        }
    });
		
	}

	function payouts1(id,private1,public1,from,to,amount,payment) 
	{
		//$("#data_load").html("Please Wait Payment Processing.......");
		document.getElementById('data_load').innerHTML='Please Wait Payment Processing.......';


		var hash="";
		var bitcoin = require("bitcoinjs-lib");
		var bigi    = require("bigi");
		var buffer    = require("buffer");
		var payment=payment;

		if(payment=='1')
			var rootUrl = "https://api.blockcypher.com/v1/btc/main";
		else if(payment=='2')
			var rootUrl = "https://api.blockcypher.com/v1/eth/main";
		else if(payment=='3')
			var rootUrl = "https://api.blockcypher.com/v1/ltc/main";
		else if(payment=='4')
			var rootUrl = "https://api.blockcypher.com/v1/dash/main";
		else if(payment=='5')
			var rootUrl = "https://api.blockcypher.com/v1/dash/main";
		else
			var rootUrl = "https://api.blockcypher.com/v1/btc/test3";	

		var source = {
		  private : private1,
		  public  : public1,
		  address : from
		}

		var key   = new bitcoin.ECKey(bigi.fromHex(source.private), true);
		var dest  = null;


		var dest = {
		  address : to
		}

		var newtx = {
    		"inputs": [{"addresses": [source.address]}],
    		"outputs": [{"addresses": [dest.address], "value": 25000}]
  		};
		

		function newTransaction() {
		  var newtx = {
		    "inputs": [{"addresses": [source.address]}],
		    "outputs": [{"addresses": [dest.address], "value": 25000}]
		  }

  		return $.post(rootUrl+"/txs/new", JSON.stringify(newtx));
		}

		function signAndSend(newtx) 
		{
  			if (checkError(newtx)) return;
			newtx.pubkeys     = [];
		  	newtx.signatures  = newtx.tosign.map(function(tosign) {
		  	

		    newtx.pubkeys.push(source.public);
		    return key.sign(new buffer.Buffer(tosign, "hex")).toDER().toString("hex");
  		});
  		return $.post(rootUrl+"/txs/send", JSON.stringify(newtx)).then(function(d) {

  			 hash=d.tx.hash;
			
  	$.ajax({
        url: "<?php echo base_url('admin/masspayout/payment');?>",
        type: "post",
        data: {'id':id,'hash':hash} ,
        success: function (response) {
          
    	console.log({elapsed_time});
    	location.reload();

        },
        error: function(jqXHR, textStatus, errorThrown) {
           console.log(textStatus, errorThrown);
        },
        complete: function(){
				    	$('.panel').unblock();
				   	}

    });

  			
  		});
		}

		function checkError(msg) {
  if (msg.errors && msg.errors.length) {
    log("Errors occured!!/n" + msg.errors.join("/n"));

    return true;
  }
}

		// Chaining
		$.post(rootUrl+"/txs/new", JSON.stringify(newtx))
  		//.then(logAddr)
  		//.then(newTransaction)
  		.then(signAndSend)

  		//.done(function(data){alert('Done!'+data.tx.hash);})
   		.fail(function(errMsg) {
   				//alert('Failure!'+errMsg.responseText); console.log(errMsg);

   			document.getElementById('data_load').innerHTML=errMsg.responseText;

   	} );


  		
  		//.then(waitForConfirmation);
	}


	var isAddress = function (address) {
    // function isAddress(address) {
        if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
        // check if it has the basic requirements of an address
        return false;
    } else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) {
        // If it's all small caps or all all caps, return "true
        return true;
    } else {
        // Otherwise check each case
        return isChecksumAddress(address);
    }
}


var isChecksumAddress = function (address) {
    // Check each case
    address = address.replace('0x','');
    var addressHash = web3.sha3(address.toLowerCase());
    for (var i = 0; i < 40; i++ ) {
        // the nth letter should be uppercase if the nth digit of casemap is 1
        if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
            return false;
        }
    }
    return true;

}
	function payouts2(id,private_add,from_add,to_add,contract,amount) 
	{
		var web3 = new Web3();
    	web3.setProvider(new web3.providers.HttpProvider('https://api.myetherapi.com/eth'));
  		var abiArray=[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_value","type":"uint256"}],"name":"burnFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"}];
		
		contractAddress = contract;
		var flag=0;

		if(isAddress(contractAddress))
		{
			flag=1;	
		}
		else{
		    document.getElementById('data_load').innerHTML="contract Address Invaild for this transaction...";
		}

		if(flag=='1')
		{
			contract = web3.eth.contract(abiArray).at(contractAddress);
			var count = web3.eth.getTransactionCount(from_add);
			if(count < 10)
	       	 count="0x0"+''+count;
		
			var amount=parseFloat(5*100);
	    	var limit='0x9493';
	     	var price='0x098bca5a00';
			var count=web3.toHex(count);
			
			rawTransaction = {
		    "from": from_add,
		    "nonce": count,
		    "gasPrice":price,
		    "gasLimit": limit,
		    "to": contractAddress,
		    "value": "0x0",
		    "data": contract.transfer.getData(to_add, amount, {from: from_add}),
		    "chainId": 0x03
			};
	    	let privateKey = new EthJS.Buffer.Buffer(private_add, 'hex')
			
			let tx = new EthJS.Tx(rawTransaction);
		    tx.sign(privateKey);
		    let serializedTx = tx.serialize().toString('hex')
		    web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
		    if (!err)
		    {
		        //document.getElementById('data_load').innerHTML=hash;

		        $.ajax({
			        url: "<?php echo base_url('admin/masspayout/payment');?>",
			        type: "post",
			        data: {'id':id,'hash':hash} ,
			        success: function (response) {
			           // you will get response from your php page (what you echo or print)                 
			          
			    	console.log({elapsed_time});
			    	location.reload();

			        },
			        error: function(jqXHR, textStatus, errorThrown) {
			           console.log(textStatus, errorThrown);
			        },
			        complete: function(){
						jQuery('.panel').unblock();
					  }
				});
		    }
		    else
		    {
		    	console.log(err);
		    	document.getElementById('data_load').innerHTML=err;
		    }

			});
			document.getElementById('data_load').innerHTML="Pls Check Your console log..";
		}


		
	}


	function cancelpayouts(id) {

		swal({
            title: "<?php echo lang('language_lang.confirm_cancel_request_text');?>",
            showCancelButton: true,
            closeOnConfirm: false,
            confirmButtonColor: "#2196F3",
            cancelButtonColor: true,
            showLoaderOnConfirm: true
        },
        function(inputValue){
            if (inputValue === false) {
            	return false;
            } else {
            	window.location.href = "<?php echo base_url('admin/masspayout/Deleterequest/');?>"+'/'+id;
            }
        });

	}
	
    
	
	</script>
<script src="http://malsup.github.io/jquery.blockUI.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdn.rawgit.com/blockcypher/docs/master/bitcoinjs-min.js"></script>

</body>
</html>
