<?php
/**
 * @var string $exemption
 * @var string $zero_rate_type
 * @var string $np_rate_type
 */

use WPDesk\FakturyKSEF\Repository\PluginSettings;
use WPDesk\FakturyKSEF\Services\DocumentKSeFSettings;

wp_nonce_field( 'fiksef_save_meta_box_data', 'fiksef_meta_box_nonce' );

$zero_rates_options = [
	'auto' => esc_html__( 'Auto', 'ksef-for-flexible-invoices' ),
	'kr'   => esc_html__( '0% KR', 'ksef-for-flexible-invoices' ),
	'wdt'  => esc_html__( '0% WDT', 'ksef-for-flexible-invoices' ),
	'ex'   => esc_html__( '0% EX', 'ksef-for-flexible-invoices' ),
];

$np_rates_options = [
	'np I' => esc_html__( 'NP I', 'ksef-for-flexible-invoices' ),
	'np II'   => esc_html__( 'NP II', 'ksef-for-flexible-invoices' ),
];
?>
<div class="form-wrap option-form-wrap">
	<div class="form-field">
		<label
			for="<?php esc_attr_e( PluginSettings::EXEMPTION ); ?>"><?php esc_html_e( 'Exemption reason', 'ksef-for-flexible-invoices' ); ?></label>
		<textarea name="ksef_params[<?php esc_attr_e( PluginSettings::EXEMPTION ); ?>]"
				  id="<?php esc_attr_e( PluginSettings::EXEMPTION ); ?>"
		><?php esc_html_e( $exemption ); ?></textarea>
	</div>
	<div class="form-field">
		<label
			for="<?php esc_attr_e( DocumentKSeFSettings::ZERO_RATE_TYPE ); ?>"><?php esc_html_e( 'Zero rate type', 'ksef-for-flexible-invoices' ); ?></label>
		<select name="ksef_params[<?php esc_attr_e( DocumentKSeFSettings::ZERO_RATE_TYPE ); ?>]"
				id="<?php esc_attr_e( DocumentKSeFSettings::ZERO_RATE_TYPE ); ?>"
		><?php foreach ( $zero_rates_options as $key => $value ): ?>
				<option
					value="<?php echo esc_attr( $key ); ?>" <?php selected( $zero_rate_type, $key ); ?>><?php echo esc_html( $value ); ?></option>
			<?php endforeach; ?>
		</select>
	</div>
	<div class="form-field">
		<label
			for="<?php esc_attr_e( PluginSettings::DEFAULT_NP_RATE_TYPE ); ?>"><?php esc_html_e( 'Not subject to VAT rate type', 'ksef-for-flexible-invoices' ); ?></label>
		<select name="ksef_params[<?php esc_attr_e( PluginSettings::DEFAULT_NP_RATE_TYPE ); ?>]"
				id="<?php esc_attr_e( PluginSettings::DEFAULT_NP_RATE_TYPE ); ?>"
		><?php foreach ( $np_rates_options as $key => $value ): ?>
				<option
					value="<?php echo esc_attr( $key ); ?>" <?php selected( $np_rate_type, $key ); ?>><?php echo esc_html( $value ); ?></option>
			<?php endforeach; ?>
		</select>
	</div>
</div>

