Merge branch 'develop' into gli-1840
This commit is contained in:
@@ -60,22 +60,39 @@ $exclude_packs = (bool)Tools::getValue('exclude_packs', true);
|
||||
|
||||
$bookingProduct = (int) Tools::getValue('booking_product');
|
||||
|
||||
$idHotel = (int) Tools::getValue('id_hotel');
|
||||
|
||||
$context = Context::getContext();
|
||||
|
||||
$sql = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)$context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
$sqlSelect = 'SELECT p.`id_product`, pl.`link_rewrite`, p.`reference`, pl.`name`, image_shop.`id_image` id_image, il.`legend`, p.`cache_default_attribute`';
|
||||
|
||||
$sqlFrom = ' FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p');
|
||||
|
||||
$sqlJoin =' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
|
||||
ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$context->language->id.')
|
||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
ON (image_shop.`id_product` = p.`id_product` AND image_shop.`cover`=1 AND image_shop.`id_shop`='.(int) $context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int) $context->language->id.')';
|
||||
|
||||
$sqlWhere = ' WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||
(!empty($excludePackItself) ? ' AND p.id_product <> '.$excludePackItself.' ' : ' ').
|
||||
($excludeVirtuals ? 'AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '').
|
||||
($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : '').
|
||||
($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : '').
|
||||
' GROUP BY p.id_product';
|
||||
($bookingProduct ? 'AND p.`booking_product` = '.(int) $bookingProduct : '');
|
||||
|
||||
$sqlGroupBy = ' GROUP BY p.id_product';
|
||||
|
||||
if ($idHotel && $bookingProduct) {
|
||||
// To get hotel info for the booking product only
|
||||
$sqlSelect .= ', hbil.`hotel_name`, hbil.`id` AS id_hotel ';
|
||||
$sqlJoin .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON hrt.`id_product` = p.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON pl.`id_lang` = hbil.`id_lang` AND hbil.`id` = hrt.`id_hotel`';
|
||||
$sqlWhere .= ' AND hbil.`id`='.(int) $idHotel ;
|
||||
}
|
||||
|
||||
$sql = $sqlSelect.' '.$sqlFrom.' '.$sqlJoin.' '.$sqlWhere.' '.$sqlGroupBy;
|
||||
|
||||
$items = Db::getInstance()->executeS($sql);
|
||||
|
||||
|
||||
@@ -227,27 +227,34 @@
|
||||
</td>
|
||||
<td class="product_action">
|
||||
<div class="btn-group">
|
||||
<button href="#" class="btn btn-default edit_room_change_link" data-product_line_data="{$data|json_encode|escape}">
|
||||
<i class="icon-pencil"></i>
|
||||
{l s='Edit'}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}'>
|
||||
<i class="icon-refresh"></i>
|
||||
{l s='Reallocate/Swap Room'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="delete_room_line">
|
||||
<i class="icon-trash"></i>
|
||||
{l s='Delete'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_cancelled}
|
||||
<button href="#" class="btn btn-default delete_room_line">
|
||||
<i class="icon-trash"></i>
|
||||
{l s='Delete'}
|
||||
</button>
|
||||
{else}
|
||||
<button href="#" class="btn btn-default edit_room_change_link" data-product_line_data="{$data|json_encode|escape}">
|
||||
<i class="icon-pencil"></i>
|
||||
{l s='Edit'}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<a href="#" class="room_reallocate_swap" id="reallocate_room_{$data['id']}" data-room_type_name="{$data['room_type_name']}" data-toggle="modal" data-target="#mySwappigModal" data-id_htl_booking="{$data['id']}" data-room_num='{$data.room_num}' data-id_room_type='{$data.id_product}' data-cust_name='{$data.alloted_cust_name}' data-cust_email='{$data.alloted_cust_email}' data-avail_rm_swap='{$data.avail_rooms_to_swap|@json_encode}' data-avail_realloc_room_types='{$data.avail_room_types_to_realloc|@json_encode}'>
|
||||
<i class="icon-refresh"></i>
|
||||
{l s='Reallocate/Swap Room'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="delete_room_line">
|
||||
<i class="icon-trash"></i>
|
||||
{l s='Delete'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
{/if}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -869,7 +869,7 @@
|
||||
<div class="panel" id="refundForm">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-bed"></i> {l s='Rooms Booking Detail'} <span class="badge">{$order_detail_data|@count}</span>
|
||||
{if !$order->hasBeenDelivered()}
|
||||
{if !$order->hasBeenDelivered() && $currentState->id != Configuration::get('PS_OS_REFUND') && $currentState->id != Configuration::get('PS_OS_CANCELED')}
|
||||
<button type="button" id="add_room" class="btn btn-primary pull-right">
|
||||
<i class="icon-plus-sign"></i> {l s='Add Rooms'}
|
||||
</button>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*}
|
||||
|
||||
<div class="modal-body">
|
||||
<form action="{$current_index}&viewOrder&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'html':'UTF-8'}{/if}" method="post">
|
||||
<form action="{$current_index}&vieworder&id_order={$order->id}{if isset($smarty.get.token)}&token={$smarty.get.token|escape:'html':'UTF-8'}{/if}" method="post">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{l s='Note Detail'}</label>
|
||||
<input type="hidden" name="id_order_invoice" id="id_order_invoice" value="" />
|
||||
|
||||
@@ -33,17 +33,25 @@
|
||||
<div class="col-sm-6 room_check_in_div">
|
||||
<label class="control-label">{l s='Check-In'}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control edit_product_date_from" readonly/>
|
||||
<input type="hidden" class="edit_product_date_from_actual" name="edit_product[date_from]"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
|
||||
{dateFormat date=$data.date_from}
|
||||
{else}
|
||||
<input type="text" class="form-control edit_product_date_from" readonly/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 room_check_out_div">
|
||||
<label class="control-label">{l s='Check-Out'}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control edit_product_date_to" readonly/>
|
||||
<input type="hidden" class="edit_product_date_to_actual" name="edit_product[date_to]"/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
{if isset($refundReqBookings) && $refundReqBookings && $data.id|in_array:$refundReqBookings && $data.is_refunded}
|
||||
{dateFormat date=$data.date_to}
|
||||
{else}
|
||||
<input type="text" class="form-control edit_product_date_to" readonly/>
|
||||
<div class="input-group-addon"><i class="icon-calendar"></i></div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
$(form).find('table.table .field_optional').hide();
|
||||
$(form).find('table.table .field_optional').each(function(i, val) {
|
||||
if (list_fields_visibility.includes($(this).data('key'))) {
|
||||
$(this).show();
|
||||
$(this).css('display', '');
|
||||
}
|
||||
});
|
||||
updateListVisibility(list_fields_visibility)
|
||||
@@ -553,10 +553,11 @@
|
||||
<style>
|
||||
@media (max-width: 992px) {
|
||||
{foreach from=$fields_display item=param name=params}
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
.table-responsive-row td:nth-of-type({math equation="x+y" x=$smarty.foreach.params.index y=$y}):before {
|
||||
{if isset($param.displayed) && $param.displayed === false}{continue}{/if}
|
||||
.table-responsive-row td:nth-of-type({$y}):before {
|
||||
content: "{$param.title}";
|
||||
}
|
||||
{assign var=y value=$y+1}
|
||||
{/foreach}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -483,6 +483,14 @@ class AddressCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
public function cacheFieldsRequiredDatabase($all = false)
|
||||
{
|
||||
parent::cacheFieldsRequiredDatabase($all);
|
||||
if ($this->id_hotel) {
|
||||
self::$fieldsRequiredDatabase['Address'] = array();
|
||||
}
|
||||
}
|
||||
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
|
||||
@@ -374,7 +374,7 @@ class CartCore extends ObjectModel
|
||||
if ($cart_vat_amount == 0 || $cart_amount_te == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return Tools::ps_round($cart_vat_amount / $cart_amount_te, 3);
|
||||
return Tools::ps_round($cart_vat_amount / $cart_amount_te, 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,6 +294,13 @@ class CartRuleCore extends ObjectModel
|
||||
return array();
|
||||
}
|
||||
|
||||
// Remove cart rule that does not match the id_customer
|
||||
foreach ($result as $key => $cart_rule) {
|
||||
if ($cart_rule['id_customer'] && $cart_rule['id_customer'] != $id_customer) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove cart rule that does not match the customer groups
|
||||
$customerGroups = Customer::getGroupsStatic($id_customer);
|
||||
|
||||
@@ -1154,6 +1161,18 @@ class CartRuleCore extends ObjectModel
|
||||
$previous_reduction_amount = $prorata * $previous_reduction_amount * (1 + $cart_average_vat_rate);
|
||||
}
|
||||
|
||||
// First we convert the voucher value to the default currency
|
||||
$previousCartRuleCurrency = new Currency($this->reduction_currency);
|
||||
|
||||
if ($previous_reduction_amount == 0 || $previousCartRuleCurrency->conversion_rate == 0) {
|
||||
$previous_reduction_amount = 0;
|
||||
} else {
|
||||
$previous_reduction_amount /= $previousCartRuleCurrency->conversion_rate;
|
||||
}
|
||||
|
||||
// Then we convert the voucher value in the default currency into the cart currency
|
||||
$previous_reduction_amount *= $context->currency->conversion_rate;
|
||||
$previous_reduction_amount = Tools::ps_round($previous_reduction_amount, _PS_PRICE_COMPUTE_PRECISION_);
|
||||
$current_cart_amount = max($current_cart_amount - (float)$previous_reduction_amount, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,11 @@ class NotificationCore
|
||||
SELECT SQL_CALC_FOUND_ROWS o.`id_order`, o.`id_customer`, o.`total_paid`, o.`id_currency`, o.`date_upd`, c.`firstname`, c.`lastname`
|
||||
FROM `'._DB_PREFIX_.'orders` as o
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` as c ON (c.`id_customer` = o.`id_customer`)
|
||||
WHERE `id_order` > '.(int)$id_last_element.
|
||||
Shop::addSqlRestriction(false, 'o').'
|
||||
ORDER BY `id_order` DESC
|
||||
LEFT JOIN '._DB_PREFIX_.'htl_booking_detail hbd ON (hbd.id_order = o.id_order)
|
||||
WHERE o.`id_order` > '.(int)$id_last_element.
|
||||
Shop::addSqlRestriction(false, 'o'). HotelBranchInformation::addHotelRestriction(false, 'hbd').'
|
||||
GROUP BY o.`id_order`
|
||||
ORDER BY o.`id_order` DESC
|
||||
LIMIT 5';
|
||||
break;
|
||||
|
||||
|
||||
@@ -2313,6 +2313,7 @@ class AdminControllerCore extends Controller
|
||||
public function ajaxProcessRefreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
$this->status = Module::refreshModuleList($force_reload_cache);
|
||||
$this->ajaxDie(json_encode(array('status' => $this->status)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -797,8 +797,9 @@ class OrderCore extends ObjectModel
|
||||
|
||||
public function getTaxesAverageUsed()
|
||||
{
|
||||
// @todo should use order table to get tax average
|
||||
return Cart::getTaxesAverageUsed((int)$this->id_cart);
|
||||
$cart = new Cart((int) $this->id_cart);
|
||||
|
||||
return $cart->getAverageProductsTaxRate() * 100;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2687,4 +2688,133 @@ class OrderCore extends ObjectModel
|
||||
{
|
||||
$this->transaction_id = $transactionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and change order status
|
||||
* @return array of status, errors, has_mail_error(if order status is changes but mail error occurs while sending mail)
|
||||
*/
|
||||
public function ChangeOrderStatus()
|
||||
{
|
||||
$result = array();
|
||||
$result['status'] = false;
|
||||
$result['has_mail_error'] = false;
|
||||
$result['errors'] = array();
|
||||
$objNewOrderState = new OrderState(Tools::getValue('id_order_state'));
|
||||
if (!Validate::isLoadedObject($objNewOrderState)) {
|
||||
$result['errors'][] = Tools::displayError('The new order status is invalid.');
|
||||
} else {
|
||||
$objHotelBooking = new HotelBookingDetail();
|
||||
$objCurrentOrderState = $this->getCurrentOrderState();
|
||||
|
||||
if ($objCurrentOrderState->id == Configuration::get('PS_OS_REFUND')) {
|
||||
$result['errors'][] = Tools::displayError('Order status can not be changed once order status is set to Refunded.');
|
||||
} elseif ($objCurrentOrderState->id == Configuration::get('PS_OS_CANCELED')) {
|
||||
$result['errors'][] = Tools::displayError('Order status can not be changed once order status is set to Cancelled.');
|
||||
} elseif (in_array($objNewOrderState->id, array (Configuration::get('PS_OS_OVERBOOKING_PAID'), Configuration::get('PS_OS_OVERBOOKING_UNPAID'), Configuration::get('PS_OS_OVERBOOKING_PARTIAL_PAID')))) {
|
||||
if (!$objHotelBooking->getOverbookedRooms($this->id)) {
|
||||
$result['errors'][] = Tools::displayError('Order status can not be changed to any overbooking status as there are no overbooked rooms in the order.');
|
||||
}
|
||||
} elseif ($objNewOrderState->id == Configuration::get('PS_OS_REFUND')
|
||||
&& !$this->hasCompletelyRefunded(Order::ORDER_COMPLETE_REFUND_FLAG)
|
||||
) {
|
||||
$result['errors'][] = Tools::displayError('Order status can not be set to Refunded until all bookings in the order are completely refunded.');
|
||||
} elseif ($objNewOrderState->id == Configuration::get('PS_OS_CANCELED')
|
||||
&& !$this->hasCompletelyRefunded(Order::ORDER_COMPLETE_CANCELLATION_FLAG)
|
||||
) {
|
||||
$result['errors'][] = Tools::displayError('Order status can not be set to Cancelled until all bookings in the order are cancelled.');
|
||||
} elseif ($objCurrentOrderState->id == Configuration::get('PS_OS_ERROR') && !($objNewOrderState->id == Configuration::get('PS_OS_ERROR'))) {
|
||||
// All rooms must be available before changing status from Payment Error to Other status in which rooms are getting blocked again
|
||||
if ($orderBookings = $objHotelBooking->getOrderCurrentDataByOrderId($this->id)) {
|
||||
foreach ($orderBookings as $orderBooking) {
|
||||
// If booking is refunded then no need to check inventory
|
||||
if ((OrderReturn::getOrdersReturnDetail($this->id, 0, $orderBooking['id']) && $orderBooking['is_refunded'])
|
||||
|| ($orderBooking['is_cancelled'] && $orderBooking['is_refunded'])
|
||||
) {
|
||||
continue;
|
||||
} else {
|
||||
// if inventory is available for that booking
|
||||
$bookingParams = array(
|
||||
'date_from' => $orderBooking['date_from'],
|
||||
'date_to' => $orderBooking['date_to'],
|
||||
'hotel_id' => $orderBooking['id_hotel'],
|
||||
'id_room_type' => $orderBooking['id_product'],
|
||||
'only_search_data' => 1
|
||||
);
|
||||
|
||||
$objHotelBookingDetail = new HotelBookingDetail($orderBooking['id']);
|
||||
if ($searchRoomsInfo = $objHotelBooking->getBookingData($bookingParams)) {
|
||||
if (isset($searchRoomsInfo['rm_data'][$orderBooking['id_product']]['data']['available'])
|
||||
&& $searchRoomsInfo['rm_data'][$orderBooking['id_product']]['data']['available']
|
||||
) {
|
||||
$availableRoomsInfo = $searchRoomsInfo['rm_data'][$orderBooking['id_product']]['data']['available'];
|
||||
if ($roomIdsAvailable = array_column($availableRoomsInfo, 'id_room')) {
|
||||
// Check If room is still there in the available rooms list
|
||||
if (!in_array($orderBooking['id_room'], $roomIdsAvailable)) {
|
||||
$result['errors'][] = Tools::displayError('You can not change the order status as some rooms are not available now in this order. You can reallocate/swap rooms with other rooms to make rooms available and then change the order status.');
|
||||
|
||||
break;
|
||||
} else {
|
||||
$objHotelBookingDetail->is_refunded = 0;
|
||||
$objHotelBookingDetail->save();
|
||||
}
|
||||
} else {
|
||||
$result['errors'][] = Tools::displayError('You can not change the order status as some rooms are not available now in this order. You can reallocate/swap rooms with other rooms to make rooms available and then change the order status.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result['errors'][] = Tools::displayError('You can not change the order status as some rooms are not available now in this order. You can reallocate/swap rooms with other rooms to make rooms available and then change the order status.');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($objCurrentOrderState->id == $objNewOrderState->id) {
|
||||
$result['errors'][] = Tools::displayError('The order has already been assigned this status.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($result['errors'])) {
|
||||
// Create new OrderHistory
|
||||
$context = Context::getContext();
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = $this->id;
|
||||
$history->id_employee = (int)$context->employee->id;
|
||||
|
||||
$useExistingsPayment = false;
|
||||
if (!$this->hasInvoice()) {
|
||||
$useExistingsPayment = true;
|
||||
}
|
||||
$history->changeIdOrderState((int)$objNewOrderState->id, $this, $useExistingsPayment);
|
||||
|
||||
// Save all changes
|
||||
$templateVars = array();
|
||||
if ($history->add(true)) {
|
||||
if (!$history->sendEmail($this, $templateVars)) {
|
||||
// if an error occurred while sending an email the set has_mail_error to true
|
||||
$result['has_mail_error'] = true;
|
||||
$result['errors'][] = Tools::displayError('We were unable to send an email to the customer while changing order status.');
|
||||
}
|
||||
|
||||
// synchronizes quantities if needed..
|
||||
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
|
||||
foreach ($this->getProducts() as $product) {
|
||||
if (StockAvailable::dependsOnStock($product['product_id'])) {
|
||||
StockAvailable::synchronize($product['product_id'], (int)$product['id_shop']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result['errors'][] = Tools::displayError('An error occurred while changing order status.');
|
||||
}
|
||||
}
|
||||
|
||||
// if no errors then return status true
|
||||
if (!count($result['errors'])) {
|
||||
$result['status'] = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ class AdminCartsControllerCore extends AdminController
|
||||
$this->allow_export = true;
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->_select = 'CONCAT(c.`firstname`, \' \', c.`lastname`) `customer`, a.id_cart total,
|
||||
TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) AS `time_diff`,
|
||||
|
||||
IFNULL(GROUP_CONCAT(DISTINCT o.`id_order`), 0) AS `ids_order`,
|
||||
IF (IFNULL(o.id_order, \''.$this->l('Non ordered cart').'\') = \''.$this->l('Non ordered cart').'\', IF(TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) > 86400, \''.$this->l('Abandoned cart').'\', \''.$this->l('Non ordered cart').'\'), GROUP_CONCAT(DISTINCT o.`id_order`)) AS filter_ids_order,
|
||||
IF (IFNULL(o.id_order, \''.$this->l('Non ordered cart').'\') = \''.$this->l('Non ordered cart').'\', IF(TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', a.`date_add`)) > '._TIME_1_DAY_.', \''.$this->l('Abandoned cart').'\', \''.$this->l('Non ordered cart').'\'), GROUP_CONCAT(DISTINCT o.`id_order`)) AS filter_ids_order,
|
||||
IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest';
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
|
||||
LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
|
||||
@@ -54,10 +54,6 @@ class AdminCartsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', co.`date_add`)) < 1800)';
|
||||
$this->_group = ' GROUP BY a.`id_cart`';
|
||||
|
||||
if (Tools::getValue('action') == 'filterOnlyAbandonedCarts') {
|
||||
$this->_filterHaving = ' AND `ids_order` = 0 AND `time_diff` > 86400';
|
||||
}
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_cart' => array(
|
||||
'title' => $this->l('ID'),
|
||||
@@ -96,7 +92,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
'type' => 'bool',
|
||||
'havingFilter' => true,
|
||||
'class' => 'fixed-width-xs',
|
||||
'icon' => array(0 => 'icon-', 1 => 'icon-user')
|
||||
'callback' => 'getOnlineStatus',
|
||||
)
|
||||
);
|
||||
$this->shopLinkType = 'shop';
|
||||
@@ -117,10 +113,32 @@ class AdminCartsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->list_no_link = true;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::getValue('action') == 'filterOnlyAbandonedCarts') {
|
||||
$this->processResetFilters();
|
||||
$this->context->cookie->{'submitFilter'.$this->table} = true;
|
||||
$prefix = $this->getCookieFilterPrefix();
|
||||
$this->context->cookie->{$prefix.$this->table.'Filter_filter_ids_order'} = $this->l('Abandoned cart');
|
||||
if (($dateFrom = Tools::getValue('date_from'))
|
||||
&& ($dateTo = Tools::getValue('date_to'))
|
||||
&& strtotime($dateTo) >= strtotime($dateFrom)
|
||||
) {
|
||||
//Updating the date format of the filter dates to the required format.
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d', strtotime($dateTo));
|
||||
$this->context->cookie->{$prefix.$this->table.'Filter_'.$this->fields_list['date_add']['filter_key']} = json_encode(array($dateFrom, $dateTo));
|
||||
}
|
||||
|
||||
$this->redirect_after = $this->context->link->getAdminLink('AdminCarts');
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function getOrderColumn($idsOrder, $tr)
|
||||
{
|
||||
$smartyVars = array();
|
||||
@@ -129,7 +147,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$smartyVars['type'] = 'orders';
|
||||
$smartyVars['ids_order'] = $idsOrder;
|
||||
} else {
|
||||
if ($tr['time_diff'] > 86400) {
|
||||
if ($tr['time_diff'] > _TIME_1_DAY_) {
|
||||
$smartyVars['type'] = 'abandoned';
|
||||
} else {
|
||||
$smartyVars['type'] = 'non_orderd';
|
||||
@@ -143,6 +161,11 @@ class AdminCartsControllerCore extends AdminController
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function getOnlineStatus($status)
|
||||
{
|
||||
return $status ? $this->l('Yes') : $this->l('No');
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (empty($this->display)) {
|
||||
@@ -184,7 +207,7 @@ class AdminCartsControllerCore extends AdminController
|
||||
$date_from = date(Context::getContext()->language->date_format_lite, strtotime('-2 day'));
|
||||
$date_to = date(Context::getContext()->language->date_format_lite, strtotime('-1 day'));
|
||||
$helper->subtitle = sprintf($this->l('From %s to %s', null, null, false), $date_from, $date_to);
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts&date_from='.$date_from.'&date_to='.$date_to;
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||
$kpis[] = $helper;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -78,13 +78,15 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
return $visits;
|
||||
}
|
||||
|
||||
public static function getAbandonedCarts($date_from, $date_to)
|
||||
|
||||
public static function getAbandonedCarts($date_from, $date_to, $timeDiff = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(DISTINCT id_guest)
|
||||
FROM `'._DB_PREFIX_.'cart`
|
||||
WHERE `date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"
|
||||
AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'orders` WHERE `'._DB_PREFIX_.'orders`.id_cart = `'._DB_PREFIX_.'cart`.id_cart)
|
||||
SELECT COUNT(`id_cart`)
|
||||
FROM `'._DB_PREFIX_.'cart` c
|
||||
WHERE `date_add` BETWEEN "'.pSQL($date_from).'" AND "'.pSQL($date_to).'"'.
|
||||
(($timeDiff) ? 'AND TIME_TO_SEC(TIMEDIFF(\''.pSQL(date('Y-m-d H:i:00', time())).'\', `date_add`)) > '.$timeDiff : ' ').'
|
||||
AND NOT EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'orders` o WHERE o.`id_cart` = c.`id_cart`)
|
||||
'.Shop::addSqlRestriction());
|
||||
}
|
||||
|
||||
@@ -638,7 +640,11 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
break;
|
||||
|
||||
case 'abandoned_cart':
|
||||
$value = AdminStatsController::getAbandonedCarts(date('Y-m-d H:i:s', strtotime('-2 day')), date('Y-m-d H:i:s', strtotime('-1 day')));
|
||||
$value = AdminStatsController::getAbandonedCarts(
|
||||
date('Y-m-d', strtotime('-2 day')).' 0:0:0',
|
||||
date('Y-m-d', strtotime('-1 day')).' 23:59:59',
|
||||
_TIME_1_DAY_
|
||||
);
|
||||
break;
|
||||
|
||||
case 'installed_modules':
|
||||
|
||||
@@ -438,6 +438,12 @@ class AuthControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
if (!Tools::getValue('is_new_customer', 1)) {
|
||||
if ($idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)) {
|
||||
$customer = new Customer($idCustomer);
|
||||
}
|
||||
}
|
||||
|
||||
$this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
|
||||
|
||||
// Check the requires fields which are settings in the BO
|
||||
@@ -601,13 +607,7 @@ class AuthControllerCore extends FrontController
|
||||
$customer->active = 1;
|
||||
// New Guest customer
|
||||
if (Tools::isSubmit('is_new_customer')) {
|
||||
if (isset($idCustomer) && $idCustomer) {
|
||||
// update guest customer details
|
||||
$customer = new Customer($idCustomer);
|
||||
$customer->firstname = Tools::getValue('firstname');
|
||||
$customer->lastname = Tools::getValue('lastname');
|
||||
}
|
||||
$customer->is_guest = 1;
|
||||
$customer->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
} else {
|
||||
$customer->is_guest = 0;
|
||||
}
|
||||
|
||||
@@ -181,22 +181,6 @@ class CategoryControllerCore extends FrontController
|
||||
|
||||
$booking_data = $objBookingDetail->dataForFrontSearch($bookingParams);
|
||||
|
||||
// set default occupancies in required format
|
||||
if (isset($booking_data['rm_data']) && $booking_data['rm_data']) {
|
||||
foreach ($booking_data['rm_data'] as &$roomTypeData) {
|
||||
$occupancy = array(
|
||||
array(
|
||||
'adults' => $roomTypeData['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
$roomTypeData['occupancies'] = $occupancy;
|
||||
$roomTypeData['occupancy_adults'] = $roomTypeData['adults']; // only one room by default
|
||||
}
|
||||
}
|
||||
|
||||
$obj_booking_detail = new HotelBookingDetail();
|
||||
$num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to);
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
public function initContent()
|
||||
{
|
||||
// validate room types before payment by customer
|
||||
$orderRestrictErr = HotelCartBookingData::validateCartBookings();
|
||||
$this->errors = HotelCartBookingData::validateCartBookings();
|
||||
|
||||
parent::initContent();
|
||||
|
||||
@@ -494,7 +494,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
// $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'orderRestrictErr' => $orderRestrictErr,
|
||||
'orderRestrictErr' => count($this->errors) ? 1 : 0,
|
||||
// 'allDemands' => $allDemands,
|
||||
// 'defaultcurrencySign' => $objCurrency->sign,
|
||||
'THEME_DIR' => _THEME_DIR_,
|
||||
|
||||
@@ -429,14 +429,27 @@ class ProductControllerCore extends FrontController
|
||||
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY) {
|
||||
$occupancy_value = 1;
|
||||
} else {
|
||||
$occupancy_value = array(
|
||||
array(
|
||||
'adults' => $room_info_by_product_id['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
$useDefaultOccupancy = true;
|
||||
// if coming from hotel page do not set occupancy, otherwise set base adult occupancy
|
||||
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] == Tools::secureReferrer($_SERVER['HTTP_REFERER'])) { // Assure us the previous page was one of the site
|
||||
$idCategoryHotel = $hotel_branch_obj->id_category;
|
||||
$categoryPageLink = $this->context->link->getCategoryLink($idCategoryHotel);
|
||||
if (Tools::strpos($_SERVER['HTTP_REFERER'], $categoryPageLink) === 0) {
|
||||
$useDefaultOccupancy = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($useDefaultOccupancy) {
|
||||
$occupancy_value = array(
|
||||
array(
|
||||
'adults' => $room_info_by_product_id['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->assignBookingFormVars($this->product->id, $date_from, $date_to, $occupancy_value);
|
||||
$this->assignServiceProductVars();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Получено частично плащане</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>আংশিক পেমেন্ট প্রাপ্ত</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Pagamento parcial recebido</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Částečná platba přijata</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Teilzahlung erhalten</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Partial payment received</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Pago parcial recibido</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>پرداخت جزئی دریافت شد</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Paiement partiel reçu</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>תשלום חלקי התקבל</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Primljena djelomična uplata</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Részleges kifizetés megérkezett</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Pembayaran sebagian diterima</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Pagamento parziale ricevuto</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Gautas dalinis apmokėjimas</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Примено е делумно плаќање</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Gedeeltelijke betaling ontvangen</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Partial payment received</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Otrzymano częściową płatność</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Pagamento parcial recebido</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Paiement partiel reçu</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Plata parțială primită</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Частичная оплата получена</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>අර්ධ ගෙවීමක් ලැබී ඇත</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Делимична уплата примљена</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Delbetalning mottagen</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>已收到部分付款</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>Đã nhận được một phần thanh toán</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<template/>
|
||||
</order_state>
|
||||
<order_state id="Partial_payment_accepted">
|
||||
<name>Partial payment accepted</name>
|
||||
<template>payment_accepted</template>
|
||||
<name>已收到部分付款</name>
|
||||
<template>partial_payment_accepted</template>
|
||||
</order_state>
|
||||
</entity_order_state>
|
||||
|
||||
@@ -90,10 +90,10 @@ div#leftpannel{
|
||||
}
|
||||
|
||||
div#buttons{
|
||||
clear:both;
|
||||
margin:0 0 0 295px;
|
||||
height:60px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
width:650px;
|
||||
padding:0 14px;
|
||||
}
|
||||
* html div#buttons {
|
||||
margin-bottom:60px;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
</div><!-- div id="sheet_step" -->
|
||||
</div><!-- div id="sheets" -->
|
||||
|
||||
<div id="buttons">
|
||||
<?php if (!$this->isLastStep()): ?>
|
||||
<?php if ($this->next_button): ?>
|
||||
<input id="btNext" class="button little" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" />
|
||||
<?php else: ?>
|
||||
<input id="btNext" class="button little disabled" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" disabled="disabled" />
|
||||
<div id="buttons" class="clearfix">
|
||||
<?php if (!$this->isLastStep()): ?>
|
||||
<?php if ($this->next_button): ?>
|
||||
<input id="btNext" class="button little" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" />
|
||||
<?php else: ?>
|
||||
<input id="btNext" class="button little disabled" type="submit" name="submitNext" value="<?php echo $this->l('Next') ?>" disabled="disabled" />
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$this->isFirstStep() && $this->previous_button): ?>
|
||||
<input id="btBack" class="button little" type="submit" name="submitPrevious" value="<?php echo $this->l('Back') ?>" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!$this->isFirstStep() && $this->previous_button): ?>
|
||||
<input id="btBack" class="button little" type="submit" name="submitPrevious" value="<?php echo $this->l('Back') ?>" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div><!-- div id="sheets" -->
|
||||
</form>
|
||||
|
||||
<div id="phone_help">
|
||||
<?php echo sprintf($this->l('If you need some assistance, you can <a href="%1$s" onclick="return !window.open(this.href);">get tailored help</a> from our support team. <a href="%2$s" onclick="return !window.open(this.href);">The official documentation</a> is also here to guide you.'), $this->getTailoredHelp(), $this->getDocumentationLink()) ?>
|
||||
</div>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Page content -->
|
||||
<form id="mainForm" action="index.php" method="post">
|
||||
<form id="mainForm" class="clearfix" action="index.php" method="post">
|
||||
<div id="sheets" class="sheet shown">
|
||||
<div id="sheet_<?php echo $this->step ?>" class="sheet shown clearfix">
|
||||
<div class="contentTitle">
|
||||
|
||||
@@ -2515,13 +2515,6 @@ const AddRoomBookingModal = {
|
||||
$('#new_product .booking_guest_occupancy').removeClass('disabled');
|
||||
setRoomTypeGuestOccupancy($('#new_product .booking_occupancy_wrapper'));
|
||||
}
|
||||
if (data.room_type_info) {
|
||||
$('#new_product .max_adults').val(data.room_type_info.max_adults);
|
||||
$('#new_product .max_children').val(data.room_type_info.max_children);
|
||||
$('#new_product .max_guests').val(data.room_type_info.max_guests);
|
||||
$('#new_product .num_adults').attr('max', data.room_type_info.max_adults);
|
||||
$('#new_product .num_children').attr('max', data.room_type_info.max_children);
|
||||
}
|
||||
|
||||
// Keep product variable
|
||||
current_product = data;
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
var dateRangePickerOrg = $.fn.dateRangePicker;
|
||||
$.fn.dateRangePicker = function(opt) {
|
||||
if(typeof opt === "object") {
|
||||
let container = $(this).parent();
|
||||
container.css({ position: 'relative' });
|
||||
|
||||
const custom_opt = {
|
||||
format: 'DD-MM-YYYY',
|
||||
showTopbar: false,
|
||||
@@ -31,14 +34,14 @@
|
||||
minDays: 2,
|
||||
startOfWeek: 'monday',
|
||||
hoveringTooltip: false,
|
||||
container: '#page',
|
||||
container: container,
|
||||
inline: true,
|
||||
customArrowPrevSymbol: '<i class="icon icon-angle-left"></i>',
|
||||
customArrowNextSymbol: '<i class="icon icon-angle-right"></i>',
|
||||
getValue: function()
|
||||
{
|
||||
getValue: function() {
|
||||
return $(this).find('span').html();
|
||||
},
|
||||
setValue: function(s, s1, s2) {
|
||||
setValue: function(s) {
|
||||
if (s) {
|
||||
$(this).find('span').html(s.replace('to', ' <i class="icon icon-minus"></i> '));
|
||||
} else {
|
||||
@@ -48,15 +51,56 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.each(opt, function(index) {
|
||||
delete custom_opt[index];
|
||||
});
|
||||
|
||||
$.extend(true, opt, custom_opt);
|
||||
|
||||
}
|
||||
|
||||
var args = Array.prototype.slice.call(arguments,0);
|
||||
return dateRangePickerOrg.apply(this, args);
|
||||
|
||||
const dateRangePickerInput = dateRangePickerOrg.apply(this, args);
|
||||
const calendarDom = $(dateRangePickerInput).data('dateRangePicker').getDatePicker();
|
||||
|
||||
dateRangePickerInput.on('datepicker-open', function() {
|
||||
const positionClass = getPositionClass(dateRangePickerInput, calendarDom);
|
||||
$(calendarDom).removeClass('top bottom').addClass(positionClass);
|
||||
setPosition(dateRangePickerInput, calendarDom, positionClass)
|
||||
});
|
||||
|
||||
return dateRangePickerInput;
|
||||
|
||||
// helper function definitions
|
||||
function getPositionClass(dateRangePickerInput, calendarDom) {
|
||||
const inputElementHeight = dateRangePickerInput.outerHeight();
|
||||
const spaceTop = dateRangePickerInput.offset().top - $(window).scrollTop();
|
||||
const spaceBottom = $(window).height() - inputElementHeight - spaceTop;
|
||||
const maxHeightNeeded = $(calendarDom).get(0).scrollHeight;
|
||||
|
||||
let positionClass = 'bottom';
|
||||
// determine position class
|
||||
if (spaceBottom < maxHeightNeeded && spaceTop > spaceBottom) {
|
||||
positionClass = 'top';
|
||||
}
|
||||
|
||||
return positionClass;
|
||||
}
|
||||
|
||||
function setPosition(dateRangePickerInput, calendarDom, positionClass) {
|
||||
const inputElementHeight = dateRangePickerInput.outerHeight();
|
||||
|
||||
const css = {};
|
||||
if (positionClass == 'top') {
|
||||
css.top = 'unset';
|
||||
css.bottom = inputElementHeight;
|
||||
} else {
|
||||
css.bottom = 'unset';
|
||||
css.top = $(dateRangePickerInput).position().top + inputElementHeight;
|
||||
}
|
||||
|
||||
$(calendarDom).css(css);
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
||||
138
mails/en/partial_payment_accepted.html
Normal file
138
mails/en/partial_payment_accepted.html
Normal file
@@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
|
||||
<style> @media only screen and (max-width: 300px){
|
||||
body {
|
||||
width:218px !important;
|
||||
margin:auto !important;
|
||||
}
|
||||
.table {width:195px !important;margin:auto !important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
|
||||
span.title{font-size:20px !important;line-height: 23px !important}
|
||||
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
|
||||
td.box p{font-size: 12px !important;font-weight: bold !important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 200px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
.table-recap{width: 295px !important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center !important;}
|
||||
|
||||
}
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {width:478px!important;margin:auto!important;}
|
||||
.table {width:450px!important;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
}
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {width:308px!important;margin:auto!important;}
|
||||
.table {width:285px;margin:auto!important;}
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
|
||||
|
||||
.table-recap{width: 295px!important;}
|
||||
.table-recap tr td, .conf_body td{text-align:center!important;}
|
||||
.address{display: block !important;margin-bottom: 10px !important;}
|
||||
.space_address{display: none !important;}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto" >
|
||||
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;padding:7px 0"> </td>
|
||||
<td align="center" style="padding:7px 0">
|
||||
<table class="table" bgcolor="#ffffff" style="width:100%">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333333;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi {firstname} {lastname},</span><br/>
|
||||
<span class="subtitle" style="font-weight:500;font-size:16px;text-transform:uppercase;line-height:25px">Thank you for booking with {shop_name}!</span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
<td style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
|
||||
Order {order_name} - Payment processed </p>
|
||||
<span style="color:#777">
|
||||
Your payment for order with the reference <strong><span style="color:#333">{order_name}</span></strong> was successfully processed.</span><br /><br />
|
||||
|
||||
<span style="color:#333"><strong>Total Booking Amount:</strong></span> {total_paid}<br /><br />
|
||||
<span style="color:#333"><strong>Partial Payment Amount:</strong></span> {advance_paid_amount}<br /><br />
|
||||
<span style="color:#333"><strong>Total Paid Amount:</strong></span> {total_paid_real}<br /><br />
|
||||
</font>
|
||||
</td>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
{extra_mail_content_html}
|
||||
<tr>
|
||||
<td class="linkbelow" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span>
|
||||
You can review your order and download your invoice from the <a href="{history_url}" style="color:#337ff1">"Order history"</a> section of your customer account by clicking <a href="{my_account_url}" style="color:#337ff1">"My account"</a> on our website. </span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="linkbelow" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<span>
|
||||
If you have a guest account, you can follow your order via the <a href="{guest_tracking_url}?id_order={order_name}" style="color:#337ff1">"Guest Tracking"</a> section on our website. </span>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333333;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> powered by <a href="https://webkul.com" style="color:#337ff1">Webkul™</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
26
mails/en/partial_payment_accepted.txt
Normal file
26
mails/en/partial_payment_accepted.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
[/{shop_url}]
|
||||
|
||||
Hi {firstname} {lastname},
|
||||
|
||||
Thank you for booking with {shop_name}!
|
||||
|
||||
Order {order_name} - Payment processed
|
||||
|
||||
Your payment for order with the reference {order_name} was successfully processed.
|
||||
|
||||
Total Booking Amount: {total_paid}
|
||||
Partial Payment Amount: {advance_paid_amount}
|
||||
Total Paid Amount: {total_paid_real}
|
||||
|
||||
You can review your order and download your invoice from the
|
||||
"Order history" [/{history_url}] section of your customer account by
|
||||
clicking "My account" [/{my_account_url}] on our website.
|
||||
|
||||
If you have a guest account, you can follow your order via the
|
||||
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
|
||||
on our website.
|
||||
|
||||
{shop_name} [/{shop_url}] powered by Webkul(tm)
|
||||
[https://webkul.com]
|
||||
|
||||
@@ -208,14 +208,16 @@ class Bankwire extends PaymentModule
|
||||
}
|
||||
|
||||
$objOrder = $params['objOrder'];
|
||||
$orderState = $objOrder->getCurrentState();
|
||||
$idOrderState = $objOrder->getCurrentState();
|
||||
$objOrderState = new OrderState($idOrderState);
|
||||
$history = $objOrder->getHistory($this->context->language->id);
|
||||
$initialStatus = array_pop($history);
|
||||
$smartyVars = array();
|
||||
if (in_array(
|
||||
$orderState,
|
||||
array(
|
||||
Configuration::get('PS_OS_AWAITING_PAYMENT'),
|
||||
if ($idOrderState == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
|| ($objOrderState->logable
|
||||
&& $initialStatus['id_order_state'] == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
)) {
|
||||
) {
|
||||
$objCart = new Cart($objOrder->id_cart);
|
||||
if ($objCart->is_advance_payment) {
|
||||
$cartTotal = $objOrder->getOrdersTotalPaid(1);
|
||||
|
||||
@@ -478,6 +478,9 @@ var ajaxCart = {
|
||||
else
|
||||
$(callerElement).removeProp('disabled');
|
||||
}
|
||||
if (!addedFromProductPage) {
|
||||
resetOccupancyField($(callerElement).closest('.booking_room_fields').find('.booking_occupancy_wrapper'));
|
||||
}
|
||||
emptyCustomizations();
|
||||
|
||||
},
|
||||
|
||||
@@ -191,13 +191,15 @@ class Cheque extends PaymentModule
|
||||
return;
|
||||
}
|
||||
$objOrder = $params['objOrder'];
|
||||
$orderState = $objOrder->getCurrentState();
|
||||
if (in_array(
|
||||
$orderState,
|
||||
array(
|
||||
Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
)) {
|
||||
$idOrderState = $objOrder->getCurrentState();
|
||||
$objOrderState = new OrderState($idOrderState);
|
||||
$history = $objOrder->getHistory($this->context->language->id);
|
||||
$initialStatus = array_pop($history);
|
||||
if ($idOrderState == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
|| ($objOrderState->logable
|
||||
&& $initialStatus['id_order_state'] == Configuration::get('PS_OS_AWAITING_PAYMENT')
|
||||
)
|
||||
) {
|
||||
$objCart = new Cart($objOrder->id_cart);
|
||||
if ($objCart->is_advance_payment) {
|
||||
$cartTotal = $objOrder->getOrdersTotalPaid(1);
|
||||
|
||||
@@ -248,7 +248,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
*/
|
||||
public function getCartCurrentDataByCartId($cart_id)
|
||||
{
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.$cart_id);
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_cart_booking_data` WHERE `id_cart`='.(int)$cart_id);
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
@@ -925,23 +925,34 @@ class HotelCartBookingData extends ObjectModel
|
||||
return true;
|
||||
}
|
||||
|
||||
// validate cart data if not available then remove from cart
|
||||
public static function validateCartBookings()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
$errors = array();
|
||||
$objModule = Module::getInstanceByName('hotelreservationsystem');
|
||||
|
||||
// For admin cart validations use this variable
|
||||
$forAdminCart = 0;
|
||||
if (isset($context->employee->id)) {
|
||||
$forAdminCart = 1;
|
||||
}
|
||||
|
||||
// validate room types if bookable from front office
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
foreach ($cartProducts as $product) {
|
||||
if ($product['booking_product'] && !$product['show_at_front']) {
|
||||
$objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
|
||||
if (!$forAdminCart) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
foreach ($cartProducts as $product) {
|
||||
if ($product['booking_product'] && !$product['show_at_front']) {
|
||||
$objHotelCartBookingData->deleteCartBookingData($context->cart->id, $product['id_product']);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors[] = $objModule->l('No booking found in the cart.', 'HotelOrderRestrictDate');
|
||||
}
|
||||
|
||||
// validate service products
|
||||
// validate service products if not active not then remove from cart
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
|
||||
foreach ($cartProducts as $product) {
|
||||
@@ -954,8 +965,20 @@ class HotelCartBookingData extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
// for admin/employee remove bookings of the back dates from cart if not allowed
|
||||
if ($forAdminCart) {
|
||||
if ($context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelCartBookingData->removeBackdateRoomsFromCart($context->cart->id);
|
||||
}
|
||||
}
|
||||
|
||||
// validate room types for restriction date
|
||||
$objModule = Module::getInstanceByName('hotelreservationsystem');
|
||||
if ($cartProducts = $context->cart->getProducts()) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData();
|
||||
$objHotelBookingDetail = new HotelBookingDetail();
|
||||
@@ -977,43 +1000,43 @@ class HotelCartBookingData extends ObjectModel
|
||||
}
|
||||
|
||||
foreach ($cartData as $roomData) {
|
||||
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
|
||||
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|
||||
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($maxOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
$error = true;
|
||||
if (!$forAdminCart) {
|
||||
if ($maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($roomData['id_hotel'])) {
|
||||
if (strtotime('-1 day', strtotime($maxOrderDate)) < strtotime($roomData['date_from'])
|
||||
|| strtotime($maxOrderDate) < strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' after date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($maxOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
|
||||
if ($preparationTime !== false) {
|
||||
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
|
||||
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|
||||
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($minOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
$error = true;
|
||||
$preparationTime = HotelOrderRestrictDate::getPreparationTime($roomData['id_hotel']);
|
||||
if ($preparationTime !== false) {
|
||||
$minOrderDate = date('Y-m-d', strtotime('+'. ($preparationTime) .' days'));
|
||||
if (strtotime($minOrderDate) > strtotime($roomData['date_from'])
|
||||
|| strtotime($minOrderDate . ' +1 day')> strtotime($roomData['date_to'])
|
||||
) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation(
|
||||
$roomData['id_hotel'],
|
||||
$context->language->id
|
||||
);
|
||||
$errors[] = sprintf(
|
||||
'You can not book rooms for hotel \'%s\' before date %s. Please remove rooms from %s - %s to proceed.',
|
||||
$objHotelBranchInformation->hotel_name,
|
||||
Tools::displayDate($minOrderDate),
|
||||
Tools::displayDate($roomData['date_from']),
|
||||
Tools::displayDate($roomData['date_to'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,32 +1048,27 @@ class HotelCartBookingData extends ObjectModel
|
||||
'only_search_data' => 1,
|
||||
);
|
||||
$bookingSearchData = $objHotelBookingDetail->dataForFrontSearch($bookingParams);
|
||||
$isRmBooked = 0;
|
||||
$isRoomBooked = 0;
|
||||
if (count($bookingSearchData['rm_data'][$product['id_product']]['data']['available']) < count($roomData['id_rms'])) {
|
||||
foreach ($roomData['id_rms'] as $searchRoomData) {
|
||||
if($isRmBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
|
||||
if($isRoomBooked = $objHotelBookingDetail->chechRoomBooked($searchRoomData, $roomData['date_from'], $roomData['date_to'])){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($isRmBooked) {
|
||||
if ($isRoomBooked) {
|
||||
$errors[] = sprintf($objModule->l('The Room \'%s\' has been booked by another customer from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
|
||||
$error = true;
|
||||
} else {
|
||||
$errors[] = sprintf($objModule->l('The Room \'%s\' is no longer avalable from \'%s\' to \'%s\' Please remove rooms from cart to proceed', 'HotelOrderRestrictDate'), $product['name'], date('d-m-Y', strtotime($roomData['date_from'])), date('d-m-Y', strtotime($roomData['date_to'])));
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
$errors[] = $objModule->l('You can not book rooms from "', 'HotelOrderRestrictDate'). $product['name'] .$objModule->l('". Please remove rooms from "', 'HotelOrderRestrictDate'). $product['name'] . $objModule->l('" from cart to proceed.', 'HotelOrderRestrictDate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$context->controller->errors = array_merge($context->controller->errors, $errors);
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,8 @@ class HotelHelper
|
||||
|
||||
Configuration::updateValue('WK_HOTEL_LOCATION_ENABLE', 1);
|
||||
Configuration::updateValue('WK_HOTEL_NAME_ENABLE', 1);
|
||||
Configuration::updateValue('WK_HOTEL_NAME_SEARCH_THRESHOLD', 5);
|
||||
Configuration::updateValue('WK_SEARCH_AUTO_FOCUS_NEXT_FIELD', 1);
|
||||
Configuration::updateValue('WK_ROOM_LEFT_WARNING_NUMBER', 10);
|
||||
Configuration::updateValue('WK_HTL_ESTABLISHMENT_YEAR', 2010);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
|
||||
)) {
|
||||
$updateQty = $product['quantity'];
|
||||
if (Product::getProductPriceCalculation($product['id_product']) == Product::PRICE_CALCULATION_METHOD_PER_DAY) {
|
||||
$objHotelCartBookingData = new HotelCartBookingData($idHtlCartData);
|
||||
$objHotelCartBookingData = new HotelCartBookingData($htlCartBookingId);
|
||||
$numdays = HotelHelper::getNumberOfDays($objHotelCartBookingData->date_from, $objHotelCartBookingData->date_to);
|
||||
$updateQty *= $numdays;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,10 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
if ($result = Db::getInstance()->getRow('
|
||||
SELECT spp.`price`, spp.`id_tax_rules_group`, p.`auto_add_to_cart`, p.`price_addition_type`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` sp ON (sp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_price` spp ON (spp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` sp
|
||||
ON (sp.`id_product` = p.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product_price` spp
|
||||
ON (spp.`id_product` = sp.`id_product` AND spp.`id_element` = sp.`id_element` AND spp.`element_type` = sp.`element_type`)
|
||||
WHERE p.`id_product`='.(int)$idProduct.
|
||||
' AND sp.`id_element`='.(int)$idElement.
|
||||
' AND sp.`element_type`='.(int)$elementType)
|
||||
|
||||
@@ -81,6 +81,32 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
|
||||
'hint' => $this->l('This option can be disabled if only one active hotel in the website.
|
||||
In case of more than one active hotel, Hotel Name will always be shown in the search panel.'),
|
||||
),
|
||||
'WK_SEARCH_AUTO_FOCUS_NEXT_FIELD' => array(
|
||||
'title' => $this->l('Focus next field automatically'),
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool',
|
||||
'default' => '0',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
),
|
||||
),
|
||||
'hint' => $this->l('Enable if you want the next booking search field to be focused automatically after setting value for a field.'),
|
||||
),
|
||||
'WK_HOTEL_NAME_SEARCH_THRESHOLD' => array(
|
||||
'title' => $this->l('Hotel name search threshold'),
|
||||
'type' => 'text',
|
||||
'required' => true,
|
||||
'validation' => 'isUnsignedInt',
|
||||
'hint' => $this->l('Enter the number of hotels after which user can search hotel by name.'),
|
||||
'desc' => $this->l('Set to 0 to always show the search box.'),
|
||||
'class' => 'fixed-width-xxl',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
@@ -312,6 +338,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitOptions'.$this->table)) {
|
||||
$hotelNameSearchThreshold = Tools::getValue('WK_HOTEL_NAME_SEARCH_THRESHOLD');
|
||||
|
||||
// check if field is atleast in default language. Not available in default prestashop
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
|
||||
@@ -324,6 +352,12 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
|
||||
|
||||
// End occupancy fields validation
|
||||
|
||||
if (!$hotelNameSearchThreshold && $hotelNameSearchThreshold !== '0') {
|
||||
$this->errors[] = $this->l('Hotel name search threshold field is required.');
|
||||
} elseif (!Validate::isUnsignedInt($hotelNameSearchThreshold)) {
|
||||
$this->errors[] = $this->l('Hotel name search threshold field is invalid.');
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('WK_HTL_CHAIN_NAME_'.$defaultLangId))) {
|
||||
$this->errors[] = $this->l('Hotel chain name is required at least in ').$objDefaultLanguage['name'];
|
||||
} else {
|
||||
|
||||
@@ -42,6 +42,9 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objCart = new Cart($this->context->cookie->id_cart);
|
||||
if (Validate::isLoadedObject($objCart) && !$objCart->orderExists()) {
|
||||
$this->context->cart = $objCart;
|
||||
|
||||
// validate cart for removing invalid data from cart
|
||||
HotelCartBookingData::validateCartBookings();
|
||||
} else {
|
||||
$this->context->cookie->id_cart = 0; // remove invalid id_cart
|
||||
$this->context->cart = new Cart();
|
||||
@@ -63,15 +66,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objCustomer->id_guest = (int) $this->context->cookie->id_guest;
|
||||
|
||||
$this->context->customer = $objCustomer;
|
||||
if ($this->context->employee->isSuperAdmin()) {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_SUPERADMIN';
|
||||
} else {
|
||||
$backOrderConfigKey = 'PS_BACKDATE_ORDER_EMPLOYEES';
|
||||
}
|
||||
if (!Configuration::get($backOrderConfigKey)) {
|
||||
$htlCart = new HotelCartBookingData();
|
||||
$htlCart->removeBackdateRoomsFromCart($this->context->cart->id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function createNewCart()
|
||||
@@ -819,19 +813,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
foreach ($booking_data['rm_data'] as $key_bk_data => $value_bk_data) {
|
||||
$booking_data['rm_data'][$key_bk_data]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value_bk_data['id_product']);
|
||||
|
||||
// set default occupancies in required format
|
||||
$occupancy = array(
|
||||
array(
|
||||
'adults' => $value_bk_data['adults'],
|
||||
'children' => 0,
|
||||
'child_ages' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
$booking_data['rm_data'][$key_bk_data]['occupancies'] = $occupancy;
|
||||
$booking_data['rm_data'][$key_bk_data]['occupancy_adults'] = $booking_data['rm_data'][$key_bk_data]['adults']; // only one room by default
|
||||
|
||||
if (isset($value_bk_data['data']['booked']) && $value_bk_data['data']['booked']) {
|
||||
foreach ($value_bk_data['data']['booked'] as $booked_k1 => $booked_v1) {
|
||||
if (isset($booked_v1['detail']) && $booked_v1['detail']) {
|
||||
|
||||
@@ -150,18 +150,6 @@ class AdminHotelFeaturesController extends ModuleAdminController
|
||||
$this->errors[] = $this->l('Please add atleast one Child features.');
|
||||
}
|
||||
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$defaultLangId
|
||||
);
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$lang['id_lang']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if (isset($parentFeatureId) && $parentFeatureId) {
|
||||
$objHotelFeatures = new HotelFeatures($parentFeatureId);
|
||||
@@ -297,13 +285,20 @@ class AdminHotelFeaturesController extends ModuleAdminController
|
||||
|
||||
public function ajaxProcessDeleteFeature()
|
||||
{
|
||||
$idFeature = Tools::getValue('feature_id');
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
|
||||
die('success');
|
||||
$response = array('status' => false);
|
||||
if ($this->tabAccess['delete']) {
|
||||
$idFeature = Tools::getValue('feature_id');
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
|
||||
$response['status'] = true;
|
||||
} else {
|
||||
$response['msg'] = $this->l('Some error occurred while deleting feature. Please try again.');
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
$response['msg'] = $this->l('You do not have the permission to delete this.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
|
||||
@@ -509,6 +509,7 @@ class HotelReservationSystem extends Module
|
||||
'htl_room_type_global_demand',
|
||||
'htl_room_type_global_demand_advance_option',
|
||||
'htl_order_refund_rules',
|
||||
'htl_settings_link',
|
||||
);
|
||||
//If Admin update new language when we do entry in module all lang tables.
|
||||
HotelHelper::updateLangTables($newIdLang, $langTables);
|
||||
|
||||
@@ -463,12 +463,13 @@ $(document).ready(function() {
|
||||
action: 'deleteFeature',
|
||||
},
|
||||
method: 'POST',
|
||||
success: function(data) {
|
||||
if (data == 'success') {
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
alert(success_delete_msg);
|
||||
$('#grand_feature_div_' + ftr_id).remove();
|
||||
} else {
|
||||
alert(error_delete_msg);
|
||||
alert(response.msg);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
|
||||
@@ -56,79 +56,40 @@
|
||||
<td class="booking_occupancy">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
|
||||
<span>
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{if (isset($book_v['occupancy_adults']) && $book_v['occupancy_adults'])}{$book_v['occupancy_adults']} {if $book_v['occupancy_adults'] > 1}{l s='Adults' mod='hotelreservationsystem'}{else}{l s='Adult' mod='hotelreservationsystem'}{/if}, {if isset($book_v['occupancy_children']) && $book_v['occupancy_children']}{$book_v['occupancy_children']} {if $book_v['occupancy_children'] > 1} {l s='Children' mod='hotelreservationsystem'}{else}{l s='Child' mod='hotelreservationsystem'}{/if}, {/if}{$book_v['occupancies']|count} {if $book_v['occupancies']|count > 1}{l s='Rooms' mod='hotelreservationsystem'}{else}{l s='Room' mod='hotelreservationsystem'}{/if}{else}{l s='1 Adult, 1 Room' mod='hotelreservationsystem'}{/if}
|
||||
{else}
|
||||
{l s='Select occupancy' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</span>
|
||||
<span>{l s='Select occupancy' mod='hotelreservationsystem'}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
|
||||
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="booking_occupancy_inner row">
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{assign var=countRoom value=1}
|
||||
{foreach from=$book_v['occupancies'] key=key item=$occupancy name=occupancyInfo}
|
||||
<div class="occupancy_info_block selected col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][adults]" value="{$occupancy['adults']|escape:'htmlall':'UTF-8'}" min="1" data-max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" value="{$occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=countRoom value=$countRoom+1}
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
{/if}
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
</div>
|
||||
{* <div class="add_occupancy_block">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
|
||||
@@ -183,79 +144,40 @@
|
||||
<td class="booking_occupancy">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-default btn-left btn-block booking_guest_occupancy input-occupancy" type="button">
|
||||
<span>
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{if (isset($book_v['occupancy_adults']) && $book_v['occupancy_adults'])}{$book_v['occupancy_adults']} {if $book_v['occupancy_adults'] > 1}{l s='Adults' mod='hotelreservationsystem'}{else}{l s='Adult' mod='hotelreservationsystem'}{/if}, {if isset($book_v['occupancy_children']) && $book_v['occupancy_children']}{$book_v['occupancy_children']} {if $book_v['occupancy_children'] > 1} {l s='Children' mod='hotelreservationsystem'}{else}{l s='Child' mod='hotelreservationsystem'}{/if}, {/if}{$book_v['occupancies']|count} {if $book_v['occupancies']|count > 1}{l s='Rooms' mod='hotelreservationsystem'}{else}{l s='Room' mod='hotelreservationsystem'}{/if}{else}{l s='1 Adult, 1 Room' mod='hotelreservationsystem'}{/if}
|
||||
{else}
|
||||
{l s='Select occupancy' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</span>
|
||||
<span>{l s='Select occupancy' mod='hotelreservationsystem'}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu booking_occupancy_wrapper well well-sm">
|
||||
<input type="hidden" class="max_adults" value="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_children" value="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{/if}">
|
||||
<input type="hidden" class="max_guests" value="{if isset($book_v)}{$book_v['max_guests']|escape:'html':'UTF-8'}{/if}">
|
||||
<div class="booking_occupancy_inner row">
|
||||
{if isset($book_v['occupancies']) && $book_v['occupancies']}
|
||||
{assign var=countRoom value=1}
|
||||
{foreach from=$book_v['occupancies'] key=key item=$occupancy name=occupancyInfo}
|
||||
<div class="occupancy_info_block selected col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][adults]" value="{$occupancy['adults']|escape:'htmlall':'UTF-8'}" min="1" data-max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[{$key|escape:'htmlall':'UTF-8'}][children]" value="{$occupancy['children']|escape:'htmlall':'UTF-8'}" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" min="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=countRoom value=$countRoom+1}
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="occupancy_info_block col-sm-12" occ_block_index="0">
|
||||
<div class="occupancy_info_head col-sm-12"><label class="room_num_wrapper">{l s='Room - 1' mod='hotelreservationsystem'}</label></div>
|
||||
<div class="col-sm-12">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Adults' mod='hotelreservationsystem'}</label>
|
||||
<input type="number" class="form-control num_occupancy num_adults" name="occupancy[0][adults]" value="1" min="1" data-max="{if isset($book_v)}{$book_v['max_adults']|escape:'html':'UTF-8'}{/if}">
|
||||
</div>
|
||||
<div class="form-group col-xs-6 occupancy_count_block">
|
||||
<label>{l s='Children' mod='hotelreservationsystem'} <span class="label-desc-txt"></span></label>
|
||||
<input type="number" class="form-control num_occupancy num_children" name="occupancy[0][children]" value="0" data-max="{if isset($book_v)}{$book_v['max_children']|escape:'html':'UTF-8'}{else}{$max_child_in_room}{/if}">
|
||||
({l s='Below' mod='hotelreservationsystem'} {$max_child_age|escape:'htmlall':'UTF-8'} {l s='years' mod='hotelreservationsystem'})
|
||||
</div>
|
||||
</div>
|
||||
<p style="display:none;"><span class="text-danger occupancy-input-errors"></span></p>
|
||||
<div class="row children_age_info_block" style="display:none">
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="">{l s='All Children' mod='hotelreservationsystem'}</label>
|
||||
<div class="">
|
||||
<div class="row children_ages">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
{/if}
|
||||
{* <hr class="occupancy-info-separator"> *}
|
||||
</div>
|
||||
</div>
|
||||
{* <div class="add_occupancy_block">
|
||||
<a class="add_new_occupancy_btn" href="#"><i class="icon-plus"></i> <span>{l s='Add Room'}</span></a>
|
||||
|
||||
@@ -187,13 +187,14 @@ class QloHotelReview extends Module
|
||||
if (QhrHotelReviewHelper::getIsReviewable($idOrder)
|
||||
&& !QhrHotelReview::getByIdOrder($idOrder)
|
||||
) {
|
||||
$hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder);
|
||||
$this->smarty->assign(array(
|
||||
'id_order' => (int) $idOrder,
|
||||
'id_hotel' => $hotel['id_hotel'],
|
||||
'hotel_name' => $hotel['hotel_name'],
|
||||
));
|
||||
return $this->display(__FILE__, 'booking-action.tpl');
|
||||
if ($hotel = QhrHotelReviewHelper::getHotelByOrder($idOrder)) {
|
||||
$this->smarty->assign(array(
|
||||
'id_order' => (int) $idOrder,
|
||||
'id_hotel' => $hotel['id_hotel'],
|
||||
'hotel_name' => $hotel['hotel_name'],
|
||||
));
|
||||
return $this->display(__FILE__, 'booking-action.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,12 +109,12 @@ $(document).ready(function()
|
||||
$('.sort_btn_span').attr('data-sort-value', 0);
|
||||
|
||||
$('#gst_rating .sort_btn_span').html($('#gst_rating .sort_btn_span').attr('data-sort-for'));
|
||||
$('#price_ftr .sort_btn_span').html($('#price_ftr .sort_btn_span').attr('data-sort-for'));
|
||||
|
||||
// select btn data enter
|
||||
var sort_text = $(this).html();
|
||||
var dp_btn_span = $(this).parents('div.filter_dw_cont').find('button span.sort_btn_span');
|
||||
dp_btn_span.html(sort_text);
|
||||
dp_btn_span.attr('data-sort-for', sort_text);
|
||||
dp_btn_span.attr('data-sort-by', $(this).attr('data-sort-by'));
|
||||
dp_btn_span.attr('data-sort-value', $(this).attr('data-value'));
|
||||
|
||||
|
||||
@@ -29,11 +29,20 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
$this->bootstrap = true;
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->_select = ' pl.`name`, hbil.`hotel_name` ';
|
||||
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = a.`id_product` AND pl.id_lang = '.(int) $this->context->language->id.')';
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
ON (hrt.`id_product` = a.`id_product`)';
|
||||
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hrt.`id_hotel` = hbil.`id` AND hbil.`id_lang` = pl.`id_lang`)';
|
||||
|
||||
$this->fields_options = array(
|
||||
'global' => array(
|
||||
'title' => $this->l('Hotel Room Display Setting'),
|
||||
'icon' => 'icon-cogs',
|
||||
'fields' => array(
|
||||
'title' => $this->l('Hotel Room Display Setting'),
|
||||
'icon' => 'icon-cogs',
|
||||
'fields' => array(
|
||||
'HOTEL_ROOM_DISPLAY_HEADING' => array(
|
||||
'title' => $this->l('Hotel Room Block Title'),
|
||||
'type' => 'textLang',
|
||||
@@ -73,6 +82,16 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
'search' => false,
|
||||
'callback' => 'getProductImage',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Room Type'),
|
||||
'align' => 'center',
|
||||
'orderby' => false,
|
||||
),
|
||||
'hotel_name' => array(
|
||||
'title' => $this->l('Hotel'),
|
||||
'align' => 'center',
|
||||
'orderby' => false,
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Active'),
|
||||
'align' => 'center',
|
||||
@@ -109,6 +128,24 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
$this->identifier = 'id_room_block';
|
||||
|
||||
parent::__construct();
|
||||
if ($this->hotelList = HotelBranchInformation::getProfileAccessedHotels($this->context->employee->id_profile, 1)) {
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($this->loadObject(true)
|
||||
&& $this->object->id
|
||||
&& ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $this->object->id_product))
|
||||
) {
|
||||
$idsHotel = array_column($this->hotelList, 'id_hotel');
|
||||
if (!in_array($roomTypeInfo['id_hotel'], $idsHotel)) {
|
||||
$this->tabAccess['edit'] = 0;
|
||||
$this->tabAccess['view'] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($this->loadObject(true) && $this->object->id) {
|
||||
$this->tabAccess['view'] =0;
|
||||
$this->tabAccess['edit'] =0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getProductImage($idProduct)
|
||||
@@ -152,23 +189,27 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!($obj = $this->loadObject(true))) {
|
||||
if (!($this->loadObject(true))) {
|
||||
return;
|
||||
} else if (!$this->object->id && empty($this->hotelList)) {
|
||||
$this->warnings[] = $this->l('No hotel found to create new hotel room block.');
|
||||
return;
|
||||
}
|
||||
|
||||
$productName = $idProduct = false;
|
||||
|
||||
if ($this->display == 'edit') {
|
||||
$objRoomBlock = new WkHotelRoomDisplay($obj->id);
|
||||
$idProduct = $objRoomBlock->id_product;
|
||||
$productName = false;
|
||||
if ($idProduct = $this->object->id_product) {
|
||||
$product = new Product($idProduct, false, Configuration::get('PS_LANG_DEFAULT'));
|
||||
$productName = $product->name;
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct((int) $product->id)) {
|
||||
$this->fields_value['id_hotel'] = $roomInfo['id_hotel'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'productName' => $productName,
|
||||
'idProduct' => $idProduct,
|
||||
'idProduct' => $idProduct
|
||||
)
|
||||
);
|
||||
$html = $this->context->smarty->fetch(
|
||||
@@ -182,6 +223,19 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
'icon' => 'icon-globe'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select hotel'),
|
||||
'name' => 'id_hotel',
|
||||
'required' => true,
|
||||
'class' => 'chosen',
|
||||
'options' => array(
|
||||
'query' => $this->hotelList,
|
||||
'id' => 'id_hotel',
|
||||
'name' => 'hotel_name'
|
||||
),
|
||||
'hint' => $this->l('Select the hotel to search for the room types.'),
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Search Room Type'),
|
||||
'type' => 'html',
|
||||
@@ -384,7 +438,7 @@ class AdminHotelRoomModuleSettingController extends ModuleAdminController
|
||||
if (isset($pos[2]) && (int) $pos[2] === $idRoomBlock) {
|
||||
if ($objRoomBlock = new WkHotelRoomDisplay((int) $pos[2])) {
|
||||
if (isset($position)
|
||||
&& $objRoomBlock->updatePosition($way, $position, $idRoomBlock)
|
||||
&& $objRoomBlock->updatePosition($way, $position)
|
||||
) {
|
||||
echo 'ok position '.(int) $position.' for hotel room block '.(int) $pos[1].'\r\n';
|
||||
} else {
|
||||
|
||||
@@ -32,27 +32,31 @@ $(document).ready(function() {
|
||||
var word = $(this).val();
|
||||
var d = new Date();
|
||||
var n = d.getTime();
|
||||
trigger_ajax = $.ajax({
|
||||
url: "ajax_products_list.php",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
q: word,
|
||||
_: n,
|
||||
booking_product: '1',
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
var html = '';
|
||||
$.each(result, function(key, value) {
|
||||
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">' + value.name + '</a></li>';
|
||||
});
|
||||
suggestion_ul.html(html).show();
|
||||
} else {
|
||||
suggestion_ul.empty().hide();
|
||||
suggestion_ul.siblings("input#id_product").val(null);
|
||||
var id_hotel = parseInt($('#id_hotel').val());
|
||||
if (!isNaN(id_hotel)) {
|
||||
trigger_ajax = $.ajax({
|
||||
url: "ajax_products_list.php",
|
||||
dataType: 'json',
|
||||
data: {
|
||||
q: word,
|
||||
_: n,
|
||||
booking_product: '1',
|
||||
id_hotel: id_hotel
|
||||
},
|
||||
success: function(result) {
|
||||
if (result) {
|
||||
var html = '';
|
||||
$.each(result, function(key, value) {
|
||||
html += '<li class="suggestion_li"><a class="suggestion_a text-capitalize" data-primary="' + value.id + '" data-secondary="' + value.name + '">'+value.name+' (#'+value.id+')</a></li>';
|
||||
});
|
||||
suggestion_ul.html(html).show();
|
||||
} else {
|
||||
suggestion_ul.empty().hide();
|
||||
suggestion_ul.siblings("input#id_product").val(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -73,4 +77,9 @@ $(document).ready(function() {
|
||||
$('ul.prod_suggest_ul').empty().hide();
|
||||
}
|
||||
});
|
||||
$(document).on('change', '#id_hotel', function () {
|
||||
// resetting the fields on hotel change
|
||||
$('#id_product').val('');
|
||||
$('#productName').val('');
|
||||
});
|
||||
});
|
||||
@@ -228,6 +228,7 @@ class WkRoomSearchHelper
|
||||
$smartyVars['hotels_info'] = $hotelsInfo;
|
||||
$smartyVars['show_hotel_name'] = Configuration::get('WK_HOTEL_NAME_ENABLE');
|
||||
$smartyVars['max_child_age'] = Configuration::get('WK_GLOBAL_CHILD_MAX_AGE');
|
||||
$smartyVars['hotel_name_search_threshold'] = (int) Configuration::get('WK_HOTEL_NAME_SEARCH_THRESHOLD');
|
||||
|
||||
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($idHotel);
|
||||
$smartyVars['max_order_date'] = date('Y-m-d', strtotime($maxOrderDate));
|
||||
|
||||
@@ -22,45 +22,52 @@ class WkRoomSearchBlockAutoCompleteSearchModuleFrontController extends ModuleFro
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
$result = array();
|
||||
$this->display_column_left = false;
|
||||
$this->display_column_right = false;
|
||||
|
||||
$result = array('status' => false);
|
||||
$search_data = Tools::getValue('to_search_data');
|
||||
$location_category_id = Tools::getValue('location_category_id');
|
||||
$obj_htl_info = new HotelBranchInformation();
|
||||
if (isset($search_data) && $search_data) {
|
||||
$return_data = $obj_htl_info->getHotelCategoryTree($search_data);
|
||||
if ($return_data) {
|
||||
$html = '';
|
||||
foreach ($return_data as $value) {
|
||||
$html .= '<li value="'.$value['id_category'].'" tabindex="-1" class="search_result_li">'.
|
||||
$value['name'].'</li>';
|
||||
}
|
||||
$result['status'] = 'success';
|
||||
$locationCategories = $obj_htl_info->getHotelCategoryTree($search_data);
|
||||
if ($locationCategories) {
|
||||
$this->context->smarty->assign(array('location_categories' => $locationCategories));
|
||||
$html = $this->context->smarty->fetch(
|
||||
$this->module->getTemplatePath('location-options.tpl')
|
||||
);
|
||||
$result['status'] = true;
|
||||
$result['data'] = $html;
|
||||
}
|
||||
} elseif (isset($location_category_id) && $location_category_id) {
|
||||
$cat_ids = Category::getAllCategoriesName($location_category_id);
|
||||
if ($cat_ids) {
|
||||
$html = '';
|
||||
foreach ($cat_ids as $value) {
|
||||
if ($hotel_info = $obj_htl_info->hotelBranchInfoByCategoryId($value['id_category'])) {
|
||||
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotel_info['id']);
|
||||
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotel_info['id']);
|
||||
$locationCategories = Category::getAllCategoriesName($location_category_id);
|
||||
if ($locationCategories) {
|
||||
$hotelsInfo = array();
|
||||
foreach ($locationCategories as $category) {
|
||||
if ($hotelInfo = $obj_htl_info->hotelBranchInfoByCategoryId($category['id_category'])) {
|
||||
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($hotelInfo['id']);
|
||||
$maxOrderDate = date('Y-m-d', strtotime($maxOrderDate));
|
||||
$html .= '<li tabindex="-1" class="search_result_li" data-id-hotel="'.$hotel_info['id'].'" data-hotel-cat-id="'.
|
||||
$hotel_info['id_category'].'" data-max_order_date="'.$maxOrderDate.'" data-preparation_time="'.$preparationTime.'">'.
|
||||
$hotel_info['hotel_name'].'</li>';
|
||||
$preparationTime = (int) HotelOrderRestrictDate::getPreparationTime($hotelInfo['id']);
|
||||
$hotelsInfo[] = array(
|
||||
'id_hotel' => $hotelInfo['id'],
|
||||
'id_category' => $hotelInfo['id_category'],
|
||||
'hotel_name' => $hotelInfo['hotel_name'],
|
||||
'max_order_date' => $maxOrderDate,
|
||||
'preparation_time' => $preparationTime
|
||||
);
|
||||
}
|
||||
}
|
||||
$result['status'] = 'success';
|
||||
$result['data'] = $html;
|
||||
} else {
|
||||
$result['status'] = 'failed2';
|
||||
|
||||
$this->context->smarty->assign(array('hotels_info' => $hotelsInfo));
|
||||
$html = $this->context->smarty->fetch(
|
||||
$this->module->getTemplatePath('hotel-options.tpl')
|
||||
);
|
||||
|
||||
$result['status'] = true;
|
||||
$result['html_hotel_options'] = $html;
|
||||
}
|
||||
} else {
|
||||
$result['status'] = 'failed3';
|
||||
}
|
||||
die(json_encode($result));
|
||||
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
470
modules/wkroomsearchblock/views/css/chosen.css
Normal file
470
modules/wkroomsearchblock/views/css/chosen.css
Normal file
@@ -0,0 +1,470 @@
|
||||
/**
|
||||
* 2010-2024 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2024 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
/* @group Base */
|
||||
.chosen-container {
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
font-size: 14px;
|
||||
zoom: 1;
|
||||
/* display: inline; */
|
||||
-moz-user-select: -moz-none;
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.chosen-container .chosen-drop {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -9999px;
|
||||
z-index: 1010;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
border-top: 0;
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.chosen-container.chosen-container-single-nosearch .chosen-drop {
|
||||
top: 100%;
|
||||
}
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
left: 0;
|
||||
}
|
||||
.chosen-container a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Single Chosen */
|
||||
.chosen-container-single .chosen-single {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding-left: 35px;
|
||||
height: 100%;
|
||||
border: 1px solid #555555;
|
||||
border-radius: 4px;
|
||||
background-clip: padding-box;
|
||||
box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
background: #fff url('../img/icon-hotel.svg') no-repeat 10px 50%;
|
||||
min-height: 55px;
|
||||
}
|
||||
.chosen-container-single.error_border {
|
||||
border: none !important;
|
||||
}
|
||||
.chosen-container-single.error_border .chosen-single {
|
||||
border: 2px solid red !important;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #999;
|
||||
}
|
||||
.chosen-container-single .chosen-single span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin-right: 26px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
top: 15px;
|
||||
color: #333;
|
||||
}
|
||||
.chosen-container-single .chosen-single-with-deselect span {
|
||||
margin-right: 38px;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 26px;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
||||
font-size: 1px;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
.chosen-container-single .chosen-single div b {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: url('../../../../themes/hotel-reservation-theme/img/icon/icon-dropdown-arrow.svg') no-repeat calc(100% - 8px) 50%;
|
||||
}
|
||||
.chosen-container-single .chosen-search {
|
||||
position: relative;
|
||||
z-index: 1010;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
height: 55px;
|
||||
}
|
||||
.chosen-container-single .chosen-search::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 1px;
|
||||
height: 22px;
|
||||
width: 19px;
|
||||
background: url('../../../../themes/hotel-reservation-theme/img/icon/icon-dropdown-arrow.svg') no-repeat calc(100% - 8px) 50%;
|
||||
/* background: url('../img/icon-hotel.svg') no-repeat 9px 50%; */
|
||||
}
|
||||
.chosen-container-single .chosen-search input[type="text"] {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding-left: 35px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
outline: 0;
|
||||
border: none;
|
||||
font-size: 1em;
|
||||
line-height: normal;
|
||||
border-radius: 4px;
|
||||
background: url('../img/icon-hotel.svg') no-repeat 9px 50%;
|
||||
}
|
||||
.chosen-container-single.chosen-container-active .chosen-search input[type="text"] {
|
||||
border: 2px solid #1292FF;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
}
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
border-radius: 0 0 4px 4px;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Results */
|
||||
.chosen-container .chosen-results {
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
max-height: 240px;
|
||||
background: #fff;
|
||||
margin-top: 2px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
list-style: none;
|
||||
color: #333;
|
||||
}
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
background-color: #379bf0;
|
||||
color: #fff;
|
||||
}
|
||||
.chosen-container .chosen-results li.no-results {
|
||||
display: list-item;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
font-weight: bold;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-option {
|
||||
padding-left: 15px;
|
||||
}
|
||||
.chosen-container .chosen-results li em {
|
||||
font-style: normal;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Multi Chosen */
|
||||
.chosen-container-multi .chosen-choices {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: auto !important;
|
||||
height: 1%;
|
||||
border: 1px solid #aaa;
|
||||
background-color: #fff;
|
||||
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2VlZWVlZSIvPjxzdG9wIG9mZnNldD0iMTUlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
|
||||
background-size: 100%;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
||||
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
cursor: text;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
||||
margin: 1px 0;
|
||||
padding: 5px;
|
||||
height: 15px;
|
||||
outline: 0;
|
||||
border: 0 !important;
|
||||
background: transparent !important;
|
||||
box-shadow: none;
|
||||
color: #666;
|
||||
font-size: 100%;
|
||||
line-height: normal;
|
||||
border-radius: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-field .default {
|
||||
color: #999;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice {
|
||||
position: relative;
|
||||
margin: 3px 0 3px 5px;
|
||||
padding: 3px 20px 3px 5px;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 3px;
|
||||
background-color: #e4e4e4;
|
||||
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIyMCUiIHN0b3AtY29sb3I9IiNmNGY0ZjQiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2YwZjBmMCIvPjxzdG9wIG9mZnNldD0iNTIlIiBzdG9wLWNvbG9yPSIjZThlOGU4Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZWVlZWVlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
|
||||
background-size: 100%;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
||||
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
background-clip: padding-box;
|
||||
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
color: #333;
|
||||
line-height: 13px;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 3px;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
||||
font-size: 1px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||
padding-right: 5px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #e4e4e4;
|
||||
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIyMCUiIHN0b3AtY29sb3I9IiNmNGY0ZjQiLz48c3RvcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2YwZjBmMCIvPjxzdG9wIG9mZnNldD0iNTIlIiBzdG9wLWNvbG9yPSIjZThlOGU4Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZWVlZWVlIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
|
||||
background-size: 100%;
|
||||
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
||||
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
||||
color: #666;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
||||
background: #d4d4d4;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
.chosen-container-multi .chosen-results {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Active */
|
||||
.chosen-container-active .chosen-single {
|
||||
border: 2px solid #1292FF;
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
||||
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-left: none;
|
||||
background: transparent;
|
||||
}
|
||||
.chosen-container-active .chosen-choices {
|
||||
border: 1px solid #5897fb;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
||||
color: #111 !important;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Disabled Support */
|
||||
.chosen-disabled {
|
||||
opacity: 0.5 !important;
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* chosen-drop top - start */
|
||||
.hotel-selector-wrap .chosen-container .chosen-drop.top .chosen-results {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: calc(100% + 2px);
|
||||
}
|
||||
.hotel-selector-wrap .chosen-container.chosen-container-single-nosearch .chosen-drop.top .chosen-results {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: calc(100% + 55px);
|
||||
}
|
||||
/* chosen-drop top - end */
|
||||
|
||||
|
||||
/* @end */
|
||||
/* @group Right to Left */
|
||||
.chosen-rtl {
|
||||
text-align: right;
|
||||
}
|
||||
.chosen-rtl .chosen-single {
|
||||
overflow: visible;
|
||||
padding: 0 8px 0 0;
|
||||
}
|
||||
.chosen-rtl .chosen-single span {
|
||||
margin-right: 0;
|
||||
margin-left: 26px;
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-single-with-deselect span {
|
||||
margin-left: 38px;
|
||||
}
|
||||
.chosen-rtl .chosen-single div {
|
||||
right: auto;
|
||||
left: 3px;
|
||||
}
|
||||
.chosen-rtl .chosen-single abbr {
|
||||
right: auto;
|
||||
left: 26px;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li {
|
||||
float: right;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li.search-choice {
|
||||
margin: 3px 5px 3px 0;
|
||||
padding: 3px 5px 3px 19px;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
||||
right: auto;
|
||||
left: 4px;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
||||
.chosen-rtl .chosen-drop {
|
||||
left: 9999px;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single .chosen-results {
|
||||
margin: 0 0 4px 4px;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
.chosen-rtl .chosen-results li.group-option {
|
||||
padding-right: 15px;
|
||||
padding-left: 0;
|
||||
}
|
||||
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-right: none;
|
||||
}
|
||||
.chosen-rtl .chosen-search input[type="text"] {
|
||||
padding: 4px 5px 4px 20px;
|
||||
background: #fff url('chosen-sprite.png') no-repeat -30px -20px;
|
||||
background: url('chosen-sprite.png') no-repeat -30px -20px, url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iI2VlZWVlZSIvPjxzdG9wIG9mZnNldD0iMTUlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g');
|
||||
background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
||||
background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single .chosen-single div b {
|
||||
background-position: 6px 2px;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
||||
background-position: -12px 2px;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-drop.dropup {
|
||||
border-bottom: 0;
|
||||
border-top: 1px solid #aaa;
|
||||
top: auto;
|
||||
bottom: 40px;
|
||||
}
|
||||
|
||||
.chosen-container.chosen-with-drop .chosen-single.dropup {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.chosen-container.chosen-with-drop .chosen-drop.dropup {
|
||||
box-shadow: none;
|
||||
margin-bottom: -16px;
|
||||
}
|
||||
|
||||
/* search results page - start */
|
||||
#category .chosen-container-single .chosen-single span {
|
||||
min-height: 45px;
|
||||
top: 11px;
|
||||
}
|
||||
/* search results page - end */
|
||||
@@ -48,6 +48,12 @@
|
||||
height: unset;
|
||||
min-height: 45px;
|
||||
}
|
||||
#search_hotel_block_form .hotel-selector-wrap .chosen-container-single .chosen-single {
|
||||
min-height: 45px;
|
||||
}
|
||||
#search_hotel_block_form .hotel-selector-wrap .chosen-container-single .chosen-search {
|
||||
height: 45px;
|
||||
}
|
||||
/* #search_hotel_block_form #search_room_submit {
|
||||
height: 45px;
|
||||
} */
|
||||
|
||||
@@ -63,6 +63,9 @@
|
||||
column-gap: 5px;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.fancybox-wrap #search_hotel_block_form .form-group.xs-calendar {
|
||||
position: relative;
|
||||
}
|
||||
/* #search_hotel_block_form {
|
||||
display: grid;
|
||||
grid-template-columns: 0.8fr repeat(3, 1fr) 0.6fr;
|
||||
@@ -100,6 +103,9 @@
|
||||
#search_hotel_block_form .header-rmsearch-input:active, #search_hotel_block_form .header-rmsearch-input:focus {
|
||||
border: 2px solid #1292FF;}
|
||||
#search_hotel_block_form #id_hotel_button {
|
||||
appearance: none;
|
||||
width: 100%;
|
||||
padding-left: 35px;
|
||||
background: url("../../views/img/icon-hotel.svg") no-repeat 10px 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat calc(100% - 10px) 50%;
|
||||
background-color: #FFF;}
|
||||
#search_hotel_block_form #guest_occupancy {
|
||||
@@ -109,6 +115,8 @@
|
||||
#search_hotel_block_form .input-date {
|
||||
display: grid;
|
||||
cursor: text;}
|
||||
#search_hotel_block_form .input-date.focused {
|
||||
border: 2px solid #1292FF; }
|
||||
#search_hotel_block_form .input-date span {
|
||||
align-self: center;}
|
||||
#search_hotel_block_form .input-date span i {
|
||||
@@ -117,14 +125,16 @@
|
||||
color: #333;}
|
||||
.header-rmsearch-input:-moz-placeholder {
|
||||
/* Firefox 18- */
|
||||
color: #999999;
|
||||
font-weight: 400;}
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
opacity: 1;}
|
||||
.header-rmsearch-input::-moz-placeholder {
|
||||
/* Firefox 19+ */
|
||||
color: #999999;
|
||||
font-weight: 400;}
|
||||
color: #333;
|
||||
font-weight: 400;
|
||||
opacity: 1;}
|
||||
.header-rmsearch-input:-ms-input-placeholder {
|
||||
color: #999999;
|
||||
color: #333;
|
||||
font-weight: 400;}
|
||||
.search_block_container .dropdown-toggle {
|
||||
background-color: #f2f2f2;
|
||||
@@ -138,15 +148,6 @@
|
||||
position: relative;}
|
||||
.header-rmsearch-wrapper .dropdown-menu {
|
||||
margin: 0px;}
|
||||
.header-rmsearch-wrapper .hotel_dropdown_ul {
|
||||
position: absolute;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
|
||||
max-height: 145px;
|
||||
overflow-y: auto;}
|
||||
.header-rmsearch-wrapper .location_search_results_ul {
|
||||
position: absolute;
|
||||
font-size: 14px;
|
||||
@@ -157,7 +158,7 @@
|
||||
box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
|
||||
max-height: 145px;
|
||||
overflow-y: auto;}
|
||||
.header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li {
|
||||
.header-rmsearch-wrapper .location_search_results_ul li {
|
||||
background-color: #fff;
|
||||
color: #333333;
|
||||
cursor: pointer;
|
||||
@@ -165,10 +166,16 @@
|
||||
font-size: 14px;
|
||||
list-style: outside none none;
|
||||
padding: 15px;}
|
||||
.header-rmsearch-wrapper .location_search_results_ul li:hover, .header-rmsearch-wrapper .location_search_results_ul li:focus, .header-rmsearch-wrapper .location_search_results_ul li:active, .header-rmsearch-wrapper .hotel_dropdown_ul li:hover, .header-rmsearch-wrapper .hotel_dropdown_ul li:focus, .header-rmsearch-wrapper .hotel_dropdown_ul li:active {
|
||||
.header-rmsearch-wrapper .location_search_results_ul li:hover, .header-rmsearch-wrapper .location_search_results_ul li:focus, .header-rmsearch-wrapper .location_search_results_ul li:active {
|
||||
background-color: #379bf0;
|
||||
color: #FFFFFF;}
|
||||
|
||||
.header-rmsearch-wrapper .location_search_results_ul.top {
|
||||
top: unset;
|
||||
bottom: 55px; }
|
||||
.header-rmsearch-wrapper .location_search_results_ul.bottom {
|
||||
top: 100%; }
|
||||
|
||||
|
||||
.header-rmsearch-wrapper .label-desc-txt {
|
||||
font-size: 12px;
|
||||
@@ -217,6 +224,11 @@
|
||||
box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
|
||||
left: 0px;
|
||||
padding: 20px;}
|
||||
#search_occupancy_wrapper.top {
|
||||
top: unset;
|
||||
bottom: 100%; }
|
||||
#search_occupancy_wrapper.bottom {
|
||||
top: 100%; }
|
||||
#search_occupancy_wrapper .occupancy-info-separator {
|
||||
margin-bottom: 15px;
|
||||
margin-top: 15px;
|
||||
|
||||
BIN
modules/wkroomsearchblock/views/img/chosen-sprite.png
Normal file
BIN
modules/wkroomsearchblock/views/img/chosen-sprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 646 B |
BIN
modules/wkroomsearchblock/views/img/chosen-sprite@2x.png
Normal file
BIN
modules/wkroomsearchblock/views/img/chosen-sprite@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 872 B |
@@ -17,7 +17,331 @@
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
const BookingSearchManager = {
|
||||
inputSteps: {
|
||||
'location': {
|
||||
init: function() {
|
||||
$('.location_search_results_ul').hide();
|
||||
|
||||
// search location with users searched characters
|
||||
$(document).on('keyup', '#hotel_location', function(e) {
|
||||
BookingSearchManager.inputSteps['location'].onInput.call(this, e);
|
||||
});
|
||||
|
||||
// set data on clicking the searched location on dropdown
|
||||
$(document).on('click', '.location_search_results_ul li', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
BookingSearchManager.inputSteps['location'].onInputComplete.call(this, e);
|
||||
});
|
||||
|
||||
// handle Tab key press on hotel location field
|
||||
$(document).on('keydown', '#hotel_location', function (e) {
|
||||
if (e.which == 9) { // Tab key
|
||||
e.preventDefault();
|
||||
|
||||
if ($('.location_search_results_ul').is(':visible')) {
|
||||
$('.location_search_results_ul li:first').focus().click();
|
||||
} else {
|
||||
BookingSearchManager.activateStep('hotel');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// handle Tab key press on hotel location list
|
||||
$(document).on('keydown', '.location_search_results_ul li', function (e) {
|
||||
if (e.which == 9) { // Tab key
|
||||
e.preventDefault();
|
||||
$(this).click();
|
||||
}
|
||||
});
|
||||
|
||||
// navigate to prev and next li in the location dropdown
|
||||
$('body').on('keydown', '.location_search_results_ul li', function(e) {
|
||||
if (e.which == 40 || e.which == 38) {
|
||||
var ulElement = $(this).closest('ul');
|
||||
var ulLength = ulElement.find('li').length;
|
||||
$(this).blur();
|
||||
ulElement.scrollTop($(this).index() * $(this).outerHeight());
|
||||
if (e.which == 40) {
|
||||
if ($(this).index() != (ulLength - 1)) {
|
||||
$(this).next('li.search_result_li').focus();
|
||||
} else {
|
||||
ulElement.find('li:first').focus();
|
||||
}
|
||||
} else if (e.which == 38) {
|
||||
if ($(this).index()) {
|
||||
$(this).prev('li.search_result_li').focus();
|
||||
} else {
|
||||
ulElement.find('li:last').focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
activate: function() {
|
||||
$('#hotel_location').focus();
|
||||
},
|
||||
inputHasValue: function () {
|
||||
return ($('#hotel_location').val() != '') && ($('#location_category_id').val() != '');
|
||||
},
|
||||
onInput: function (e) {
|
||||
if (e.which == 13) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (($('.location_search_results_ul').is(':visible')) && (e.which == 40 || e.which == 38)) {
|
||||
$(this).blur();
|
||||
if (e.which == 40) {
|
||||
$('.location_search_results_ul li:first').focus();
|
||||
} else if (e.which == 38) {
|
||||
$('.location_search_results_ul li:last').focus();
|
||||
}
|
||||
} else {
|
||||
$('.location_search_results_ul').empty().hide();
|
||||
if ($(this).val() != '') {
|
||||
abortRunningAjax();
|
||||
ajax_check_var = $.ajax({
|
||||
url: autocomplete_search_url,
|
||||
data: {
|
||||
to_search_data: $(this).val(),
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.status) {
|
||||
$('.location_search_results_ul').html(result.data);
|
||||
$('.location_search_results_ul').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onInputComplete: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('.location_search_results_ul').empty().hide();
|
||||
$('#hotel_location').attr('value', $(this).html());
|
||||
$('#location_category_id').val($(this).val());
|
||||
|
||||
// fetch hotels for selected location
|
||||
$.ajax({
|
||||
url: autocomplete_search_url,
|
||||
data: {
|
||||
location_category_id: $('#location_category_id').val(),
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.status) {
|
||||
$('#hotel_cat_id').val('');
|
||||
$('#id_hotel_button').html(result.html_hotel_options);
|
||||
$('#id_hotel_button').trigger('chosen:updated');
|
||||
// Resetting the data from previously selected hotel
|
||||
$('#preparation_time').val(0);
|
||||
var max_order_date = $('#max_order_date').val();
|
||||
var preparation_time = 0;
|
||||
createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val());
|
||||
if (search_auto_focus_next_field) {
|
||||
BookingSearchManager.activateStep('hotel');
|
||||
}
|
||||
} else {
|
||||
alert(no_results_found_cond);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
'hotel': {
|
||||
init: function() {
|
||||
$('select#id_hotel_button').chosen({
|
||||
search_contains: true,
|
||||
disable_search: !hotel_name_has_search,
|
||||
width: '100%',
|
||||
});
|
||||
|
||||
$(document).on('change', '#id_hotel_button', function() {
|
||||
if ($(this).find('option:selected').val().trim() != '') {
|
||||
$('#id_hotel_button_chosen .chosen-search input').blur();
|
||||
BookingSearchManager.inputSteps['hotel'].onInputComplete.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
// prevents calendar from closing on hotel selection
|
||||
$(document).on('click', '#id_hotel_button_chosen li', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$(document).on('keydown', '#id_hotel_button_chosen.chosen-container-active', function (e) {
|
||||
if (e.which == 9) { // Tab key
|
||||
e.preventDefault();
|
||||
if ($('#daterange_value').length) {
|
||||
$('#daterange_value').focus();
|
||||
$('#daterange_value').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keydown', '#id_hotel_button_chosen .chosen-search input', function (e) {
|
||||
if (e.which == 9 && $('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) { // Tab key
|
||||
e.preventDefault();
|
||||
$('#daterange_value').data('dateRangePicker').close();
|
||||
|
||||
if (is_occupancy_wise_search) {
|
||||
BookingSearchManager.activateStep('occupancy');
|
||||
} else {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if chosen will not be initialized add placeholder to hotel select element as first option
|
||||
if (!BookingSearchManager.isBrowserSupported()) {
|
||||
$('select#id_hotel_button option').first().html(select_htl_txt);
|
||||
}
|
||||
|
||||
if (hotel_name_has_search) {
|
||||
$('select#id_hotel_button').on('chosen:showing_dropdown', function() {
|
||||
$(this).siblings('.chosen-container').find('.chosen-single').addClass('invisible')
|
||||
});
|
||||
|
||||
$('select#id_hotel_button').on('chosen:hiding_dropdown', function() {
|
||||
$(this).siblings('.chosen-container').find('.chosen-single').removeClass('invisible')
|
||||
});
|
||||
}
|
||||
},
|
||||
activate: function() {
|
||||
$('#id_hotel_button').trigger('chosen:open');
|
||||
},
|
||||
inputHasValue: function () {
|
||||
return ($('#id_hotel').val() != '') && ($('#hotel_cat_id').val() != '');
|
||||
},
|
||||
onInputComplete: function () {
|
||||
$('#id_hotel_button_chosen .chosen-search input').blur();
|
||||
const selectedHotel = $(this).find('option:selected');
|
||||
|
||||
if ($(selectedHotel).val().trim() != '') {
|
||||
const maxOrderDate = $(selectedHotel).attr('data-max_order_date');
|
||||
const preparationTime = $(selectedHotel).attr('data-preparation_time')
|
||||
|
||||
createDateRangePicker(maxOrderDate, preparationTime, $('#check_in_time').val(), $('#check_out_time').val());
|
||||
|
||||
$('#max_order_date').val(maxOrderDate);
|
||||
$('#preparation_time').val(preparationTime);
|
||||
$('#id_hotel').val($(selectedHotel).attr('data-id-hotel'));
|
||||
$('#hotel_cat_id').val($(selectedHotel).attr('data-hotel-cat-id'));
|
||||
|
||||
if (search_auto_focus_next_field) {
|
||||
setTimeout(function () {
|
||||
if ($('#id_hotel_button').data('chosen') != undefined) {
|
||||
$('#id_hotel_button').data('chosen').close_field();
|
||||
}
|
||||
|
||||
BookingSearchManager.activateStep('date_range');
|
||||
}, 10);
|
||||
}
|
||||
} else {
|
||||
$('#id_hotel').val('');
|
||||
$('#hotel_cat_id').val('');
|
||||
}
|
||||
},
|
||||
},
|
||||
'date_range': {
|
||||
init: function() {
|
||||
$(document).on('keydown', '#daterange_value', function (e) {
|
||||
if (e.which == 9) { // Tab key
|
||||
e.preventDefault();
|
||||
$('#daterange_value').removeClass('focused').blur();
|
||||
|
||||
if ($('#daterange_value').data('dateRangePicker') != undefined) {
|
||||
$('#daterange_value').data('dateRangePicker').close();
|
||||
}
|
||||
|
||||
if (is_occupancy_wise_search) {
|
||||
BookingSearchManager.activateStep('occupancy');
|
||||
} else {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
activate: function() {
|
||||
$('#daterange_value').data('dateRangePicker').open();
|
||||
},
|
||||
inputHasValue: function () {
|
||||
return ($('#check_in_time').val() != '') && ($('#check_out_time').val() != '');
|
||||
},
|
||||
},
|
||||
'occupancy': {
|
||||
init: function() {
|
||||
$(document).on('keydown', '#guest_occupancy', function (e) {
|
||||
if (e.which == 9) { // Tab key
|
||||
e.preventDefault();
|
||||
if ($('#search_occupancy_wrapper').css('display') != 'none') {
|
||||
$('#guest_occupancy').click();
|
||||
}
|
||||
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
});
|
||||
},
|
||||
activate: function() {
|
||||
if ($('#search_occupancy_wrapper').css('display') == 'none') {
|
||||
$('#guest_occupancy').click().focus();
|
||||
}
|
||||
},
|
||||
inputHasValue: function () {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
'submit': {
|
||||
activate: function() {
|
||||
$('#search_room_submit').focus();
|
||||
},
|
||||
inputHasValue: function () {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
},
|
||||
init: function () {
|
||||
this.inputSteps['location'].init();
|
||||
this.inputSteps['hotel'].init();
|
||||
this.inputSteps['date_range'].init();
|
||||
if (is_occupancy_wise_search) {
|
||||
this.inputSteps['occupancy'].init();
|
||||
}
|
||||
},
|
||||
activateStep: function (step) {
|
||||
if (step in this.inputSteps) {
|
||||
this.inputSteps[step].activate();
|
||||
}
|
||||
},
|
||||
allFieldsFilled: function () {
|
||||
return this.inputSteps['hotel'].inputHasValue()
|
||||
&& this.inputSteps['date_range'].inputHasValue()
|
||||
},
|
||||
isBrowserSupported: function() { // defined as it is from chosen to decide if chosen will be initialized
|
||||
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
||||
return document.documentMode >= 8;
|
||||
}
|
||||
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
||||
return false;
|
||||
}
|
||||
if (/Android/i.test(window.navigator.userAgent)) {
|
||||
if (/Mobile/i.test(window.navigator.userAgent)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// initialize booking search fields
|
||||
BookingSearchManager.init();
|
||||
|
||||
// for screen size changes for room search
|
||||
var window_width = $(window).width();
|
||||
if (window_width > 767) {
|
||||
@@ -54,18 +378,16 @@ $(document).ready(function() {
|
||||
|
||||
/*END*/
|
||||
var ajax_check_var = '';
|
||||
$('.location_search_results_ul').hide();
|
||||
|
||||
function createDateRangePicker(max_order_date, preparation_time, dateFrom, dateTo)
|
||||
{
|
||||
createDateRangePicker = function (max_order_date, preparation_time, dateFrom, dateTo) {
|
||||
let start_date = new Date();
|
||||
if (preparation_time) {
|
||||
start_date.setDate(start_date.getDate() + parseInt(preparation_time));
|
||||
start_date.setHours(0, 0, 0, 0);
|
||||
let selecteDateFrom = new Date(Date.parse(dateFrom));
|
||||
let selecteDateTo = new Date(Date.parse(dateTo));
|
||||
if (selecteDateFrom < start_date
|
||||
|| selecteDateTo < start_date
|
||||
let selectedDateFrom = new Date(Date.parse(dateFrom));
|
||||
let selectedDateTo = new Date(Date.parse(dateTo));
|
||||
if (selectedDateFrom < start_date
|
||||
|| selectedDateTo < start_date
|
||||
) {
|
||||
$('#check_in_time').val('');
|
||||
$('#check_out_time').val('');
|
||||
@@ -119,18 +441,63 @@ $(document).ready(function() {
|
||||
}
|
||||
},
|
||||
endDate: max_order_date,
|
||||
}).on('datepicker-first-date-selected', function() {
|
||||
calendarFirstDateSelected = true;
|
||||
}).on('datepicker-change', function(event,obj){
|
||||
$('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1));
|
||||
$('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2));
|
||||
focusNextOnCalendarClose = true;
|
||||
calendarFirstDateSelected = false;
|
||||
}).on('datepicker-open', function() {
|
||||
$('#daterange_value').addClass('focused').focus();
|
||||
}).on('datepicker-close', function() {
|
||||
$('#daterange_value').removeClass('focused').blur();
|
||||
}).on('datepicker-closed', function() {
|
||||
if (search_auto_focus_next_field && focusNextOnCalendarClose) {
|
||||
if (is_occupancy_wise_search) {
|
||||
if ($('#check_in_time').val() != '' && $('#check_out_time').val() != '') {
|
||||
BookingSearchManager.activateStep('occupancy');
|
||||
}
|
||||
} else {
|
||||
if (BookingSearchManager.allFieldsFilled()) {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}
|
||||
|
||||
focusNextOnCalendarClose = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#daterange_value').dateRangePicker({
|
||||
startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
|
||||
startDate: start_date,
|
||||
endDate: max_order_date,
|
||||
}).on('datepicker-first-date-selected', function() {
|
||||
calendarFirstDateSelected = true;
|
||||
}).on('datepicker-change', function(event,obj){
|
||||
$('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1));
|
||||
$('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2));
|
||||
focusNextOnCalendarClose = true;
|
||||
calendarFirstDateSelected = false;
|
||||
}).on('datepicker-open', function() {
|
||||
$('#daterange_value').addClass('focused').focus();
|
||||
}).on('datepicker-close', function() {
|
||||
$('#daterange_value').removeClass('focused').blur();
|
||||
calendarFirstDateSelected = false;
|
||||
}).on('datepicker-closed', function() {
|
||||
if (search_auto_focus_next_field && focusNextOnCalendarClose) {
|
||||
if (is_occupancy_wise_search) {
|
||||
if ($('#check_in_time').val() != '' && $('#check_out_time').val() != '') {
|
||||
BookingSearchManager.activateStep('occupancy');
|
||||
}
|
||||
} else {
|
||||
if (BookingSearchManager.allFieldsFilled()) {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}
|
||||
|
||||
focusNextOnCalendarClose = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -140,156 +507,21 @@ $(document).ready(function() {
|
||||
$.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateTo))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function abortRunningAjax() {
|
||||
abortRunningAjax = function () {
|
||||
if (ajax_check_var) {
|
||||
ajax_check_var.abort();
|
||||
}
|
||||
}
|
||||
|
||||
// search location with users searched characters
|
||||
$(document).on('keyup', "#hotel_location", function(e) {
|
||||
if (($('.location_search_results_ul').is(':visible')) && (e.which == 40 || e.which == 38)) {
|
||||
$(this).blur();
|
||||
if (e.which == 40) {
|
||||
$(".location_search_results_ul li:first").focus();
|
||||
} else if (e.which == 38) {
|
||||
$(".location_search_results_ul li:last").focus();
|
||||
}
|
||||
} else {
|
||||
$('.location_search_results_ul').empty().hide();
|
||||
if ($(this).val() != '') {
|
||||
abortRunningAjax();
|
||||
ajax_check_var = $.ajax({
|
||||
url: autocomplete_search_url,
|
||||
data: {
|
||||
to_search_data: $(this).val(),
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.status == 'success') {
|
||||
$('.location_search_results_ul').html(result.data);
|
||||
$('.location_search_results_ul').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if user clicks anywhere and location/hotel li is visible the select first li as selection
|
||||
$('body').on('click', function(e) {
|
||||
if ($('.location_search_results_ul').is(':visible') && e.target.className != "search_result_li" && e.target.id != "hotel_location") {
|
||||
$('.location_search_results_ul .search_result_li:first').click();
|
||||
}
|
||||
|
||||
if ($('.hotel_dropdown_ul').is(':visible') && e.target.className != "search_result_li" && e.target.id != "hotel_location") {
|
||||
$('.hotel_dropdown_ul .search_result_li:first').click();
|
||||
}
|
||||
});
|
||||
|
||||
// set data on clicking the searched location on dropdown
|
||||
$(document).on('click', '.location_search_results_ul li', function(e) {
|
||||
$('#hotel_location').attr('value', $(this).html());
|
||||
$('#location_category_id').val($(this).val());
|
||||
|
||||
$('.location_search_results_ul').empty().hide();
|
||||
|
||||
$.ajax({
|
||||
url: autocomplete_search_url,
|
||||
data: {
|
||||
location_category_id: $('#location_category_id').val(),
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function(result) {
|
||||
if (result.status == 'success') {
|
||||
$('#hotel_cat_id').val('');
|
||||
$('#hotel_cat_name').html('Select Hotel');
|
||||
$('.hotel_dropdown_ul').empty();
|
||||
$('.hotel_dropdown_ul').html(result.data);
|
||||
// Resetting the data from previously selected hotel
|
||||
$('#preparation_time').val(0);
|
||||
var max_order_date = $('#max_order_date').val();
|
||||
var preparation_time = 0;
|
||||
createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val());
|
||||
} else {
|
||||
alert(no_results_found_cond);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// navigate to prev and next li in the location/hotel dropdown
|
||||
$('body').on('keyup', 'li.search_result_li', function(e) {
|
||||
if (e.which == 40 || e.which == 38) {
|
||||
var ulElement = $(this).closest('ul');
|
||||
var ulLength = ulElement.find('li').length;
|
||||
$(this).blur();
|
||||
ulElement.scrollTop($(this).index() * $(this).outerHeight());
|
||||
if (e.which == 40) {
|
||||
if ($(this).index() != (ulLength - 1)) {
|
||||
$(this).next('li.search_result_li').focus();
|
||||
} else {
|
||||
ulElement.find("li:first").focus();
|
||||
}
|
||||
} else if (e.which == 38) {
|
||||
if ($(this).index()) {
|
||||
$(this).prev('li.search_result_li').focus();
|
||||
} else {
|
||||
ulElement.find("li:last").focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// when focus goes from hotel button to li list of hotels
|
||||
$(document).on('keyup', "#id_hotel_button", function(e) {
|
||||
if ($('.hotel_dropdown_ul').is(':visible')) {
|
||||
if ($('.hotel_dropdown_ul .search_result_li').length) {
|
||||
$(".hotel_dropdown_ul li:first").focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if user is selecting the location by keydown / up key
|
||||
$(document).on('keydown', 'body', function(e) {
|
||||
if ((e.which == 40 || e.which == 38) && ($('.location_search_results_ul li.search_result_li').is(':visible') || $('.hotel_dropdown_ul li.search_result_li').is(':visible'))) {
|
||||
return false;
|
||||
} else if (e.which == 13 && e.target.className == 'search_result_li') {
|
||||
e.target.click();
|
||||
} else if (e.which == 9 && $('.location_search_results_ul').is(':visible')) {
|
||||
if ($('.location_search_results_ul .search_result_li').length) {
|
||||
$('.location_search_results_ul li.search_result_li:first').click();
|
||||
}
|
||||
} else if (e.which == 9 && $('.hotel_dropdown_ul').is(':visible')) {
|
||||
if ($('.hotel_dropdown_ul .search_result_li').length) {
|
||||
$('.hotel_dropdown_ul li.search_result_li:first').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.hotel_dropdown_ul li', function() {
|
||||
let max_order_date = $(this).attr('data-max_order_date');
|
||||
let preparation_time = $(this).attr('data-preparation_time')
|
||||
createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val());
|
||||
$("#max_order_date").val(max_order_date);
|
||||
$('#preparation_time').val(preparation_time);
|
||||
$('#id_hotel').val($(this).attr('data-id-hotel'));
|
||||
$('#hotel_cat_id').val($(this).attr('data-hotel-cat-id'));
|
||||
$('#hotel_cat_name').html($(this).html());
|
||||
});
|
||||
|
||||
// If only one hotel then set max order date on date pickers
|
||||
var max_order_date = $('#max_order_date').val();
|
||||
var preparation_time = $('#preparation_time').val();
|
||||
createDateRangePicker(max_order_date, preparation_time, $('#check_in_time').val(), $('#check_out_time').val());
|
||||
|
||||
// validations on the submit of the search fields
|
||||
$('#search_room_submit').on('click', function(e) {
|
||||
$(document).on('click', '#search_room_submit', function() {
|
||||
var check_in_time = $("#check_in_time").val();
|
||||
var check_out_time = $("#check_out_time").val();
|
||||
var max_order_date = $("#max_order_date").val();
|
||||
@@ -304,7 +536,7 @@ $(document).ready(function() {
|
||||
$("#hotel_location").addClass("error_border");
|
||||
error = true;
|
||||
}
|
||||
$("#id_hotel_button").addClass("error_border");
|
||||
$("#id_hotel_button_chosen").addClass("error_border");
|
||||
$('#select_htl_error_p').text(hotel_name_cond);
|
||||
error = true;
|
||||
}
|
||||
@@ -346,9 +578,10 @@ $(document).ready(function() {
|
||||
else
|
||||
return true;
|
||||
});
|
||||
|
||||
// Occupancy field dropdown
|
||||
// add occupancy info block
|
||||
$('#search_occupancy_wrapper .add_new_occupancy_btn').on('click', function(e) {
|
||||
$(document).on('click', '#search_occupancy_wrapper .add_new_occupancy_btn', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var occupancy_block = '';
|
||||
@@ -525,64 +758,167 @@ $(document).ready(function() {
|
||||
// toggle occupancy block
|
||||
$('#guest_occupancy').on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
if ($('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) {
|
||||
$('#daterange_value').data('dateRangePicker').close();
|
||||
}
|
||||
$("#search_occupancy_wrapper").toggle();
|
||||
});
|
||||
|
||||
// close the occupancy block when clink anywhere in the body outside occupancy block
|
||||
function validateOccupancies() {
|
||||
let hasErrors = 0;
|
||||
|
||||
let adults = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get();
|
||||
let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get();
|
||||
let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get();
|
||||
|
||||
// start validating above values
|
||||
if (!adults.length || (adults.length != children.length)) {
|
||||
hasErrors = 1;
|
||||
showErrorMessage(invalid_occupancy_txt);
|
||||
} else {
|
||||
$("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border');
|
||||
|
||||
// validate values of adults and children
|
||||
adults.forEach(function (item, index) {
|
||||
if (isNaN(item) || parseInt(item) < 1) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
if (isNaN(children[index])) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
});
|
||||
|
||||
// validate values of selected child ages
|
||||
$("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border');
|
||||
child_ages.forEach(function (age, index) {
|
||||
age = parseInt(age);
|
||||
if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (hasErrors == 0) {
|
||||
$("#search_occupancy_wrapper").hide();
|
||||
$("#search_hotel_block_form #guest_occupancy").removeClass('error_border');
|
||||
} else {
|
||||
$("#search_hotel_block_form #guest_occupancy").addClass('error_border');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Body Events - start
|
||||
var focusNextOnCalendarClose = true;
|
||||
var calendarFirstDateSelected = false;
|
||||
$('body').on('click', function(e) {
|
||||
// @TODO better approach to be found
|
||||
// if user clicks anywhere and location li is visible then close it
|
||||
if ($('.location_search_results_ul').is(':visible')
|
||||
&& e.target.className != 'search_result_li'
|
||||
&& e.target.id != 'hotel_location'
|
||||
) {
|
||||
$('.location_search_results_ul').hide();
|
||||
$('#hotel_location').attr('placeholder', hotel_location_txt);
|
||||
}
|
||||
|
||||
// check if user clicked outside calendar
|
||||
if ($('#daterange_value').siblings('.date-picker-wrapper').is(':visible')) {
|
||||
if (!$(e.target).closest('.form-group').find('.date-picker-wrapper').length) {
|
||||
focusNextOnCalendarClose = false;
|
||||
}
|
||||
}
|
||||
|
||||
// close the occupancy block when clink anywhere in the body outside occupancy block
|
||||
if ($('#search_occupancy_wrapper').length) {
|
||||
if ($('#search_occupancy_wrapper').css('display') !== 'none') {
|
||||
if (!($(e.target).closest("#search_occupancy_wrapper").length)) {
|
||||
// Before closing the occupancy block validate the vaules inside
|
||||
let hasErrors = 0;
|
||||
|
||||
let adults = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get();
|
||||
let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get();
|
||||
let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get();
|
||||
|
||||
// start validating above values
|
||||
if (!adults.length || (adults.length != children.length)) {
|
||||
hasErrors = 1;
|
||||
showErrorMessage(invalid_occupancy_txt);
|
||||
} else {
|
||||
$("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border');
|
||||
|
||||
// validate values of adults and children
|
||||
adults.forEach(function (item, index) {
|
||||
if (isNaN(item) || parseInt(item) < 1) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
if (isNaN(children[index])) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
|
||||
}
|
||||
});
|
||||
|
||||
// validate values of selected child ages
|
||||
$("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border');
|
||||
child_ages.forEach(function (age, index) {
|
||||
age = parseInt(age);
|
||||
if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) {
|
||||
hasErrors = 1;
|
||||
$("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (hasErrors == 0) {
|
||||
$("#search_occupancy_wrapper").hide();
|
||||
$("#search_hotel_block_form #guest_occupancy").removeClass('error_border');
|
||||
} else {
|
||||
$("#search_hotel_block_form #guest_occupancy").addClass('error_border');
|
||||
return false;
|
||||
}
|
||||
// Before closing the occupancy block validate the values inside
|
||||
return validateOccupancies();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var isEnterKeyHeldOnLocation = false;
|
||||
$('body').on('keydown', function(e) {
|
||||
let preventDefault = false;
|
||||
|
||||
// fix for: if user pressed Tab after selecting only first date
|
||||
if (e.which == 9
|
||||
&& $('#daterange_value').siblings('.date-picker-wrapper').is(':visible')
|
||||
&& calendarFirstDateSelected
|
||||
) {
|
||||
preventDefault = true;
|
||||
$('#daterange_value').data('dateRangePicker').close();
|
||||
|
||||
setTimeout(function () {
|
||||
if (is_occupancy_wise_search) {
|
||||
BookingSearchManager.activateStep('occupancy');
|
||||
} else {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
// if user is selecting the location by Up, Down, Enter or Tab keys
|
||||
if ((e.which == 40 || e.which == 38) && $('.location_search_results_ul li.search_result_li').is(':visible')) {
|
||||
return false;
|
||||
} else if (e.which == 13 && e.target.className == 'search_result_li') {
|
||||
// select location only after held Enter key is unheld
|
||||
preventDefault = true;
|
||||
isEnterKeyHeldOnLocation = true;
|
||||
} else if (e.which == 9 && $('.location_search_results_ul').is(':visible')) {
|
||||
preventDefault = true;
|
||||
$(e.target).click();
|
||||
}
|
||||
|
||||
// check if submit button must be focused
|
||||
if (e.which == 9 && $('#search_occupancy_wrapper:visible').length) {
|
||||
preventDefault = true;
|
||||
if (validateOccupancies()) {
|
||||
BookingSearchManager.activateStep('submit');
|
||||
}
|
||||
}
|
||||
|
||||
if (preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// select location only after held Enter key is unheld
|
||||
$('body').on('keyup', function(e) {
|
||||
if ($(e.target).is('.location_search_results_ul li')
|
||||
&& isEnterKeyHeldOnLocation
|
||||
&& e.which == 13
|
||||
) {
|
||||
$(e.target).click();
|
||||
}
|
||||
});
|
||||
// Body Events - end
|
||||
|
||||
// set positions of popups when required
|
||||
if (page_name == 'index') {
|
||||
$('#hotel_location, #id_hotel_button, #guest_occupancy').focus(function () {
|
||||
setBookingSearchPositions();
|
||||
});
|
||||
|
||||
// after chosen has been initialized
|
||||
$('select#id_hotel_button').on('chosen:ready', function() {
|
||||
$('#id_hotel_button_chosen .chosen-search input').focus(function () {
|
||||
setBookingSearchPositions();
|
||||
});
|
||||
});
|
||||
|
||||
$('#daterange_value').click(function () {
|
||||
setBookingSearchPositions();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// function to set occupancy infor in guest occupancy field(search form)
|
||||
function setGuestOccupancy()
|
||||
{
|
||||
@@ -614,4 +950,45 @@ function setGuestOccupancy()
|
||||
guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt;
|
||||
}
|
||||
$('#guest_occupancy > span').text(guestButtonVal);
|
||||
}
|
||||
|
||||
// position dropdowns
|
||||
function setBookingSearchPositions() {
|
||||
// calculate available spaces
|
||||
let searchForm = $('#search_hotel_block_form');
|
||||
|
||||
let inputFieldsAndDropdowns = [
|
||||
{ input: $('#hotel_location'), dropdown: $('.location_search_results_ul')},
|
||||
{ input: $('.hotel-selector-wrap'), dropdown: $('#id_hotel_button_chosen .chosen-drop')},
|
||||
{ input: $('#guest_occupancy'), dropdown: $('#search_occupancy_wrapper')},
|
||||
];
|
||||
|
||||
let positionClass = 'bottom';
|
||||
if (!searchForm.closest('.fancybox-wrap').length) {
|
||||
let searchFormHeight = searchForm.outerHeight();
|
||||
let spaceTop = searchForm.offset().top - $(window).scrollTop();
|
||||
let spaceBottom = $(window).height() - searchFormHeight - spaceTop;
|
||||
|
||||
// calculate max height for dropdowns
|
||||
let maxHeightNeeded = 0;
|
||||
$(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) {
|
||||
if (!inputFieldAndDropdown.input.length) return false;
|
||||
|
||||
// find needed space height
|
||||
let cssMaxHeight = parseInt(inputFieldAndDropdown.dropdown.css('max-height'));
|
||||
if (Number.isInteger(cssMaxHeight)) {
|
||||
maxHeightNeeded = Math.max(maxHeightNeeded, cssMaxHeight);
|
||||
}
|
||||
});
|
||||
|
||||
// determine position class
|
||||
if (spaceBottom < maxHeightNeeded && spaceTop > spaceBottom) {
|
||||
positionClass = 'top';
|
||||
}
|
||||
}
|
||||
|
||||
// position dropdowns
|
||||
$(inputFieldsAndDropdowns).each(function (i, inputFieldAndDropdown) {
|
||||
inputFieldAndDropdown.dropdown.removeClass('top bottom').addClass(positionClass);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{**
|
||||
* 2010-2024 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2024 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<option value=""></option>
|
||||
{if isset($hotels_info) && is_array($hotels_info)}
|
||||
{foreach from=$hotels_info item=hotel_info}
|
||||
<option class="search_result_li" data-id-hotel="{$hotel_info.id_hotel}" data-hotel-cat-id="{$hotel_info.id_category}" data-max_order_date="{$hotel_info.max_order_date}" tabindex="-1">
|
||||
{$hotel_info.hotel_name}
|
||||
</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
29
modules/wkroomsearchblock/views/templates/front/index.php
Normal file
29
modules/wkroomsearchblock/views/templates/front/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2024 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2024 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
@@ -0,0 +1,24 @@
|
||||
{**
|
||||
* 2010-2024 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2024 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
{if isset($location_categories) && is_array($location_categories)}
|
||||
{foreach from=$location_categories item=category}
|
||||
<li class="search_result_li" value="{$category.id_category}" tabindex="-1">{$category.name}</li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
@@ -1,7 +1,7 @@
|
||||
<form method="POST" id="search_hotel_block_form" class="grid">
|
||||
{if isset($location_enabled) && $location_enabled}
|
||||
<div class="form-group area-{$column_widths['location']}">
|
||||
<input type="text" class="form-control header-rmsearch-input input-location" id="hotel_location" name="hotel_location" autocomplete="off" placeholder="{l s='Hotel location' mod='wkroomsearchblock'}" {if isset($search_data)}value="{$search_data['location']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="text" class="form-control header-rmsearch-input input-location" id="hotel_location" name="hotel_location" autocomplete="off" placeholder="{l s='Hotel Location' mod='wkroomsearchblock'}" {if isset($search_data)}value="{$search_data['location']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input hidden="hidden" name="location_category_id" id="location_category_id" {if isset($search_data)}value="{$search_data['location_category_id']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<div class="dropdown">
|
||||
<ul class="location_search_results_ul dropdown-menu"></ul>
|
||||
@@ -16,29 +16,19 @@
|
||||
<input type="hidden" id="htl_name" class="form-control header-rmsearch-input" value="{$hotels_info[0]['hotel_name']}" readonly>
|
||||
{else}
|
||||
<div class="form-group area-{$column_widths['hotel']}">
|
||||
{if isset($hotels_info) && count($hotels_info)}
|
||||
<div class="dropdown">
|
||||
<input type="hidden" id="hotel_cat_id" name="hotel_cat_id" {if isset($search_data)}value="{$search_data['htl_dtl']['id_category']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="hidden" id="id_hotel" name="id_hotel" {if isset($search_data)}value="{$search_data['htl_dtl']['id']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="hidden" id="max_order_date" name="max_order_date" value="{if isset($max_order_date)}{$max_order_date|escape:'htmlall':'UTF-8'}{/if}">
|
||||
<input type="hidden" id="preparation_time" name="preparation_time" value="{if isset($preparation_time)}{$preparation_time|escape:'htmlall':'UTF-8'}{/if}">
|
||||
<input type="hidden" id="hotel_cat_id" name="hotel_cat_id" {if isset($search_data)}value="{$search_data['htl_dtl']['id_category']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="hidden" id="id_hotel" name="id_hotel" {if isset($search_data)}value="{$search_data['htl_dtl']['id']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="hidden" id="max_order_date" name="max_order_date" value="{if isset($max_order_date)}{$max_order_date|escape:'htmlall':'UTF-8'}{/if}">
|
||||
<input type="hidden" id="preparation_time" name="preparation_time" value="{if isset($preparation_time)}{$preparation_time|escape:'htmlall':'UTF-8'}{/if}">
|
||||
|
||||
<button class="form-control header-rmsearch-input input-hotel {if isset($error) && $error == 1}error_border{/if}" type="button" data-toggle="dropdown" id="id_hotel_button">
|
||||
{if isset($search_data)}
|
||||
<span id="hotel_cat_name" class="pull-left">{$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}</span>
|
||||
{else}
|
||||
<span id="hotel_cat_name" class="pull-left">{l s='Select Hotel' mod='wkroomsearchblock'}</span>
|
||||
{/if}
|
||||
</button>
|
||||
<ul class="dropdown-menu hotel_dropdown_ul">
|
||||
{if isset($hotels_info) && $hotels_info}
|
||||
{foreach $hotels_info as $name_val}
|
||||
<li tabindex="-1" class="search_result_li" data-id-hotel="{$name_val['id']|escape:'htmlall':'UTF-8'}" data-hotel-cat-id="{$name_val['id_category']|escape:'htmlall':'UTF-8'}" data-max_order_date="{$name_val['max_order_date']}" data-preparation_time="{$name_val['preparation_time']|escape:'htmlall':'UTF-8'}">{$name_val['hotel_name']|escape:'htmlall':'UTF-8'}</li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="hotel-selector-wrap">
|
||||
<select name="id_hotel" class="chosen header-rmsearch-input" data-placeholder="{l s='Select Hotel' mod='wkroomsearchblock'}" id="id_hotel_button">
|
||||
<option value=""></option>
|
||||
{foreach $hotels_info as $name_val}
|
||||
<option class="search_result_li" value="{$name_val['id']|escape:'htmlall':'UTF-8'}" data-id-hotel="{$name_val['id']|escape:'htmlall':'UTF-8'}" data-hotel-cat-id="{$name_val['id_category']|escape:'htmlall':'UTF-8'}" data-max_order_date="{$name_val['max_order_date']}" data-preparation_time="{$name_val['preparation_time']|escape:'htmlall':'UTF-8'}" {if isset($search_data) && $name_val['id'] == $search_data['htl_dtl']['id']}selected{/if}>{$name_val['hotel_name']|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($multiple_dates_input) && $multiple_dates_input}
|
||||
@@ -56,7 +46,7 @@
|
||||
<div class="form-group area-{$column_widths['date']}">
|
||||
<input type="hidden" id="check_in_time" name="check_in_time" {if isset($search_data)}value="{$search_data['date_from']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<input type="hidden" id="check_out_time" name="check_out_time" {if isset($search_data)}value="{$search_data['date_to']|escape:'htmlall':'UTF-8'}"{/if}>
|
||||
<div class="form-control header-rmsearch-input input-date" id="daterange_value" autocomplete="off" placeholder="{l s='Check-in - Check-out' mod='wkroomsearchblock'}"><span>{l s='Check-in' mod='wkroomsearchblock'} <i class="icon icon-minus"></i> {l s='Check-out' mod='wkroomsearchblock'}</span></div>
|
||||
<div class="form-control header-rmsearch-input input-date" id="daterange_value" autocomplete="off" placeholder="{l s='Check-in - Check-out' mod='wkroomsearchblock'}" tabindex="-1"><span>{l s='Check-in' mod='wkroomsearchblock'} <i class="icon icon-minus"></i> {l s='Check-out' mod='wkroomsearchblock'}</span></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -51,9 +51,16 @@ class WkRoomSearchBlock extends Module
|
||||
$objHotelBranchInformation = new HotelBranchInformation();
|
||||
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(0, 1);
|
||||
if (is_array($hotelBranchesInfo) && count($hotelBranchesInfo)) {
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/jquery.chosen.js');
|
||||
$this->context->controller->addCSS($this->_path.'/views/css/chosen.css');
|
||||
|
||||
$this->context->controller->addCSS($this->_path.'/views/css/wk-global-search.css');
|
||||
$this->context->controller->addJS($this->_path.'/views/js/wk-room-search-block.js');
|
||||
|
||||
$isOccupancyWiseSearch = false;
|
||||
if (Configuration::get('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
|
||||
$isOccupancyWiseSearch = true;
|
||||
}
|
||||
Media::addJsDef(
|
||||
array (
|
||||
'autocomplete_search_url' => $this->context->link->getModuleLink(
|
||||
@@ -66,6 +73,7 @@ class WkRoomSearchBlock extends Module
|
||||
'check_out_time_cond' => $this->l('Please enter Check Out time', false, true),
|
||||
'less_checkin_date' => $this->l('Check In date can not be before current date.', false, true),
|
||||
'more_checkout_date' => $this->l('Check Out date must be greater than Check In date.', false, true),
|
||||
'hotel_location_txt' => $this->l('Hotel Location', false, true),
|
||||
'select_htl_txt' => $this->l('Select Hotel', false, true),
|
||||
'select_age_txt' => $this->l('Select age', false, true),
|
||||
'under_1_age' => $this->l('Under 1', false, true),
|
||||
@@ -80,6 +88,9 @@ class WkRoomSearchBlock extends Module
|
||||
'years_txt' => $this->l('years', false, true),
|
||||
'all_children_txt' => $this->l('All Children', false, true),
|
||||
'invalid_occupancy_txt' => $this->l('Invalid occupancy(adults/children) found.', false, true),
|
||||
'hotel_name_has_search' => count($hotelBranchesInfo) >= Configuration::get('WK_HOTEL_NAME_SEARCH_THRESHOLD'),
|
||||
'search_auto_focus_next_field' => (bool) Configuration::get('WK_SEARCH_AUTO_FOCUS_NEXT_FIELD'),
|
||||
'is_occupancy_wise_search' => $isOccupancyWiseSearch,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,6 @@
|
||||
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
|
||||
{if isset($occupancy_required_for_booking) && $occupancy_required_for_booking}
|
||||
<div class="booking_guest_occupancy_conatiner">
|
||||
{assign var=occupancies value=$room_v['occupancies']}
|
||||
{assign var=occupancy_adults value=$room_v['occupancy_adults']}
|
||||
{include file="./occupancy_field.tpl" room_type_info=$room_v total_available_rooms=$room_v['room_left']}
|
||||
</div>
|
||||
{else}
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
<div class="col-sm-3">
|
||||
<div class="filter_dw_cont">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="price_ftr" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="pull-left sort_btn_span" data-sort-by="0" data-sort-value="0" data-sort-for="{l s='Price'}">{l s='Price'}</span>
|
||||
<span class="pull-left sort_btn_span" data-sort-by="0" data-sort-value="0" data-sort-for="{l s='Recommended'}">{l s='Recommended'}</span>
|
||||
<span class="caret pull-right margin-top-7"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="price_ftr">
|
||||
<li><a href="#" class="sort_result" data-sort-by="0" data-value="0">{l s='Recommended'}</a></li>
|
||||
<li><a href="#" class="sort_result" data-sort-by="2" data-value="1">{l s='Price : Lowest First'}</a></li>
|
||||
<li><a href="#" class="sort_result" data-sort-by="2" data-value="2">{l s='Price : Highest first '}</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
box-shadow: 0 4px 10px 0 rgb(0 0 0 / 26%);
|
||||
}
|
||||
.date-picker-wrapper.no-shortcuts {
|
||||
margin-top: -4px;
|
||||
padding: 10px;
|
||||
}
|
||||
.date-picker-wrapper.top,
|
||||
.date-picker-wrapper.bottom {
|
||||
position: absolute;
|
||||
}
|
||||
.date-picker-wrapper .month-wrapper{
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
|
||||
@@ -6533,8 +6533,8 @@ table.table_block td {
|
||||
.input-date span i, .form-control .input-date span i {
|
||||
transform: scale(0.8, 0.6);}
|
||||
|
||||
.input-hotel, .form-control .input-hotel, .input-location, .form-control .input-location {
|
||||
background: url("../img/icon/icon-hotel.svg") no-repeat 10px 50%;
|
||||
.input-location, .form-control .input-location {
|
||||
background: url("../img/icon/icon-location.svg") no-repeat 6px 50%;
|
||||
padding-left: 35px;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.card.card-toolbar .card-header {
|
||||
padding: 8px 18px;
|
||||
}
|
||||
|
||||
.card .card-subheader {
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
@@ -211,6 +207,10 @@
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.payment-details .detail-row .status .processing {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.hotel-location p.hotel-address {
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
@@ -251,6 +251,10 @@
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.room-details .card-header .booking-actions-wrap {
|
||||
margin: -6px 0;
|
||||
}
|
||||
|
||||
.room-details .card-header .booking-actions-wrap .col-xs-12 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 10.3636C19 15.2727 12 21 12 21C12 21 5 15.2727 5 10.3636C5 6.35291 8.18733 3 12 3C15.8127 3 19 6.35291 19 10.3636Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M12 13C13.6569 13 15 11.6569 15 10C15 8.34315 13.6569 7 12 7C10.3431 7 9 8.34315 9 10C9 11.6569 10.3431 13 12 13Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 522 B |
@@ -478,6 +478,9 @@ var ajaxCart = {
|
||||
else
|
||||
$(callerElement).removeProp('disabled');
|
||||
}
|
||||
if (!addedFromProductPage) {
|
||||
resetOccupancyField($(callerElement).closest('.booking_room_fields').find('.booking_occupancy_wrapper'));
|
||||
}
|
||||
emptyCustomizations();
|
||||
|
||||
},
|
||||
|
||||
@@ -380,3 +380,19 @@ function getRoomTypeGuestOccupancyFormated(adults, children, rooms)
|
||||
return guestButtonVal;
|
||||
}
|
||||
|
||||
|
||||
function resetOccupancyField(booking_occupancy_wrapper)
|
||||
{
|
||||
$(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(select_occupancy_txt);
|
||||
$(booking_occupancy_wrapper).find('.booking_occupancy_inner > div').each(function(index, element){
|
||||
let num_adults = $(booking_occupancy_wrapper).find('.base_adult').val();
|
||||
if (index == 0) {
|
||||
$(this).removeClass('selected');
|
||||
$(this).find('.num_adults').val(num_adults).siblings('.occupancy_count').find('span').text(num_adults);
|
||||
$(this).find('.num_children').val(0).siblings('.occupancy_count').find('span').text(0);
|
||||
$(this).find('.children_ages > div').remove();
|
||||
} else {
|
||||
$(element).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -116,13 +116,17 @@
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
<div class="pull-right value status">
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{if isset($order_history[0]) && $order_history[0]}
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{else}
|
||||
<span class="processing">{l s='Processing'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -173,7 +177,7 @@
|
||||
{/if}
|
||||
|
||||
{hook h='displayOrderDetailRoomDetailsBefore' id_order=$order->id}
|
||||
<div class="card room-details card-toolbar">
|
||||
<div class="card room-details">
|
||||
<div class="card-header">
|
||||
{l s='Room Details'}
|
||||
<div class="booking-actions-wrap">
|
||||
@@ -499,13 +503,17 @@
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
<div class="pull-right value status">
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{if isset($order_history[0]) && $order_history[0]}
|
||||
<span{if isset($order_history[0].color) && $order_history[0].color} style="background-color:{$order_history[0].color|escape:'html':'UTF-8'}30; border: 1px solid {$order_history[0].color|escape:'html':'UTF-8'};" {/if} class="label">
|
||||
{if $order_history[0].id_order_state|in_array:$overbooking_order_states}
|
||||
{l s='Order Not Confirmed'}
|
||||
{else}
|
||||
{$order_history[0].ostate_name|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</span>
|
||||
{else}
|
||||
<span class="processing">{l s='Processing'}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -777,7 +785,10 @@
|
||||
{if $hotel_booking_detail.is_refunded || $hotel_booking_detail.is_cancelled}<span class="badge badge-danger badge-cancelled">{l s='Cancelled'}</span>{/if}
|
||||
</div>
|
||||
</div>
|
||||
{assign var='has_services' value=(isset($rm_v.additional_services) && isset($rm_v.additional_services[$hotel_booking_detail.id_room]) && isset($rm_v.additional_services[$hotel_booking_detail.id_room]['additional_services']))}
|
||||
|
||||
{* Services are indexed with id_htl_booking *}
|
||||
{assign var='has_services' value=(isset($rm_v.additional_services) && isset($rm_v.additional_services[$hotel_booking_detail.id_htl_booking]) && isset($rm_v.additional_services[$hotel_booking_detail.id_htl_booking]['additional_services']))}
|
||||
{* Additional Facilities are indexed with id_room *}
|
||||
{assign var='has_facilities' value=(isset($rm_v.extra_demands) && isset($rm_v.extra_demands[$hotel_booking_detail.id_room]) && isset($rm_v.extra_demands[$hotel_booking_detail.id_room]['extra_demands']))}
|
||||
{if $has_services || $has_facilities}
|
||||
<div class="extra-services-wrap clearfix">
|
||||
@@ -787,7 +798,7 @@
|
||||
<strong>{l s='Services'}</strong>
|
||||
</div>
|
||||
<div class="col-xs-9">
|
||||
{foreach from=$rm_v.additional_services[$hotel_booking_detail.id_room]['additional_services'] item=service}
|
||||
{foreach from=$rm_v.additional_services[$hotel_booking_detail.id_htl_booking]['additional_services'] item=service}
|
||||
<span class="service">{$service.name}</span>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user