Merge branch 'Qloapps:develop' into gli-2934
This commit is contained in:
@@ -1349,6 +1349,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
parent::setMedia();
|
||||
|
||||
$this->addJqueryUI('ui.datepicker');
|
||||
$this->addJqueryUI('ui.tooltip', 'base', true);
|
||||
|
||||
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
|
||||
|
||||
if ($this->display == 'view') {
|
||||
@@ -3218,6 +3220,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
if (!Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->tabAccess['kpi'] === 1) {
|
||||
$this->content .= $this->renderKpis();
|
||||
}
|
||||
@@ -3580,6 +3583,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$order_detail_data[$key]['amt_with_qty_tax_incl'] = $value['total_price_tax_incl'];
|
||||
$order_detail_data[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']);
|
||||
$order_detail_data[$key]['total_room_tax'] = $order_detail_data[$key]['total_room_price_ti'] - $order_detail_data[$key]['total_room_price_te'];
|
||||
$order_detail_data[$key]['connected_rooms'] = HotelConnectedRoom::getConnectedRooms($value['id_room'], null, null, (int) Context::getContext()->language->id);
|
||||
|
||||
if (isset($value['refund_info'])
|
||||
&& $value['refund_info']['refunded']
|
||||
|
||||
@@ -1602,7 +1602,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
) {
|
||||
$this->addJqueryUI(array(
|
||||
'ui.core',
|
||||
'ui.widget'
|
||||
'ui.widget',
|
||||
'ui.tooltip'
|
||||
));
|
||||
|
||||
$this->addjQueryPlugin(array(
|
||||
@@ -3159,6 +3160,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$disableDates = $objRoomDisableDates->getRoomDisableDates($room['id']);
|
||||
$room['disable_dates_json'] = json_encode($disableDates);
|
||||
}
|
||||
$room['connected_rooms_count'] = HotelConnectedRoom::getTotalConnectedRooms($room['id']);
|
||||
}
|
||||
|
||||
$data->assign('htl_room_info', $hotelRoomInfo);
|
||||
@@ -3786,6 +3788,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->errors[] = $this->l('This room cannot be deleted as this room contains future booking.');
|
||||
}
|
||||
if (empty($this->errors)) {
|
||||
$response['affected_rooms'] = HotelConnectedRoom::getTotalConnectedRooms(null, $idRoom);
|
||||
if ($objRoomInfo->delete()) {
|
||||
$response['success'] = true;
|
||||
} else {
|
||||
@@ -5506,7 +5509,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (empty($this->errors)) {
|
||||
foreach ($roomsInfo as $roomInfo) {
|
||||
$objHotelRoomInfo = new HotelRoomInformation($roomInfo['id']);
|
||||
$objHotelRoomInfo->id_status = $roomInfo['id_status'];
|
||||
if (!empty($roomInfo['id_status'])) {
|
||||
$objHotelRoomInfo->id_status = $roomInfo['id_status'];
|
||||
}
|
||||
if (isset($roomInfo['floor']) && $roomInfo['floor'] != '') {
|
||||
$objHotelRoomInfo->floor = $roomInfo['floor'];
|
||||
}
|
||||
@@ -5707,4 +5712,102 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function ajaxProcessGetNotConnectedRooms()
|
||||
{
|
||||
$roomId = (int) Tools::getValue('room_id');
|
||||
$roomTypeId = (int) Tools::getValue('room_type_id');
|
||||
$allGroups = HotelConnectedRoom::getNotConnectedRooms($roomId, $this->context->language->id);
|
||||
$rooms = isset($allGroups[$roomTypeId]) ? $allGroups[$roomTypeId]['rooms'] : array();
|
||||
die(Tools::jsonEncode(['success' => true, 'rooms' => $rooms]));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitConnectedRoomModal()
|
||||
{
|
||||
$response['hasError'] = 1;
|
||||
$roomId = (int) Tools::getValue('room_id');
|
||||
$objRoom = new HotelRoomInformation($roomId);
|
||||
$idProduct = (int) $objRoom->id_product;
|
||||
$idHotel = (int) $objRoom->id_hotel;
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'htl_connected_rooms' => HotelConnectedRoom::getConnectedRooms($roomId, null, null, $this->context->language->id),
|
||||
'htl_not_connected_rooms' => HotelConnectedRoom::getNotConnectedRooms($roomId, $this->context->language->id),
|
||||
'main_room_id' => $roomId,
|
||||
'current_roomtype' => $idProduct,
|
||||
));
|
||||
|
||||
$modal = array(
|
||||
'modal_id' => 'connectedRoomModal',
|
||||
'modal_class' => 'modal-md',
|
||||
'modal_title' => '<i class="icon-random"></i> '.$this->l('Connected Room').' <span id="connected_room_title" class="connected_room_num"></span>',
|
||||
'modal_content' => $this->context->smarty->fetch('controllers/products/modal-connected-rooms.tpl'),
|
||||
'modal_actions' => array(),
|
||||
);
|
||||
|
||||
$this->context->smarty->assign($modal);
|
||||
$response['hasError'] = 0;
|
||||
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
|
||||
|
||||
die(Tools::jsonEncode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessManageConnectedRoom()
|
||||
{
|
||||
if ($this->tabAccess['edit'] !== 1) {
|
||||
die(json_encode(['success' => false, 'message' => $this->l('You do not have permission to edit this.')]));
|
||||
}
|
||||
|
||||
$mode = Tools::getValue('mode');
|
||||
$roomId = (int) Tools::getValue('room_id');
|
||||
$connectedRoomId = (int) Tools::getValue('connected_room_id');
|
||||
$connectedId = (int) Tools::getValue('connected_id');
|
||||
$objRoom = new HotelRoomInformation($roomId);
|
||||
$idProduct = (int) $objRoom->id_product;
|
||||
$idHotel = (int) $objRoom->id_hotel;
|
||||
|
||||
if ($mode === 'add') {
|
||||
$connection = new HotelConnectedRoom();
|
||||
$connection->id_room = $roomId;
|
||||
$connection->id_room_connected = $connectedRoomId;
|
||||
if ($connection->add()) {
|
||||
$this->context->smarty->assign(array(
|
||||
'htl_connected_rooms' => HotelConnectedRoom::getConnectedRooms($roomId, null, null, $this->context->language->id),
|
||||
'htl_not_connected_rooms' => HotelConnectedRoom::getNotConnectedRooms($roomId, $this->context->language->id),
|
||||
'main_room_id' => $roomId,
|
||||
'current_roomtype' => $idProduct,
|
||||
));
|
||||
die(json_encode([
|
||||
'html' => $this->context->smarty->fetch('controllers/products/modal-connected-rooms.tpl'),
|
||||
'success' => true,
|
||||
'message' => $this->l('Room connected successfully.'),
|
||||
'connected_count' => HotelConnectedRoom::getTotalConnectedRooms($roomId),
|
||||
]));
|
||||
}
|
||||
die(json_encode(['success' => false, 'message' => $this->l('Failed to connect room.')]));
|
||||
}
|
||||
|
||||
if ($mode === 'delete') {
|
||||
if (!$connectedId) {
|
||||
die(json_encode(['success' => false, 'message' => $this->l('Invalid data.')]));
|
||||
}
|
||||
$objHotelConnectedRoom = new HotelConnectedRoom($connectedId);
|
||||
if ($objHotelConnectedRoom->delete()) {
|
||||
$this->context->smarty->assign(array(
|
||||
'htl_connected_rooms' => HotelConnectedRoom::getConnectedRooms($roomId, null, null, $this->context->language->id),
|
||||
'htl_not_connected_rooms' => HotelConnectedRoom::getNotConnectedRooms($roomId, $this->context->language->id),
|
||||
'main_room_id' => $roomId,
|
||||
'current_roomtype' => $idProduct,
|
||||
));
|
||||
die(json_encode([
|
||||
'success' => true,
|
||||
'html' => $this->context->smarty->fetch('controllers/products/modal-connected-rooms.tpl'),
|
||||
'message' => $this->l('Connected room removed successfully.'),
|
||||
'connected_count' => HotelConnectedRoom::getTotalConnectedRooms($roomId),
|
||||
]));
|
||||
}
|
||||
die(json_encode(['success' => false, 'message' => $this->l('Failed to remove connected room.')]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user