| @@ -259,8 +259,11 @@ | ||
| 259 | 259 | 'trip_id' => (int) $request->get_param('trip_id'), |
| 260 | 260 | 'search' => $request->get_param('search') ?: '', |
| 261 | 261 | 'date_from' => $request->get_param('date_from') ?: '', |
| 262 | 262 | 'date_to' => $request->get_param('date_to') ?: '', |
| 263 | + // Column sorting from the table headers — whitelisted in the repository. | |
| 264 | + 'orderby' => $request->get_param('orderby') ?: '', | |
| 265 | + 'order' => $request->get_param('order') ?: '', | |
| 263 | 266 | ]; |
| 264 | 267 | |
| 265 | 268 | // Delegate to service |
| 266 | 269 | $result = $this->bookingService->getBookings($filters); |
| @@ -805,12 +808,14 @@ | ||
| 805 | 808 | |
| 806 | 809 | $templateData = [ |
| 807 | 810 | 'company_name' => $companyName, |
| 808 | 811 | 'company_address' => $companyAddress, |
| 812 | + 'company_address_lines' => \Yatra\Helpers\FormatHelper::companyAddressLines(), | |
| 809 | 813 | 'company_email' => $companyEmail, |
| 810 | 814 | 'company_phone' => $companyPhone, |
| 811 | 815 | 'customer_name' => $customerName, |
| 812 | 816 | 'customer_email' => (string) ($booking['contact_email'] ?? $booking['customer_email'] ?? ''), |
| 817 | + 'customer_address_lines' => FormatHelper::customerAddressLines($booking), | |
| 813 | 818 | 'booking_ref' => $bookingRef, |
| 814 | 819 | 'booking_date' => $bookingDate, |
| 815 | 820 | 'booking_status' => ucfirst($statusRaw ?: 'pending'), |
| 816 | 821 | 'status_class' => in_array(strtolower($statusRaw), ['confirmed', 'completed', 'success'], true) ? 'confirmed' : |
| @@ -818,9 +823,15 @@ | ||
| 818 | 823 | 'trip_title' => $trip ? ($trip->title ?? $booking['trip_title'] ?? __('Trip Booking', 'yatra')) : ($booking['trip_title'] ?? __('Trip Booking', 'yatra')), |
| 819 | 824 | // Trip duration comes from duration_days/duration_nights (there is no |
| 820 | 825 | // `duration` column — accessing it caused a blank value + PHP notice). |
| 821 | 826 | 'trip_duration' => $trip |
| 822 | - ? yatra_format_duration((int) ($trip->duration_days ?? 0), isset($trip->duration_nights) ? (int) $trip->duration_nights : null) | |
| 827 | + ? yatra_format_duration( | |
| 828 | + (int) ($trip->duration_days ?? 0), | |
| 829 | + isset($trip->duration_nights) ? (int) $trip->duration_nights : null, | |
| 830 | + // Hour-based day tours: "8 hours" instead of "1 day". Absent | |
| 831 | + // or NULL on every day-based trip, which keeps its wording. | |
| 832 | + (int) ($trip->duration_hours ?? 0) | |
| 833 | + ) | |
| 823 | 834 | : '', |
| 824 | 835 | 'trip_difficulty' => $trip ? ($trip->difficulty_name ?? '') : '', |
| 825 | 836 | 'departure_location' => $trip ? ($trip->departure_location ?? '') : '', |
| 826 | 837 | 'destination' => $trip ? ($trip->destination ?? '') : '', |
| @@ -826,11 +837,11 @@ | ||
| 826 | 837 | 'destination' => $trip ? ($trip->destination ?? '') : '', |
| 827 | 838 | 'travel_date' => $travelDate, |
| 828 | 839 | 'return_date' => $returnDate, |
| 829 | 840 | 'currency_symbol' => $currencySymbol, |
| 830 | - 'total_amount' => number_format((float) ($booking['total_amount'] ?? 0), 2), | |
| 831 | - 'amount_paid' => number_format((float) ($booking['amount_paid'] ?? 0), 2), | |
| 832 | - 'amount_due' => number_format((float) ($booking['amount_due'] ?? 0), 2), | |
| 841 | + 'total_amount' => yatra_format_price((float) ($booking['total_amount'] ?? 0), $currency, false), | |
| 842 | + 'amount_paid' => yatra_format_price((float) ($booking['amount_paid'] ?? 0), $currency, false), | |
| 843 | + 'amount_due' => yatra_format_price((float) ($booking['amount_due'] ?? 0), $currency, false), | |
| 833 | 844 | 'traveler_count' => (int) ($booking['travelers_count'] ?? $booking['travelers'] ?? 1), |
| 834 | 845 | ]; |
| 835 | 846 | |
| 836 | 847 | $pdfService = new PdfService(); |