<?php
/**
 * Created by PhpStorm.
 * User: Hani
 * Date: 3/13/2019
 * Time: 3:33 PM
 */

if (!defined( 'ABSPATH' )) exit;

wp_register_style( 'woo2app_style', WOO2APP_CSS_URL.'woo2app_style.css'  );
wp_enqueue_style( 'woo2app_style'.WOO2APP_FILES_VER );
if(get_locale() == 'fa_IR'){
	wp_register_style('myfont', WOO2APP_CSS_URL . 'font.css');
	wp_enqueue_style( 'myfont'.WOO2APP_FILES_VER);
}

if(isset($_POST['submit_setting'])){
	$order_setting = array();
	$order_setting = get_option('woo2app_order_form');
	if(!is_array($order_setting)){
		$order_setting = array();
		$order_setting['save_order_form'] = 1 ;
		update_option('woo2app_order_form' , $order_setting);
	}
	$order_setting = array();
	$order_setting['save_order_form'] = ($_POST['save_order_form']);
	update_option('woo2app_order_form' , $order_setting);

}


$order_setting = array();
$order_setting = get_option('woo2app_order_form');
if(!is_array($order_setting)){
	$order_setting = array();
	$order_setting['save_order_form'] = 1 ;
	update_option('woo2app_order_form' , $order_setting);
}

?>

<div class="wrap">
	<form method="post">
        <?php wp_nonce_field('woo2app-admin', 'woo2app-admin'); ?>
        <table class="form-table">
			<tbody>
			<tr valign="top" class="" >
				<th scope="row" class="titledesc">
                    <?php _e('Fill Checkout Form', 'woo2app'); ?>
				</th>
				<td class="forminp">
					<select class="regular-text" name="save_order_form">
                        <option value="1" <?= selected($order_setting['save_order_form'], 1) ?>>  <?php _e('Save By User Info', 'woo2app'); ?> </option>
                        <option value="2" <?= selected($order_setting['save_order_form'], 2) ?>>  <?php _e('Empty form', 'woo2app'); ?> </option>
                        <option value="3" <?= selected($order_setting['save_order_form'], 3) ?>> <?php _e('Save Automatically', 'woo2app'); ?> </option>
                        <option value="4" <?= selected($order_setting['save_order_form'], 4) ?>>  <?php _e('Save By Asking ?', 'woo2app'); ?></option>
					</select>
				</td>
			</tr>
			</tbody>
		</table>
        <input name="submit_setting" class="button button-primary" value="<?php _e('Save Changes', 'woo2app'); ?>"
               type="submit">
	</form>
</div>

