| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
// Quick Facts Section for Single Trip Page |
| 7 |
// Expected variables: $trip |
| 8 |
?> |
| 9 |
<div class="yatra-trip-quick-facts-section"> |
| 10 |
<div class="yatra-spec-sheet yatra-spec-sheet--quick-facts"> |
| 11 |
<div class="yatra-trip-quick-facts"> |
| 12 |
<!-- Duration --> |
| 13 |
<div class="yatra-quick-fact"> |
| 14 |
<div class="yatra-quick-fact-icon"> |
| 15 |
<?php echo yatra_svg_icon('calendar', 'yatra-icon-lg'); ?> |
| 16 |
</div> |
| 17 |
<div class="yatra-quick-fact-content"> |
| 18 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Duration', 'yatra'); ?></div> |
| 19 |
<div class="yatra-quick-fact-value"> |
| 20 |
<?php |
| 21 |
if ($trip->getTripType() === 'single_day') { |
| 22 |
echo esc_html__('Day Trip', 'yatra'); |
| 23 |
} else { |
| 24 |
echo esc_html(yatra_format_duration($trip->getDurationDays(), $trip->getDurationNights())); |
| 25 |
} |
| 26 |
?> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
|
| 31 |
<!-- Difficulty --> |
| 32 |
<?php |
| 33 |
$difficulty_level = $trip->getDifficultyLevel(); |
| 34 |
if (!empty($difficulty_level)): |
| 35 |
?> |
| 36 |
<div class="yatra-quick-fact"> |
| 37 |
<div class="yatra-quick-fact-icon"> |
| 38 |
<?php |
| 39 |
$difficulty_icons = [ |
| 40 |
'easy' => 'heart', |
| 41 |
'moderate' => 'activity', |
| 42 |
'challenging' => 'zap', |
| 43 |
'difficult' => 'flame', |
| 44 |
]; |
| 45 |
$icon = $difficulty_icons[$difficulty_level] ?? 'mountain'; |
| 46 |
echo yatra_svg_icon($icon, 'yatra-icon-lg'); |
| 47 |
?> |
| 48 |
</div> |
| 49 |
<div class="yatra-quick-fact-content"> |
| 50 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Difficulty', 'yatra'); ?></div> |
| 51 |
<div class="yatra-quick-fact-value"><?php echo esc_html(ucfirst($difficulty_level)); ?></div> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
<?php endif; ?> |
| 55 |
|
| 56 |
<!-- Landmarks --> |
| 57 |
<?php |
| 58 |
$landmarks = $trip->getLandmarks(); |
| 59 |
if (!empty($landmarks)): |
| 60 |
?> |
| 61 |
<div class="yatra-quick-fact"> |
| 62 |
<div class="yatra-quick-fact-icon"> |
| 63 |
<?php echo yatra_svg_icon('map-pin', 'yatra-icon-lg'); ?> |
| 64 |
</div> |
| 65 |
<div class="yatra-quick-fact-content"> |
| 66 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Landmarks', 'yatra'); ?></div> |
| 67 |
<div class="yatra-quick-fact-value"> |
| 68 |
<?php |
| 69 |
$landmark_count = count($landmarks); |
| 70 |
echo esc_html(sprintf(_n('%d landmark', '%d landmarks', $landmark_count, 'yatra'), $landmark_count)); |
| 71 |
?> |
| 72 |
</div> |
| 73 |
</div> |
| 74 |
</div> |
| 75 |
<?php endif; ?> |
| 76 |
|
| 77 |
|
| 78 |
<!-- Group Size --> |
| 79 |
<div class="yatra-quick-fact"> |
| 80 |
<div class="yatra-quick-fact-icon"> |
| 81 |
<?php echo yatra_svg_icon('users', 'yatra-icon-lg'); ?> |
| 82 |
</div> |
| 83 |
<div class="yatra-quick-fact-content"> |
| 84 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Group Size', 'yatra'); ?></div> |
| 85 |
<div class="yatra-quick-fact-value"> |
| 86 |
<?php |
| 87 |
$min_travelers = $trip->getMinTravelers(); |
| 88 |
$max_travelers = $trip->getMaxTravelers(); |
| 89 |
echo esc_html(sprintf(__('%d-%d travelers', 'yatra'), $min_travelers, $max_travelers)); |
| 90 |
?> |
| 91 |
</div> |
| 92 |
</div> |
| 93 |
</div> |
| 94 |
|
| 95 |
<!-- Price --> |
| 96 |
<?php |
| 97 |
$original_price = $trip->getOriginalPrice(); |
| 98 |
if ($original_price > 0): |
| 99 |
?> |
| 100 |
<div class="yatra-quick-fact"> |
| 101 |
<div class="yatra-quick-fact-icon"> |
| 102 |
<?php echo yatra_svg_icon('dollar-sign', 'yatra-icon-lg'); ?> |
| 103 |
</div> |
| 104 |
<div class="yatra-quick-fact-content"> |
| 105 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Price', 'yatra'); ?></div> |
| 106 |
<div class="yatra-quick-fact-value"> |
| 107 |
<?php |
| 108 |
$sale_price = $trip->getSalePrice(); |
| 109 |
if ($sale_price > 0 && $sale_price < $original_price) { |
| 110 |
echo '<span class="yatra-price-current">' . yatra_format_price($sale_price) . '</span>'; |
| 111 |
echo ' <span class="yatra-price-original">' . yatra_format_price($original_price) . '</span>'; |
| 112 |
} else { |
| 113 |
echo '<span class="yatra-price-current">' . yatra_format_price($original_price) . '</span>'; |
| 114 |
} |
| 115 |
?> |
| 116 |
</div> |
| 117 |
</div> |
| 118 |
</div> |
| 119 |
<?php endif; ?> |
| 120 |
|
| 121 |
<!-- Rating --> |
| 122 |
<?php |
| 123 |
$avg_rating = $trip->average_rating ?? 0; |
| 124 |
$review_count = $trip->review_count ?? 0; |
| 125 |
|
| 126 |
if ($avg_rating > 0): |
| 127 |
?> |
| 128 |
<div class="yatra-quick-fact"> |
| 129 |
<div class="yatra-quick-fact-icon"> |
| 130 |
<?php echo yatra_svg_icon('star', 'yatra-icon-lg'); ?> |
| 131 |
</div> |
| 132 |
<div class="yatra-quick-fact-content"> |
| 133 |
<div class="yatra-quick-fact-label"><?php echo esc_html__('Reviews', 'yatra'); ?></div> |
| 134 |
<div class="yatra-quick-fact-value"> |
| 135 |
<div class="yatra-rating-display"> |
| 136 |
<span class="yatra-rating-number"><?php echo esc_html(number_format($avg_rating, 1)); ?></span> |
| 137 |
<div class="yatra-rating-stars"> |
| 138 |
<?php |
| 139 |
$rating = round($avg_rating); |
| 140 |
for ($i = 1; $i <= 5; $i++) { |
| 141 |
if ($i <= $rating) { |
| 142 |
echo '<span class="star-filled">� |
| 143 |
</span>'; |
| 144 |
} else { |
| 145 |
echo '<span class="star-empty">☆</span>'; |
| 146 |
} |
| 147 |
} |
| 148 |
?> |
| 149 |
</div> |
| 150 |
<span class="yatra-review-count">(<?php echo esc_html($review_count); ?> <?php echo esc_html(_n('review', 'reviews', $review_count, 'yatra')); ?>)</span> |
| 151 |
</div> |
| 152 |
</div> |
| 153 |
</div> |
| 154 |
</div> |
| 155 |
<?php endif; ?> |
| 156 |
</div> |
| 157 |
</div> |
| 158 |
</div> |