<?php 

function pm_payment_method_cb() {
	if(!($token = verify_token($_POST[SALT]))) {
		do_action("_display_message", ["msg" => '<i class="fa fa-warning"></i> Sorry, it seems that you submitted your request through invalid token. Please try again later.']);
		return;
	}
	$args = $_POST;
	$args['referer'] = str_replace(get_option('home_url'), '', $_SERVER['HTTP_REFERER']);
	$args[SALT] = $token;
	$invoice = new pm_invoice($args['user_id']);
	$invoice->set_invoice_by_number($args['in_ref']);
	?>
	<style type="text/css">
		.payment-method img {
			border-radius: 0% !important;
			display: grid;
			grid-template-columns: auto auto;
		}
		.payment-method div.each {
			border-bottom: 1px solid #f1f2f7;
			padding-bottom: 5px;
			padding-top: 10px;
			/* min-height: 300px; */
		}
		.payment-method .submit-payment {
			display: flex;
		}
		.submit-payment:focus {
			text-decoration: none;
		}
	</style>
	<div class="row">
		<div class="col-md-8">
			<div class="panel panel-custom">
			    <div class="panel-heading">
			        <h3>These are available payment gateways</h3>
			        <a href="invoice?id=<?php echo $invoice->invoice->id ?>" style="float:right;" class="btn btn-primary">View Invoice</a>
			    </div>
		        <div class="panel-body instruction">
		        	<div class="box-body no-padding">
		                <ul class="users-list clearfix list-unstyled payment-method">
		                    
		                    <?php do_action('payment_method_display', $args); ?>
		                    
		                </ul>
		                  <!-- /.users-list -->
		            </div>
		        </div>
		    </div>
		</div>
		<div class="col-md-4">
			<?php do_action('pm_right_col'); ?>
		</div>
	</div>
	
	<?php
	global $post_meta;
	add_page_javascript('contents/plugins/payment_module/js/pm-template.js');
}