<?php
/**
 * Template file for payment option and fbbttm_place_order button
 * 
 */ 
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

global $fbbttm_helperobj,$fbbttm_cartobj,$cartsummary,$fbbttm_fullcartinfo,$userid,$fbbttm_checkoutobj;
$userid = $fbbttm_helperobj->fbbttm_check_user_loginornot();

$stripe = '';
$paypal = $grandtotal ='';


$availmethod = $fbbttm_checkoutobj->fbbttm_get_payment_method_list();


if(!empty($cartsummary)){
	 $grandtotal = $cartsummary['grandtotal'];
}

global $fbbttm_settingdata;

?>


<form id="fbbttm_form_place_order" class="fbbttm_form_place_order hide" method="post"> 
<?php
    // Noncename needed to verify where the data originated
    wp_nonce_field( 'fbbttm_meta_box_nonce', 'fbbttm_meta_box_noncename' );
?>
 <input type="hidden" name="userid" id="fbbttmuserid" value="<?php echo esc_html($userid);?>"/>
 <input type="hidden" name="pay_user_id" id="pay_user_id" value="<?php echo esc_html($userid);?>"/>
 <input type="hidden" name="action_name" value="payment_update">
 <input type="hidden" name="fbbttm_currency" id="fbbttm_currency" value="<?php echo esc_html(FBBTTM_CURRENCY);?>">
 <input type="hidden" name="current_url" id="redirect_url" value="<?php echo esc_html(FBBTTM_ORDERRECIEVED_PAGE_LINK);?>">
 <input type="hidden" name="fbbttm_url" id="fbbttm_url" value="<?php echo esc_url(FBBTTM_URL);?>">
 <input type="hidden" name="pay_service_name" id="pay_service_name" value="<?php echo esc_html('FoodBoxBooker');?>">
 <input type="hidden" name="pay_service_price" id="pay_service_price" value="<?php echo esc_html($grandtotal);?>">
 <input type="hidden" name="orderidtemp" id="orderidtemp" value="">

 <div class="fbbttm-checkout-payment-button"> 
	<div class="fbbttm-paymentmethod">
		<div class="">
			<label><input type="radio" name="fbbttm-payment-method" value="<?php echo esc_html__('cod','foodboxbooker');?>">
				<span><?php echo esc_html__('Cash on delivery','foodboxbooker');?></span>
			</label>
			</div>
			

			</div>	
             <div class="fbbttm-error fbbttm-payment-method">
            </div>
<div class="">
                <button class="fbbttm_place_order" id="fbbttm_place_order" data-id="<?php echo esc_html($userid);?>">
                    <?php echo esc_html__('Place Order','foodboxbooker');?>
                </button>
                <div class="fbbttm-loader hide"></div> 
            </div>
            </div>
</form>