<?php
	/**
	 * Admin Notification - Sub Tab View
	 *
	 * @package EASYFUA
	 */

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

	$lang        = easyfua_lang();
	$option_name = 'easyfua_settings' . $lang;
	$notif       = easyfua_settings( 'admin_notif' );

	// Message body template.
	$message_body = isset( $notif['message'] ) && ! empty( $notif['message'] ) ? $notif['message'] : null;
if ( empty( $message_body ) ) {
	$message_body = easyfua_email_template( 'admin-notification' );
}
?>
<table class="form-table easyfua-email-templates" role="presentation">
	<tbody>
		<tr>
			<th scope="row"><?php esc_html_e( 'To', 'easy-file-upload-approval' ); ?></th>
			<td class="easyfua-text-info">
				<input value="<?php echo isset( $notif['email'] ) ? esc_attr( $notif['email'] ) : ''; ?>" type="text" name="<?php echo esc_attr( $option_name ); ?>[admin_notif][email]" placeholder="<?php esc_attr_e( 'Separate emails by comma.', 'easy-file-upload-approval' ); ?>" class="regular-text">
				<p class="description"><?php esc_html_e( 'Tag', 'easy-file-upload-approval' ); ?>: <code>{admin_email}</code></p>
			</td>
		</tr>
		<tr>
			<th scope="row"><?php esc_html_e( 'Subject', 'easy-file-upload-approval' ); ?></th>
			<td class="easyfua-text-info">
				<?php
					// translators: %s will be replaced with file or files.
				?>
				<input value="<?php echo isset( $notif['subject'] ) ? esc_attr( $notif['subject'] ) : ''; ?>" type="text" name="<?php echo esc_attr( $option_name ); ?>[admin_notif][subject]" placeholder="<?php esc_attr_e( 'New &#37;s submission', 'easy-file-upload-approval' ); ?>" class="regular-text">
				<p class="description">
					<?php
						// translators: %s use and replace tag with file or files.
						esc_html_e( '%s will be replaced with "file" or "files" automatically.', 'easy-file-upload-approval' );
					?>
				</p>
			</td>
		</tr>
		<tr>
			<th scope="row"><?php esc_html_e( 'Headers', 'easy-file-upload-approval' ); ?></th>
			<td class="easyfua-text-info">
				<textarea rows="3" name="<?php echo esc_attr( $option_name ); ?>[admin_notif][headers]" placeholder="From: Name &lt;no-reply@yourdomain.com&gt;" cols="40" class="regular-text"><?php echo isset( $notif['headers'] ) ? esc_textarea( wp_specialchars_decode( $notif['headers'] ) ) : ''; ?></textarea>
				<p class="description">
					<?php esc_html_e( 'Use the header format below. Each header must be on a new line.', 'easy-file-upload-approval' ); ?>
				</p>
				<span class="easyfua-admin-tags">
					From: Name &lt;no-reply@yourdomain.com&gt;<br>
					Reply-To: support@yourdomain.com<br/>
					Cc: manager@yourdomain.com
				</span>
			</td>
		</tr>
		<tr>
			<th scope="row"><?php esc_html_e( 'Message Body', 'easy-file-upload-approval' ); ?></th>
			<td class="easyfua-text-info">
				<textarea rows="15" name="<?php echo esc_attr( $option_name ); ?>[admin_notif][message]" cols="40" class="regular-text"><?php echo ! empty( $message_body ) ? wp_kses_post( $message_body ) : ''; ?></textarea>
				<p class="description">
					Tags:
					<code>
						{display_name}, {email}, {submitted_at}, {total_files}, {submission_url}, {site_name}
					</code>
				</p>
			</td>
		</tr>
	</tbody>
</table>