<?php
/**
 * Leave request rejected (to employee) email body.
 *
 * @package MerchantKits\AttendanceManager
 *
 * @var array $leave    Leave row.
 * @var array $employee Employee row.
 */

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

$name   = isset( $employee ) ? MKAM_Employee::full_name( $employee ) : '';
$policy = isset( $leave['leave_type'] ) ? MKAM_Leave::get_policy( $leave['leave_type'] ) : null;
$label  = $policy ? $policy['label'] : ( $leave['leave_type'] ?? '' );
?>
<?php /* translators: %s: employee name. */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'merchantkits-attendance-manager' ), esc_html( $name ) ); ?></p>
<p style="color:#dc2626;font-weight:bold;"><?php esc_html_e( 'Your leave request has been rejected.', 'merchantkits-attendance-manager' ); ?></p>
<ul>
	<li><strong><?php esc_html_e( 'Type:', 'merchantkits-attendance-manager' ); ?></strong> <?php echo esc_html( $label ); ?></li>
	<li><strong><?php esc_html_e( 'Dates:', 'merchantkits-attendance-manager' ); ?></strong> <?php echo esc_html( ( $leave['start_date'] ?? '' ) . ' → ' . ( $leave['end_date'] ?? '' ) ); ?></li>
</ul>
<?php if ( ! empty( $leave['review_note'] ) ) : ?>
	<p><strong><?php esc_html_e( 'Reason:', 'merchantkits-attendance-manager' ); ?></strong> <?php echo esc_html( $leave['review_note'] ); ?></p>
<?php endif; ?>
