<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

$job_id        = ! empty( $args['p_id'] ) ? $args['p_id'] : 0;
$proposal_id   = ! empty( $args['proposal_id'] ) ? $args['proposal_id'] : 0;
$template_args = array(
	'job_id'      => $job_id,
	'proposal_id' => $proposal_id,
);
$allowed_html  = gigneo_allowed_html_tags();
$cover_letter  = gigneo_post_meta( $proposal_id, '_gigneo_pm_cover_letter' );
?>

<div class="gn-section gn-cover-letter">
	<div class="gn-head">
		<h2 class="gn-title"><?php esc_html_e( 'Cover letter', 'gigneo' ); ?></h2>
		<p class="gn-description"><?php esc_html_e( 'Introduce yourself, highlight relevant experience, and explain how you’ll approach and solve the client’s project.', 'gigneo' ); ?></p>
	</div>
	<div class="gn-body">
		<fieldset class="gn-form-fields">
			<div class="gn-form-field gn-details-fields gn-wysiwyg-editor-two">
				<?php
				wp_editor(
					wp_kses( $cover_letter, $allowed_html ),
					'gn-cover-letter',
					array(
						'textarea_name' => 'cover_letter',
						'media_buttons' => false,
						'quicktags'     => false,
						'textarea_rows' => 10,
						'editor_class'  => 'gn-wp-editor gn-required-field',
						'tinymce'       => array(
							'toolbar1'                => 'bold italic bullist numlist link unlink',
							'toolbar2'                => '',
							'plugins'                 => 'lists link',
							'directionality'          => is_rtl() ? 'rtl' : 'ltr',
							'forced_root_block'       => false,
							'force_br_newlines'       => true,
							'force_p_newlines'        => false,
							'convert_newlines_to_brs' => true,
							'valid_elements'          => 'strong/b,em/i,ul,ol,li,a[href|target],br,hr',
							'invalid_elements'        => 'p,pre,h1,h2,h3,h4,h5,h6,img',
							'content_style'           => 'body { font-size: 14px; background-color: transparent; font-family: var(--gigneo-primary-font,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji) }',
						),
					)
				);
				?>
			</div>
		</fieldset>
	</div>
</div>