<?php
/**
 * GFB Calendar Appointment View
 *
 * @package GFB.
 */

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

$appointment_status = get_post_meta( $appointment_id, 'status', true );
$wp_user = get_post_meta( $appointment_id, 'wp_user', true );
$user = get_userdata($wp_user);
if ( $user ) {
	$user_first_name = $user->first_name;
} else {
	$user_first_name = '';
}
$staff_id = get_post_meta( $appointment_id, 'staff_id', true );
$staffData = APBGF_Staff::get_staff_by_id( $staff_id );
$staff_name = get_the_title( $staff_id );
$service_id = get_post_meta( $appointment_id, 'service_id', true );
$service_name = get_the_title($service_id);
$location_id = get_post_meta( $appointment_id, 'location_id', true );
if ( 'all' != $location_id ) {
	$location_name = get_the_title($location_id);
} else {
	$location_name = $location_id;
}
$time = get_post_meta( $appointment_id, 'time', true );
$time = apply_filters('apbgf_staff_time_slot', $time, $staffData);
$fullday_or_custom = ! empty( get_post_meta($appointment_id, 'booking_type', true) ) ? get_post_meta($appointment_id, 'booking_type', true) : $time;
?>
<div class="apbgf-appointment-block  apbgf-tooltip">
	<span class="apbgf-<?php echo esc_attr($appointment_status); ?>">
	<?php
		// translators: %1$s is for appointment id
		 printf(esc_html__('App # %1$s', 'appointment-and-booking-for-gravity-forms'), esc_attr( $appointment_id ) );
	?>
	</span>
	<span class="apbgf-tooltip-text">
		<?php
		printf(
			// Translators: %1$s is customer, %2$s is <br>, %3$s is location, %4$s is <br>, %5$s is service, %6$s is <br>, %7$s is staff, %8$s is <br>, %9$s is time
			esc_html__( 'Customer: %1$s %2$s Location: %3$s %4$s Service: %5$s %6$s Staff: %7$s %8$s Time: %9$s', 'appointment-and-booking-for-gravity-forms' ),
			esc_html( $user_first_name ),
			'<br/>',
			esc_html( $location_name ),
			'<br/>',
			esc_html( $service_name ),
			'<br/>',
			esc_html( $staff_name ),
			'<br/>',
			esc_html( $fullday_or_custom )
		);
		?>
	</span>
</div>