PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.2.8
Yatra – Travel Booking & Tour Operator Software v3.0.2.8
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / templates / partials / single-trip / content-itinerary.php

content-itinerary.php in Yatra – Travel Booking & Tour Operator Software 3.0.2.8, at templates/partials/single-trip/content-itinerary.php

343 lines 25.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5 ?>
6 <section class="yatra-trip-section" id="itinerary" itemscope itemtype="https://schema.org/TouristTrip">
7 <div class="yatra-section-header-with-actions">
8 <h2 class="yatra-trip-section-title">
9 <?php yatra_render_tab_icon($tab->icon ?? null, 'calendar', 'yatra-trip-section-title-icon', $tab->label ?? 'Itinerary'); ?>
10 <?php echo esc_html(isset($tab->label) ? $tab->label : __('Itinerary', 'yatra')); ?>
11 </h2>
12 <div class="yatra-itinerary-actions">
13 <button type="button" class="yatra-toggle-all-btn" id="yatra-toggle-all">
14 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24" class="toggle-icon expand-icon" aria-hidden="true">
15 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"/>
16 </svg>
17 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24" class="toggle-icon collapse-icon" aria-hidden="true">
18 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"/>
19 </svg>
20 <span class="toggle-text">Expand All</span>
21 </button>
22 </div>
23 </div>
24
25 <?php
26 // Use dynamic itinerary data from trip only
27 $itinerary_days = $trip->getItineraryDays();
28
29 // Icon mapping function
30 $get_icon = function($icon_name) {
31 $icons = [
32 'car' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 17h.01M16 17h.01M3 11l1.5-4.5A2 2 0 016.4 5h11.2a2 2 0 011.9 1.5L21 11M3 11v6a1 1 0 001 1h1m16-7v6a1 1 0 01-1 1h-1M3 11h18"/></svg>',
33 'plane' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>',
34 'utensils' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v18m-7-4h14M5 3v4a2 2 0 002 2h10a2 2 0 002-2V3"/></svg>',
35 'hotel' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/></svg>',
36 'hiking' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 5.5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zM5 22l3-9 4 3 5-7"/></svg>',
37 'moon' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"/></svg>',
38 'camera' => '<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"/></svg>',
39 ];
40 return $icons[$icon_name] ?? $icons['hiking'];
41 };
42
43 // Item type colors
44 $type_colors = [
45 'Transportation' => '#3b82f6',
46 'Meal' => '#f59e0b',
47 'Accommodation' => '#8b5cf6',
48 'Activity' => '#10b981',
49 'Rest' => '#6b7280',
50 ];
51 ?>
52
53 <div class="yatra-itinerary-timeline">
54 <?php if (empty($itinerary_days)): ?>
55 <div class="yatra-empty-itinerary">
56 <div class="yatra-empty-state-icon">
57 <?php echo yatra_svg_icon('calendar', 'yatra-icon-lg'); ?>
58 </div>
59 <h3 class="yatra-empty-state-title"><?php esc_html_e('No Itinerary Available', 'yatra'); ?></h3>
60 <p class="yatra-empty-state-description">
61 <?php esc_html_e('Detailed itinerary information will be available soon. Please check back later or contact us for more details.', 'yatra'); ?>
62 </p>
63 </div>
64 <?php else: ?>
65 <?php foreach ($itinerary_days as $idx => $day): ?>
66 <div class="yatra-itinerary-day<?php echo (int) $idx === 0 ? ' is-day-expanded' : ''; ?>" data-day="<?php echo esc_attr($day['day']); ?>">
67 <div class="yatra-itinerary-day-header">
68 <div class="yatra-day-badge"><?php esc_html_e('Day', 'yatra'); ?> <?php echo esc_html($day['day']); ?></div>
69 <h3 class="yatra-day-title"><?php echo esc_html($day['day_title']); ?></h3>
70 <button type="button" class="yatra-day-toggle" aria-expanded="<?php echo (int) $idx === 0 ? 'true' : 'false'; ?>">
71 <svg class="yatra-chevron-icon" width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24">
72 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
73 </svg>
74 </button>
75 </div>
76
77 <div class="yatra-itinerary-day-content">
78 <?php if (!empty($day['day_description'])): ?>
79 <div class="yatra-day-description">
80 <?php echo wp_kses_post(wpautop($day['day_description'])); ?>
81 </div>
82 <?php endif; ?>
83 <div class="yatra-entries-timeline">
84 <?php foreach ($day['entries'] as $index => $entry):
85 $type_color = $type_colors[$entry['item_type']] ?? '#6b7280';
86 ?>
87 <div class="yatra-entry-item" style="--entry-color: <?php echo esc_attr($type_color); ?>">
88 <div class="yatra-entry-timeline-dot"></div>
89 <div class="yatra-entry-card">
90 <div class="yatra-entry-header">
91 <div class="yatra-entry-icon" style="background: <?php echo esc_attr($type_color); ?>15; color: <?php echo esc_attr($type_color); ?>">
92 <?php echo $get_icon($entry['icon']); ?>
93 </div>
94 <div class="yatra-entry-info">
95 <span class="yatra-entry-type" style="color: <?php echo esc_attr($type_color); ?>"><?php echo esc_html($entry['item_type']); ?></span>
96 <h4 class="yatra-entry-title"><?php echo esc_html($entry['title']); ?></h4>
97 </div>
98 <?php if ($entry['start_time']): ?>
99 <div class="yatra-entry-time">
100 <svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24">
101 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
102 </svg>
103 <span>
104 <?php echo esc_html($entry['start_time']); ?>
105 <?php if ($entry['end_time']) { echo ' - ' . esc_html($entry['end_time']); } ?>
106 </span>
107 </div>
108 <?php endif; ?>
109 </div>
110
111 <p class="yatra-entry-description"><?php echo esc_html($entry['description']); ?></p>
112
113 <?php if (!empty($entry['cost']) && $entry['cost'] > 0): ?>
114 <div class="yatra-entry-cost">
115 <span class="yatra-cost-amount">
116 <?php echo yatra_format_price($entry['cost']); ?>
117 </span>
118 <?php if ($entry['cost_per_person']): ?>
119 <span class="yatra-cost-label"><?php esc_html_e('per person', 'yatra'); ?></span>
120 <?php else: ?>
121 <span class="yatra-cost-label"><?php esc_html_e('per booking', 'yatra'); ?></span>
122 <?php endif; ?>
123 </div>
124 <?php endif; ?>
125
126 <div class="yatra-entry-meta">
127 <?php if ($entry['location']): ?>
128 <div class="yatra-entry-meta-item">
129 <svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24">
130 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"/>
131 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"/>
132 </svg>
133 <span><?php echo esc_html($entry['location']); ?></span>
134 </div>
135 <?php endif; ?>
136
137 <?php if ($entry['duration']): ?>
138 <div class="yatra-entry-meta-item">
139 <svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24">
140 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
141 </svg>
142 <span><?php echo esc_html($entry['duration']); ?></span>
143 </div>
144 <?php endif; ?>
145 </div>
146
147 <?php if (!empty($entry['included'])): ?>
148 <div class="yatra-entry-included">
149 <?php foreach ($entry['included'] as $item): ?>
150 <span class="yatra-included-tag">
151 <svg width="12" height="12" fill="none" stroke="currentColor" viewBox="0 0 24 24">
152 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
153 </svg>
154 <?php echo esc_html($item); ?>
155 </span>
156 <?php endforeach; ?>
157 </div>
158 <?php endif; ?>
159
160 <!-- Gallery Section -->
161 <?php if (!empty($entry['gallery']) && is_array($entry['gallery'])): ?>
162 <div class="yatra-entry-gallery">
163 <h5 class="yatra-gallery-title">
164 <svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24">
165 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
166 </svg>
167 <?php esc_html_e('Photos', 'yatra'); ?>
168 </h5>
169 <div class="yatra-gallery-grid">
170 <?php
171 global $yatra_itinerary_gallery_images;
172 $global_index = 0;
173 // Find the starting index in global data for this entry's gallery
174 foreach ($yatra_itinerary_gallery_images as $idx => $img_url) {
175 foreach ($entry['gallery'] as $media) {
176 $media_url = $media['thumbnail_url'] ?? $media['url'] ?? '';
177 if ($img_url === $media_url) {
178 $global_index = $idx;
179 break 2;
180 }
181 }
182 }
183 ?>
184 <?php foreach ($entry['gallery'] as $index => $media): ?>
185 <div class="yatra-gallery-item">
186 <a href="#" class="yatra-itinerary-gallery-link"
187 data-gallery="itinerary-gallery"
188 data-image-index="<?php echo esc_attr($global_index + $index); ?>">
189 <div class="yatra-media-card">
190 <img src="<?php echo esc_url($media['thumbnail_url'] ?? $media['url'] ?? ''); ?>"
191 data-full-size="<?php echo esc_url($media['url'] ?? ''); ?>"
192 alt="<?php echo esc_attr($media['alt_text'] ?? $media['caption'] ?? $media['title'] ?? sprintf(__('Itinerary Gallery Image %d', 'yatra'), $global_index + $index + 1)); ?>"
193 loading="lazy">
194 <?php if (isset($media['type']) && $media['type'] === 'video'): ?>
195 <div class="yatra-media-overlay">
196 <svg width="32" height="32" fill="white" viewBox="0 0 24 24">
197 <path d="M8 5v14l11-7z"/>
198 </svg>
199 </div>
200 <?php endif; ?>
201 </div>
202 </a>
203 </div>
204 <?php endforeach; ?>
205
206 <!-- Add video to gallery if exists -->
207 <?php if (!empty($entry['video_url'])): ?>
208 <?php
209 global $yatra_itinerary_gallery_images;
210 $video_global_index = 0;
211 // Find the index of this video thumbnail in global data
212 $video_url = esc_url($entry['video_url']);
213 $video_id = '';
214 $thumbnail_url = '';
215
216 // Extract video ID and thumbnail
217 if (strpos($video_url, 'youtube.com') !== false || strpos($video_url, 'youtu.be') !== false) {
218 // YouTube thumbnail extraction
219 preg_match('/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\n?#]+)/', $video_url, $matches);
220 $video_id = $matches[1] ?? '';
221 $thumbnail_url = "https://img.youtube.com/vi/{$video_id}/maxresdefault.jpg";
222 } elseif (strpos($video_url, 'vimeo.com') !== false) {
223 // Vimeo thumbnail extraction
224 preg_match('#vimeo\.com\/.*?(\d+)#', $video_url, $matches);
225 $video_id = $matches[1] ?? '';
226 if ($video_id) {
227 // Get Vimeo thumbnail via oEmbed API
228 $oembed_url = "https://vimeo.com/api/oembed.json?url=" . urlencode($video_url);
229 $response = wp_remote_get($oembed_url);
230 if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) {
231 $body = wp_remote_retrieve_body($response);
232 $data = json_decode($body, true);
233 if ($data && isset($data['thumbnail_url'])) {
234 $thumbnail_url = $data['thumbnail_url'];
235 }
236 }
237
238 // Fallback if API fails
239 if (empty($thumbnail_url)) {
240 $thumbnail_url = 'https://i.vimeocdn.com/video/' . $video_id . '_640.jpg';
241 }
242 }
243 }
244
245 // Find the thumbnail in global data
246 foreach ($yatra_itinerary_gallery_images as $idx => $img_url) {
247 if ($img_url === $thumbnail_url) {
248 $video_global_index = $idx;
249 break;
250 }
251 }
252 ?>
253 <div class="yatra-gallery-item">
254 <a href="<?php echo esc_url($video_url); ?>" class="yatra-itinerary-video-link"
255 data-gallery="itinerary-gallery"
256 data-image-index="<?php echo esc_attr($video_global_index); ?>"
257 data-video-url="<?php echo esc_attr($video_url); ?>"
258 data-video-id="<?php echo esc_attr($video_id); ?>">
259 <div class="yatra-media-card">
260 <img src="<?php echo esc_url($thumbnail_url ?: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDIwMCAxMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIyMDAiIGhlaWdodD0iMTIwIiBmaWxsPSIjMzc0MTUxIi8+CjxwYXRoIGQ9Ik04NSA0NUwxMTUgNjBMODE4IDc1VjQ1WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+'); ?>"
261 data-full-size="<?php echo esc_url($thumbnail_url ?: ''); ?>"
262 alt="<?php esc_attr_e('Video thumbnail', 'yatra'); ?>"
263 loading="lazy">
264 <div class="yatra-media-overlay yatra-media-youtube-overlay">
265 <div class="yatra-youtube-play-button">
266 <svg width="100" height="100" viewBox="0 0 100 100" fill="none">
267 <circle cx="50" cy="50" r="45" fill="rgba(255, 0, 0, 0.9)" stroke="white" stroke-width="3"/>
268 <path d="M40 30 L70 50 L40 70 Z" fill="white"/>
269 </svg>
270 </div>
271 </div>
272 </div>
273 </a>
274 </div>
275 <?php endif; ?>
276 </div>
277 </div>
278 <?php endif; ?>
279 </div>
280 </div>
281 <?php endforeach; ?>
282 </div>
283 </div>
284 </div>
285 <?php endforeach; ?>
286 <?php endif; ?>
287 </div>
288 </section>
289
290 <!-- Hidden Gallery Section for JavaScript Collection -->
291 <?php if (!empty($yatra_itinerary_gallery_images)): ?>
292 <div class="yatra-itinerary-trip-gallery" data-gallery="itinerary-gallery" aria-hidden="true">
293 <?php foreach ($yatra_itinerary_gallery_images as $index => $image_url): ?>
294 <?php if ($image_url): ?>
295 <div class="yatra-gallery-item" data-image-index="<?php echo esc_attr($index); ?>" itemscope itemtype="https://schema.org/ImageObject">
296 <img src="<?php echo esc_url($image_url); ?>"
297 data-full-size="<?php echo esc_url($image_url); ?>"
298 alt="<?php esc_attr_e('Itinerary Gallery Image', 'yatra'); ?>"
299 itemprop="url" content="<?php echo esc_url($image_url); ?>"
300 loading="lazy">
301 <meta itemprop="contentUrl" content="<?php echo esc_url($image_url); ?>">
302 </div>
303 <?php endif; ?>
304 <?php endforeach; ?>
305 </div>
306 <?php endif; ?>
307
308 <!-- Itinerary Gallery Modal -->
309 <div class="yatra-gallery-modal" id="itinerary-gallery" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('Itinerary Gallery', 'yatra'); ?>">
310 <div class="yatra-gallery-modal-overlay"></div>
311 <div class="yatra-gallery-modal-content">
312 <button type="button" class="yatra-gallery-modal-close" aria-label="<?php esc_attr_e('Close Gallery', 'yatra'); ?>">
313 <svg class="yatra-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
314 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
315 </svg>
316 </button>
317 <button type="button" class="yatra-gallery-modal-prev" aria-label="<?php esc_attr_e('Previous Image', 'yatra'); ?>">
318 <svg class="yatra-icon-lg" fill="none" stroke="currentColor" viewBox="0 0 24 24">
319 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
320 </svg>
321 </button>
322 <button type="button" class="yatra-gallery-modal-next" aria-label="<?php esc_attr_e('Next Image', 'yatra'); ?>">
323 <svg class="yatra-icon-lg" fill="none" stroke="currentColor" viewBox="0 0 24 24">
324 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
325 </svg>
326 </button>
327 <div class="yatra-gallery-modal-main">
328 <img src="" alt="<?php esc_attr_e('Itinerary Gallery Image', 'yatra'); ?>" class="yatra-gallery-modal-image">
329 <div class="yatra-gallery-modal-loader"><?php esc_html_e('Loading...', 'yatra'); ?></div>
330 </div>
331 <div class="yatra-gallery-modal-info">
332 <div class="yatra-gallery-modal-counter">
333 <span class="yatra-gallery-current-index">1</span> / <span class="yatra-gallery-total-count">1</span>
334 </div>
335 </div>
336 <div class="yatra-gallery-modal-thumbnails">
337 <div class="yatra-gallery-thumbnails-container">
338 <!-- Thumbnails will be populated by JavaScript -->
339 </div>
340 </div>
341 </div>
342 </div>
343