PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
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 2.0.10 2.0.11 All 82 releases
yatra / templates / booking.php

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

197 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Booking Page Template
4 *
5 * Data is prepared by AppServiceProvider::prepareBookingData()
6 * Template only handles presentation - no database queries
7 *
8 * @package Yatra
9 * @global object $booking Booking data object (set by AppServiceProvider)
10 */
11
12 // Prevent direct access
13 if (!defined('ABSPATH')) {
14 exit;
15 }
16
17 // Access global $booking object (set by controller)
18 global $booking;
19
20 // Handle error states
21 if (empty($booking) || (!is_object($booking))) {
22 $booking = (object) [
23 'error' => 'no_session',
24 ];
25 }
26
27 if (!empty($booking->error)) {
28 yatra_get_header();
29 ?>
30 <style>
31 .yatra-error-page {
32 min-height: 70vh;
33 display: flex;
34 align-items: center;
35 justify-content: center;
36 padding: 40px 20px;
37 background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
38 margin:0 auto;
39 }
40 .yatra-error-card {
41 max-width: 480px;
42 width: 100%;
43 background: #ffffff;
44 border-radius: 20px;
45 box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
46 padding: 48px 40px;
47 text-align: center;
48 }
49 .yatra-error-icon {
50 width: 80px;
51 height: 80px;
52 margin: 0 auto 24px;
53 background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
54 border-radius: 50%;
55 display: flex;
56 align-items: center;
57 justify-content: center;
58 }
59 .yatra-error-icon svg {
60 width: 40px;
61 height: 40px;
62 color: #d97706;
63 }
64 .yatra-error-icon.error {
65 background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
66 }
67 .yatra-error-icon.error svg {
68 color: #dc2626;
69 }
70 .yatra-error-title {
71 font-size: 26px;
72 font-weight: 700;
73 color: #1e293b;
74 margin: 0 0 12px;
75 line-height: 1.3;
76 }
77 .yatra-error-message {
78 font-size: 15px;
79 color: #64748b;
80 margin: 0 0 32px;
81 line-height: 1.6;
82 }
83 .yatra-error-actions {
84 display: flex;
85 flex-direction: column;
86 gap: 12px;
87 }
88 .yatra-error-btn {
89 display: inline-flex;
90 align-items: center;
91 justify-content: center;
92 gap: 10px;
93 padding: 14px 28px;
94 border-radius: 10px;
95 font-size: 15px;
96 font-weight: 600;
97 text-decoration: none;
98 transition: all 0.2s ease;
99 }
100 .yatra-error-btn-primary {
101 background: linear-gradient(135deg, var(--yatra-primary, #3b82f6) 0%, var(--yatra-primary-dark, #2563eb) 100%);
102 color: #ffffff;
103 box-shadow: 0 4px 14px 0 color-mix(in srgb, var(--yatra-primary, #3b82f6) 40%, transparent);
104 }
105 .yatra-error-btn-primary:hover {
106 transform: translateY(-2px);
107 box-shadow: 0 6px 20px 0 color-mix(in srgb, var(--yatra-primary, #3b82f6) 50%, transparent);
108 color: #ffffff;
109 }
110 .yatra-error-btn-secondary {
111 background: #f1f5f9;
112 color: #475569;
113 }
114 .yatra-error-btn-secondary:hover {
115 background: #e2e8f0;
116 color: #334155;
117 }
118 .yatra-error-divider {
119 display: flex;
120 align-items: center;
121 gap: 16px;
122 margin: 24px 0;
123 color: #94a3b8;
124 font-size: 13px;
125 }
126 .yatra-error-divider::before,
127 .yatra-error-divider::after {
128 content: '';
129 flex: 1;
130 height: 1px;
131 background: #e2e8f0;
132 }
133 </style>
134 <div class="yatra-error-page">
135 <div class="yatra-error-card">
136 <?php if ($booking->error === 'no_session') : ?>
137 <div class="yatra-error-icon">
138 <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
139 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"/>
140 </svg>
141 </div>
142 <h1 class="yatra-error-title"><?php esc_html_e('No Trip Selected', 'yatra'); ?></h1>
143 <p class="yatra-error-message">
144 <?php esc_html_e('It looks like you haven\'t selected a trip yet. Browse our amazing destinations and find your perfect adventure!', 'yatra'); ?>
145 </p>
146 <?php else : ?>
147 <div class="yatra-error-icon error">
148 <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
149 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
150 </svg>
151 </div>
152 <h1 class="yatra-error-title"><?php esc_html_e('Trip Not Available', 'yatra'); ?></h1>
153 <p class="yatra-error-message">
154 <?php esc_html_e('Sorry, the trip you\'re looking for is no longer available. Don\'t worry, we have plenty of other exciting adventures waiting for you!', 'yatra'); ?>
155 </p>
156 <?php endif; ?>
157 <div class="yatra-error-actions">
158 <a href="<?php echo esc_url(home_url('/' . \Yatra\Services\SettingsService::getTripBase() . '/')); ?>" class="yatra-error-btn yatra-error-btn-primary">
159 <svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24">
160 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
161 </svg>
162 <?php esc_html_e('Explore Trips', 'yatra'); ?>
163 </a>
164 <div class="yatra-error-divider"><?php esc_html_e('or', 'yatra'); ?></div>
165 <a href="<?php echo esc_url(home_url()); ?>" class="yatra-error-btn yatra-error-btn-secondary">
166 <svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24">
167 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"/>
168 </svg>
169 <?php esc_html_e('Back to Home', 'yatra'); ?>
170 </a>
171 </div>
172 </div>
173 </div>
174 <?php
175 yatra_get_footer();
176 exit;
177 }
178
179 // Extract data from booking object for easier access in template
180 $trip = $booking->trip;
181 $travel_date = $booking->travel_date;
182 $total_travelers = $booking->travelers;
183 $deposit_required = $booking->deposit_required;
184 $deposit_percentage = $booking->deposit_percentage;
185 $partial_payment = $booking->partial_payment;
186 $partial_payment_percentage = $booking->partial_payment_percentage;
187 $enabled_gateways = $booking->enabled_gateways;
188
189
190
191 yatra_get_header();
192
193 // Include the shared booking content partial
194 include YATRA_PLUGIN_PATH . 'templates/partials/booking-content.php';
195
196 yatra_get_footer();
197