Update the hotel tooltip design
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -23,15 +23,8 @@
|
||||
{if $hotel_names_first}
|
||||
<span>{$hotel_names_first|escape:'html':'UTF-8'}</span>
|
||||
{if $hotel_names_remaining}
|
||||
{assign var='tooltipLines' value=''}
|
||||
{foreach from=$hotel_names_remaining item='hotel' key='index'}
|
||||
{assign var='tooltipLines' value="{$tooltipLines}{if $index > 0}<br>{/if}{$hotel|escape:'html':'UTF-8'}"}
|
||||
{/foreach}
|
||||
<span class="badge label-tooltip"
|
||||
data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
data-html="true"
|
||||
title="<div style="text-align:left">{$tooltipLines}</div>">+{$hotel_names_remaining|@count}</span>
|
||||
<span class="badge qlo-hotel-names-badge"
|
||||
data-hotel-names="{$hotel_names_remaining_json}">+{$hotel_names_remaining|@count}</span>
|
||||
{/if}
|
||||
{else}
|
||||
--
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{**
|
||||
* 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 id="qlo-hotel-names-tooltip" style="display:none">
|
||||
<div class="bootstrap tooltip_cont">
|
||||
<div class="tip_header">
|
||||
<div>{l s='Selected Hotels'}</div>
|
||||
</div>
|
||||
<div class="tip-body">
|
||||
<div class="qlo-hotel-names-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,9 +89,11 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
public function formatHotelNames($hotelNames, $row)
|
||||
{
|
||||
$hotels = !empty($hotelNames) ? explode('|||', $hotelNames) : array();
|
||||
$remaining = count($hotels) > 1 ? array_slice($hotels, 1) : array();
|
||||
$this->context->smarty->assign(array(
|
||||
'hotel_names_first' => !empty($hotels) ? $hotels[0] : null,
|
||||
'hotel_names_remaining' => count($hotels) > 1 ? array_slice($hotels, 1) : array(),
|
||||
'hotel_names_first' => !empty($hotels) ? $hotels[0] : null,
|
||||
'hotel_names_remaining' => $remaining,
|
||||
'hotel_names_remaining_json' => htmlspecialchars(json_encode($remaining)),
|
||||
));
|
||||
return $this->context->smarty->fetch(
|
||||
'controllers/cart_rules/helpers/list/_hotel_names_column.tpl'
|
||||
@@ -276,10 +278,21 @@ class AdminCartRulesControllerCore extends AdminController
|
||||
'room_rmv_txt' => $this->l('Unselect below room types'),
|
||||
)
|
||||
);
|
||||
$this->addJqueryUI('ui.tooltip', 'base', true);
|
||||
$this->addJS(_PS_JS_DIR_.'admin/cart-rules.js');
|
||||
$this->addJS(_PS_JS_DIR_.'admin/cart_rules_hotel_tooltip.js');
|
||||
$this->addJqueryPlugin(array('typewatch', 'fancybox', 'autocomplete'));
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->content .= $this->context->smarty->fetch(
|
||||
'controllers/cart_rules/helpers/list/_hotel_names_tooltip.tpl'
|
||||
);
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (empty($this->display)) {
|
||||
|
||||
61
js/admin/cart_rules_hotel_tooltip.js
Normal file
61
js/admin/cart_rules_hotel_tooltip.js
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
if (typeof window.initHotelNamesTooltips === 'undefined') {
|
||||
window.initHotelNamesTooltips = function () {
|
||||
if (typeof $.fn.tooltip === 'undefined' || typeof $.ui === 'undefined' || typeof $.ui.tooltip === 'undefined') {
|
||||
return;
|
||||
}
|
||||
$('.qlo-hotel-names-badge').each(function () {
|
||||
if ($(this).data('ui-tooltip')) {
|
||||
return;
|
||||
}
|
||||
$(this).tooltip({
|
||||
items: '.qlo-hotel-names-badge',
|
||||
content: function () {
|
||||
var hotels = $(this).data('hotel-names');
|
||||
if (!hotels || !hotels.length) {
|
||||
return '';
|
||||
}
|
||||
var rows = $.map(hotels, function (name) {
|
||||
return '<div class="tip_element_value">' + $('<div>').text(name).html() + '</div>';
|
||||
}).join('');
|
||||
$('#qlo-hotel-names-tooltip .qlo-hotel-names-list').html(rows);
|
||||
return $('#qlo-hotel-names-tooltip').html();
|
||||
},
|
||||
close: function (event, ui) {
|
||||
ui.tooltip.hover(function () {
|
||||
$(this).stop(true).fadeTo(300, 1);
|
||||
},
|
||||
function () {
|
||||
$(this).fadeOut('300', function () {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
window.initHotelNamesTooltips();
|
||||
});
|
||||
Reference in New Issue
Block a user