update date display process

This commit is contained in:
Shreesh Arora
2024-10-01 20:00:08 +05:30
parent 4a007d2724
commit 527fa2f048
24 changed files with 62 additions and 35 deletions

View File

@@ -100,7 +100,8 @@
</a>
</td>
<td><a href="{$link->getAdminLink('AdminAddHotel')|escape:'html':'UTF-8'}&amp;id={$room['id_hotel']}&amp;updatehtl_branch_info">{$room['room_type_info'].hotel_name}</a></td>
<td>{dateFormat date=$room['date_from']} - {dateFormat date=$room['date_to']}</td>
{assign var="is_full_date" value=($show_full_date && ($room['date_from']|date_format:'%D' == $room['date_to']|date_format:'%D'))}
<td>{dateFormat date=$room['date_from'] full=$is_full_date} - {dateFormat date=$room['date_to'] full=$is_full_date}</td>
<td>
<span>
{if $room['adults']}{$room['adults']}{/if} {if $room['adults'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$room['children']}}, {$room['children']} {if $room['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}

View File

@@ -51,7 +51,8 @@
<td>
<p>{$data.room_type|escape:'html':'UTF-8'}</p>
</td>
<td>{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}</td>
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
<td>{dateFormat date=$data.date_from full=$is_full_date} - {dateFormat date=$data.date_to full=$is_full_date}</td>
{if $occupancy_required_for_booking}
<td>
<div class="dropdown">

View File

@@ -39,7 +39,8 @@
<tr>
<td>{$data['room_num']}</td>
<td>{$data['room_type_name']}</td>
<td>{dateFormat date=$data['date_from']} {l s='To'} {dateFormat date=$data['date_to']}</td>
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
<td>{dateFormat date=$data['date_from'] full=$is_full_date} {l s='To'} {dateFormat date=$data['date_to'] full=$is_full_date}</td>
<td>
{if $order->with_occupancy && $data['children']}
<div class="dropdown">

View File

@@ -35,7 +35,8 @@
<p><a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$data.id_product}&amp;updateproduct" target="_blank"><span>{$data.room_type}</span></a></p>
</td>
<td>
{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to}
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
{dateFormat date=$data.date_from full=$is_full_date} - {dateFormat date=$data.date_to full=$is_full_date}
</td>
<td>
{if $data['children']}

View File

@@ -55,7 +55,8 @@
<td>
<a href="{$link->getAdminLink('AdminAddHotel')}&amp;id={$data['id_hotel']|escape:'html':'UTF-8'}&amp;updatehtl_branch_info" target="_blank"><span>{$data['hotel_name']}</span></a>
</td>
<td>{dateFormat date=$data['date_from']|escape:'html':'UTF-8'} {l s='To'} {dateFormat date=$data['date_to']|escape:'html':'UTF-8'}</td>
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
<td>{dateFormat date=$data['date_from']|escape:'html':'UTF-8' full=$is_full_date} {l s='To'} {dateFormat date=$data['date_to']|escape:'html':'UTF-8' full=$is_full_date}</td>
<td>
<a href="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&amp;vieworder&amp;id_order={$data['id_order']|escape:'html':'UTF-8'}">#{$data['id_order']|escape:'html':'UTF-8'}</a>
</td>

View File

@@ -115,7 +115,8 @@
<a href="{$link->getAdminLink('AdminProducts')|escape:'html':'UTF-8'}&amp;id_product={$data['id_product']}&amp;updateproduct" target="_blank">{$data['room_type_name']|escape:'html':'UTF-8'}</a>
</td>
<td>
{dateFormat date=$data['date_from']} - {dateFormat date=$data['date_to']}
{assign var="is_full_date" value=($show_full_date && ($data['date_from']|date_format:'%D' == $data['date_to']|date_format:'%D'))}
{dateFormat date=$data['date_from'] full=$is_full_date} - {dateFormat date=$data['date_to'] full=$is_full_date}
</td>
<td>
{if ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_IN']['id_status']) || ($data['id_status'] == $hotel_order_status['STATUS_CHECKED_OUT']['id_status'])}

View File

@@ -42,7 +42,8 @@
<td><b>{$bookingInfo.room_num|escape:'html':'UTF-8'}</b></td>
<td>{$bookingInfo.room_type_name|escape:'html':'UTF-8'}</td>
<td>{$bookingInfo.hotel_name|escape:'html':'UTF-8'}</td>
<td>{dateFormat date=$bookingInfo.date_from} - {dateFormat date=$bookingInfo.date_to}</span></td>
{assign var="is_full_date" value=($show_full_date && ($bookingInfo['date_from']|date_format:'%D' == $bookingInfo['date_to']|date_format:'%D'))}
<td>{dateFormat date=$bookingInfo.date_from full=$is_full_date} - {dateFormat date=$bookingInfo.date_to full=$is_full_date}</span></td>
<td>{convertPriceWithCurrency price=$bookingInfo.total_price_tax_incl currency=$currency->id}</td>
</tr>
{/foreach}

View File

@@ -2160,7 +2160,8 @@ class AdminControllerCore extends Controller
'currentIndex' => self::$currentIndex,
'bootstrap' => $this->bootstrap,
'default_language' => (int)Configuration::get('PS_LANG_DEFAULT'),
'display_addons_connection' => Tab::checkTabRights(Tab::getIdFromClassName('AdminModulesController'))
'display_addons_connection' => Tab::checkTabRights(Tab::getIdFromClassName('AdminModulesController')),
'show_full_date' => $this->show_full_date,
));
$module = Module::getInstanceByName('themeconfigurator');

View File

@@ -78,6 +78,8 @@ abstract class ControllerCore
/** @var string Controller name */
public $php_self;
public $show_full_date = false;
/**
* Check if the controller is available for the current user/visitor
*/

View File

@@ -596,7 +596,8 @@ class FrontControllerCore extends Controller
'HOOK_TOP' => Hook::exec('displayTop'),
'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),
'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),
'show_breadcrump' => $this->show_breadcrump, // By webkul
'show_breadcrump' => $this->show_breadcrump,
'show_full_date' => $this->show_full_date
));
} else {
$this->context->smarty->assign('HOOK_MOBILE_HEADER', Hook::exec('displayMobileHeader'));
@@ -1191,6 +1192,7 @@ class FrontControllerCore extends Controller
'token' => Tools::getToken(),
'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
'content_only' => (int)Tools::getValue('content_only'),
'show_full_date' => $this->show_full_date,
));
$this->context->smarty->assign($this->initLogoAndFavicon());

View File

@@ -2874,13 +2874,13 @@ abstract class ModuleCore
$overrides = array();
foreach (Tools::scandir($this->getLocalPath().'override', 'php', '', true) as $file) {
$class = basename($file, '.php');
if ($class != 'index') {
$classInfo = array('class' => $class, 'file' => $file, 'type' => null);
if (PrestaShopAutoload::getInstance()->getClassPath($class.'Core')) {
$classInfo['type'] = self::OVERRIDE_TYPE_CORE;
} elseif (Module::getModuleIdByName($class)) {
$classInfo['type'] = self::OVERRIDE_TYPE_MODULE;
} elseif (preg_match('#^modules/([a-zA-Z0-9_-]+)/controllers/(admin|front)/([0-9a-zA-Z-_]+).php#', $file, $matches)) {
$classInfo = array('class' => $class, 'file' => $file, 'type' => null);
if (PrestaShopAutoload::getInstance()->getClassPath($class.'Core')) {
$classInfo['type'] = self::OVERRIDE_TYPE_CORE;
} elseif (Module::getModuleIdByName($class)) {
$classInfo['type'] = self::OVERRIDE_TYPE_MODULE;
} elseif (preg_match('#^modules/([a-zA-Z0-9_-]+)/controllers/(admin|front)/([0-9a-zA-Z-_]+).php#', $file, $matches)) {
if ($class != 'index') {
$classInfo['type'] = self::OVERRIDE_TYPE_MODULE_CONTROLLER;
$classInfo['module'] = $matches[1];
$classInfo['controller_type'] = $matches[2];

View File

@@ -475,8 +475,9 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($data_v['date_from']);
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($data_v['date_to']);
$fullDate = ($this->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);
$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

@@ -248,8 +248,9 @@ class Blockcart extends Module
} else {
$addedProduct['price'] = Tools::displayPrice($price['total_price_tax_incl']);
}
$addedProduct['date_from'] = Tools::displayDate($addedProduct['date_from']);
$addedProduct['date_to'] = Tools::displayDate($addedProduct['date_to']);
$fullDate = ($this->context->controller->show_full_date && (date('Y-m-d', strtotime($addedProduct['date_from'])) == date('Y-m-d', strtotime($addedProduct['date_to']))) ? true : false);
$addedProduct['date_from'] = Tools::displayDate($addedProduct['date_from'], null, $fullDate);
$addedProduct['date_to'] = Tools::displayDate($addedProduct['date_to'], null, $fullDate);
} else {
// @todo get price of added product from front
$addedProduct['price'] = ProductCore::getPriceStatic(

View File

@@ -134,7 +134,8 @@
{foreach from=$product.bookingData['date_diff'] key=data_k1 item=data_v}
<tr class="rooms_remove_container">
<td>
{$data_v['data_form']|date_format:"%d-%m-%Y"}&nbsp;-&nbsp;{$data_v['data_to']|date_format:"%d-%m-%Y"}
{assign var="is_full_date" value=($show_full_date && ($data_v['data_form']|date_format:'%D' == $data_v['data_to']|date_format:'%D'))}
{dateFormat date=$data_v['data_form'] full=$is_full_date}&nbsp;-&nbsp;{dateFormat date=$data_v['data_to'] full=$show_full_date}
</td>
<td class="num_rooms_in_date">{$data_v['num_rm']}</td>
<td>{convertPrice price=($data_v['amount'] + $data_v['demand_price'])}</td>

View File

@@ -26,7 +26,8 @@
<tr>
<td class="text-center">{$cart_data['room_num']|escape:'htmlall':'UTF-8'}</td>
<td class="text-center">{$cart_data['room_type']|escape:'htmlall':'UTF-8'}</td>
<td class="text-center">{dateFormat date=$cart_data['date_from']} - {dateFormat date=$cart_data['date_to']}</td>
{assign var="is_full_date" value=($show_full_date && ($cart_data['date_from']|date_format:'%D' == $cart_data['date_to']|date_format:'%D'))}
<td class="text-center">{dateFormat date=$cart_data['date_from'] full=$is_full_date} - {dateFormat date=$cart_data['date_to'] full=$is_full_date}</td>
<td class="text-center">{convertPrice price=($cart_data['amt_with_qty'] + $cart_data['additional_services_auto_add_with_room_price'] + $cart_data['additional_service_price'] + $cart_data['demand_price'])}</td>
<td class="text-center"><button class="btn btn-default ajax_cart_delete_data" data-id-product="{$cart_data['id_product']|escape:'htmlall':'UTF-8'}" data-id-hotel="{$cart_data['id_hotel']|escape:'htmlall':'UTF-8'}" data-id-cart="{$cart_data['id_cart']|escape:'htmlall':'UTF-8'}" data-id-cart-book-data="{$cart_data['id']|escape:'htmlall':'UTF-8'}" data-date-from="{$cart_data['date_from']|escape:'htmlall':'UTF-8'}" data-date-to="{$cart_data['date_to']|escape:'htmlall':'UTF-8'}"><i class='icon-trash'></i></button></td>
</tr>

View File

@@ -41,7 +41,8 @@
{foreach from=$book_v['data']['available'] key=avai_k item=avai_v}
<tr>
<td>{$avai_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$avai_v type='available'}</td>
<td>{dateFormat date=$date_from} - {dateFormat date=$date_to}</td>
{assign var="is_full_date" value=($show_full_date && ($date_from|date_format:'%D' == $date_to|date_format:'%D'))}
<td>{dateFormat date=$date_from full=$is_full_date} - {dateFormat date=$date_to full=$is_full_date}</td>
<td>{$avai_v['room_comment']|escape:'htmlall':'UTF-8'}</td>
<td>
{foreach $allotment_types as $allotment_type}
@@ -126,8 +127,9 @@
{foreach from=$part_v['rooms'] key=sub_part_k item=sub_part_v}
<tr>
{if $sub_part_v@first}
{assign var="is_full_date" value=($show_full_date && ($part_v['date_from']|date_format:'%D' == $part_v['date_to']|date_format:'%D'))}
<td rowspan="{$part_v['rooms']|count}">
<p>{dateFormat date=$part_v['date_from']} - {dateFormat date=$part_v['date_to']}</p>
<p>{dateFormat date=$part_v['date_from'] full=$is_full_date} - {dateFormat date=$part_v['date_to'] full=$is_full_date}</p>
</td>
{/if}
<td >{$sub_part_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$sub_part_v type='partially_available'}</td>
@@ -213,10 +215,11 @@
{foreach from=$book_v['data']['booked'] key=booked_k item=booked_v}
{foreach from=$booked_v['detail'] key=rm_dtl_k item=rm_dtl_v}
<tr>
{assign var="is_full_date" value=($show_full_date && ($rm_dtl_v['date_from']|date_format:'%D' == $rm_dtl_v['date_to']|date_format:'%D'))}
{if $rm_dtl_v@first}
<td rowspan="{$booked_v['detail']|count}">{$booked_v['room_num']|escape:'htmlall':'UTF-8'} {hook h='displayRoomNumAfter' data=$booked_v key=$rm_dtl_k type='booked'}</td>
{/if}
<td>{dateFormat date=$rm_dtl_v['date_from']} - {dateFormat date=$rm_dtl_v['date_to']}</td>
<td>{dateFormat date=$rm_dtl_v['date_from'] full=$is_full_date} - {dateFormat date=$rm_dtl_v['date_to'] full=$is_full_date}</td>
<td><a href="{$link->getAdminLink('AdminOrders')}&id_order={$rm_dtl_v['id_order']|intval}&vieworder" target="_blank">#{$rm_dtl_v['id_order']}</a></td>
<td>{$rm_dtl_v['comment']|escape:'htmlall':'UTF-8'}</td>
<td>

View File

@@ -147,7 +147,8 @@
<td>{$booking['room_num']|escape:'htmlall':'UTF-8'}</td>
<td>{$booking['room_type_name']|escape:'htmlall':'UTF-8'}</td>
<td>{$booking['hotel_name']|escape:'htmlall':'UTF-8'}</td>
<td>{$booking['date_from']|date_format:"%d-%m-%Y"} {l s='To' mod='hotelreservationsystem'} {$booking['date_to']|date_format:"%d-%m-%Y"}</td>
{assign var="is_full_date" value=($show_full_date && ($booking['date_from']|date_format:'%D' == $booking['date_to']|date_format:'%D'))}
<td>{dateFormat date=$booking['date_from'] full=$is_full_date} {l s='To' mod='hotelreservationsystem'} {dateFormat date=$booking['date_to'] full=$is_full_date}</td>
<td>
{displayPrice price=($booking['total_price_tax_incl'] + $booking['extra_service_total_price_tax_incl']) currency=$orderCurrency['id']}
<span class="price_info">

View File

@@ -61,16 +61,17 @@
<div class="description-list">
<dl class="">
<div class="row">
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
<div class="col-xs-12 col-md-6">
<div class="row">
<dt class="col-xs-5">{l s='Check-in'}</dt>
<dd class="col-xs-7">{$rm_v.data_form|date_format:'D'}, {dateFormat date=$rm_v.data_form}</dd>
<dd class="col-xs-7">{dateFormat date=$rm_v.data_form full=$is_full_date}</dd>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="row">
<dt class="col-xs-5">{l s='Check-out'}</dt>
<dd class="col-xs-7">{$rm_v.data_to|date_format:'D'}, {dateFormat date=$rm_v.data_to}</dd>
<dd class="col-xs-7">{dateFormat date=$rm_v.data_to full=$is_full_date}</dd>
</div>
</div>
</div>

View File

@@ -57,6 +57,7 @@
{addJsDef quickView=$quick_view|boolval}
{addJsDef displayList=Configuration::get('PS_GRID_PRODUCT')|boolval}
{addJsDef highDPI=Configuration::get('PS_HIGHT_DPI')|boolval}
{addJsDef showFullDate=$show_full_date|boolval}
{* occupancy text *}
{addJsDef is_occupancy_wise_search=$is_occupancy_wise_search|boolval}
{addJsDef occupancy_required_for_booking=$occupancy_required_for_booking|boolval}

View File

@@ -133,8 +133,9 @@
</tr>
{foreach from=$product.bookingData['date_diff'] key=data_k1 item=data_v}
<tr class="rooms_remove_container">
{assign var="is_full_date" value=($show_full_date && ($data_v['data_form']|date_format:'%D' == $data_v['data_to']|date_format:'%D'))}
<td>
{$data_v['data_form']|date_format:"%d-%m-%Y"}&nbsp;-&nbsp;{$data_v['data_to']|date_format:"%d-%m-%Y"}
{dateFormat date=$data_v['data_form'] full=$is_full_date}&nbsp;-&nbsp;{dateFormat date=$data_v['data_to'] full=$show_full_date}
</td>
<td class="num_rooms_in_date">{$data_v['num_rm']}</td>
<td>{convertPrice price=($data_v['amount'] + $data_v['demand_price'])}</td>

View File

@@ -120,17 +120,18 @@
</p>
</td>
{/block}
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
{block name='order_detail_room_type_check_in'}
<td class="text-center">
<p>
{$rm_v['data_form']|date_format:"%d-%m-%Y"}
{dateFormat date=$rm_v['data_form'] full=$is_full_date}
</p>
</td>
{/block}
{block name='order_detail_room_type_check_out'}
<td class="text-center">
<p>
{$rm_v['data_to']|date_format:"%d-%m-%Y"}
{dateFormat date=$rm_v['data_to'] full=$is_full_date}
</p>
</td>
{/block}

View File

@@ -846,10 +846,11 @@
{assign var='flag_is_first_iteration' value=true}
{foreach from=$cart_htl_data key=data_k item=data_v}
{foreach from=$data_v['date_diff'] key=rm_k item=rm_v}
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
<li class="{if $flag_is_first_iteration}active{/if}">
<a href="#room-info-tab-{$data_v.id_product}-{$rm_k}" class="" data-toggle="tab">
<div class="room-type-name">{$data_v.name}</div>
<div class="duration">{dateFormat date=$rm_v.data_form} - {dateFormat date=$rm_v.data_to}</div>
<div class="duration">{dateFormat date=$rm_v.data_form full=$is_full_date} - {dateFormat date=$rm_v.data_to full=$is_full_date}</div>
</a>
</li>
{if $flag_is_first_iteration}{assign var='flag_is_first_iteration' value=false}{/if}

View File

@@ -71,7 +71,8 @@
<td>{l s='Room'} - {$smarty.foreach.refundRequest.iteration|string_format:'%02d'}</td>
<td>{$booking['room_type_name']|escape:'htmlall':'UTF-8'}</td>
<td>{$booking['hotel_name']|escape:'htmlall':'UTF-8'}</td>
<td>{$booking['date_from']|date_format:"%d-%m-%Y"} {l s='To'} {$booking['date_to']|date_format:"%d-%m-%Y"}</td>
{assign var="is_full_date" value=($show_full_date && ($booking['date_from']|date_format:'%D' == $booking['date_to']|date_format:'%D'))}
<td>{dateFormat date=$booking['date_from'] full=$is_full_date} {l s='To'} {dateFormat date=$booking['date_to'] full=$is_full_date}</td>
<td>{displayPrice price=$booking['total_price_tax_incl'] currency=$orderCurrency['id']}</td>
<td>{displayPrice price=$booking['extra_service_total_price_tax_incl'] currency=$orderCurrency['id']}</td>
{if $isRefundCompleted}

View File

@@ -153,14 +153,15 @@
{/if}
{/block}
{block name='shopping_cart_room_type_booking_information'}
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
<div class="room_duration_block">
<div class="col-sm-3 col-xs-6">
<p class="room_duration_block_head">{l s='CHECK IN'}</p>
<p class="room_duration_block_value">{$rm_v['data_form']|date_format:"%d %b, %a"}</p>
<p class="room_duration_block_value">{$rm_v['data_form']|date_format:"%d %b, %a"}{if $is_full_date} {$rm_v['data_form']|date_format:"%H:%M"}{/if}</p>
</div>
<div class="col-sm-3 col-xs-6">
<p class="room_duration_block_head">{l s='CHECK OUT'}</p>
<p class="room_duration_block_value">{$rm_v['data_to']|date_format:"%d %b, %a"}</p>
<p class="room_duration_block_value">{$rm_v['data_to']|date_format:"%d %b, %a"}{if $is_full_date} {$rm_v['data_to']|date_format:"%H:%M"}{/if}</p>
</div>
<div class="col-sm-6 col-xs-6">
<p class="room_duration_block_head">{l s='OCCUPANCY'}</p>