<?php
/**
 * This template show the modal to edit or add a new receive
 *
 * @package YITH\PayPalPayouts\Admin
 * @since 2.0.0
 * @author YITH <plugins@yithemes.com>
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<script type="text/template" id="tmpl-yith-payouts-receiver-modal-content">
	<input type="hidden" id="yith_payouts_option_index" name="yith_payouts_option_index" value="{{data.index}}">
	<div class="yith-payouts-receiver-form-content">
		<div class="receiver-customer-wrapper">
			<div class="customer-navigation">
				<?php
				// translators: %1$s and %3$s are placeholder for a html opening anchor, %2$s is a placeholder for closing anchor.
				echo wp_kses_post( sprintf( __( '%1$sSelect a user%2$s or %3$screate a new user profile%2$s', 'yith-paypal-payouts-for-woocommerce' ), '<a href="#select-customer" class="current">', '</a>', '<a href="#create-customer">' ) );
				?>
			</div>
			<div id="select-customer">
				<?php

				yith_plugin_fw_get_field(
					array(
						'id'       => 'yith_payouts_search_user',
						'type'     => 'ajax-customers',
						'multiple' => false,
						'data'     => array(
							'exclude' => wp_json_encode( apply_filters( 'yith_paypal_payoyts_exclude_customer_ids', array() ) ),
						),
					),
					true
				);
				?>
			</div>
			<div id="create-customer" class="receiver-fields-container" style="display: none;">
				<div class="receiver-field yith-plugin-fw-panel-wc-row ">
					<label for="new_customer_first_name"><?php esc_html_e( 'First name', 'yith-paypal-payouts-for-woocommerce' ); ?></label>
					<div class="yith-plugin-fw-field-wrapper yith-plugin-fw-text-field-wrapper">
						<input type="text" id="new_customer_first_name" name="new_customer_first_name" class="" value="">
					</div>
				</div>
				<div class="receiver-field yith-plugin-fw-panel-wc-row ">
					<label for="new_customer_last_name"><?php esc_html_e( 'Last name', 'yith-paypal-payouts-for-woocommerce' ); ?></label>
					<div class="yith-plugin-fw-field-wrapper yith-plugin-fw-text-field-wrapper">
						<input type="text" id="new_customer_last_name" name="new_customer_last_name" class="" value="">
					</div>
				</div>
				<div class="receiver-field yith-plugin-fw-panel-wc-row ">
					<label for="new_customer_username"><?php esc_html_e( 'User name', 'yith-paypal-payouts-for-woocommerce' ); ?></label>
					<div class="yith-plugin-fw-field-wrapper yith-plugin-fw-text-field-wrapper">
						<input type="text" id="new_customer_username" name="new_customer_username" class="" value="">
					</div>
				</div>
				<div class="receiver-field yith-plugin-fw-panel-wc-row ">
					<label for="new_customer_email"><?php esc_html_e( 'Email', 'yith-paypal-payouts-for-woocommerce' ); ?><abbr class="required">*</abbr> </label>
					<?php
					yith_plugin_fw_get_field(
						array(
							'id'   => 'new_customer_email',
							'type' => 'email',
						),
						true
					);
					?>
				</div>
				<div class="receiver-field">
					<button class="set-password yith-plugin-fw__button--secondary"><?php esc_html_e( 'Generate Password', 'yith-paypal-payouts-for-woocommerce' ); ?></button>
					<div class="password-field-wrap" style="display: none;">
						<label for="new_customer_generate_password"><?php esc_html_e( 'Password', 'yith-paypal-payouts-for-woocommerce' ); ?></label>
						<input type="text" name="new_customer_generate_password" id="new_customer_generate_password" value="<?php echo esc_attr( wp_generate_password() ); ?>"/>
					</div>
				</div>
			</div>
			<div id="payment-info" class="receiver-fields-container">
				<div class="receiver-field yith-plugin-fw-panel-wc-row">
					<label for="customer_paypal_email"><?php esc_html_e( 'PayPal Email', 'yith-paypal-payouts-for-woocommerce' ); ?><abbr class="required">*</abbr> </label>
					<?php
					yith_plugin_fw_get_field(
						array(
							'id'    => 'customer_paypal_email',
							'type'  => 'email',
							'value' => '{{data.paypal_email}}',
						),
						true
					);
					?>
				</div>
				<div class="receiver-field yith-plugin-fw-panel-wc-row">
					<label for="customer_commission_rate"><?php esc_html_e( 'Commission Rate %', 'yith-paypal-payouts-for-woocommerce' ); ?><abbr class="required">*</abbr> </label>
					<?php
					yith_plugin_fw_get_field(
						array(
							'id'    => 'customer_commission_rate',
							'type'  => 'number',
							'min'   => 0,
							'max'   => 100,
							'step'  => 0.1,
							'value' => '{{data.commission_rate}}',
						),
						true
					);
					?>
				</div>
			</div>
		</div>
	</div>
</script>
