Merge branch 'develop' into gli-3021

This commit is contained in:
varun kewlani
2026-06-15 13:39:41 +05:30
21 changed files with 453 additions and 296 deletions

View File

@@ -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 @@
<input type="checkbox"{if $access_edit == 1} data-rel="{$access[$tab.id_tab]['id_tab']}||{$profile.id_profile}||all||{$tabsize}||{count($tabs)}" class="ajaxPower all {$access[$tab.id_tab]['id_tab']}"{else} class="all {$access[$tab.id_tab]['id_tab']}" disabled="disabled"{/if}{if $result_accesses == 4} checked="checked"{/if}/>
</td>
</tr>
{if !empty($tab.has_kpi)}
<tr class="kpi-row kpi-level-1 child-kpi-{$tab.id_tab}" data-kpi-parent="{$tab.id_tab}" data-kpi-profile="{$profile.id_profile}">
<td>&nbsp; &raquo; {l s='KPI'}</td>
<td>
<input type="checkbox"
class="ajaxPower kpi {$tab.id_tab}"
data-rel="{$tab.id_tab}||{$profile.id_profile}||kpi||{$tabsize}||{count($tabs)}"
data-kpi-editable="{if $access_edit == 1}1{else}0{/if}"
{if $access_edit != 1 || $access[$tab.id_tab].view != 1}disabled="disabled"{/if}
{if isset($access[$tab.id_tab].kpi) && $access[$tab.id_tab].kpi == 1 && $access[$tab.id_tab].view == 1}checked="checked"{/if}
/>
</td>
<td><input type="checkbox" disabled="disabled"/></td>
<td><input type="checkbox" disabled="disabled"/></td>
<td><input type="checkbox" disabled="disabled"/></td>
<td>
<input type="checkbox"
class="ajaxPower kpi {$tab.id_tab}"
data-rel="{$tab.id_tab}||{$profile.id_profile}||kpi||{$tabsize}||{count($tabs)}"
data-kpi-editable="{if $access_edit == 1}1{else}0{/if}"
{if $access_edit != 1 || $access[$tab.id_tab].view != 1}disabled="disabled"{/if}
{if isset($access[$tab.id_tab].kpi) && $access[$tab.id_tab].kpi == 1 && $access[$tab.id_tab].view == 1}checked="checked"{/if}
/>
</td>
</tr>
{/if}
{foreach $tabs AS $child}
{if $child.id_parent === $tab.id_tab}
{if isset($access[$child.id_tab])}
@@ -372,6 +439,32 @@
<input type="checkbox"{if $access_edit == 1} data-rel="{$access[$child.id_tab]['id_tab']}||{$profile.id_profile}||all||{$tabsize}||{count($tabs)}" class="ajaxPower all {$access[$child.id_tab]['id_tab']}"{else} class="all {$access[$child.id_tab]['id_tab']}" disabled="disabled"{/if}{if $result_accesses == 4} checked="checked"{/if}/>
</td>
</tr>
{if !empty($child.has_kpi)}
<tr class="kpi-row kpi-level-2 child-kpi-{$child.id_tab}" data-kpi-parent="{$child.id_tab}" data-kpi-profile="{$profile.id_profile}">
<td>&nbsp; &raquo; {l s='KPI'}</td>
<td>
<input type="checkbox"
class="ajaxPower kpi {$child.id_tab}"
data-rel="{$child.id_tab}||{$profile.id_profile}||kpi||{$tabsize}||{count($tabs)}"
data-kpi-editable="{if $access_edit == 1}1{else}0{/if}"
{if $access_edit != 1 || $access[$child.id_tab].view != 1}disabled="disabled"{/if}
{if isset($access[$child.id_tab].kpi) && $access[$child.id_tab].kpi == 1 && $access[$child.id_tab].view == 1}checked="checked"{/if}
/>
</td>
<td><input type="checkbox" disabled="disabled"/></td>
<td><input type="checkbox" disabled="disabled"/></td>
<td><input type="checkbox" disabled="disabled"/></td>
<td>
<input type="checkbox"
class="ajaxPower kpi {$child.id_tab}"
data-rel="{$child.id_tab}||{$profile.id_profile}||kpi||{$tabsize}||{count($tabs)}"
data-kpi-editable="{if $access_edit == 1}1{else}0{/if}"
{if $access_edit != 1 || $access[$child.id_tab].view != 1}disabled="disabled"{/if}
{if isset($access[$child.id_tab].kpi) && $access[$child.id_tab].kpi == 1 && $access[$child.id_tab].view == 1}checked="checked"{/if}
/>
</td>
</tr>
{/if}
{/if}
{/if}
{/foreach}
@@ -438,4 +531,4 @@
</div>
{/foreach}
</form>
</div>
</div>

View File

@@ -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'];
}
}

View File

@@ -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;
}
/**

View File

@@ -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();

View File

@@ -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'];

View File

@@ -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
}
}

View File

@@ -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');
}

View File

@@ -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'),

View File

@@ -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);

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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
*}
<div class="row">
<div class="col-xs-12">
<section id="dashguestcycle" class="dashboard-top widget allow_push">
<div class="badges-wrapper">
{hook h="displayDashboardBadgeListBefore"}
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of arrivals scheduled for today.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #266FFE;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">{l s="Arrivals" mod='dashguestcycle'}</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_arrived"></span>/<span id="dgc_total_arrivals"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of departures scheduled for today.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #72C3F0;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">{l s="Departures" mod='dashguestcycle'}</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_departed"></span>/<span id="dgc_total_departures"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of new bookings created today so far.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #56CE56;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">{l s="New Bookings" mod='dashguestcycle'}</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_new_bookings"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The count of rooms that are currently occupied by guests.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #FFC148;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">{l s='Occupied Rooms' mod='dashguestcycle'}</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_occupied"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of new messages received from guests today.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #A569DF;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">
{l s="Guest Messages" mod='dashguestcycle'}
</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_new_messages"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of bookings cancelled today so far.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #FF4036;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">
{l s="Cancelled Bookings" mod='dashguestcycle'}
</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_cancelled_bookings"></span>
</p>
</div>
</div>
</div>
</div>
<div class="badge-wrapper">
<div class="badge-item label-tooltip" data-toggle="tooltip" data-original-title="{l s='The number of adults and children scheduled to stay today.' mod='dashguestcycle'}">
<div class="badge-strip" style="background-color: #FF809E;"></div>
<div class="badge-content-wrapper">
<div class="title-wrapper">
<p class="text-center">
{l s="Guests (Adults/Children)" mod='dashguestcycle'}
</p>
</div>
<div class="value-wrapper">
<p class="text-center">
<span id="dgc_guests_adults"></span>/<span id="dgc_guests_children"></span>
</p>
</div>
</div>
</div>
</div>
{hook h="displayDashboardBadgeListAfter"}
</div>
</section>
</div>
</div>

View File

@@ -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.');

View File

@@ -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.');
}

View File

@@ -214,11 +214,11 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3 required" for="hotel_country">{l s='Rating :' mod='hotelreservationsystem'}</label>
<label class="control-label col-sm-3 " for="hotel_country">{l s='Rating :' mod='hotelreservationsystem'}</label>
<div class="col-sm-6">
<div style="width: 195px;">
<select class="form-control" name="hotel_rating" id="hotel_rating" value="">
<option value="">{l s='No star' mod='hotelreservationsystem'}</option>
<option value="0">{l s='No star' mod='hotelreservationsystem'}</option>
<option value="1" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '1') || isset($edit) && $hotel_info['rating'] == '1'}selected{/if}>*</option>
<option value="2" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '2') || isset($edit) && $hotel_info['rating'] == '2'}selected{/if}>**</option>
<option value="3" {if (isset($smarty.post.hotel_rating) && $smarty.post.hotel_rating == '3') || isset($edit) && $hotel_info['rating'] == '3'}selected{/if}>***</option>

View File

@@ -1,5 +1,5 @@
<div class="copyRightWrapper">
<p class="copyRight">
&copy;{if isset($WK_HTL_ESTABLISHMENT_YEAR) && $WK_HTL_ESTABLISHMENT_YEAR} {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date}&nbsp;{/if}<a href="{$base_dir}">&nbsp;{$WK_HTL_CHAIN_NAME}</a>.&nbsp;{l s=' All rights reserved.' mod='hotelreservationsystem'}
&copy;{if isset($WK_HTL_ESTABLISHMENT_YEAR) && $WK_HTL_ESTABLISHMENT_YEAR} {$WK_HTL_ESTABLISHMENT_YEAR}-{'Y'|date}&nbsp;{/if}<a href="{$base_dir}">&nbsp;{$WK_HTL_CHAIN_NAME}</a>.&nbsp;{l s=' All rights reserved. | Powered by' mod='hotelreservationsystem'} <a href="https://qloapps.com/" target="_blank">QloApps</a>
</p>
</div>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>wkfooterlangcurrencyblock</name>
<displayName><![CDATA[Display Language and Currency Block]]></displayName>
<version><![CDATA[1.0.1]]></version>
<description><![CDATA[Contains language and currency block in footer.]]></description>
<author><![CDATA[webkul]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>