/** * Get Availability */ public function getAvailability() { // init request $search = $this->search; $search->hotels_ids = $this->getHotelsIds(); $api_request = $this->apiRequest('search_results', $search); if (!$api_request) { return false; } // prepare availability object $availability = (object) []; $availability->errors = $api_request->errors; $availability->request = $api_request->request->data; if (isset($api_request->app)) { $availability->app = $api_request->app; $availability->app->voucher_text_html = CHLibDisplay::convertMarkdownToHtml($availability->app->voucher_text); } // inventory tasks if (isset($api_request->response->inventory)) { // prepare hotel info $availability->hotel = CHInventory::prepare($api_request->response->inventory[0]); // update inventory db foreach ($api_request->response->inventory as $inventory) { $this->_db->setQuery("DELETE FROM `#__chclient_inventory` WHERE id = {$inventory->id}")->execute(); $insert = (object) ['id' => $inventory->id, 'title' => $inventory->title, 'slug' => $inventory->slug, 'data' => json_encode($inventory)]; $this->_db->insertObject('#__chclient_inventory', $insert, 'id'); } } // check for errors if ($api_request->errors->errors) { // init calendar object if (isset($api_request->response->month_ari)) { $calendar = new stdClass(); $calendar->month = CHLibDate::getMonth(substr($search->start_date, 0, -3)); $calendar->months_list = CHLibDate::getMonthsList(); $calendar->ari = $api_request->response->month_ari; $availability->calendar = $calendar; } return $availability; } // prepare the info $availability->results = $api_request->response->results[0]; $availability->month_ari = $api_request->response->month_ari; return $availability; }
</small> </div> </div> <?php if ($currency != $hotel_currency) { ?> <p class="uk-alert"> <?php echo CHClient::string('property_currency'); ?> : <?php echo CHLibDisplay::money($booking->amounts->total, $hotel_currency); ?> <br><small><?php echo CHClient::string('exchange_notice'); ?> : <?php echo CHLibDisplay::money($booking->amounts->total_customer_currency, $currency); ?> = <?php echo CHLibDisplay::money($booking->amounts->total, $hotel_currency); ?> </small> </p> <?php } ?> </div>
<?php /** * @package CHClient * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; // load data $booking = $this->booking; $currency = CHLibDisplay::currencySymbol($booking->currency); $confirmed = $booking->booking_status < 20; $cancelled = $booking->booking_status >= 30; ?> <div class="uk-panel uk-panel-box"> <h3><?php echo CHClient::string('your_booking'); ?> </h3> <p><?php echo CHClient::string('thank_your_for_booking_with_us'); ?> </p> <div class="uk-text-center"> <p class="uk-margin-small"><a href="<?php echo JUri::current(); ?> ?print=1" data-ch-print-voucher class="uk-button uk-button-primary uk-width-8-10"><i class="uk-icon-print"></i> <?php echo CHClient::string('print_voucher');
} } ?> </div> </div> <div class="ch-available-room-price"> <div data-ch-room-price="unit-<?php echo $unit; ?> room-<?php echo $this->room->id; ?> "> <?php $amount = CHLibDisplay::money($this->available->rates[0]->currency->amount->{$first_board}, $currency); ?> <h4 data-ch-amount data-ch-amount-unit="<?php echo $unit; ?> " data-ch-amount-room="<?php echo $this->room->id; ?> "><?php echo $amount; ?> </h4> <a class="uk-button uk-button-primary uk-button-small ch-available-display-active" href="javascript:;" data-ch-reserve data-ch-hotel-title="<?php echo $hotel->title; ?> "><?php
echo $n; ?> " data-ch-upgrade-amount="<?php echo CHLibDisplay::money($room_extra->currency->amount * $n, $currency); ?> " data-ch-upgrade-sum="<?php echo $room_extra->currency->amount * $n; ?> " ><?php echo $n; ?> <?php echo $n ? ' ' . CHLibDisplay::money($room_extra->currency->amount * $n, $currency) : ''; ?> </option> <?php } ?> </select> </p> <!-- <button data-ch-upgrade-button type="button" class="uk-button"><?php echo CHClient::string('add'); ?> </button> --> </div> </div>
<a data-uk-modal href="#ch-modal-conditions"><?php echo CHClient::string('see_conditions'); ?> </a></p> </div> </div> <hr> <div class="uk-grid"> <div class="uk-width-medium-10-10 uk-text-right"> <button data-ch-book-submit data-ch-hotel-title="<?php echo $hotel->title; ?> " class="uk-button uk-button-primary uk-button-large"><?php echo $config->confirm_card_hosted ? CHClient::numstring(count($this->rooms->units), 'book_room') . ' ' . CHLibDisplay::money($this->data->currency_total, $currency) . ' <i class="uk-icon-lock"></i>' : CHClient::string('continue') . ' <i class="uk-icon-angle-right"></i>'; ?> </button> <br><small><?php echo CHClient::string('get_instant_confirmation'); ?> </small> </div> </div> </form> </div>
<?php /** * @package CHClient * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; // load assets CHClient::chassets(); // load engine data $config = CHClient::getConfig(); $search = CHClient::getSearch(); // get currency display $currency = CHLibDisplay::currencySymbol($this->availability->request->currency); ?> <div class="uk-panel"> <h2 class="uk-margin-small"><?php echo CHClient::string('upgrade_your_stay'); ?> </h2> <h4 class="uk-margin-small"><?php echo CHClient::string('upgrade_your_stay_tip'); ?> </h4> </div> <!-- results --> <div class="ch-upgrade-extras uk-margin-top">
/** * Render month row */ static function monthRow($first, $last, $month, $rooms, $ari, $filter_room = false, $start_empty_days = 0, $end_empty_days = 0) { $html = []; $today_int = CHLibDate::getDate()->format('Ymd'); $currency = isset($ari->currency) ? CHLibDisplay::currencySymbol($ari->currency) : ''; foreach ($rooms as $room) { // check room if ($filter_room && $room->id != $filter_room) { continue; } // prepare available & rates keys $room_ari = isset($ari->ari) ? CHLibData::getObjectFromList($ari->ari, $room->id, 'room_id') : 0; // generate html if (!$filter_room) { $title = '<div class="uk-vertical-align-middle">' . $room->title . '</div>'; $html[] = '<div class="uk-vertical-align ch-month-cell ch-month-cell-row ch-month-cell-title">' . $title . '</div>'; } // empty rows for ($i = 0; $i < $start_empty_days; $i++) { $html[] = '<div class="ch-month-cell ch-month-cell-row"></div>'; } foreach ($month->dates as $date) { // month rows $day = $date->day; if ($day < $first || $day > $last) { continue; } // get day data $date_int = str_replace('-', '', $date->date); $rate = '-'; $aclass = ''; $is_not_in_past = $date_int >= $today_int; if ($room_ari) { $has_availability = isset($room_ari->availability[$day - 1]); $has_rate_and_is_not_zero = isset($room_ari->rates[0]->rate[$day - 1]) && $room_ari->rates[0]->rate[$day - 1] > 0; if ($is_not_in_past && $has_availability && $has_rate_and_is_not_zero) { $rate = CHLibDisplay::money($room_ari->rates[0]->rate[$day - 1], $currency); $available = $room_ari->availability[$day - 1]; $aclass = 'ch-month-cell-span-available-' . ($available ? $available > 2 ? 'ok' : 'low' : 'no'); } } // cells $html[] = '<div class="ch-month-cell ch-month-cell-row ch-month-cell-day-' . $date->day_week . '">'; $html[] = '<small class="uk-text-muted ch-month-cell-span ch-month-cell-span-available ' . $aclass . '">' . $rate . '</small>'; $html[] = '</div>'; } // empty rows for ($i = 0; $i < $end_empty_days; $i++) { $html[] = '<div class="ch-month-cell ch-month-cell-row"></div>'; } } return implode("\n", $html); }
</small> </div> </div> <?php if ($hotel->currency != $this->availability->request->currency) { ?> <p class="uk-alert"> <?php echo CHClient::string('property_currency'); ?> : <?php echo CHLibDisplay::money($this->data->total, $hotel_currency); ?> <br><small><?php echo CHClient::string('exchange_notice'); ?> : <?php echo CHLibDisplay::money($this->data->currency_total, $currency); ?> = <?php echo CHLibDisplay::money($this->data->total, $hotel_currency); ?> </small> </p> <?php } ?> </div>
/** * Load required assets */ static function chassets() { // check if already loaded $app = self::getApp(); if (isset($app->chclient->assets)) { return; } // config $config = self::getConfig(); // chclient assets CHAssets::script('chclient', 'chclient.min.js'); CHAssets::style('chclient', 'chclient.min.css'); // credit card validator CHAssets::script('chclient/jquery-creditcardvalidator', 'jquery.creditCardValidator.min.js'); // required uikit components CHAssets::uikit_component('accordion'); CHAssets::uikit_component('datepicker'); CHAssets::uikit_component('form-select'); CHAssets::uikit_component('notify'); CHAssets::uikit_component('sticky'); CHAssets::uikit_component('tooltip'); // optional components if ($config->settings_uikit_form_advanced) { CHAssets::uikit_component('form-advanced'); } // javascript options $localeconv = CHLibDisplay::getLocaleconv(); $js = (object) []; $js->string_error = self::string('error_occurred'); $js->string_check_form = self::string('error_check_form'); $js->string_people = self::string('people'); $js->money_decimal = $localeconv['mon_decimal_point']; $js->money_thousands = $localeconv['mon_thousands_sep']; $js->datepicker_i18n = self::datePickerLocale(); $js->datepicker_min_date = CHLibDate::getDate()->format(CHLibDate::dateLocale()); $js->datepicker_format = str_replace('Y', 'YYYY', str_replace('m', 'MM', str_replace('d', 'DD', CHLibDate::dateLocale()))); $js->datepicker_weekstart = CHLibDate::weekStart(); $js->bootstrap_adapter = (int) $config->settings_bootstrap_adapter; CHAssets::script_declaration('window.chclient_options = ' . json_encode($js) . ';'); $app->chclient->assets = true; }
<?php } ?> </p> </div> </div> <hr> <?php } ?> <h2><?php echo CHClient::string('hotel_conditions'); ?> </h2> <?php echo CHLibDisplay::convertMarkdownToHtml($hotel->conditions_text_lang); ?> <hr> <?php echo CHLibDisplay::convertMarkdownToHtml($booking->app->voucher_text_lang);
?> </h4> <?php echo CHLibDisplay::convertMarkdownToHtml($vlang == 'hotel' ? $hotel->conditions_text : $hotel->conditions_text_lang); ?> <?php } ?> <hr/> <div class="small"> <?php echo CHLibDisplay::convertMarkdownToHtml($vlang == 'hotel' ? $booking->app->voucher_text : $booking->app->voucher_text_lang); ?> </div> </td> </tr> </table> </div> <!-- /CONTENT --> </td> <td></td> </tr> </table> <!-- /BODY --> <!-- FOOTER -->
-board> </span> <br> <i class="uk-icon-check-square-o"></i> <span data-ch-summary-unit-<?php echo $i; ?> -type> </span> </small> </p> <?php } ?> <p><strong><?php echo CHClient::string('booking_total'); ?> : <?php echo CHLibDisplay::money(0, $currency, 'data-ch-summary-total'); ?> </strong></p> <p><a class="uk-button uk-button-primary" data-ch-reserve data-ch-hotel-title="<?php echo $hotel->title; ?> "><?php echo CHClient::string('reserve'); ?> </a></p> </div> <!-- summary invalid selection --> <p data-ch-summary-invalid class="uk-hidden"><?php
</small> </div> </div> <?php } ?> <div class="uk-hidden" data-ch-upgrade-extra-template> <br> <i class="uk-icon-check-square-o"></i> {title} {n}: <strong>{amount}</strong> </div> <p><strong><?php echo CHClient::string('booking_total'); ?> : <?php echo CHLibDisplay::money($this->rooms->currency_total, $currency, 'data-ch-summary-total'); ?> </strong></p> <p><a class="uk-button uk-button-primary" data-ch-reserve data-ch-hotel-title="<?php echo $hotel->title; ?> "><?php echo CHClient::string('continue'); ?> <i class="uk-icon-angle-right"></i></a></p> </div> </div>
<?php if ($room->available < 3) { ?> <small class="ch-text-red"><?php echo CHClient::string('warn_available_' . $room->available); ?> </small><?php } ?> <?php echo $rate->free_cancellation ? '<small class="ch-text-block ch-text-green">' . CHClient::string('free_cancellation') . '</small>' : '<small>' . CHClient::string($rate->conditions) . '</small>'; ?> <span class="uk-float-right"> <span class="ch-text-block ch-text-green"><?php echo CHLibDisplay::money($amount, $currency); ?> </span> </span> </p> <?php } ?> <?php } ?> <?php