<?php
/**
 * Admin view: the Money panel of the settings screen.
 *
 * Included by admin/views/settings.php inside that tab's own form, so the
 * closures and the $s array defined there are in scope here.
 *
 * @package BitForgeNet_Guest_Tickets
 */

defined( 'ABSPATH' ) || exit;

// This file is a template: it is included from a method -- never at file
// scope -- so everything declared here belongs to that method's variable
// scope and not to the global one. PHPCS reads each file on its own and has
// no way to see where the include happens, so it reads these as globals.
// Stated once, for the whole file, per this plugin's suppression rule.
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?>
	<div class="bfnet-panel">
		<div class="bfnet-panel__head"><h2><?php esc_html_e( 'Money', 'bitforgenet-guest-tickets' ); ?></h2></div>
		<div class="bfnet-panel__body">
			<div class="bfnet-row">
				<div class="bfnet-field">
					<label for="s-currency"><?php esc_html_e( 'Currency', 'bitforgenet-guest-tickets' ); ?></label>
					<select id="s-currency" name="bfnet_settings[currency]">
						<?php foreach ( $currencies as $code => $meta ) : ?>
							<option value="<?php echo esc_attr( $code ); ?>" <?php selected( $s['currency'], $code ); ?>><?php echo esc_html( $meta['label'] ); ?></option>
						<?php endforeach; ?>
					</select>
				</div>
				<div class="bfnet-field">
					<label for="s-pos"><?php esc_html_e( 'Symbol position', 'bitforgenet-guest-tickets' ); ?></label>
					<select id="s-pos" name="bfnet_settings[currency_position]">
						<option value="suffix_space" <?php selected( $s['currency_position'], 'suffix_space' ); ?>>120.00 $</option>
						<option value="suffix" <?php selected( $s['currency_position'], 'suffix' ); ?>>120.00$</option>
						<option value="prefix" <?php selected( $s['currency_position'], 'prefix' ); ?>>$120.00</option>
						<option value="prefix_space" <?php selected( $s['currency_position'], 'prefix_space' ); ?>>$ 120.00</option>
					</select>
				</div>
			</div>
			<div class="bfnet-row bfnet-row--3">
				<div class="bfnet-field">
					<label for="s-dec"><?php esc_html_e( 'Decimals', 'bitforgenet-guest-tickets' ); ?></label>
					<input type="number" id="s-dec" name="bfnet_settings[decimals]" min="0" max="3" value="<?php echo (int) $s['decimals']; ?>">
				</div>
				<div class="bfnet-field">
					<label for="s-decsep"><?php esc_html_e( 'Decimal separator', 'bitforgenet-guest-tickets' ); ?></label>
					<input type="text" id="s-decsep" name="bfnet_settings[decimal_separator]" maxlength="1" value="<?php echo esc_attr( $s['decimal_separator'] ); ?>">
				</div>
				<div class="bfnet-field">
					<label for="s-thsep"><?php esc_html_e( 'Thousands separator', 'bitforgenet-guest-tickets' ); ?></label>
					<input type="text" id="s-thsep" name="bfnet_settings[thousand_separator]" maxlength="1" value="<?php echo esc_attr( $s['thousand_separator'] ); ?>">
				</div>
			</div>
		</div>
	</div>
