PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.2.9
Yatra – Travel Booking & Tour Operator Software v3.0.2.9
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 / booking-confirmation.php

booking-confirmation.php in Yatra – Travel Booking & Tour Operator Software 3.0.2.9, at templates/booking-confirmation.php

1,496 lines 61.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Booking Confirmation Template
4 *
5 * Displays booking confirmation after successful booking
6 *
7 * @package Yatra
8 *
9 * Global variables available:
10 * - $booking_data or $GLOBALS['yatra_booking']
11 */
12
13 if (!defined('ABSPATH')) {
14 exit;
15 }
16
17 // Get booking data
18 $booking = $GLOBALS['yatra_booking'] ?? null;
19
20 if (!$booking) {
21 wp_safe_redirect(home_url('/'));
22 exit;
23 }
24
25 // Completed booking: ensure checkout session and its transient cannot repopulate the booking form.
26 if (function_exists('yatra_clear_booking_session')) {
27 yatra_clear_booking_session();
28 }
29
30 // Format dates
31 $travel_date_formatted = \Yatra\Helpers\FormatHelper::formatDate((string) ($booking->travel_date ?? ''));
32 $booking_date_formatted = \Yatra\Helpers\FormatHelper::formatDateTime((string) ($booking->created_at ?? ''));
33
34 // Get status color
35 $status_colors = [
36 'pending' => ['bg' => '#fef3c7', 'text' => '#d97706', 'label' => 'Pending'],
37 'confirmed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Confirmed'],
38 'processing' => ['bg' => '#dbeafe', 'text' => '#2563eb', 'label' => 'Processing'],
39 'completed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Completed'],
40 'cancelled' => ['bg' => '#fee2e2', 'text' => '#dc2626', 'label' => 'Cancelled'],
41 'refunded' => ['bg' => '#fce7f3', 'text' => '#db2777', 'label' => 'Refunded'],
42 'on_hold' => ['bg' => '#e5e7eb', 'text' => '#6b7280', 'label' => 'On Hold'],
43 ];
44
45 $status_style = $status_colors[$booking->status] ?? $status_colors['pending'];
46
47 yatra_get_header();
48
49 // Hook for Pro modules to add custom scripts (Facebook Pixel, etc.)
50 do_action('yatra_booking_confirmation_header', $booking);
51 ?>
52
53 <div class="yatra-wrapper yatra-confirmation-wrapper">
54 <div class="yatra-confirmation-container">
55
56 <!-- Success Header -->
57 <div class="yatra-confirmation-header">
58 <div class="yatra-confirmation-icon">
59 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
60 <circle cx="12" cy="12" r="10"></circle>
61 <polyline points="9,12 12,15 16,10"></polyline>
62 </svg>
63 </div>
64 <h1 class="yatra-confirmation-title">
65 <?php
66 if ($booking->status === 'confirmed') {
67 esc_html_e('Booking Confirmed!', 'yatra');
68 } elseif ($booking->status === 'pending') {
69 esc_html_e('Booking Received!', 'yatra');
70 } elseif ($booking->status === 'cancelled') {
71 esc_html_e('Booking Cancelled', 'yatra');
72 } else {
73 esc_html_e('Booking Submitted!', 'yatra');
74 }
75 ?>
76 </h1>
77 <p class="yatra-confirmation-subtitle">
78 <?php
79 if ($booking->status === 'confirmed') {
80 esc_html_e('Thank you for your booking. We look forward to hosting you!', 'yatra');
81 } elseif ($booking->status === 'pending') {
82 esc_html_e('Thank you for your booking. Your booking is pending confirmation.', 'yatra');
83 } elseif ($booking->status === 'cancelled') {
84 esc_html_e('This booking has been cancelled.', 'yatra');
85 } else {
86 esc_html_e('Thank you for your booking submission.', 'yatra');
87 }
88 ?>
89 </p>
90 <div class="yatra-confirmation-reference">
91 <span class="yatra-ref-label"><?php esc_html_e('Booking Reference:', 'yatra'); ?></span>
92 <span class="yatra-ref-code"><?php echo esc_html($booking->reference); ?></span>
93 </div>
94 </div>
95
96 <?php
97 // Resolve featured image URL (handle attachment ID or direct URL)
98 $featured_image_url = '';
99 if (!empty($booking->featured_image)) {
100 if (is_numeric($booking->featured_image)) {
101 $featured_image_url = wp_get_attachment_url((int) $booking->featured_image) ?: '';
102 } else {
103 $featured_image_url = $booking->featured_image;
104 }
105 }
106 ?>
107
108 <div class="yatra-confirmation-content">
109 <!-- Trip Summary Card -->
110 <div class="yatra-confirmation-card yatra-trip-summary-card">
111 <div class="yatra-trip-summary">
112 <?php if (!empty($featured_image_url)) : ?>
113 <div class="yatra-trip-image">
114 <img src="<?php echo esc_url($featured_image_url); ?>" alt="<?php echo esc_attr($booking->trip_title); ?>">
115 </div>
116 <?php endif; ?>
117
118 <div class="yatra-trip-info">
119 <h2 class="yatra-trip-name"><?php echo esc_html($booking->trip_title); ?></h2>
120
121 <?php if (!empty($booking->trip_average_rating) && $booking->trip_review_count >= 0) : ?>
122 <div class="yatra-trip-rating">
123 <div class="yatra-rating-stars">
124 <?php
125 $filled_stars = floor($booking->trip_average_rating);
126 $has_half = ($booking->trip_average_rating - $filled_stars) >= 0.5;
127 for ($i = 1; $i <= 5; $i++) :
128 $class = $i <= $filled_stars ? 'yatra-star-filled' : ($has_half && $i === $filled_stars + 1 ? 'yatra-star-half' : '');
129 ?>
130 <span class="yatra-star <?php echo esc_attr($class); ?>">
131 <svg viewBox="0 0 24 24" fill="currentColor"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26"></polygon></svg>
132 </span>
133 <?php endfor; ?>
134 </div>
135 <div class="yatra-rating-meta">
136 <strong><?php echo esc_html(number_format($booking->trip_average_rating, 1)); ?></strong>
137 <span>
138 <?php
139 /* translators: %d review count */
140 printf(esc_html(_n('%d Review', '%d Reviews', (int) $booking->trip_review_count, 'yatra')), (int) $booking->trip_review_count);
141 ?>
142 </span>
143 </div>
144 </div>
145 <?php endif; ?>
146
147 <div class="yatra-trip-meta">
148 <?php if (!empty($booking->duration_days)) : ?>
149 <span class="yatra-meta-item">
150 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
151 <circle cx="12" cy="12" r="10"></circle>
152 <polyline points="12 6 12 12 16 14"></polyline>
153 </svg>
154 <?php printf(esc_html__('%d Days / %d Nights', 'yatra'), (int) $booking->duration_days, (int) $booking->duration_nights); ?>
155 </span>
156 <?php endif; ?>
157
158 <?php if (!empty($booking->difficulty_level)) : ?>
159 <span class="yatra-meta-item">
160 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
161 <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
162 </svg>
163 <?php echo esc_html(ucfirst($booking->difficulty_level)); ?>
164 </span>
165 <?php endif; ?>
166 </div>
167
168 <?php if (!empty($booking->starting_location)) : ?>
169 <p class="yatra-trip-location">
170 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
171 <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path>
172 <circle cx="12" cy="10" r="3"></circle>
173 </svg>
174 <?php echo esc_html($booking->starting_location); ?>
175 <?php if (!empty($booking->ending_location) && $booking->ending_location !== $booking->starting_location) : ?>
176 → <?php echo esc_html($booking->ending_location); ?>
177 <?php endif; ?>
178 </p>
179 <?php endif; ?>
180
181 <?php if (!empty($booking->trip_destinations_list)) : ?>
182 <div class="yatra-trip-tags">
183 <span class="yatra-tag-label"><?php esc_html_e('Destinations:', 'yatra'); ?></span>
184 <div class="yatra-tag-group">
185 <?php foreach ($booking->trip_destinations_list as $destination) : ?>
186 <span class="yatra-tag-item"><?php echo esc_html($destination); ?></span>
187 <?php endforeach; ?>
188 </div>
189 </div>
190 <?php endif; ?>
191
192 <?php if (!empty($booking->trip_activities_list)) : ?>
193 <div class="yatra-trip-tags">
194 <span class="yatra-tag-label"><?php esc_html_e('Activities:', 'yatra'); ?></span>
195 <div class="yatra-tag-group">
196 <?php foreach ($booking->trip_activities_list as $activity) : ?>
197 <span class="yatra-tag-item"><?php echo esc_html($activity); ?></span>
198 <?php endforeach; ?>
199 </div>
200 </div>
201 <?php endif; ?>
202
203 <?php if (!empty($booking->trip_categories_list)) : ?>
204 <div class="yatra-trip-tags">
205 <span class="yatra-tag-label"><?php esc_html_e('Trip Type:', 'yatra'); ?></span>
206 <div class="yatra-tag-group">
207 <?php foreach ($booking->trip_categories_list as $category) : ?>
208 <span class="yatra-tag-item"><?php echo esc_html($category); ?></span>
209 <?php endforeach; ?>
210 </div>
211 </div>
212 <?php endif; ?>
213
214 <?php if (!empty($booking->trip_attributes_list)) : ?>
215 <div class="yatra-trip-tags">
216 <span class="yatra-tag-label"><?php esc_html_e('Features:', 'yatra'); ?></span>
217 <div class="yatra-tag-group">
218 <?php foreach ($booking->trip_attributes_list as $attribute) : ?>
219 <span class="yatra-tag-item yatra-attribute-tag"><?php echo esc_html($attribute); ?></span>
220 <?php endforeach; ?>
221 </div>
222 </div>
223 <?php endif; ?>
224 </div>
225 </div>
226 </div>
227
228 <!-- Booking Details -->
229 <div class="yatra-confirmation-grid">
230 <!-- Left Column -->
231 <div class="yatra-confirmation-column">
232 <!-- Booking Info Card -->
233 <div class="yatra-confirmation-card">
234 <h3 class="yatra-card-title">
235 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
236 <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
237 <line x1="16" y1="2" x2="16" y2="6"></line>
238 <line x1="8" y1="2" x2="8" y2="6"></line>
239 <line x1="3" y1="10" x2="21" y2="10"></line>
240 </svg>
241 <?php esc_html_e('Booking Information', 'yatra'); ?>
242 </h3>
243
244 <div class="yatra-info-grid">
245 <div class="yatra-info-item">
246 <span class="yatra-info-label"><?php esc_html_e('Status', 'yatra'); ?></span>
247 <span class="yatra-info-value">
248 <span class="yatra-status-badge" style="background: <?php echo esc_attr($status_style['bg']); ?>; color: <?php echo esc_attr($status_style['text']); ?>;">
249 <?php echo esc_html($status_style['label']); ?>
250 </span>
251 </span>
252 </div>
253 <div class="yatra-info-item">
254 <span class="yatra-info-label"><?php esc_html_e('Travel Date', 'yatra'); ?></span>
255 <span class="yatra-info-value"><?php echo esc_html($travel_date_formatted); ?></span>
256 </div>
257 <div class="yatra-info-item">
258 <span class="yatra-info-label"><?php esc_html_e('Number of Travelers', 'yatra'); ?></span>
259 <span class="yatra-info-value"><?php echo esc_html($booking->travelers_count); ?></span>
260 </div>
261 <div class="yatra-info-item">
262 <span class="yatra-info-label"><?php esc_html_e('Booked On', 'yatra'); ?></span>
263 <span class="yatra-info-value"><?php echo esc_html($booking_date_formatted); ?></span>
264 </div>
265 </div>
266 </div>
267
268 <!-- Travelers Card -->
269 <?php if (!empty($booking->travelers)) : ?>
270 <div class="yatra-confirmation-card">
271 <h3 class="yatra-card-title">
272 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
273 <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
274 <circle cx="9" cy="7" r="4"></circle>
275 <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
276 <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
277 </svg>
278 <?php esc_html_e('Travelers', 'yatra'); ?>
279 </h3>
280
281 <div class="yatra-travelers-list">
282 <?php foreach ($booking->travelers as $index => $traveler) :
283 $traveler_name = trim(($traveler['first_name'] ?? '') . ' ' . ($traveler['last_name'] ?? ''));
284 ?>
285 <div class="yatra-traveler-item">
286 <span class="yatra-traveler-number"><?php echo esc_html($index + 1); ?></span>
287 <div class="yatra-traveler-details">
288 <span class="yatra-traveler-name">
289 <?php echo esc_html($traveler_name ?: __('Traveler', 'yatra') . ' ' . ($index + 1)); ?>
290 </span>
291 <?php if (!empty($traveler['date_of_birth'])) : ?>
292 <span class="yatra-traveler-dob">
293 <?php echo esc_html(\Yatra\Helpers\FormatHelper::formatDate((string) $traveler['date_of_birth'])); ?>
294 </span>
295 <?php endif; ?>
296 </div>
297 </div>
298 <?php endforeach; ?>
299 </div>
300 </div>
301 <?php endif; ?>
302
303 <?php
304 // Allow gateways to inject cards (e.g., Bank Transfer instructions)
305 do_action('yatra_booking_confirmation_after_details', $booking);
306 ?>
307 </div>
308
309 <!-- Right Column -->
310 <div class="yatra-confirmation-column">
311 <!-- Payment Summary Card -->
312 <div class="yatra-confirmation-card yatra-payment-card">
313 <h3 class="yatra-card-title">
314 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
315 <rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect>
316 <line x1="1" y1="10" x2="23" y2="10"></line>
317 </svg>
318 <?php esc_html_e('Payment Summary', 'yatra'); ?>
319 </h3>
320
321 <div class="yatra-payment-rows">
322 <?php
323 // ── Raw figures from DB ───────────────────────────────────
324 $db_subtotal = (float) ($booking->subtotal ?? $booking->total_amount);
325 $discount_amount = (float) ($booking->discount_amount ?? 0);
326 $itinerary_costs_total = (float) ($booking->itinerary_costs_total ?? 0);
327 $tax_amount = (float) ($booking->tax_amount ?? 0);
328 $tax_inclusive = !empty($booking->tax_inclusive);
329 $total_amount = (float) $booking->total_amount;
330 $amount_paid = (float) ($booking->amount_paid ?? 0);
331 $amount_due = (float) ($booking->amount_due ?? 0);
332
333 // ── Tax breakdown (built first so it can gate later rows) ─
334 $tax_breakdown = [];
335 if (!empty($booking->tax_details)) {
336 $taxes = json_decode($booking->tax_details, true) ?: [];
337 foreach ($taxes as $tax) {
338 $tax_breakdown[] = [
339 'name' => $tax['name'] ?? __('Tax', 'yatra'),
340 'rate' => (float) ($tax['rate'] ?? 0),
341 'amount' => (float) ($tax['amount'] ?? 0),
342 ];
343 }
344 } elseif ($tax_amount > 0) {
345 $tax_breakdown[] = [
346 'name' => __('Tax', 'yatra'),
347 'rate' => (float) ($booking->tax_rate ?? 0),
348 'amount' => $tax_amount,
349 ];
350 }
351
352 // ── Itinerary costs ───────────────────────────────────────
353 $itinerary_costs = [];
354 if (!empty($booking->itinerary_costs)) {
355 $itinerary_costs = json_decode($booking->itinerary_costs, true) ?: [];
356 }
357
358 // ── Additional services ───────────────────────────────────
359 $raw_services = apply_filters('yatra_booking_get_services', [], (int) ($booking->id ?? 0));
360 $selected_services = [];
361 if (!empty($raw_services) && is_array($raw_services)) {
362 foreach ($raw_services as $s) {
363 $arr = is_array($s) ? $s : (array) $s;
364 if (!isset($arr['selected']) || !empty($arr['selected'])) {
365 $selected_services[] = $arr;
366 }
367 }
368 }
369 $services_total = 0.0;
370 foreach ($selected_services as $s) {
371 $services_total += (float) ($s['total_price'] ?? $s['calculated_price'] ?? $s['total_cost'] ?? $s['amount'] ?? $s['unit_price'] ?? $s['price'] ?? 0);
372 }
373
374 // ── Derived amounts ───────────────────────────────────────
375 // base_trip_cost: the trip price without services (services are embedded in db_subtotal by Pro)
376 $base_trip_cost = $db_subtotal - $services_total;
377 // taxable_amount: what tax is calculated on
378 $taxable_amount = max(0.0, $db_subtotal - $discount_amount) + $itinerary_costs_total;
379
380 $has_services = !empty($selected_services);
381 $has_discount = $discount_amount > 0;
382 $has_itinerary = !empty($itinerary_costs) && $itinerary_costs_total > 0;
383 $has_tax = !empty($tax_breakdown);
384 $show_taxable_row = $has_tax && ($has_discount || $has_itinerary);
385 ?>
386
387 <!-- Trip Base Price (always the first line) -->
388 <div class="yatra-payment-row">
389 <span>
390 <?php esc_html_e('Trip Base Price', 'yatra'); ?>
391 <?php if ($tax_inclusive): ?>
392 <span style="display:inline-flex;align-items:center;padding:1px 6px;border-radius:4px;font-size:0.72em;font-weight:600;background:#eff6ff;color:#1d4ed8;margin-left:5px;letter-spacing:0;">
393 <?php esc_html_e('Tax Incl.', 'yatra'); ?>
394 </span>
395 <?php endif; ?>
396 </span>
397 <span><?php echo esc_html(yatra_format_price($base_trip_cost, $booking->currency)); ?></span>
398 </div>
399
400 <?php if ($has_services): ?>
401 <!-- Additional Services section header -->
402 <div class="yatra-payment-row" style="margin-top: 4px;">
403 <span style="font-size: 0.75em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280;">
404 + <?php esc_html_e('Additional Services', 'yatra'); ?>
405 </span>
406 <span></span>
407 </div>
408 <!-- Service line items -->
409 <?php foreach ($selected_services as $svc): ?>
410 <?php
411 $svc_name = $svc['service_name'] ?? $svc['name'] ?? $svc['title'] ?? $svc['label'] ?? __('Service', 'yatra');
412 $svc_amount = (float) ($svc['total_price'] ?? $svc['calculated_price'] ?? $svc['total_cost'] ?? $svc['amount'] ?? $svc['unit_price'] ?? $svc['price'] ?? 0);
413 ?>
414 <div class="yatra-payment-row" style="margin-left: 16px;">
415 <span><?php echo esc_html($svc_name); ?></span>
416 <span><?php echo esc_html(yatra_format_price($svc_amount, $booking->currency, false)); ?></span>
417 </div>
418 <?php endforeach; ?>
419 <!-- Gross Total = Trip Base Price + Services -->
420 <div class="yatra-payment-row" style="border-top: 1px solid #e5e7eb; margin-top: 6px; padding-top: 6px;">
421 <span><strong><?php esc_html_e('Gross Total', 'yatra'); ?></strong></span>
422 <span><strong><?php echo esc_html(yatra_format_price($db_subtotal, $booking->currency)); ?></strong></span>
423 </div>
424 <?php endif; ?>
425
426 <?php if ($has_discount): ?>
427 <!-- Discount -->
428 <div class="yatra-payment-row">
429 <span><?php esc_html_e('Discount', 'yatra'); ?></span>
430 <span style="color: #059669; font-weight: 500;">-<?php echo esc_html(yatra_format_price($discount_amount, $booking->currency)); ?></span>
431 </div>
432 <?php endif; ?>
433
434 <?php if ($has_itinerary): ?>
435 <!-- Itinerary costs header -->
436 <div class="yatra-payment-row" style="margin-top: 4px;">
437 <span><strong><?php esc_html_e('Itinerary Costs', 'yatra'); ?></strong></span>
438 <span></span>
439 </div>
440 <?php foreach ($itinerary_costs as $cost): ?>
441 <div class="yatra-payment-row" style="margin-left: 20px;">
442 <span>
443 <?php echo esc_html($cost['name']); ?>
444 <?php if (!empty($cost['price_per'])): ?>
445 <small style="opacity: 0.65;">
446 <?php
447 if ($cost['price_per'] === 'person') {
448 esc_html_e('(per person)', 'yatra');
449 } elseif ($cost['price_per'] === 'group') {
450 esc_html_e('(per booking)', 'yatra');
451 } else {
452 esc_html_e('(flat rate)', 'yatra');
453 }
454 ?>
455 </small>
456 <?php endif; ?>
457 </span>
458 <span><?php echo esc_html(yatra_format_price($cost['total_cost'] ?? $cost['price'], $booking->currency)); ?></span>
459 </div>
460 <?php endforeach; ?>
461 <?php endif; ?>
462
463 <?php if (!$tax_inclusive && $show_taxable_row): ?>
464 <!-- Taxable Amount (only for exclusive tax when there are deductions above it) -->
465 <div class="yatra-payment-row" style="border-top: 1px dashed #e5e7eb; margin-top: 8px; padding-top: 8px;">
466 <span><strong><?php esc_html_e('Taxable Amount', 'yatra'); ?></strong></span>
467 <span><strong><?php echo esc_html(yatra_format_price($taxable_amount, $booking->currency)); ?></strong></span>
468 </div>
469 <?php endif; ?>
470
471 <?php if ($has_tax && !$tax_inclusive): ?>
472 <!-- Exclusive tax: shown as an addition before Net Amount -->
473 <div class="yatra-payment-row" style="margin-top: 4px;">
474 <span style="font-size: 0.75em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280;">
475 + <?php esc_html_e('Tax', 'yatra'); ?>
476 </span>
477 <span></span>
478 </div>
479 <?php foreach ($tax_breakdown as $tax): ?>
480 <div class="yatra-payment-row" style="margin-left: 16px;">
481 <span>
482 <?php echo esc_html($tax['name']); ?>
483 <?php if ($tax['rate'] > 0): ?>
484 (<?php echo esc_html($tax['rate']); ?>%)
485 <?php endif; ?>
486 </span>
487 <span>+<?php echo esc_html(yatra_format_price($tax['amount'], $booking->currency)); ?></span>
488 </div>
489 <?php endforeach; ?>
490 <?php endif; ?>
491
492 <!-- Net Amount -->
493 <div class="yatra-payment-row" style="border-top: 2px solid #111827; margin-top: 10px; padding-top: 10px;">
494 <span style="font-size: 1.05em;"><strong><?php esc_html_e('Net Amount', 'yatra'); ?></strong></span>
495 <span style="font-size: 1.05em;"><strong><?php echo esc_html(yatra_format_price($total_amount, $booking->currency)); ?></strong></span>
496 </div>
497
498 <?php if ($has_tax && $tax_inclusive): ?>
499 <!-- Inclusive tax: shown as an informational footnote after Net Amount -->
500 <?php foreach ($tax_breakdown as $tax): ?>
501 <div class="yatra-payment-row" style="margin-top: 4px; opacity: 0.7;">
502 <span style="font-size: 0.85em; font-style: italic;">
503 <?php
504 printf(
505 /* translators: %1$s = tax name, %2$s = rate, %3$s = amount */
506 esc_html__('Incl. %1$s%2$s: %3$s', 'yatra'),
507 esc_html($tax['name']),
508 $tax['rate'] > 0 ? ' (' . esc_html($tax['rate']) . '%)' : '',
509 esc_html(yatra_format_price($tax['amount'], $booking->currency))
510 );
511 ?>
512 </span>
513 <span></span>
514 </div>
515 <?php endforeach; ?>
516 <?php endif; ?>
517
518 <?php if ($amount_paid > 0): ?>
519 <div class="yatra-payment-row" style="margin-top: 6px;">
520 <span><?php esc_html_e('Amount Paid', 'yatra'); ?></span>
521 <span style="color: #059669;"><?php echo esc_html(yatra_format_price($amount_paid, $booking->currency)); ?></span>
522 </div>
523 <?php endif; ?>
524
525 <?php if ($amount_due > 0): ?>
526 <div class="yatra-payment-row yatra-due-row">
527 <span><strong><?php esc_html_e('Due Now', 'yatra'); ?></strong></span>
528 <span><strong><?php echo esc_html(yatra_format_price($amount_due, $booking->currency)); ?></strong></span>
529 </div>
530 <?php endif; ?>
531 </div>
532
533 <div class="yatra-payment-method">
534 <span class="yatra-pm-label"><?php esc_html_e('Payment Method:', 'yatra'); ?></span>
535 <span class="yatra-pm-value"><?php echo esc_html(ucwords(str_replace('_', ' ', $booking->payment_gateway))); ?></span>
536 </div>
537 </div>
538
539 <!-- Contact Info Card -->
540 <div class="yatra-confirmation-card">
541 <h3 class="yatra-card-title">
542 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
543 <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path>
544 <polyline points="22,6 12,13 2,6"></polyline>
545 </svg>
546 <?php esc_html_e('Contact Information', 'yatra'); ?>
547 </h3>
548
549 <div class="yatra-contact-info">
550 <?php
551 // Try to get contact data from multiple sources
552 $contact_data = [];
553 if (!empty($booking->contact_data)) {
554 $contact_data = json_decode($booking->contact_data, true) ?: [];
555 }
556
557 $contact_name = trim((
558 $contact_data['first_name'] ??
559 $booking->contact_first_name ??
560 ($booking->contact['first_name'] ?? '')
561 ) . ' ' . (
562 $contact_data['last_name'] ??
563 $booking->contact_last_name ??
564 ($booking->contact['last_name'] ?? '')
565 ));
566
567 $contact_email = $contact_data['email'] ?? $booking->contact_email ?? ($booking->contact['email'] ?? '');
568 $contact_phone = $contact_data['phone'] ?? $booking->contact_phone ?? ($booking->contact['phone'] ?? '');
569 ?>
570
571 <?php if ($contact_name) : ?>
572 <p class="yatra-contact-item">
573 <strong><?php esc_html_e('Name:', 'yatra'); ?></strong>
574 <?php echo esc_html($contact_name); ?>
575 </p>
576 <?php endif; ?>
577
578 <?php if ($contact_email) : ?>
579 <p class="yatra-contact-item">
580 <strong><?php esc_html_e('Email:', 'yatra'); ?></strong>
581 <?php echo esc_html($contact_email); ?>
582 </p>
583 <?php endif; ?>
584
585 <?php if ($contact_phone) : ?>
586 <p class="yatra-contact-item">
587 <strong><?php esc_html_e('Phone:', 'yatra'); ?></strong>
588 <?php echo esc_html($contact_phone); ?>
589 </p>
590 <?php endif; ?>
591
592 <?php if (!$contact_name && !$contact_email && !$contact_phone) : ?>
593 <p class="yatra-contact-item">
594 <em><?php esc_html_e('Contact information not available', 'yatra'); ?></em>
595 </p>
596 <?php endif; ?>
597 </div>
598 </div>
599 </div>
600 </div>
601
602 <!-- What's Next Section -->
603 <div class="yatra-confirmation-card yatra-whats-next">
604 <h3 class="yatra-card-title">
605 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
606 <circle cx="12" cy="12" r="10"></circle>
607 <polyline points="12 16 16 12 12 8"></polyline>
608 <line x1="8" y1="12" x2="16" y2="12"></line>
609 </svg>
610 <?php esc_html_e("What's Next?", 'yatra'); ?>
611 </h3>
612
613 <div class="yatra-next-steps">
614 <div class="yatra-step">
615 <span class="yatra-step-number">1</span>
616 <div class="yatra-step-content">
617 <h4><?php esc_html_e('Check Your Email', 'yatra'); ?></h4>
618 <p><?php esc_html_e('We\'ve sent a confirmation email with all the details to your registered email address.', 'yatra'); ?></p>
619 </div>
620 </div>
621
622 <div class="yatra-step">
623 <span class="yatra-step-number">2</span>
624 <div class="yatra-step-content">
625 <h4><?php esc_html_e('Detailed Itinerary', 'yatra'); ?></h4>
626 <p><?php esc_html_e('You\'ll receive a detailed itinerary and preparation guide within 24-48 hours.', 'yatra'); ?></p>
627 </div>
628 </div>
629
630 <div class="yatra-step">
631 <span class="yatra-step-number">3</span>
632 <div class="yatra-step-content">
633 <h4><?php esc_html_e('Prepare for Adventure', 'yatra'); ?></h4>
634 <p><?php esc_html_e('Ensure all travelers have valid ID or travel documents and any required visas for your destination.', 'yatra'); ?></p>
635 </div>
636 </div>
637 </div>
638 </div>
639
640 <!-- Action Buttons -->
641 <div class="yatra-confirmation-actions">
642 <a href="<?php echo esc_url(home_url('/')); ?>" class="yatra-btn yatra-btn-secondary">
643 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
644 <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
645 <polyline points="9 22 9 12 15 12 15 22"></polyline>
646 </svg>
647 <?php esc_html_e('Return to Home', 'yatra'); ?>
648 </a>
649
650 <?php
651 // Get latest payment for this booking to enable invoice download.
652 // The invoice endpoint authorises via: admin → owner → signed invoice_token → guest booking_token.
653 // We always issue a signed invoice_token here so the link works for guests
654 // (no session required) AND for logged-in users who don't own the booking
655 // (e.g. site admins viewing the page) — without re-checking login on the client.
656 $paymentRepository = new \Yatra\Repositories\PaymentRepository();
657 $latestPayment = $paymentRepository->findLatestByBookingId((int) $booking->id);
658 if ($latestPayment && in_array($latestPayment->status, ['completed', 'paid'], true)) :
659 $invoiceToken = \Yatra\Controllers\PaymentGatewayController::issueInvoiceToken(
660 (int) $latestPayment->id,
661 (int) ($latestPayment->booking_id ?? $booking->id)
662 );
663 $invoiceUrl = add_query_arg(
664 [
665 'download' => '1',
666 'invoice_token' => $invoiceToken,
667 ],
668 rest_url('yatra/v1/payment/' . (int) $latestPayment->id . '/invoice')
669 );
670 ?>
671 <a href="<?php echo esc_url($invoiceUrl); ?>"
672 target="_blank"
673 rel="noopener"
674 class="yatra-btn yatra-btn-primary">
675 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
676 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
677 <polyline points="7 10 12 15 17 10"></polyline>
678 <line x1="12" y1="15" x2="12" y2="3"></line>
679 </svg>
680 <?php esc_html_e('Download Invoice', 'yatra'); ?>
681 </a>
682 <?php endif; ?>
683
684 <button type="button" data-yatra-print="confirmation" class="yatra-btn yatra-btn-outline">
685 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
686 <polyline points="6 9 6 2 18 2 18 9"></polyline>
687 <path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"></path>
688 <rect x="6" y="14" width="12" height="8"></rect>
689 </svg>
690 <?php esc_html_e('Print Confirmation', 'yatra'); ?>
691 </button>
692 </div>
693
694 </div>
695 </div>
696 </div>
697
698 <style>
699 /* Confirmation Page Styles */
700 .yatra-confirmation-wrapper {
701 max-width: 1300px;
702 margin: 0 auto;
703 padding: 40px 20px;
704 }
705
706 .yatra-confirmation-container {
707 max-width: 900px;
708 margin: 0 auto;
709 }
710
711 .yatra-confirmation-header {
712 text-align: center;
713 margin-bottom: 40px;
714 }
715
716 .yatra-confirmation-icon {
717 width: 100px;
718 height: 100px;
719 margin: 0 auto 24px;
720 background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
721 border-radius: 50%;
722 display: flex;
723 align-items: center;
724 justify-content: center;
725 animation: scaleIn 0.5s ease-out;
726 }
727
728 .yatra-confirmation-icon svg {
729 width: 50px;
730 height: 50px;
731 color: white;
732 }
733
734 @keyframes scaleIn {
735 0% { transform: scale(0); opacity: 0; }
736 50% { transform: scale(1.1); }
737 100% { transform: scale(1); opacity: 1; }
738 }
739
740 .yatra-confirmation-title {
741 font-size: 36px;
742 font-weight: 700;
743 color: #111827;
744 margin: 0 0 12px;
745 }
746
747 .yatra-confirmation-subtitle {
748 font-size: 18px;
749 color: #6b7280;
750 margin: 0 0 24px;
751 }
752
753 .yatra-confirmation-reference {
754 display: inline-flex;
755 align-items: center;
756 gap: 12px;
757 background: #f3f4f6;
758 padding: 12px 24px;
759 border-radius: 100px;
760 }
761
762 .yatra-ref-label {
763 color: #6b7280;
764 font-size: 14px;
765 }
766
767 .yatra-ref-code {
768 font-size: 18px;
769 font-weight: 700;
770 color: #111827;
771 font-family: monospace;
772 letter-spacing: 1px;
773 }
774
775 .yatra-confirmation-card {
776 background: #fff;
777 border: 1px solid #e5e7eb;
778 border-radius: 16px;
779 padding: 24px;
780 margin-bottom: 24px;
781 }
782
783 .yatra-card-title {
784 display: flex;
785 align-items: center;
786 gap: 12px;
787 font-size: 18px;
788 font-weight: 600;
789 color: #111827;
790 margin: 0 0 20px;
791 padding-bottom: 16px;
792 border-bottom: 1px solid #e5e7eb;
793 }
794
795 .yatra-card-title svg {
796 width: 22px;
797 height: 22px;
798 color: #3b82f6;
799 }
800
801 .yatra-trip-summary-card {
802 background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
803 border-color: #bfdbfe;
804 }
805
806 .yatra-trip-summary {
807 display: flex;
808 gap: 24px;
809 align-items: center;
810 }
811
812 .yatra-trip-image {
813 width: 120px;
814 height: 120px;
815 border-radius: 12px;
816 overflow: hidden;
817 flex-shrink: 0;
818 }
819
820 .yatra-trip-image img {
821 width: 100%;
822 height: 100%;
823 object-fit: cover;
824 }
825
826 .yatra-trip-name {
827 font-size: 22px;
828 font-weight: 700;
829 color: #111827;
830 margin: 0 0 12px;
831 }
832
833 .yatra-trip-meta {
834 display: flex;
835 gap: 20px;
836 flex-wrap: wrap;
837 margin-bottom: 8px;
838 }
839
840 .yatra-meta-item {
841 display: flex;
842 align-items: center;
843 gap: 6px;
844 font-size: 14px;
845 color: #4b5563;
846 }
847
848 .yatra-meta-item svg {
849 width: 16px;
850 height: 16px;
851 }
852
853 .yatra-trip-location {
854 display: flex;
855 align-items: center;
856 gap: 6px;
857 font-size: 14px;
858 color: #6b7280;
859 margin: 0;
860 }
861
862 .yatra-trip-location svg {
863 width: 16px;
864 height: 16px;
865 }
866
867 .yatra-confirmation-grid {
868 display: grid;
869 grid-template-columns: 1fr 1fr;
870 gap: 24px;
871 }
872
873 @media (max-width: 768px) {
874 .yatra-confirmation-grid {
875 grid-template-columns: 1fr;
876 }
877
878 .yatra-trip-summary {
879 flex-direction: column;
880 text-align: center;
881 }
882 }
883
884 .yatra-info-grid {
885 display: grid;
886 grid-template-columns: 1fr 1fr;
887 gap: 16px;
888 }
889
890 .yatra-info-item {
891 display: flex;
892 flex-direction: column;
893 gap: 4px;
894 }
895
896 .yatra-info-label {
897 font-size: 13px;
898 color: #6b7280;
899 }
900
901 .yatra-info-value {
902 font-size: 15px;
903 font-weight: 600;
904 color: #111827;
905 }
906
907 .yatra-status-badge {
908 display: inline-block;
909 padding: 4px 12px;
910 border-radius: 100px;
911 font-size: 13px;
912 font-weight: 600;
913 }
914
915 .yatra-travelers-list {
916 display: flex;
917 flex-direction: column;
918 gap: 12px;
919 }
920
921 .yatra-traveler-item {
922 display: flex;
923 align-items: center;
924 gap: 12px;
925 padding: 12px;
926 background: #f9fafb;
927 border-radius: 8px;
928 }
929
930 .yatra-traveler-number {
931 width: 28px;
932 height: 28px;
933 display: flex;
934 align-items: center;
935 justify-content: center;
936 background: #3b82f6;
937 color: white;
938 border-radius: 50%;
939 font-size: 13px;
940 font-weight: 600;
941 }
942
943 .yatra-traveler-name {
944 font-weight: 600;
945 color: #111827;
946 }
947
948 .yatra-traveler-dob {
949 font-size: 13px;
950 color: #6b7280;
951 }
952
953 .yatra-payment-card {
954 background: #fafafa;
955 }
956
957 .yatra-payment-rows {
958 border: 1px solid #e5e7eb;
959 border-radius: 8px;
960 overflow: hidden;
961 }
962
963 .yatra-payment-row {
964 display: flex;
965 justify-content: space-between;
966 padding: 12px 16px;
967 border-bottom: 1px solid #e5e7eb;
968 }
969
970 .yatra-payment-row:last-child {
971 border-bottom: none;
972 background: #111827;
973 color: white;
974 font-weight: 600;
975 }
976
977 .yatra-discount-row span:last-child {
978 color: #22c55e;
979 }
980
981 .yatra-payment-method {
982 margin-top: 16px;
983 padding: 12px;
984 background: white;
985 border-radius: 8px;
986 display: flex;
987 justify-content: space-between;
988 }
989
990 .yatra-pm-label {
991 color: #6b7280;
992 }
993
994 .yatra-pm-value {
995 font-weight: 600;
996 color: #111827;
997 }
998
999 .yatra-contact-info p {
1000 margin: 0 0 8px;
1001 }
1002
1003 .yatra-whats-next {
1004 background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
1005 border-color: #bbf7d0;
1006 }
1007
1008 .yatra-next-steps {
1009 display: flex;
1010 flex-direction: column;
1011 gap: 20px;
1012 }
1013
1014 .yatra-step {
1015 display: flex;
1016 gap: 16px;
1017 }
1018
1019 .yatra-step-number {
1020 width: 32px;
1021 height: 32px;
1022 display: flex;
1023 align-items: center;
1024 justify-content: center;
1025 background: #22c55e;
1026 color: white;
1027 border-radius: 50%;
1028 font-weight: 600;
1029 flex-shrink: 0;
1030 }
1031
1032 .yatra-step-content h4 {
1033 margin: 0 0 4px;
1034 font-size: 16px;
1035 color: #111827;
1036 }
1037
1038 .yatra-step-content p {
1039 margin: 0;
1040 font-size: 14px;
1041 color: #6b7280;
1042 }
1043
1044 .yatra-confirmation-actions {
1045 display: flex;
1046 gap: 16px;
1047 justify-content: center;
1048 margin-top: 32px;
1049 }
1050
1051 .yatra-btn {
1052 display: inline-flex;
1053 align-items: center;
1054 gap: 8px;
1055 padding: 14px 28px;
1056 border-radius: 8px;
1057 font-size: 15px;
1058 font-weight: 600;
1059 text-decoration: none;
1060 cursor: pointer;
1061 transition: all 0.2s;
1062 border: none;
1063 }
1064
1065 .yatra-btn svg {
1066 width: 18px;
1067 height: 18px;
1068 }
1069
1070 .yatra-btn-secondary {
1071 background: #3b82f6;
1072 color: white;
1073 }
1074
1075 .yatra-btn-secondary:hover {
1076 background: #2563eb;
1077 }
1078
1079 .yatra-btn-outline {
1080 background: white;
1081 color: #374151;
1082 border: 2px solid #e5e7eb;
1083 }
1084
1085 .yatra-btn-outline:hover {
1086 border-color: #3b82f6;
1087 color: #3b82f6;
1088 }
1089
1090 /* =====================================================================
1091 Print Styles — produce a clean, single-page-friendly receipt.
1092 Triggered by the print button (adds .yatra-printing-confirmation
1093 to <body> + clones the confirmation card into .yatra-print-root).
1094 ===================================================================== */
1095 @media print {
1096 @page {
1097 size: A4;
1098 margin: 9mm 10mm;
1099 }
1100
1101 /* Force browsers to print our colors / borders */
1102 body.yatra-printing-confirmation,
1103 body.yatra-printing-confirmation * {
1104 -webkit-print-color-adjust: exact !important;
1105 print-color-adjust: exact !important;
1106 color-adjust: exact !important;
1107 }
1108
1109 /* Reset body, kill animations & transitions */
1110 body.yatra-printing-confirmation {
1111 background: #fff !important;
1112 color: #111827 !important;
1113 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
1114 Helvetica, Arial, sans-serif !important;
1115 font-size: 10pt !important;
1116 line-height: 1.45 !important;
1117 }
1118 body.yatra-printing-confirmation *,
1119 body.yatra-printing-confirmation *::before,
1120 body.yatra-printing-confirmation *::after {
1121 animation: none !important;
1122 transition: none !important;
1123 box-shadow: none !important;
1124 text-shadow: none !important;
1125 }
1126
1127 /* Hide everything except our cloned print root */
1128 body.yatra-printing-confirmation > *:not(.yatra-print-root) {
1129 display: none !important;
1130 }
1131 body.yatra-printing-confirmation .yatra-print-root,
1132 body.yatra-printing-confirmation .yatra-print-root * {
1133 visibility: visible;
1134 }
1135 body.yatra-printing-confirmation .yatra-print-root {
1136 position: static !important;
1137 left: auto;
1138 top: auto;
1139 width: 100%;
1140 margin: 0;
1141 padding: 0;
1142 }
1143
1144 /* Wrappers — remove screen padding/widths */
1145 body.yatra-printing-confirmation .yatra-confirmation-wrapper,
1146 body.yatra-printing-confirmation .yatra-confirmation-container {
1147 max-width: none !important;
1148 margin: 0 !important;
1149 padding: 0 !important;
1150 }
1151
1152 /* Hide things that don't belong on paper */
1153 body.yatra-printing-confirmation .yatra-confirmation-actions,
1154 body.yatra-printing-confirmation .yatra-no-print,
1155 body.yatra-printing-confirmation .yatra-whats-next,
1156 body.yatra-printing-confirmation .yatra-trip-rating {
1157 display: none !important;
1158 }
1159
1160 /* Confirmation header — compact, two-column with status icon left & ref right */
1161 body.yatra-printing-confirmation .yatra-confirmation-header {
1162 display: flex !important;
1163 align-items: center !important;
1164 justify-content: space-between !important;
1165 gap: 16pt !important;
1166 text-align: left !important;
1167 margin: 0 0 8pt !important;
1168 padding: 0 0 6pt !important;
1169 border-bottom: 1pt solid #111827 !important;
1170 }
1171 body.yatra-printing-confirmation .yatra-confirmation-icon {
1172 width: 28pt !important;
1173 height: 28pt !important;
1174 margin: 0 !important;
1175 background: #16a34a !important;
1176 flex-shrink: 0 !important;
1177 }
1178 body.yatra-printing-confirmation .yatra-confirmation-icon svg {
1179 width: 16pt !important;
1180 height: 16pt !important;
1181 }
1182 body.yatra-printing-confirmation .yatra-confirmation-title {
1183 font-size: 14pt !important;
1184 font-weight: 700 !important;
1185 margin: 0 !important;
1186 flex: 1 !important;
1187 color: #111827 !important;
1188 }
1189 body.yatra-printing-confirmation .yatra-confirmation-subtitle {
1190 display: none !important;
1191 }
1192 body.yatra-printing-confirmation .yatra-confirmation-reference {
1193 display: inline-flex !important;
1194 flex-direction: column !important;
1195 align-items: flex-end !important;
1196 gap: 2pt !important;
1197 background: transparent !important;
1198 padding: 0 !important;
1199 border: none !important;
1200 border-radius: 0 !important;
1201 }
1202 body.yatra-printing-confirmation .yatra-ref-label {
1203 font-size: 8pt !important;
1204 text-transform: uppercase !important;
1205 letter-spacing: 0.4pt !important;
1206 color: #6b7280 !important;
1207 }
1208 body.yatra-printing-confirmation .yatra-ref-code {
1209 font-size: 11pt !important;
1210 font-weight: 700 !important;
1211 color: #111827 !important;
1212 letter-spacing: 0.6pt !important;
1213 }
1214
1215 /* Cards — flat, thin border, never split across pages */
1216 body.yatra-printing-confirmation .yatra-confirmation-card {
1217 background: #fff !important;
1218 border: 0.75pt solid #d1d5db !important;
1219 border-radius: 3pt !important;
1220 padding: 8pt 10pt !important;
1221 margin: 0 0 6pt !important;
1222 page-break-inside: avoid !important;
1223 break-inside: avoid !important;
1224 }
1225 body.yatra-printing-confirmation .yatra-trip-summary-card {
1226 background: #f9fafb !important;
1227 border-color: #d1d5db !important;
1228 }
1229 body.yatra-printing-confirmation .yatra-card-title {
1230 font-size: 10.5pt !important;
1231 font-weight: 700 !important;
1232 gap: 6pt !important;
1233 margin: 0 0 8pt !important;
1234 padding: 0 0 5pt !important;
1235 border-bottom: 0.5pt solid #e5e7eb !important;
1236 color: #111827 !important;
1237 }
1238 body.yatra-printing-confirmation .yatra-card-title svg {
1239 width: 12pt !important;
1240 height: 12pt !important;
1241 color: #111827 !important;
1242 }
1243
1244 /* Trip summary — small image, tight spacing */
1245 body.yatra-printing-confirmation .yatra-trip-summary {
1246 gap: 10pt !important;
1247 align-items: flex-start !important;
1248 }
1249 /* Images often render as empty placeholders in print preview; hide for a cleaner receipt. */
1250 body.yatra-printing-confirmation .yatra-trip-image {
1251 display: none !important;
1252 }
1253 body.yatra-printing-confirmation .yatra-trip-name {
1254 font-size: 12pt !important;
1255 font-weight: 700 !important;
1256 margin: 0 0 4pt !important;
1257 color: #111827 !important;
1258 }
1259 body.yatra-printing-confirmation .yatra-trip-meta {
1260 font-size: 9pt !important;
1261 gap: 10pt !important;
1262 margin-bottom: 4pt !important;
1263 color: #374151 !important;
1264 }
1265 body.yatra-printing-confirmation .yatra-trip-meta svg,
1266 body.yatra-printing-confirmation .yatra-trip-location svg {
1267 width: 9pt !important;
1268 height: 9pt !important;
1269 }
1270 body.yatra-printing-confirmation .yatra-trip-location {
1271 font-size: 9pt !important;
1272 margin: 0 0 4pt !important;
1273 color: #374151 !important;
1274 }
1275
1276 /* Tags — outline pills, no fills */
1277 body.yatra-printing-confirmation .yatra-trip-tags {
1278 font-size: 9pt !important;
1279 margin-top: 4pt !important;
1280 }
1281 body.yatra-printing-confirmation .yatra-tag-label {
1282 font-weight: 700 !important;
1283 color: #374151 !important;
1284 margin-right: 4pt !important;
1285 }
1286 body.yatra-printing-confirmation .yatra-tag-item {
1287 display: inline-block !important;
1288 background: #fff !important;
1289 border: 0.5pt solid #d1d5db !important;
1290 padding: 1pt 5pt !important;
1291 border-radius: 2pt !important;
1292 font-size: 8.5pt !important;
1293 color: #374151 !important;
1294 margin: 1pt 2pt 1pt 0 !important;
1295 }
1296
1297 /* Two-column grid stays two columns on paper */
1298 body.yatra-printing-confirmation .yatra-confirmation-grid {
1299 display: grid !important;
1300 grid-template-columns: 1.15fr 0.85fr !important;
1301 gap: 6pt !important;
1302 align-items: start !important;
1303 }
1304 body.yatra-printing-confirmation .yatra-confirmation-column {
1305 min-width: 0 !important;
1306 }
1307
1308 /* Booking info grid */
1309 body.yatra-printing-confirmation .yatra-info-grid {
1310 display: grid !important;
1311 grid-template-columns: 1fr 1fr !important;
1312 gap: 5pt 9pt !important;
1313 }
1314 body.yatra-printing-confirmation .yatra-info-item {
1315 display: flex !important;
1316 flex-direction: column !important;
1317 gap: 1pt !important;
1318 }
1319 body.yatra-printing-confirmation .yatra-info-label {
1320 font-size: 7.5pt !important;
1321 text-transform: uppercase !important;
1322 letter-spacing: 0.3pt !important;
1323 color: #6b7280 !important;
1324 }
1325 body.yatra-printing-confirmation .yatra-info-value {
1326 font-size: 10pt !important;
1327 font-weight: 600 !important;
1328 color: #111827 !important;
1329 }
1330 body.yatra-printing-confirmation .yatra-status-badge {
1331 display: inline-block !important;
1332 padding: 1pt 6pt !important;
1333 border: 0.75pt solid currentColor !important;
1334 border-radius: 2pt !important;
1335 font-size: 8.5pt !important;
1336 font-weight: 700 !important;
1337 }
1338
1339 /* Travelers */
1340 body.yatra-printing-confirmation .yatra-travelers-list {
1341 margin: 0 !important;
1342 }
1343 body.yatra-printing-confirmation .yatra-traveler-item {
1344 display: flex !important;
1345 align-items: center !important;
1346 gap: 8pt !important;
1347 padding: 4pt 0 !important;
1348 border-bottom: 0.5pt solid #e5e7eb !important;
1349 }
1350 body.yatra-printing-confirmation .yatra-traveler-item:last-child {
1351 border-bottom: none !important;
1352 }
1353 body.yatra-printing-confirmation .yatra-traveler-number {
1354 display: inline-flex !important;
1355 align-items: center !important;
1356 justify-content: center !important;
1357 width: 16pt !important;
1358 height: 16pt !important;
1359 background: #111827 !important;
1360 color: #fff !important;
1361 border-radius: 50% !important;
1362 font-size: 8.5pt !important;
1363 font-weight: 700 !important;
1364 flex-shrink: 0 !important;
1365 }
1366 body.yatra-printing-confirmation .yatra-traveler-name {
1367 font-size: 10pt !important;
1368 font-weight: 600 !important;
1369 color: #111827 !important;
1370 }
1371 body.yatra-printing-confirmation .yatra-traveler-dob {
1372 font-size: 8.5pt !important;
1373 color: #6b7280 !important;
1374 }
1375
1376 /* Payment summary rows */
1377 body.yatra-printing-confirmation .yatra-payment-rows {
1378 margin: 0 !important;
1379 }
1380 body.yatra-printing-confirmation .yatra-payment-row {
1381 display: flex !important;
1382 justify-content: space-between !important;
1383 align-items: baseline !important;
1384 gap: 12pt !important;
1385 font-size: 9.25pt !important;
1386 padding: 1.5pt 0 !important;
1387 color: #111827 !important;
1388 }
1389 body.yatra-printing-confirmation .yatra-due-row {
1390 background: #fef3c7 !important;
1391 padding: 4pt 6pt !important;
1392 margin-top: 5pt !important;
1393 border-radius: 2pt !important;
1394 border: 0.5pt solid #fbbf24 !important;
1395 }
1396 body.yatra-printing-confirmation .yatra-payment-method {
1397 margin-top: 6pt !important;
1398 padding-top: 5pt !important;
1399 font-size: 9pt !important;
1400 border-top: 0.5pt solid #e5e7eb !important;
1401 color: #374151 !important;
1402 }
1403
1404 /* Contact info */
1405 body.yatra-printing-confirmation .yatra-contact-info {
1406 margin: 0 !important;
1407 }
1408 body.yatra-printing-confirmation .yatra-contact-item {
1409 font-size: 9.5pt !important;
1410 margin: 0 0 3pt !important;
1411 color: #111827 !important;
1412 }
1413 body.yatra-printing-confirmation .yatra-contact-item strong {
1414 color: #6b7280 !important;
1415 font-weight: 600 !important;
1416 margin-right: 4pt !important;
1417 }
1418
1419 /* Links — print as plain text, no underline (URL is still in browser footer) */
1420 body.yatra-printing-confirmation a,
1421 body.yatra-printing-confirmation a:visited {
1422 color: inherit !important;
1423 text-decoration: none !important;
1424 }
1425
1426 /* Avoid orphan headings */
1427 body.yatra-printing-confirmation h1,
1428 body.yatra-printing-confirmation h2,
1429 body.yatra-printing-confirmation h3,
1430 body.yatra-printing-confirmation h4 {
1431 page-break-after: avoid !important;
1432 break-after: avoid !important;
1433 }
1434 }
1435 </style>
1436
1437 <script>
1438 (function () {
1439 document.addEventListener('click', function (e) {
1440 var btn = e.target.closest('[data-yatra-print="confirmation"]');
1441 if (!btn) {
1442 return;
1443 }
1444 e.preventDefault();
1445
1446 var card = document.querySelector('.yatra-confirmation-container');
1447 if (!card) {
1448 window.print();
1449 return;
1450 }
1451
1452 // Wrap (or reuse) a print-only root so the @media print rules can target a single
1453 // direct child of <body>. Reused on the account page if the same data attribute
1454 // and CSS rules are added there.
1455 var root = document.querySelector('.yatra-print-root');
1456 var addedWrapper = false;
1457 if (!root) {
1458 root = document.createElement('div');
1459 root.className = 'yatra-print-root';
1460 document.body.appendChild(root);
1461 addedWrapper = true;
1462 }
1463 var clone = card.cloneNode(true);
1464 // Drop the action buttons from the clone so they don't appear on paper.
1465 clone.querySelectorAll('.yatra-confirmation-actions').forEach(function (n) { n.remove(); });
1466 root.innerHTML = '';
1467 root.appendChild(clone);
1468
1469 document.body.classList.add('yatra-printing-confirmation');
1470
1471 var cleanup = function () {
1472 document.body.classList.remove('yatra-printing-confirmation');
1473 if (addedWrapper && root && root.parentNode) {
1474 root.parentNode.removeChild(root);
1475 } else if (root) {
1476 root.innerHTML = '';
1477 }
1478 window.removeEventListener('afterprint', cleanup);
1479 };
1480
1481 window.addEventListener('afterprint', cleanup);
1482 // Safety net for browsers that don't fire afterprint reliably.
1483 window.setTimeout(function () {
1484 if (document.body.classList.contains('yatra-printing-confirmation')) {
1485 cleanup();
1486 }
1487 }, 5000);
1488
1489 window.print();
1490 });
1491 })();
1492 </script>
1493
1494 <?php yatra_get_footer(); ?>
1495
1496