<?php
/**
 * Single Event Meta (Details) Template
 *
 * Override this template in your own theme by creating a file at:
 * [your-theme]/tribe-events/modules/meta/details.php
 *
 * @package TribeEventsCalendar
 */
?>

<div class="tribe-events-meta-group tribe-events-meta-group-details column dt-sc-one-half  space first">
	<h3 class="tribe-events-single-section-title"> <?php _e('Details', 'tribe-events-calendar' ) ?> </h3>
	<dl>

		<?php
		do_action( 'tribe_events_single_meta_details_section_start' );

		$time_format = get_option( 'time_format', TribeDateUtils::TIMEFORMAT );
		$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');

		$start_datetime = tribe_get_start_date();
		$start_date = tribe_get_start_date( null, false );
		$start_time = tribe_get_start_date( null, false, $time_format );
		$start_ts = tribe_get_start_date( null, false, TribeDateUtils::DBDATEFORMAT );

		$end_datetime = tribe_get_end_date();
		$end_date = tribe_get_end_date( null, false );
		$end_time = tribe_get_end_date( null, false,  $time_format );
		$end_ts = tribe_get_end_date( null, false, TribeDateUtils::DBDATEFORMAT );

		// All day (multiday) events
		if ( tribe_event_is_all_day() && tribe_event_is_multiday() ) :
		?>

			<dt> <?php _e( 'Start:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr updated published dtstart" title="<?php esc_attr_e( $start_ts ) ?>"> <?php esc_html_e( $start_date ) ?> </abbr> </dd>

			<dt> <?php _e( 'End:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr dtend" title="<?php esc_attr_e( $end_ts ) ?>"> <?php esc_html_e( $end_date ) ?> </abbr> </dd>

		<?php
		// All day (single day) events
		elseif ( tribe_event_is_all_day() ):
			?>

			<dt> <?php _e( 'Date:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr updated published dtstart" title="<?php esc_attr_e( $start_ts ) ?>"> <?php esc_html_e( $start_date ) ?> </abbr> </dd>

		<?php
		// Multiday events
		elseif ( tribe_event_is_multiday() ) :
			?>

			<dt> <?php _e( 'Start:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr updated published dtstart" title="<?php esc_attr_e( $start_ts ) ?>"> <?php esc_html_e( $start_datetime ) ?> </abbr> </dd>

			<dt> <?php _e( 'End:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr dtend" title="<?php esc_attr_e( $end_ts ) ?>"> <?php esc_html_e( $end_datetime ) ?> </abbr> </dd>

		<?php
		// Single day events
		else :
			?>

			<dt> <?php _e( 'Date:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr updated published dtstart" title="<?php esc_attr_e( $start_ts ) ?>"> <?php esc_html_e( $start_date ) ?> </abbr> </dd>

			<dt> <?php _e( 'Time:', 'tribe-events-calendar' ) ?> </dt>
			<dd> <abbr class="tribe-events-abbr updated published dtstart" title="<?php esc_attr_e( $end_ts ) ?>">
					<?php if ( $start_time == $end_time ) esc_html_e( $start_time ); else esc_html_e( $start_time . $time_range_separator . $end_time ); ?>
				</abbr> </dd>

		<?php endif ?>

		<?php
		$cost = tribe_get_formatted_cost();
		if ( ! empty( $cost ) ):
		?>
			<dt> <?php _e( 'Cost:', 'tribe-events-calendar' ) ?> </dt>
			<dd class="tribe-events-event-cost"> <?php esc_html_e( tribe_get_formatted_cost() ) ?> </dd>
		<?php endif ?>

		<?php
		echo tribe_get_event_categories( get_the_id(),array(
			'before' => '',
			'sep' => ', ',
			'after' => '',
			'label' => null, // An appropriate plural/singular label will be provided
			'label_before' => '<dt>',
			'label_after' => '</dt>',
			'wrap_before' => '<dd class="tribe-events-event-categories">',
			'wrap_after' => '</dd>'
		) );
		?>

		<?php echo tribe_meta_event_tags( __( 'Event Tags:', 'tribe-events-calendar' ), ', ', false ) ?>

		<?php
		$website = tribe_get_event_website_link();
		if ( ! empty( $website ) ):
		?>
			<dt> <?php _e( 'Website:', 'tribe-events-calendar' ) ?> </dt>
			<dd class="tribe-events-event-url"> <?php echo $website ?> </dd>
		<?php endif ?>

		<?php do_action( 'tribe_events_single_meta_details_section_end' ) ?>
	</dl>
</div>