<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

/**
 * ============================================
 * FILE: templates/emails/employee/appointment-completed.php
 * Employee Completed Appointment Email Template
 * ============================================
 */
?>
<?php
do_action( 'rtrb_get_email_header', $email, $booking );
do_action( 'rtrb_email_before_content', $email, $booking );
do_action( 'rtrb_email_content_start', $email, $booking );
?>

	<!-- Email Content Text -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td class="main-content">
				<?php if ( ! empty( $settings['additional_content'] ) ) : ?>
					<?php echo wp_kses_post( wpautop( wptexturize( $settings['additional_content'] ) ) ); ?>
				<?php else : ?>
					<p style="margin: 0;"><?php esc_html_e( 'An appointment has been marked as completed. Please find the details below for your records.', 'radius-booking' ); ?></p>
				<?php endif; ?>
			</td>
		</tr>
	</table>

	<!-- Customer Info Box -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; margin: 16px 0;">
		<tr>
			<td style="padding: 16px;">
				<p style="margin: 0 0 8px 0; font-weight: 600; color: #111827;">
					<?php esc_html_e( 'Customer Information:', 'radius-booking' ); ?>
				</p>
				<p style="margin: 0 0 4px 0; font-size: 14px; color: #374151;">
					<strong><?php esc_html_e( 'Name:', 'radius-booking' ); ?></strong> <?php echo esc_html( $booking['customer']->customer_info['name'] ?? '' ); ?>
				</p>
				<p style="margin: 0; font-size: 14px; color: #374151;">
					<strong><?php esc_html_e( 'Email:', 'radius-booking' ); ?></strong> <?php echo esc_html( $booking['customer']->customer_info['email'] ?? '' ); ?>
				</p>
			</td>
		</tr>
	</table>

<?php do_action( 'rtrb_email_before_booking_details', $email, $booking ); ?>

	<!-- Booking Details Box -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="booking-details">
		<tr>
			<td style="padding: 20px;">
				<?php do_action( 'rtrb_email_booking_details', $email, $booking ); ?>
			</td>
		</tr>
	</table>

<?php do_action( 'rtrb_email_after_booking_details', $email, $booking ); ?>

	<!-- Status Badge -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td align="center" style="padding: 16px 0;">
			<span style="background-color: #d1fae5; color: #065f46; padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block;">
				✅ <?php esc_html_e( 'COMPLETED', 'radius-booking' ); ?>
			</span>
			</td>
		</tr>
	</table>

	<!-- Earnings Summary -->
<?php if ( isset( $booking['customer']->price ) ) : ?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); border: 1px solid #10b981; border-radius: 6px; margin: 16px 0;">
		<tr>
			<td style="padding: 16px; text-align: center;">
				<p style="margin: 0 0 4px 0; font-size: 12px; color: #065f46; font-weight: 500;">
					<?php esc_html_e( 'Service Payment', 'radius-booking' ); ?>
				</p>
				<p style="margin: 0; font-size: 24px; color: #047857; font-weight: bold;">
					<?php echo esc_html( get_rtrb_currency_symbol() . number_format( $booking['customer']->price, 2 ) ); ?>
				</p>
			</td>
		</tr>
	</table>
<?php endif; ?>

<?php do_action( 'rtrb_email_before_button', $email, $booking ); ?>

<?php if ( ! empty( $settings['button_text'] ) ) : ?>
	<?php do_action( 'rtrb_email_button', $email, $booking, $settings ); ?>
<?php endif; ?>

<?php
do_action( 'rtrb_email_content_end', $email, $booking );
do_action( 'rtrb_email_after_content', $email, $booking );
do_action( 'rtrb_get_email_footer', $email, $booking );