diff --git a/admin/themes/default/template/controllers/access/helpers/form/form.tpl b/admin/themes/default/template/controllers/access/helpers/form/form.tpl index d3f2a73f8..7c5a71acc 100644 --- a/admin/themes/default/template/controllers/access/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/access/helpers/form/form.tpl @@ -107,6 +107,47 @@ } perfect_access_js_gestion(this, perm, id_tab, tabsize, tabnumber, table); + if (perm == 'kpi') { + $(table + ' .kpi.' + id_tab).prop('checked', !!enabled); + } + + $(table + ' tr.kpi-row').each(function() { + var kpiTabId = $(this).data('kpi-parent'); + var kpiProfile = $(this).data('kpi-profile'); + var $kpiInputs = $(this).find('input.ajaxPower.kpi'); + if (!$kpiInputs.length || $kpiInputs.first().data('kpi-editable') != 1) { return; } + // For perm=view, read state directly from action — jQuery 1.11 .attr() doesn't update .prop() + var parentEnabled = (perm == 'view' && (id_tab == kpiTabId || id_tab == -1)) + ? !!enabled + : $(table + ' input.view.' + kpiTabId).first().is(':checked'); + if (!parentEnabled) { + $kpiInputs.prop('checked', false).prop('disabled', true); + } else { + $kpiInputs.prop('disabled', false); + if (perm == 'all' && (id_tab == -1 || id_tab == kpiTabId)) { + $kpiInputs.prop('checked', !!enabled).first().trigger('change'); + } + if (perm == 'view' && (id_tab == kpiTabId || id_tab == -1) && !!enabled) { + $kpiInputs.prop('checked', true); + $.ajax({ + url: "{$link->getAdminLink('AdminAccess')|addslashes}", + cache: false, + data: { + ajaxMode: '1', + id_tab: kpiTabId, + id_profile: kpiProfile, + perm: 'kpi', + enabled: 1, + submitAddAccess: '1', + action: 'updateAccess', + ajax: '1', + token: '{getAdminToken tab='AdminAccess'}' + } + }); + } + } + }); + $.ajax({ url: "{$link->getAdminLink('AdminAccess')|addslashes}", cache: false, @@ -349,6 +390,32 @@ + {if !empty($tab.has_kpi)} + +   » {l s='KPI'} + + + + + + + + + + + {/if} {foreach $tabs AS $child} {if $child.id_parent === $tab.id_tab} {if isset($access[$child.id_tab])} @@ -372,6 +439,32 @@ + {if !empty($child.has_kpi)} + +   » {l s='KPI'} + + + + + + + + + + + {/if} {/if} {/if} {/foreach} @@ -438,4 +531,4 @@ {/foreach} - + \ No newline at end of file diff --git a/classes/Profile.php b/classes/Profile.php index 39637163a..54900fb44 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -81,7 +81,7 @@ class ProfileCore extends ObjectModel public function add($autodate = true, $null_values = false) { if (parent::add($autodate, true)) { - $result = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)$this->id.', id_tab, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)'); + $result = Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'access (SELECT '.(int)$this->id.', id_tab, 0, 0, 0, 0, 0 FROM '._DB_PREFIX_.'tab)'); $result &= Db::getInstance()->execute(' INSERT INTO '._DB_PREFIX_.'module_access (`id_profile`, `id_module`, `configure`, `view`, `uninstall`) @@ -138,6 +138,7 @@ class ProfileCore extends ObjectModel 'add' => 1, 'edit' => 1, 'delete' => 1, + 'kpi' => 1, ); } } else { @@ -151,6 +152,7 @@ class ProfileCore extends ObjectModel $result[$key]['delete'] = (int) $profileAccess['delete']; $result[$key]['add'] = (int) $profileAccess['add']; $result[$key]['edit'] = (int) $profileAccess['edit']; + $result[$key]['kpi'] = (int) $profileAccess['kpi']; } } diff --git a/classes/Tab.php b/classes/Tab.php index 662ad74b5..4f8dfed89 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -137,12 +137,12 @@ class TabCore extends ObjectModel } /* Query definition */ - $query = 'REPLACE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES '; - $query .= '(1, '.(int)$id_tab.', 1, 1, 1, 1),'; + $query = 'REPLACE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`, `kpi`) VALUES '; + $query .= '(1, '.(int)$id_tab.', 1, 1, 1, 1, 1),'; foreach ($profiles as $profile) { $rights = $profile['id_profile'] == $context->employee->id_profile ? 1 : 0; - $query .= '('.(int)$profile['id_profile'].', '.(int)$id_tab.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.'),'; + $query .= '('.(int)$profile['id_profile'].', '.(int)$id_tab.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.', '.(int)$rights.'),'; } $query = trim($query, ', '); return Db::getInstance()->execute($query); @@ -247,7 +247,7 @@ class TabCore extends ObjectModel * @return array tabs */ protected static $_cache_tabs = array(); - public static function getTabs($id_lang, $id_parent = null) + public static function getTabs($id_lang, $id_parent = null, $include_kpi = false) { if (!isset(self::$_cache_tabs[$id_lang])) { self::$_cache_tabs[$id_lang] = array(); @@ -274,10 +274,52 @@ class TabCore extends ObjectModel foreach (self::$_cache_tabs[$id_lang] as $array_parent) { $array_all = array_merge($array_all, $array_parent); } - return $array_all; + $tabs = $array_all; + } else { + $tabs = isset(self::$_cache_tabs[$id_lang][$id_parent]) ? self::$_cache_tabs[$id_lang][$id_parent] : array(); } - return (isset(self::$_cache_tabs[$id_lang][$id_parent]) ? self::$_cache_tabs[$id_lang][$id_parent] : array()); + if ($include_kpi) { + $hookKpiClasses = array(); + $hookRows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' + SELECT DISTINCT SUBSTRING(h.`name`, 7, LENGTH(h.`name`) - 24) AS `class_name` + FROM `'._DB_PREFIX_.'hook` h + INNER JOIN `'._DB_PREFIX_.'hook_module` hm + ON hm.`id_hook` = h.`id_hook` + AND hm.`id_shop` = '.(int)Context::getContext()->shop->id.' + INNER JOIN `'._DB_PREFIX_.'module` m + ON m.`id_module` = hm.`id_module` AND m.`active` = 1 + WHERE h.`name` LIKE \'action%KPIListingModifier\'' + ); + if (is_array($hookRows)) { + foreach ($hookRows as $row) { + $hookKpiClasses[$row['class_name']] = true; + } + } + + foreach ($tabs as &$tab) { + if (!empty($tab['module'])) { + $file = _PS_MODULE_DIR_.$tab['module'].'/controllers/admin/'.$tab['class_name'].'Controller.php'; + $class_name = $tab['class_name'].'Controller'; + } else { + $file = _PS_CONTROLLER_DIR_.'admin/'.$tab['class_name'].'Controller.php'; + $class_name = $tab['class_name'].'ControllerCore'; + } + if (file_exists($file) && !class_exists($class_name)) { + require_once $file; + } + try { + $objreflect = new ReflectionMethod($class_name, 'renderKpis'); + $tab['has_kpi'] = ($objreflect->getDeclaringClass()->getName() === $class_name) + || isset($hookKpiClasses[$tab['class_name']]); + } catch (ReflectionException $e) { + $tab['has_kpi'] = isset($hookKpiClasses[$tab['class_name']]); + } + } + unset($tab); + } + + return $tabs; } /** diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 88cb91075..bdf2d3f74 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2307,7 +2307,9 @@ class AdminControllerCore extends Controller $this->content .= $this->renderDetails(); } elseif (!$this->ajax) { $this->content .= $this->renderModulesList(); - $this->content .= $this->renderKpis(); + if ($this->tabAccess['kpi'] === 1) { + $this->content .= $this->renderKpis(); + } $this->content .= $this->renderList(); $this->content .= $this->renderOptions(); diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index c23fdd280..e5b36b518 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -474,8 +474,32 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false; - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from'], null, $fullDate); - $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to'], null, $fullDate); + $display_date_from = $data_v['date_from']; + $display_date_to = $data_v['date_to']; + if ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_OUT) { + if ($data_v['check_in']) { + $display_date_from = $data_v['check_in']; + } + if ($data_v['check_out']) { + $display_date_to = $data_v['check_out']; + } + } elseif ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_IN) { + if ($data_v['check_in']) { + $display_date_from = $data_v['check_in']; + } + if ($data_v['check_out_time']) { + $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time'])); + } + } else { + if ($data_v['check_in_time']) { + $display_date_from = date('Y-m-d', strtotime($data_v['date_from'])) . ' ' . date('H:i:s', strtotime($data_v['check_in_time'])); + } + if ($data_v['check_out_time']) { + $display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time'])); + } + } + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, true); + $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, true); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults']; $cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children']; diff --git a/composer.json b/composer.json index 74ff00cb0..db48f1054 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,52 @@ { - "require": { - "php": ">=5.4 <8.0", - "ext-simplexml": "*", - "ext-curl": "*", - "ext-gd": "*", - "ext-zip": "*", - "ext-soap": "*" - }, - "name": "webkul/qloapps", + "name": "qloapps/qloapps", "description": "QloApps is an Open-source and Free hotel reservation system and booking engine. With the help of QloApps, you can launch your hotel booking website without any cost and take & manage online bookings.", "type": "project", + "homepage": "https://qloapps.com", "license": "OSL-3.0", + "keywords": [ + "qloapps", + "hospitality", + "booking-engine", + "hotel-booking-website", + "hotel-management-system", + "hotel-reservation-system", + "property-management-system", + "cms" + ], "authors": [ { - "name": "webkul", - "email": "support@qloapps.com" + "name": "QloApps", + "email": "support@qloapps.com", + "homepage": "https://qloapps.com" + }, + { + "name": "QloApps Community", + "homepage": "https://github.com/Qloapps/QloApps/graphs/contributors" } ], - "minimum-stability": "dev", - "prefer-stable": true + "support": { + "docs": "https://qloapps.com/docs/", + "email": "support@qloapps.com", + "forum": "https://forums.qloapps.com/", + "source": "https://github.com/Qloapps/QloApps" + }, + "require": { + "php": ">8.0 <8.5", + "ext-curl": "*", + "ext-dom": "*", + "ext-gd": "*", + "ext-mcrypt": "*", + "ext-openssl": "*", + "ext-pdo_mysql": "*", + "ext-phar": "*", + "ext-simplexml": "*", + "ext-soap": "*", + "ext-zip": "*" + }, + "minimum-stability": "stable", + "prefer-stable": true, + "config": { + "sort-packages": true + } } \ No newline at end of file diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 74ef79b09..0d588c240 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -56,7 +56,7 @@ class AdminAccessControllerCore extends AdminController { $current_profile = (int)$this->getCurrentProfileId(); $profiles = Profile::getProfiles($this->context->language->id); - $tabs = Tab::getTabs($this->context->language->id); + $tabs = Tab::getTabs($this->context->language->id, null, true); $accesses = array(); foreach ($profiles as $profile) { $accesses[$profile['id_profile']] = Profile::getProfileAccesses($profile['id_profile']); @@ -214,7 +214,7 @@ class AdminAccessControllerCore extends AdminController if (Tools::isSubmit('submitAddAccess')) { $perm = Tools::getValue('perm'); - if (!in_array($perm, array('view', 'add', 'edit', 'delete', 'all'))) { + if (!in_array($perm, array('view', 'add', 'edit', 'delete', 'all', 'kpi'))) { throw new PrestaShopException('permission does not exist'); } diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 1fc4a45ae..81ff78003 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -168,6 +168,10 @@ class AdminDashboardControllerCore extends AdminController return parent::renderOptions(); } + if ($this->tabAccess['kpi'] === 1) { + $this->content .= $this->renderKpis(); + } + // $translations = array( // 'Calendar' => $this->l('Calendar', 'AdminStatsTab'), // 'Day' => $this->l('Day', 'AdminStatsTab'), diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 5290c7625..8e76b8a48 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3215,8 +3215,9 @@ class AdminOrdersControllerCore extends AdminController if (!Validate::isLoadedObject($order = new Order(Tools::getValue('id_order')))) { return; } - - $this->content .= $this->renderKpis(); + if ($this->tabAccess['kpi'] === 1) { + $this->content .= $this->renderKpis(); + } $customer = new Customer($order->id_customer); $carrier = new Carrier($order->id_carrier); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index d9e771c58..9520ec459 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -8,6 +8,7 @@ CREATE TABLE `PREFIX_access` ( `add` int(11) NOT NULL, `edit` int(11) NOT NULL, `delete` int(11) NOT NULL, + `kpi` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id_profile`,`id_tab`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; diff --git a/modules/dashguestcycle/dashguestcycle.php b/modules/dashguestcycle/dashguestcycle.php index d630c926a..6aae1cb46 100644 --- a/modules/dashguestcycle/dashguestcycle.php +++ b/modules/dashguestcycle/dashguestcycle.php @@ -46,7 +46,7 @@ class DashGuestCycle extends Module public function install() { return (parent::install() - && $this->registerHook('dashboardTop') + && $this->registerHook('actionAdminDashboardKPIListingModifier') && $this->registerHook('dashboardZoneTwo') && $this->registerHook('dashboardData') && $this->registerHook('actionAdminControllerSetMedia') @@ -60,9 +60,120 @@ class DashGuestCycle extends Module } } - public function hookDashboardTop() + public function hookActionAdminDashboardKPIListingModifier(array $params) { - return $this->display(__FILE__, 'dashboard-top.tpl'); + $idHotel = (int)$this->context->cookie->stats_id_hotel; + $kpiValues = $this->getKpiValues($idHotel); + + $kpisData = array( + array( + 'id' => 'box-dgc-arrivals', + 'color' => 'color1', + 'title' => $this->l('Arrivals'), + 'tooltip' => $this->l('The number of arrivals scheduled for today.'), + 'value' => $kpiValues['box-dgc-arrivals'], + ), + array( + 'id' => 'box-dgc-departures', + 'color' => 'color2', + 'title' => $this->l('Departures'), + 'tooltip' => $this->l('The number of departures scheduled for today.'), + 'value' => $kpiValues['box-dgc-departures'], + ), + array( + 'id' => 'box-dgc-new-bookings', + 'color' => 'color3', + 'title' => $this->l('New Bookings'), + 'tooltip' => $this->l('The number of new bookings created today so far.'), + 'value' => $kpiValues['box-dgc-new-bookings'], + ), + array( + 'id' => 'box-dgc-occupied', + 'color' => 'color4', + 'title' => $this->l('Occupied Rooms'), + 'tooltip' => $this->l('The count of rooms currently occupied by guests.'), + 'value' => $kpiValues['box-dgc-occupied'], + ), + array( + 'id' => 'box-dgc-messages', + 'color' => 'color5', + 'title' => $this->l('Guest Messages'), + 'tooltip' => $this->l('The number of new messages received from guests today.'), + 'value' => $kpiValues['box-dgc-messages'], + ), + array( + 'id' => 'box-dgc-cancelled', + 'color' => 'color6', + 'title' => $this->l('Cancelled Bookings'), + 'tooltip' => $this->l('The number of bookings cancelled today so far.'), + 'value' => $kpiValues['box-dgc-cancelled'], + ), + array( + 'id' => 'box-dgc-guests', + 'color' => 'color1', + 'title' => $this->l('Guests (Adults/Children)'), + 'tooltip' => $this->l('The number of adults and children scheduled to stay today.'), + 'value' => $kpiValues['box-dgc-guests'], + ), + ); + + foreach ($kpisData as $data) { + $helper = new HelperKpi(); + $helper->id = $data['id']; + $helper->color = $data['color']; + $helper->title = $data['title']; + $helper->tooltip = $data['tooltip']; + $helper->value = $data['value']; + $params['kpis'][] = $helper; + } + } + + private function getKpiValues($idHotel) + { + $dateToday = date('Y-m-d'); + + if (Configuration::get('PS_DASHBOARD_SIMULATION')) { + $totalArrivals = rand(100, 1000); + $arrived = rand(0, $totalArrivals); + $totalDepartures = rand(100, 1000); + $departed = rand(0, $totalDepartures); + $newBookings = rand(10, 500); + $occupied = rand(10, 500); + $newMessages = rand(0, 20); + $cancelledBookings = rand(0, 20); + $totalAdults = rand(100, 1000); + $children = rand(0, $totalAdults); + } else { + $arrivalsData = AdminStatsController::getArrivalsByDate($dateToday, $idHotel); + $departuresData = AdminStatsController::getDeparturesByDate($dateToday, $idHotel); + $guestsData = AdminStatsController::getGuestsByDate($dateToday, $idHotel); + + $arrived = (int) $arrivalsData['arrived']; + $totalArrivals = (int) $arrivalsData['total_arrivals']; + $departed = (int) $departuresData['departed']; + $totalDepartures = (int) $departuresData['total_departures']; + $newBookings = count(AdminStatsController::getNewBookingsInfoByDate($dateToday, $idHotel)); + $occupied = (int) AdminStatsController::getDistinctRoomBookingsCount( + date('Y-m-d', strtotime('-1 day')), + $dateToday, + $idHotel, + HotelBookingDetail::STATUS_CHECKED_IN + ); + $newMessages = (int) CustomerMessage::getMessagesByDate($dateToday); + $cancelledBookings = (int) AdminStatsController::getCancelledBookingsByDate($dateToday, $idHotel); + $totalAdults = (int) $guestsData['adults']; + $children = (int) $guestsData['children']; + } + + return array( + 'box-dgc-arrivals' => sprintf('%02d', $arrived).'/'.sprintf('%02d', $totalArrivals), + 'box-dgc-departures' => sprintf('%02d', $departed).'/'.sprintf('%02d', $totalDepartures), + 'box-dgc-new-bookings' => sprintf('%02d', $newBookings), + 'box-dgc-occupied' => sprintf('%02d', $occupied), + 'box-dgc-messages' => sprintf('%02d', $newMessages), + 'box-dgc-cancelled' => sprintf('%02d', $cancelledBookings), + 'box-dgc-guests' => sprintf('%02d', $totalAdults).'/'.sprintf('%02d', $children), + ); } public function hookDashboardZoneTwo() @@ -76,37 +187,10 @@ class DashGuestCycle extends Module $dataTable = array(); $dateToday = date('Y-m-d'); - if (Configuration::get('PS_DASHBOARD_SIMULATION')) { - $dataValue['dgc_total_arrivals'] = sprintf('%02d', rand(100, 1000)); - $dataValue['dgc_arrived'] = sprintf('%02d', rand(0, $dataValue['dgc_total_arrivals'])); - $dataValue['dgc_total_departures'] = sprintf('%02d', rand(100, 1000)); - $dataValue['dgc_departed'] = sprintf('%02d', rand(0, $dataValue['dgc_total_departures'])); - $dataValue['dgc_new_bookings'] = sprintf('%02d', rand(10, 500)); - $dataValue['dgc_occupied'] = sprintf('%02d', rand(10, 500)); - $dataValue['dgc_new_messages'] = sprintf('%02d', rand(0, 20)); - $dataValue['dgc_cancelled_bookings'] = sprintf('%02d', rand(0, 20)); - $dataValue['dgc_guests_adults'] = sprintf('%02d', rand(100, 1000)); - $dataValue['dgc_guests_children'] = sprintf('%02d', rand(0, $dataValue['dgc_guests_adults'])); - } else { - // set badges data - $arrivalsData = AdminStatsController::getArrivalsByDate($dateToday, $params['id_hotel']); - $departuresData = AdminStatsController::getDeparturesByDate($dateToday, $params['id_hotel']); - $guestsData = AdminStatsController::getGuestsByDate($dateToday, $params['id_hotel']); - $dataValue['dgc_arrived'] = sprintf('%02d', $arrivalsData['arrived']); - $dataValue['dgc_total_arrivals'] = sprintf('%02d', $arrivalsData['total_arrivals']); - $dataValue['dgc_departed'] = sprintf('%02d', $departuresData['departed']); - $dataValue['dgc_total_departures'] = sprintf('%02d', $departuresData['total_departures']); - $dataValue['dgc_new_bookings'] = sprintf('%02d', count(AdminStatsController::getNewBookingsInfoByDate($dateToday, $params['id_hotel']))); - $dataValue['dgc_occupied'] = sprintf('%02d', AdminStatsController::getDistinctRoomBookingsCount( - date('Y-m-d', strtotime('-1 day')), - $dateToday, - $params['id_hotel'], - HotelBookingDetail::STATUS_CHECKED_IN - )); - $dataValue['dgc_new_messages'] = sprintf('%02d', CustomerMessage::getMessagesByDate($dateToday)); - $dataValue['dgc_cancelled_bookings'] = sprintf('%02d', AdminStatsController::getCancelledBookingsByDate($dateToday, $params['id_hotel'])); - $dataValue['dgc_guests_adults'] = sprintf('%02d', $guestsData['adults']); - $dataValue['dgc_guests_children'] = sprintf('%02d', $guestsData['children']); + + // KPI box values — updated on every AJAX refresh (demo toggle, date change) + foreach ($this->getKpiValues((int) $params['id_hotel']) as $boxId => $value) { + $dataValue[$boxId . ' .value'] = $value; } // set tables data diff --git a/modules/dashguestcycle/views/css/dashguestcycle.css b/modules/dashguestcycle/views/css/dashguestcycle.css index 0f8e7ca14..7fd58544d 100644 --- a/modules/dashguestcycle/views/css/dashguestcycle.css +++ b/modules/dashguestcycle/views/css/dashguestcycle.css @@ -20,76 +20,6 @@ * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 */ -#dashguestcycle { - padding-bottom: 5px; -} - -#dashguestcycle .badges-wrapper { - white-space: nowrap; - overflow: auto; - margin: -5px; - margin-bottom: 0px; - padding-bottom: 10px; - font-size: 0; -} - -#dashguestcycle .badge-wrapper { - display: inline-block; - width: 14.28%; - min-width: 145px; - padding: 5px; -} - -#dashguestcycle .badge-item { - position: relative; - min-width: 135px; - height: 80px; - border-radius: 10px; - background: #FFFFFF; - box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.15); -} - -#dashguestcycle .badge-strip { - position: absolute; - width: 10px; - height: 100%; - border-top-left-radius: 10px; - border-bottom-left-radius: 10px; -} - -#dashguestcycle .badge-content-wrapper { - height: 100%; -} - -#dashguestcycle .badge-content-wrapper p { - color: #00AFF0; - margin-bottom: 0; -} - -#dashguestcycle .title-wrapper, #dashguestcycle .value-wrapper { - display: table; - width: 100%; - height: 50%; - padding: 0 10px; -} - -#dashguestcycle .title-wrapper p { - display: table-cell; - vertical-align: middle; - font-weight: normal; - font-size: 13px; - line-height: 15px; - white-space: normal; -} - -#dashguestcycle .value-wrapper p { - display: table-cell; - vertical-align: top; - font-weight: bold; - font-size: 24px; - line-height: 30px; -} - #dashguestcycle .tab-content { max-height: 300px; overflow-y: auto; @@ -97,4 +27,107 @@ #dashguestcycle table tbody>tr>td { padding: 8px 7px; +} + +/* ── KPI row container: strip panel chrome ──────────────────────────────── */ +.kpi-container { + background: transparent !important; + border: none !important; + box-shadow: none !important; + padding: 0 0 15px !important; +} + +.kpi-container .kpis-wrap { + flex-wrap: nowrap !important; + overflow-x: auto; + gap: 8px; + margin: 0 !important; +} + +.kpi-container .kpis-wrap .kpi-wrap { + width: 14.28% !important; + min-width: 110px; + padding: 0 !important; + margin-bottom: 0 !important; +} + +.kpi-container .box-stats { + height: 80px !important; + background: #fff !important; + border-radius: 10px !important; + overflow: hidden; + font-size: inherit !important; +} + +.kpi-container .box-stats .kpi-content { + border: none !important; + border-left: 10px solid !important; + border-radius: 0 !important; + height: 100% !important; + padding: 8px 12px !important; + align-items: center !important; + gap: 0 !important; +} + +.kpi-container .box-stats .kpi-content .kpi-data { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; + gap: 4px; +} + +.kpi-container .box-stats .kpi-content .title-subtitle { + justify-content: center !important; + width: 100%; +} + +.kpi-container .box-stats .kpi-content .title-subtitle .title-container .title { + font-size: 13px !important; + font-weight: normal !important; + color: #555 !important; + display: block; + text-align: center; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.kpi-container .box-stats .kpi-content .value-container { + width: 100%; + text-align: center; +} + +.kpi-container .box-stats .kpi-content .value-container .value { + font-size: 24px !important; + font-weight: bold !important; + min-height: auto !important; + display: block; + text-align: center; +} + +.kpi-container .box-stats .kpi-content .arrow { + display: none !important; +} + +.kpi-container .box-stats.color1 .kpi-content { border-left-color: #266FFE !important; } +.kpi-container .box-stats.color1 .value { color: #266FFE !important; } + +.kpi-container .box-stats.color2 .kpi-content { border-left-color: #72C3F0 !important; } +.kpi-container .box-stats.color2 .value { color: #72C3F0 !important; } + +.kpi-container .box-stats.color3 .kpi-content { border-left-color: #56CE56 !important; } +.kpi-container .box-stats.color3 .value { color: #56CE56 !important; } + +.kpi-container .box-stats.color4 .kpi-content { border-left-color: #FFC148 !important; } +.kpi-container .box-stats.color4 .value { color: #FFC148 !important; } + +.kpi-container .box-stats.color5 .kpi-content { border-left-color: #A569DF !important; } +.kpi-container .box-stats.color5 .value { color: #A569DF !important; } + +.kpi-container .box-stats.color6 .kpi-content { border-left-color: #FF4036 !important; } +.kpi-container .box-stats.color6 .value { color: #FF4036 !important; } + +.kpi-container .actions-wrap { + display: none !important; } \ No newline at end of file diff --git a/modules/dashguestcycle/views/templates/hook/dashboard-top.tpl b/modules/dashguestcycle/views/templates/hook/dashboard-top.tpl deleted file mode 100644 index 1d904e3b9..000000000 --- a/modules/dashguestcycle/views/templates/hook/dashboard-top.tpl +++ /dev/null @@ -1,143 +0,0 @@ -{** -* NOTICE OF LICENSE -* -* This source file is subject to the Open Software License version 3.0 -* that is bundled with this package in the file LICENSE.md -* It is also available through the world-wide-web at this URL: -* https://opensource.org/license/osl-3-0-php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to support@qloapps.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to a newer -* versions in the future. If you wish to customize this module for your needs -* please refer to https://store.webkul.com/customisation-guidelines for more information. -* -* @author Webkul IN -* @copyright Since 2010 Webkul -* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 -*} - -
-
-
-
- {hook h="displayDashboardBadgeListBefore"} -
-
-
-
-
-

{l s="Arrivals" mod='dashguestcycle'}

-
-
-

- / -

-
-
-
-
-
-
-
-
-
-

{l s="Departures" mod='dashguestcycle'}

-
-
-

- / -

-
-
-
-
-
-
-
-
-
-

{l s="New Bookings" mod='dashguestcycle'}

-
-
-

- -

-
-
-
-
-
-
-
-
-
-

{l s='Occupied Rooms' mod='dashguestcycle'}

-
-
-

- -

-
-
-
-
-
-
-
-
-
-

- {l s="Guest Messages" mod='dashguestcycle'} -

-
-
-

- -

-
-
-
-
-
-
-
-
-
-

- {l s="Cancelled Bookings" mod='dashguestcycle'} -

-
-
-

- -

-
-
-
-
-
-
-
-
-
-

- {l s="Guests (Adults/Children)" mod='dashguestcycle'} -

-
-
-

- / -

-
-
-
-
- {hook h="displayDashboardBadgeListAfter"} -
-
-
-
diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index b4fb0ada8..0797c7035 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -51,7 +51,7 @@ class HotelBranchInformation extends ObjectModel 'fields' => array( 'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'email' => array('type' => self::TYPE_STRING,'validate' => 'isEmail', 'size' => 255, 'required' => true), - 'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), + 'rating' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'check_in' => array('type' => self::TYPE_STRING, 'required' => true), 'check_out' => array('type' => self::TYPE_STRING, 'required' => true), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), @@ -1160,7 +1160,7 @@ class HotelBranchInformation extends ObjectModel { // set additional hotel address and restriction fields validations here if (isset($this->webservice_validation) && $this->webservice_validation) { - if ($this->rating < 1 || $this->rating > 5) { + if ($this->rating && ($this->rating < 1 || $this->rating > 5)) { $message = Tools::displayError('Rating must be between 1 and 5.'); } elseif (!strtotime($this->check_in)) { $message = Tools::displayError('Check In time is invalid.'); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index f804b11ba..868012630 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -391,10 +391,6 @@ class AdminAddHotelController extends ModuleAdminController $this->errors[] = $this->l('Check Out time must be before Check In time.'); } - if (!$rating) { - $this->errors[] = $this->l('Rating is required field.'); - } - if (!$address = trim($address)) { $this->errors[] = $this->l('Address is required field.'); } diff --git a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl index 22ae63e61..978872548 100644 --- a/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/add_hotel/helpers/form/form.tpl @@ -214,11 +214,11 @@
- +