PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.11
Yatra – Travel Booking & Tour Operator Software v3.0.11
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 / remaining-checkout-content.php

remaining-checkout-content.php in Yatra – Travel Booking & Tour Operator Software 3.0.11, at templates/partials/remaining-checkout-content.php

179 lines 8.3 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 $booking = $booking ?? ($GLOBALS['yatra_booking'] ?? null);
7
8 if (!$booking || empty($booking->has_session)) {
9 echo '<div class="yatra-booking-error">' . esc_html__('No active booking session was found. Please initiate the remaining payment from your account page.', 'yatra') . '</div>';
10 return;
11 }
12
13 if (empty($booking->is_remaining_payment)) {
14 echo '<div class="yatra-booking-error">' . esc_html__('This page is only for remaining balance payments. Please use the regular booking form.', 'yatra') . '</div>';
15 return;
16 }
17
18 if (empty($booking->remaining_amount) || $booking->remaining_amount <= 0) {
19 echo '<div class="yatra-booking-error">' . esc_html__('This booking is already fully paid.', 'yatra') . '</div>';
20 return;
21 }
22
23 $trip = $booking->trip ?? null;
24
25 if (!$trip) {
26 echo '<div class="yatra-booking-error">' . esc_html__('Trip information is missing for this booking.', 'yatra') . '</div>';
27 return;
28 }
29
30 $trip_id = $trip->id;
31 $trip_slug = $trip->slug ?? '';
32 $travel_date = $booking->travel_date;
33 $total_travelers = $booking->travelers;
34 $remaining_amount = $booking->remaining_amount;
35 $amount_paid = $booking->amount_paid ?? 0;
36 $total_amount = $booking->total_amount ?? ($remaining_amount + $amount_paid);
37 $enabled_gateways = $booking->enabled_gateways ?? [];
38 $booking_reference = $booking->booking_reference ?? '';
39 $existing_booking_id = $booking->existing_booking_id ?? 0;
40 $pricing_type = $booking->pricing_type ?? 'regular';
41 $price_types = $booking->price_types ?? [];
42 $traveler_counts = $booking->traveler_counts ?? [];
43 $is_remaining_payment = true;
44 ?>
45
46 <div class="yatra-booking-layout">
47 <div class="yatra-booking-main">
48 <div class="yatra-booking-header">
49 <h1><?php esc_html_e('Pay Remaining Balance', 'yatra'); ?></h1>
50 <p class="yatra-booking-subtitle">
51 <?php
52 echo esc_html(
53 sprintf(
54 __('You are paying the remaining balance for Booking %s.', 'yatra'),
55 $booking_reference ? '#' . $booking_reference : __('(unknown)', 'yatra')
56 )
57 );
58 ?>
59 </p>
60 <div class="yatra-reference-badge">
61 <span><?php esc_html_e('Booking Reference', 'yatra'); ?></span>
62 <strong><?php echo esc_html($booking_reference ? '#' . $booking_reference : __('Not available', 'yatra')); ?></strong>
63 </div>
64 <div class="yatra-remaining-banner">
65 <div>
66 <strong><?php esc_html_e('Amount Due Now', 'yatra'); ?>:</strong>
67 <span><?php echo esc_html(yatra_format_price((float) $remaining_amount, null, false)); ?></span>
68 </div>
69 <div>
70 <strong><?php esc_html_e('Amount Paid', 'yatra'); ?>:</strong>
71 <span><?php echo esc_html(yatra_format_price((float) $amount_paid, null, false)); ?></span>
72 </div>
73 <div>
74 <strong><?php esc_html_e('Total Cost', 'yatra'); ?>:</strong>
75 <span><?php echo esc_html(yatra_format_price((float) $total_amount, null, false)); ?></span>
76 </div>
77 </div>
78 <div class="yatra-remaining-details">
79 <div class="yatra-remaining-detail">
80 <span><?php esc_html_e('Trip', 'yatra'); ?></span>
81 <strong><?php echo esc_html($trip->title); ?></strong>
82 </div>
83 <div class="yatra-remaining-detail">
84 <span><?php esc_html_e('Travel Date', 'yatra'); ?></span>
85 <strong><?php echo esc_html(date_i18n(get_option('date_format'), strtotime($travel_date))); ?></strong>
86 </div>
87 <div class="yatra-remaining-detail">
88 <span><?php esc_html_e('Travelers', 'yatra'); ?></span>
89 <strong><?php echo esc_html($total_travelers); ?></strong>
90 </div>
91 <div class="yatra-remaining-detail">
92 <span><?php esc_html_e('Status', 'yatra'); ?></span>
93 <strong><?php esc_html_e('Partial Payment', 'yatra'); ?></strong>
94 </div>
95 </div>
96 </div>
97
98 <form
99 class="yatra-booking-form"
100 id="yatra-booking-form"
101 data-payment-due="<?php echo esc_attr($remaining_amount); ?>"
102 data-is-remaining-payment="yes"
103 >
104 <?php
105 // Ensure the booking form partial knows we're in remaining-payment mode
106 $existing_booking_id = $existing_booking_id;
107 $booking_reference = $booking_reference;
108 $remaining_amount = $remaining_amount;
109 $amount_paid = $amount_paid;
110 $total_amount = $total_amount;
111 ?>
112 <?php include YATRA_PLUGIN_PATH . 'templates/partials/booking-form-fields.php'; ?>
113
114 <div class="yatra-booking-actions">
115 <button type="submit" class="yatra-booking-pay-btn" id="yatra-submit-booking">
116 <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
117 <rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect>
118 <line x1="1" y1="10" x2="23" y2="10"></line>
119 </svg>
120 <span id="pay-button-text"><?php esc_html_e('Pay Remaining Balance', 'yatra'); ?></span>
121 <span id="pay-amount"><?php echo esc_html(yatra_format_price((float) $remaining_amount, null, false)); ?></span>
122 </button>
123 <a href="<?php echo esc_url(home_url('/my-account?tab=bookings')); ?>" class="yatra-booking-cancel-btn">
124 <?php esc_html_e('Back to My Bookings', 'yatra'); ?>
125 </a>
126 </div>
127
128 <input type="hidden" name="trip_price" value="<?php echo esc_attr($trip->price); ?>">
129 <input type="hidden" name="currency" value="<?php echo esc_attr(\Yatra\Services\SettingsService::getCurrency()); ?>">
130 <?php wp_nonce_field('yatra_booking_nonce', 'yatra_booking_nonce'); ?>
131 </form>
132 </div>
133
134 <div class="yatra-booking-sidebar">
135 <div class="yatra-booking-summary">
136 <h3><?php esc_html_e('Booking Summary', 'yatra'); ?></h3>
137 <ul class="yatra-summary-list">
138 <li>
139 <span><?php esc_html_e('Trip', 'yatra'); ?>:</span>
140 <strong><?php echo esc_html($trip->title); ?></strong>
141 </li>
142 <li>
143 <span><?php esc_html_e('Travel Date', 'yatra'); ?>:</span>
144 <strong><?php echo esc_html(date_i18n(get_option('date_format'), strtotime($travel_date))); ?></strong>
145 </li>
146 <li>
147 <span><?php esc_html_e('Travelers', 'yatra'); ?>:</span>
148 <strong><?php echo esc_html($total_travelers); ?></strong>
149 </li>
150 </ul>
151
152 <div class="yatra-price-summary">
153 <div class="yatra-price-row">
154 <span><?php esc_html_e('Total Amount', 'yatra'); ?></span>
155 <strong><?php echo esc_html(yatra_format_price((float) $total_amount, null, false)); ?></strong>
156 </div>
157 <div class="yatra-price-row">
158 <span><?php esc_html_e('Paid', 'yatra'); ?></span>
159 <strong><?php echo esc_html(yatra_format_price((float) $amount_paid, null, false)); ?></strong>
160 </div>
161 <div class="yatra-price-row due">
162 <span><?php esc_html_e('Due Now', 'yatra'); ?></span>
163 <strong><?php echo esc_html(yatra_format_price((float) $remaining_amount, null, false)); ?></strong>
164 </div>
165 </div>
166
167 <div class="yatra-summary-info">
168 <h4><?php esc_html_e('Why pay now?', 'yatra'); ?></h4>
169 <ul>
170 <li><?php esc_html_e('Secure your spot instantly', 'yatra'); ?></li>
171 <li><?php esc_html_e('Receive updated confirmation via email', 'yatra'); ?></li>
172 <li><?php esc_html_e('Access travel documents inside your account', 'yatra'); ?></li>
173 </ul>
174 </div>
175
176 </div>
177 </div>
178 </div>
179