| 1 |
<?php |
| 2 |
/** |
| 3 |
* Reusable Trip Listing Card Template |
| 4 |
* |
| 5 |
* This template uses Trip model getter methods for clean, reusable data access |
| 6 |
* All trip-related data comes from the Trip model methods |
| 7 |
* |
| 8 |
* @package Yatra |
| 9 |
* @var \Yatra\Models\Trip $trip The trip model object with getter methods |
| 10 |
*/ |
| 11 |
|
| 12 |
// Prevent direct access |
| 13 |
if (!defined('ABSPATH')) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
// Ensure we have a trip object |
| 18 |
if (!isset($trip) || !is_object($trip)) { |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
// Convert stdClass to Trip model instance if needed |
| 23 |
if (!($trip instanceof \Yatra\Models\Trip)) { |
| 24 |
// Preserve review data before conversion |
| 25 |
$original_reviews = $trip->reviews ?? null; |
| 26 |
$original_average_rating = $trip->avg_rating ?? null; |
| 27 |
$original_review_count = $trip->reviews_count ?? null; |
| 28 |
|
| 29 |
$trip = \Yatra\Models\Trip::fromStdClass($trip); |
| 30 |
|
| 31 |
// Restore review data after conversion |
| 32 |
if ($original_reviews !== null) { |
| 33 |
$trip->reviews = $original_reviews; |
| 34 |
} |
| 35 |
if ($original_average_rating !== null) { |
| 36 |
$trip->avg_rating = $original_average_rating; |
| 37 |
} |
| 38 |
if ($original_review_count !== null) { |
| 39 |
$trip->reviews_count = $original_review_count; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
// Get all trip data using Trip model getter methods |
| 45 |
$title = $trip->getTitle(); |
| 46 |
$duration = $trip->getDuration(); |
| 47 |
$difficulty = $trip->getDifficulty(); |
| 48 |
// Calculate rating directly from reviews array (working correctly) |
| 49 |
$reviews = $trip->reviews ?? []; |
| 50 |
$review_count = count($reviews); |
| 51 |
$average_rating = 0; |
| 52 |
|
| 53 |
if ($review_count > 0) { |
| 54 |
$total_rating = 0; |
| 55 |
foreach ($reviews as $review) { |
| 56 |
$total_rating += (float) ($review->rating ?? 0); |
| 57 |
} |
| 58 |
$average_rating = round($total_rating / $review_count, 1); |
| 59 |
} |
| 60 |
|
| 61 |
$rating = [ |
| 62 |
'average_rating' => $average_rating, |
| 63 |
'review_count' => $review_count, |
| 64 |
'formatted_rating' => number_format($average_rating, 1), |
| 65 |
'has_rating' => $average_rating > 0 && $review_count > 0, |
| 66 |
]; |
| 67 |
if (function_exists('yatra_trip_listing_card_rating_data')) { |
| 68 |
$rating = array_merge($rating, yatra_trip_listing_card_rating_data($trip, $rating)); |
| 69 |
} |
| 70 |
|
| 71 |
$pricing = $trip->getPricing(); |
| 72 |
$discount = $trip->getDiscount(); |
| 73 |
$image = $trip->getImage(); |
| 74 |
$permalink = $trip->getPermalink(); |
| 75 |
$destinations = $trip->getDestinations(); |
| 76 |
$categories = $trip->getCategories(); |
| 77 |
$activities = $trip->getActivities(); |
| 78 |
|
| 79 |
if (function_exists('yatra_trip_listing_filter_classification_duplicates')) { |
| 80 |
[$destinations, $activities, $categories] = yatra_trip_listing_filter_classification_duplicates( |
| 81 |
$destinations, |
| 82 |
$activities, |
| 83 |
$categories, |
| 84 |
$trip |
| 85 |
); |
| 86 |
} |
| 87 |
|
| 88 |
$starting_loc = method_exists($trip, 'getStartingLocation') ? $trip->getStartingLocation() : ($trip->starting_location ?? null); |
| 89 |
$ending_loc = $trip->ending_location ?? null; |
| 90 |
$starting_loc = is_string($starting_loc) ? trim($starting_loc) : ''; |
| 91 |
$ending_loc = is_string($ending_loc) ? trim($ending_loc) : ''; |
| 92 |
$yatra_card_location_line = ''; |
| 93 |
if ($starting_loc !== '' && $ending_loc !== '' && $starting_loc !== $ending_loc) { |
| 94 |
$yatra_card_location_line = function_exists('yatra_format_trip_listing_route_line') |
| 95 |
? yatra_format_trip_listing_route_line($starting_loc, $ending_loc) |
| 96 |
: $starting_loc . ' → ' . $ending_loc; |
| 97 |
} elseif ($starting_loc !== '') { |
| 98 |
$yatra_card_location_line = $starting_loc; |
| 99 |
} elseif ($ending_loc !== '') { |
| 100 |
$yatra_card_location_line = $ending_loc; |
| 101 |
} |
| 102 |
|
| 103 |
$yatra_traveler_type_labels = function_exists('yatra_trip_listing_traveler_type_labels_for_card') |
| 104 |
? yatra_trip_listing_traveler_type_labels_for_card($trip) |
| 105 |
: []; |
| 106 |
|
| 107 |
$yatra_trip_type_label = function_exists('yatra_trip_listing_trip_type_label') |
| 108 |
? yatra_trip_listing_trip_type_label($trip->trip_type ?? null) |
| 109 |
: ''; |
| 110 |
$yatra_primary_category = !empty($categories[0]) ? $categories[0] : null; |
| 111 |
$yatra_categories_additional = []; |
| 112 |
foreach ($categories as $yatra_cat_row) { |
| 113 |
if ($yatra_primary_category && isset($yatra_cat_row->id, $yatra_primary_category->id) |
| 114 |
&& (int) $yatra_cat_row->id === (int) $yatra_primary_category->id) { |
| 115 |
continue; |
| 116 |
} |
| 117 |
$yatra_categories_additional[] = $yatra_cat_row; |
| 118 |
} |
| 119 |
|
| 120 |
$yatra_view_details_icon_slug = function_exists('yatra_trip_listing_card_cta_icon_slug') |
| 121 |
? yatra_trip_listing_card_cta_icon_slug($categories, $destinations, $difficulty) |
| 122 |
: ''; |
| 123 |
|
| 124 |
// Check for group discounts availability |
| 125 |
$has_group_discounts = false; |
| 126 |
$group_discount_summary = ''; |
| 127 |
try { |
| 128 |
// Call the group discount API to check availability |
| 129 |
$api_url = rest_url('yatra/v1/discounts/group-discounts'); |
| 130 |
$response = wp_remote_post($api_url, [ |
| 131 |
'method' => 'GET', |
| 132 |
'body' => [ |
| 133 |
'trip_ids' => [$trip->id] |
| 134 |
], |
| 135 |
'headers' => [ |
| 136 |
'Content-Type' => 'application/json', |
| 137 |
], |
| 138 |
]); |
| 139 |
|
| 140 |
if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) { |
| 141 |
$data = json_decode(wp_remote_retrieve_body($response), true); |
| 142 |
if (isset($data[$trip->id]) && $data[$trip->id]['has_group_discounts']) { |
| 143 |
$has_group_discounts = true; |
| 144 |
$group_discount_summary = $data[$trip->id]['summary']; |
| 145 |
} |
| 146 |
} |
| 147 |
} catch (Exception $e) { |
| 148 |
// Silently fail if API call fails - don't break the page |
| 149 |
$has_group_discounts = false; |
| 150 |
} |
| 151 |
?> |
| 152 |
|
| 153 |
<div class="yatra-trip-card"> |
| 154 |
<div class="yatra-trip-card-image"> |
| 155 |
<?php if (!empty($permalink)): ?> |
| 156 |
<a href="<?php echo esc_url($permalink); ?>" class="yatra-trip-image-link"> |
| 157 |
<img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>"> |
| 158 |
</a> |
| 159 |
<?php else: ?> |
| 160 |
<img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>"> |
| 161 |
<?php endif; ?> |
| 162 |
<?php if ($discount['has_discount']): ?> |
| 163 |
<div class="yatra-discount-badge"> |
| 164 |
<?php echo esc_html($discount['discount_text']); ?> OFF |
| 165 |
</div> |
| 166 |
<?php endif; ?> |
| 167 |
<?php if ($has_group_discounts): ?> |
| 168 |
<div class="yatra-group-discount-badge" title="<?php echo esc_attr($group_discount_summary); ?>"> |
| 169 |
<svg width="12" height="12" fill="currentColor" viewBox="0 0 20 20"> |
| 170 |
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/> |
| 171 |
</svg> |
| 172 |
<?php esc_html_e('Group Discounts', 'yatra'); ?> |
| 173 |
</div> |
| 174 |
<?php endif; ?> |
| 175 |
<?php if (function_exists('yatra_wishlist_enabled') && yatra_wishlist_enabled()) : ?> |
| 176 |
<button type="button" class="yatra-favorite-btn" data-trip-id="<?php echo esc_attr($trip->id); ?>" title="<?php esc_attr_e('Save to wishlist', 'yatra'); ?>" aria-label="<?php esc_attr_e('Save to wishlist', 'yatra'); ?>"> |
| 177 |
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 178 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/> |
| 179 |
</svg> |
| 180 |
</button> |
| 181 |
<?php endif; ?> |
| 182 |
<!-- Difficulty level overlay on bottom-right --> |
| 183 |
<?php if ($difficulty['has_difficulty'] && !empty($difficulty['icon'])): ?> |
| 184 |
<div class="yatra-difficulty-overlay"> |
| 185 |
<?php echo yatra_svg_icon($difficulty['icon'], 'difficulty-icon'); ?> |
| 186 |
<?php echo ' ' . esc_html($difficulty['level']); ?> |
| 187 |
</div> |
| 188 |
<?php endif; ?> |
| 189 |
</div> |
| 190 |
<div class="yatra-trip-content"> |
| 191 |
<?php if ($yatra_card_location_line !== '' || !empty($destinations)) : ?> |
| 192 |
<div class="yatra-trip-destinations" role="group" aria-label="<?php esc_attr_e('Trip location', 'yatra'); ?>"> |
| 193 |
<svg class="location-icon" width="14" height="14" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true"> |
| 194 |
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd" /> |
| 195 |
</svg> |
| 196 |
<?php if ($yatra_card_location_line !== '') : ?> |
| 197 |
<span class="yatra-trip-card-location-text"><?php echo esc_html($yatra_card_location_line); ?></span> |
| 198 |
<?php else : ?> |
| 199 |
<?php |
| 200 |
$destination_links = []; |
| 201 |
foreach ($destinations as $destination) { |
| 202 |
if (empty($destination->name)) { |
| 203 |
continue; |
| 204 |
} |
| 205 |
$destination_permalink = function_exists('yatra_get_destination_permalink') |
| 206 |
? yatra_get_destination_permalink($destination) |
| 207 |
: '#'; |
| 208 |
$destination_links[] = '<a href="' . esc_url($destination_permalink) . '" class="destination-link">' . esc_html($destination->name) . '</a>'; |
| 209 |
} |
| 210 |
echo implode(', ', $destination_links); |
| 211 |
?> |
| 212 |
<?php endif; ?> |
| 213 |
</div> |
| 214 |
<?php endif; ?> |
| 215 |
|
| 216 |
<h3 class="yatra-trip-title"> |
| 217 |
<?php if (!empty($permalink)): ?> |
| 218 |
<a href="<?php echo esc_url($permalink); ?>" class="yatra-trip-title-link"><?php echo esc_html($title); ?></a> |
| 219 |
<?php else: ?> |
| 220 |
<?php echo esc_html($title); ?> |
| 221 |
<?php endif; ?> |
| 222 |
</h3> |
| 223 |
|
| 224 |
<?php if ($yatra_trip_type_label !== '' || $yatra_primary_category) : ?> |
| 225 |
<div class="yatra-trip-card-meta"> |
| 226 |
<?php if ($yatra_trip_type_label !== '') : ?> |
| 227 |
<span class="yatra-trip-type-chip"><?php echo esc_html($yatra_trip_type_label); ?></span> |
| 228 |
<?php endif; ?> |
| 229 |
<?php if ($yatra_primary_category && !empty($yatra_primary_category->name)) : ?> |
| 230 |
<?php |
| 231 |
$pc_link = function_exists('yatra_get_category_permalink') |
| 232 |
? yatra_get_category_permalink($yatra_primary_category) |
| 233 |
: ''; |
| 234 |
?> |
| 235 |
<?php if ($pc_link !== '') : ?> |
| 236 |
<a class="yatra-trip-primary-category-chip" href="<?php echo esc_url($pc_link); ?>"><?php echo esc_html($yatra_primary_category->name); ?></a> |
| 237 |
<?php else : ?> |
| 238 |
<span class="yatra-trip-primary-category-chip yatra-trip-primary-category-chip--text"><?php echo esc_html($yatra_primary_category->name); ?></span> |
| 239 |
<?php endif; ?> |
| 240 |
<?php endif; ?> |
| 241 |
</div> |
| 242 |
<?php endif; ?> |
| 243 |
|
| 244 |
<!-- Short Description --> |
| 245 |
<?php |
| 246 |
$short_desc = $trip->getShortDescription(); |
| 247 |
if (!empty($short_desc)): |
| 248 |
?> |
| 249 |
<p class="yatra-trip-short-description"> |
| 250 |
<?php echo \Yatra\Helpers\FormatHelper::sanitizeQuillHtml($short_desc); ?> |
| 251 |
</p> |
| 252 |
<?php endif; ?> |
| 253 |
|
| 254 |
<!-- Trip Stats Row: scannable decision cues (duration, rating, group, difficulty, optional bookings) --> |
| 255 |
<div class="yatra-trip-stats-row"> |
| 256 |
<?php if ($duration['has_duration']) : ?> |
| 257 |
<div class="yatra-trip-stat"> |
| 258 |
<div class="yatra-stat-icon duration"> |
| 259 |
<?php echo yatra_svg_icon('calendar', ''); ?> |
| 260 |
</div> |
| 261 |
<div class="yatra-stat-content"> |
| 262 |
<span class="yatra-stat-value"><?php echo esc_html($duration['formatted']); ?></span> |
| 263 |
<span class="yatra-stat-label"><?php esc_html_e('Duration', 'yatra'); ?></span> |
| 264 |
</div> |
| 265 |
</div> |
| 266 |
<?php endif; ?> |
| 267 |
|
| 268 |
<?php if (!empty($rating['has_rating'])) : ?> |
| 269 |
<div class="yatra-trip-stat"> |
| 270 |
<div class="yatra-stat-icon rating"> |
| 271 |
<?php echo yatra_svg_icon('star', ''); ?> |
| 272 |
</div> |
| 273 |
<div class="yatra-stat-content"> |
| 274 |
<span class="yatra-stat-value"><?php echo esc_html($rating['formatted_rating']); ?></span> |
| 275 |
<span class="yatra-stat-label"> |
| 276 |
<?php |
| 277 |
printf( |
| 278 |
/* translators: %d: number of reviews */ |
| 279 |
esc_html(_n('%d review', '%d reviews', (int) $rating['review_count'], 'yatra')), |
| 280 |
(int) $rating['review_count'] |
| 281 |
); |
| 282 |
?> |
| 283 |
</span> |
| 284 |
</div> |
| 285 |
</div> |
| 286 |
<?php endif; ?> |
| 287 |
|
| 288 |
<?php if (!empty($trip->min_travelers) || !empty($trip->max_travelers)) : ?> |
| 289 |
<div class="yatra-trip-stat"> |
| 290 |
<div class="yatra-stat-icon group"> |
| 291 |
<?php echo yatra_svg_icon('users', ''); ?> |
| 292 |
</div> |
| 293 |
<div class="yatra-stat-content"> |
| 294 |
<span class="yatra-stat-value"> |
| 295 |
<?php |
| 296 |
$min_travelers = $trip->min_travelers ?? 1; |
| 297 |
$max_travelers = $trip->max_travelers ?? 20; |
| 298 |
echo esc_html($min_travelers . '-' . $max_travelers); |
| 299 |
?> |
| 300 |
</span> |
| 301 |
<span class="yatra-stat-label"><?php esc_html_e('Group size', 'yatra'); ?></span> |
| 302 |
</div> |
| 303 |
</div> |
| 304 |
<?php endif; ?> |
| 305 |
|
| 306 |
<?php if (!empty($difficulty['has_difficulty']) && empty($difficulty['icon'])) : ?> |
| 307 |
<div class="yatra-trip-stat"> |
| 308 |
<div class="yatra-stat-icon difficulty"> |
| 309 |
<?php echo yatra_svg_icon('mountain', ''); ?> |
| 310 |
</div> |
| 311 |
<div class="yatra-stat-content"> |
| 312 |
<span class="yatra-stat-value"><?php echo esc_html($difficulty['level']); ?></span> |
| 313 |
<span class="yatra-stat-label"><?php esc_html_e('Difficulty', 'yatra'); ?></span> |
| 314 |
</div> |
| 315 |
</div> |
| 316 |
<?php endif; ?> |
| 317 |
|
| 318 |
<?php if (apply_filters('yatra_trip_listing_card_show_bookings_count', false, $trip) && !empty($trip->bookings_count) && (int) $trip->bookings_count > 0) : ?> |
| 319 |
<div class="yatra-trip-stat"> |
| 320 |
<div class="yatra-stat-icon bookings"> |
| 321 |
<svg width="14" height="14" fill="currentColor" viewBox="0 0 20 20"> |
| 322 |
<path fill-rule="evenodd" d="M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z" clip-rule="evenodd" /> |
| 323 |
</svg> |
| 324 |
</div> |
| 325 |
<div class="yatra-stat-content"> |
| 326 |
<span class="yatra-stat-value"><?php echo esc_html((string) (int) $trip->bookings_count); ?></span> |
| 327 |
<span class="yatra-stat-label"><?php esc_html_e('Bookings', 'yatra'); ?></span> |
| 328 |
</div> |
| 329 |
</div> |
| 330 |
<?php endif; ?> |
| 331 |
</div> |
| 332 |
|
| 333 |
<?php if (!empty($yatra_traveler_type_labels)) : ?> |
| 334 |
<div class="yatra-trip-traveler-types" role="group" aria-label="<?php esc_attr_e('Traveler types', 'yatra'); ?>"> |
| 335 |
<svg class="yatra-trip-traveler-types-icon" width="14" height="14" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true"> |
| 336 |
<path fill-rule="evenodd" d="M4 4a2 2 0 00-2 2v8a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2H4zm2 2h8v2H6V6zm0 4h5v2H6v-2z" clip-rule="evenodd" /> |
| 337 |
</svg> |
| 338 |
<div class="yatra-trip-traveler-types-inner"> |
| 339 |
<span class="yatra-trip-traveler-types-label"><?php esc_html_e('Traveler types', 'yatra'); ?></span> |
| 340 |
<span class="yatra-trip-traveler-types-pills"> |
| 341 |
<?php foreach ($yatra_traveler_type_labels as $ttl) : ?> |
| 342 |
<span class="yatra-traveler-tier-pill"><?php echo esc_html($ttl); ?></span> |
| 343 |
<?php endforeach; ?> |
| 344 |
</span> |
| 345 |
</div> |
| 346 |
</div> |
| 347 |
<?php endif; ?> |
| 348 |
|
| 349 |
|
| 350 |
<!-- Activities Only --> |
| 351 |
<?php if (!empty($activities)) : ?> |
| 352 |
<div class="yatra-trip-activities" role="group" aria-label="<?php esc_attr_e('Activities', 'yatra'); ?>"> |
| 353 |
<?php foreach (array_slice($activities, 0, 3) as $activity) : ?> |
| 354 |
<a href="<?php echo esc_url(yatra_get_activity_permalink($activity)); ?>" class="yatra-tag activity-tag"> |
| 355 |
<?php echo esc_html($activity->name); ?> |
| 356 |
</a> |
| 357 |
<?php endforeach; ?> |
| 358 |
</div> |
| 359 |
<?php endif; ?> |
| 360 |
|
| 361 |
<!-- Additional trip categories (primary chip is under title) --> |
| 362 |
<?php if (!empty($yatra_categories_additional)) : ?> |
| 363 |
<div class="yatra-trip-categories-compact" role="group" aria-label="<?php esc_attr_e('More categories', 'yatra'); ?>"> |
| 364 |
<div class="yatra-category-icon"> |
| 365 |
<?php |
| 366 |
$first_category = $yatra_categories_additional[0]; |
| 367 |
if (!empty($first_category->icon)) { |
| 368 |
$icon_data = maybe_unserialize($first_category->icon); |
| 369 |
if (is_array($icon_data) && isset($icon_data['type']) && $icon_data['type'] === 'icon' && !empty($icon_data['value'])) { |
| 370 |
echo yatra_svg_icon($icon_data['value'], 'category-icon'); |
| 371 |
} else { |
| 372 |
echo '<svg width="14" height="14" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z" clip-rule="evenodd" /></svg>'; |
| 373 |
} |
| 374 |
} else { |
| 375 |
echo '<svg width="14" height="14" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z" clip-rule="evenodd" /></svg>'; |
| 376 |
} |
| 377 |
?> |
| 378 |
</div> |
| 379 |
<span class="yatra-categories-text"> |
| 380 |
<?php |
| 381 |
$category_links = []; |
| 382 |
foreach ($yatra_categories_additional as $category) { |
| 383 |
$category_links[] = '<a href="' . esc_url(yatra_get_category_permalink($category)) . '" class="yatra-category-link">' . esc_html($category->name) . '</a>'; |
| 384 |
} |
| 385 |
echo implode(', ', $category_links); |
| 386 |
?> |
| 387 |
</span> |
| 388 |
</div> |
| 389 |
<?php endif; ?> |
| 390 |
|
| 391 |
<div class="yatra-trip-footer"> |
| 392 |
<div class="yatra-trip-card-price"> |
| 393 |
<span class="yatra-trip-price"> |
| 394 |
<?php if ($pricing['has_price']): ?> |
| 395 |
<?php echo esc_html($pricing['price_prefix'] . $pricing['current_price']); ?> |
| 396 |
<?php if ($pricing['has_discount'] && !empty($pricing['original_price'])): ?> |
| 397 |
<span class="yatra-original-price"><?php echo esc_html($pricing['original_price']); ?></span> |
| 398 |
<?php endif; ?> |
| 399 |
<?php else: ?> |
| 400 |
<?php esc_html_e('Contact for pricing', 'yatra'); ?> |
| 401 |
<?php endif; ?> |
| 402 |
</span> |
| 403 |
</div> |
| 404 |
<?php if (!empty($permalink)) : ?> |
| 405 |
<a href="<?php echo esc_url($permalink); ?>" class="yatra-btn yatra-btn-primary yatra-archive-card-cta yatra-card-view-btn"> |
| 406 |
<?php echo function_exists('yatra_archive_listing_cta_icon_markup') ? yatra_archive_listing_cta_icon_markup($yatra_view_details_icon_slug, 'file-text') : yatra_svg_icon('file-text', 'yatra-btn-icon'); ?> |
| 407 |
<span><?php esc_html_e('View Details', 'yatra'); ?></span> |
| 408 |
</a> |
| 409 |
<?php endif; ?> |
| 410 |
</div> |
| 411 |
</div> |
| 412 |
</div> |
| 413 |
|
| 414 |
<style> |
| 415 |
.yatra-trip-short-description { |
| 416 |
color: #64748b; |
| 417 |
font-size: 0.875rem; |
| 418 |
line-height: 1.5; |
| 419 |
margin: 8px 0 12px 0; |
| 420 |
display: -webkit-box; |
| 421 |
-webkit-line-clamp: 2; |
| 422 |
-webkit-box-orient: vertical; |
| 423 |
overflow: hidden; |
| 424 |
text-overflow: ellipsis; |
| 425 |
} |
| 426 |
|
| 427 |
/* Trip Stats Row */ |
| 428 |
.yatra-trip-stats-row { |
| 429 |
display: flex; |
| 430 |
flex-wrap: wrap; |
| 431 |
gap: 16px; |
| 432 |
margin: 12px 0; |
| 433 |
padding: 12px 0; |
| 434 |
} |
| 435 |
|
| 436 |
.yatra-trip-stat { |
| 437 |
display: flex; |
| 438 |
align-items: center; |
| 439 |
gap: 8px; |
| 440 |
min-width: 0; |
| 441 |
flex: 1; |
| 442 |
} |
| 443 |
|
| 444 |
.yatra-stat-icon { |
| 445 |
display: flex; |
| 446 |
align-items: center; |
| 447 |
justify-content: center; |
| 448 |
width: 28px; |
| 449 |
height: 28px; |
| 450 |
border-radius: 6px; |
| 451 |
flex-shrink: 0; |
| 452 |
} |
| 453 |
|
| 454 |
.yatra-stat-icon.duration { |
| 455 |
background: #dbeafe; |
| 456 |
color: #1e40af; |
| 457 |
} |
| 458 |
|
| 459 |
.yatra-stat-icon.difficulty { |
| 460 |
background: #fef3c7; |
| 461 |
color: #d97706; |
| 462 |
} |
| 463 |
|
| 464 |
.yatra-stat-icon.group { |
| 465 |
background: #dcfce7; |
| 466 |
color: #166534; |
| 467 |
} |
| 468 |
|
| 469 |
.yatra-stat-icon.bookings { |
| 470 |
background: #fce7f3; |
| 471 |
color: #be185d; |
| 472 |
} |
| 473 |
|
| 474 |
.yatra-stat-content { |
| 475 |
display: flex; |
| 476 |
flex-direction: column; |
| 477 |
min-width: 0; |
| 478 |
flex: 1; |
| 479 |
} |
| 480 |
|
| 481 |
.yatra-stat-value { |
| 482 |
font-size: 0.875rem; |
| 483 |
font-weight: 600; |
| 484 |
color: #1f2937; |
| 485 |
line-height: 1.2; |
| 486 |
} |
| 487 |
|
| 488 |
.yatra-stat-label { |
| 489 |
font-size: 0.75rem; |
| 490 |
color: #6b7280; |
| 491 |
line-height: 1.2; |
| 492 |
margin-top: 2px; |
| 493 |
} |
| 494 |
|
| 495 |
/* Rating Row */ |
| 496 |
.yatra-trip-rating-row { |
| 497 |
display: flex; |
| 498 |
align-items: center; |
| 499 |
gap: 12px; |
| 500 |
margin: 12px 0; |
| 501 |
} |
| 502 |
|
| 503 |
.yatra-rating-stars { |
| 504 |
display: flex; |
| 505 |
align-items: center; |
| 506 |
gap: 4px; |
| 507 |
} |
| 508 |
|
| 509 |
.yatra-rating-value { |
| 510 |
font-weight: 600; |
| 511 |
color: #1f2937; |
| 512 |
font-size: 0.875rem; |
| 513 |
} |
| 514 |
|
| 515 |
.yatra-reviews-count { |
| 516 |
font-size: 0.75rem; |
| 517 |
color: #6b7280; |
| 518 |
} |
| 519 |
|
| 520 |
/* Responsive design */ |
| 521 |
@media (max-width: 768px) { |
| 522 |
.yatra-trip-stats-row { |
| 523 |
gap: 12px; |
| 524 |
} |
| 525 |
|
| 526 |
.yatra-trip-stat { |
| 527 |
min-width: calc(50% - 6px); |
| 528 |
} |
| 529 |
|
| 530 |
.yatra-stat-icon { |
| 531 |
width: 24px; |
| 532 |
height: 24px; |
| 533 |
} |
| 534 |
|
| 535 |
.yatra-stat-value { |
| 536 |
font-size: 0.8rem; |
| 537 |
} |
| 538 |
|
| 539 |
.yatra-stat-label { |
| 540 |
font-size: 0.7rem; |
| 541 |
} |
| 542 |
} |
| 543 |
|
| 544 |
@media (max-width: 480px) { |
| 545 |
.yatra-trip-stats-row { |
| 546 |
flex-direction: column; |
| 547 |
gap: 8px; |
| 548 |
} |
| 549 |
|
| 550 |
.yatra-trip-stat { |
| 551 |
min-width: 100%; |
| 552 |
} |
| 553 |
} |
| 554 |
</style> |
| 555 |
|