<?php
if (!defined('ABSPATH')) exit;

// add_action('admin_init', 'flexyconsent_settings_updateUserSettingsPage');
// function flexyconsent_settings_updateUserSettingsPage()
// {
// 	global $flexyconsentSettings;
// 	$pageNameMain = 'updateUserSettingsPage';
// 	$pageName = flexyconsent_getPageName($pageNameMain);
// 	$sectionName = flexyconsent_getSectionName($pageNameMain);
// }

function flexyconsent_updateUserSettingsPage()
{
	$pageNameMain = 'updateUserSettingsPage'; 
	// $reqiured_text =  esc_html(' (' . esc_html__('Required', 'flexyconsent') . ')');
	$reqiured_text =  ' (' . esc_html__('Required', 'flexyconsent') . ')'; ?>
	<div class="container py-3">
		<div class="row">
			<div class="col-12 text-center">
				<?php flexyconsent_get_top_section(); ?>
			</div>
			<div class="col-12">
				<form method='post' id="<?php echo esc_attr($pageNameMain); ?>" class="d-table mx-auto my-3 flexyconsent-form">
					<table class="form-table" role="presentation">
						<h4 class="text-center mb-0"><?php esc_html_e("User Info", "flexyconsent"); ?></h4>						
						<tbody>
							<tr>
								<th scope="row"><?php esc_html_e('Email', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="email" name="email" placeholder='<?php echo esc_attr(__('Email', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Company', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="company-name" name="company-name" placeholder='<?php echo esc_attr(__('Company Name', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Full Name', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="full-name" name="full-name" placeholder='<?php echo esc_attr(__('Full Name', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
						</tbody>
					</table>

					<table class="form-table" role="presentation">
						<h4 class="text-center mb-0"><?php esc_html_e("Invoice Info", "flexyconsent"); ?></h4>
						<tbody>
							<tr>
								<th scope="row"><?php esc_html_e('Business Account', 'flexyconsent'); ?></th>
								<td>
									<input class="w-auto" type="checkbox" id="business" name="business">
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Name On Invoice', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="name-on-invoice" name="name-on-invoice" placeholder='<?php echo esc_attr(__('Name On Invoice', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Address Line 1', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="address-line-1" name="address-line-1" maxlength="35" placeholder='<?php echo esc_attr(__('Address Line 1', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Address Line 2', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="address-line-2" name="address-line-2" maxlength="35" placeholder='<?php esc_attr_e('Address Line 2', 'flexyconsent'); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('City', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="city" name="city" placeholder='<?php echo esc_attr(__('City', 'flexyconsent') . $reqiured_text); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Post Code', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="postcode" name="postcode" placeholder='<?php esc_attr_e('Post Code', 'flexyconsent'); ?>'>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('Country', 'flexyconsent'); ?></th>
								<td>
									<select id="countries" name="countries">
										<option value="0" selected disabled><?php esc_html_e('Select', 'flexyconsent');?></option>
									</select>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php esc_html_e('VAT Number', 'flexyconsent'); ?></th>
								<td>
									<input type="text" id="vatnumber" name="vatnumber" placeholder='<?php esc_attr_e('VAT Number', 'flexyconsent'); ?>'>
								</td>
							</tr>
						</tbody>
					</table>
					<input type="hidden" id="id" name="id">
					<input type="hidden" id="userId" name="userId">

					<?php settings_fields($pageNameMain);
					do_settings_sections($pageNameMain); ?>
					<div class="d-flex justify-content-between">
						<a class="button button-back" href="<?php echo esc_url(flexyconsent_generateGoPage('userSettingsPage')); ?>"><?php esc_html_e('Cancel', 'flexyconsent'); ?></a>
						<button type="submit" id="submit" class="button button-primary"><?php esc_html_e('Save', 'flexyconsent'); ?></button>
					</div>
				</form>
			</div>
			<div class="col-12 text-center">
				<?php flexyconsent_get_bottom_section(); ?>
			</div>
		</div>
	</div>


<?php
}
