_decodeProperties($_smarty_tpl, array ( 'version' => '3.1.39', 'unifunc' => 'content_6494329198f652_33026214', 'has_nocache_code' => false, 'file_dependency' => array ( '0fc709b553ef82999d15ed1d34d993b295caf648' => array ( 0 => 'C:\\xampp\\htdocs\\hotelcommerce\\admin\\themes\\default\\template\\controllers\\products\\lengthofstay.tpl', 1 => 1687433793, 2 => 'file', ), ), 'includes' => array ( ), ),false)) { function content_6494329198f652_33026214 (Smarty_Internal_Template $_smarty_tpl) { $_smarty_tpl->_checkPlugins(array(0=>array('file'=>'C:\\xampp\\htdocs\\hotelcommerce\\tools\\smarty\\plugins\\modifier.date_format.php','function'=>'smarty_modifier_date_format',),)); if ((isset($_smarty_tpl->tpl_vars['product']->value->id))) {?>

smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Length Of Stay'),$_smarty_tpl ) );?>

smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Please read below important points regarding length of stay management'),$_smarty_tpl ) );?>
  • smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Set 1 day for setting no limit on Minimum length of stay'),$_smarty_tpl ) );?>
  • smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Set 0 day for setting no limit on Maximum length of stay'),$_smarty_tpl ) );?>
  • smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Enable "Length of stay for date ranges" for setting values of \"Minimum length of stay\" and \"Maximum length of stay\" according to different date ranges'),$_smarty_tpl ) );?>
  • smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Length of stays (minimum|maximum) of all the dates which does not fall under the date ranges of \"Length of stay for date ranges\", will be taken from the global values of length of stays of this room type.'),$_smarty_tpl ) );?>
  • smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'\"Date to\" will not be included in the date range of \"Length of stay for date ranges\".'),$_smarty_tpl ) );?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Day(s)'),$_smarty_tpl ) );?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Day(s)'),$_smarty_tpl ) );?>
checked="checked"tpl_vars['roomTypeInfo']->value['restrictionDataRange'])) && $_smarty_tpl->tpl_vars['roomTypeInfo']->value['restrictionDataRange']) {?>checked="checked"> checked="checked"tpl_vars['roomTypeInfo']->value['restrictionDataRange']))) { if (!$_smarty_tpl->tpl_vars['roomTypeInfo']->value['restrictionDataRange']) {?>checked="checked"checked="checked">
style="display:none;"tpl_vars['roomTypeInfo']->value['restrictionDataRange']))) { if (!$_smarty_tpl->tpl_vars['roomTypeInfo']->value['restrictionDataRange']) {?>style="display:none;"> _assignInScope('restrictionDataRange', array());?> smarty->ext->_foreach->init($_smarty_tpl, $_POST['restriction_date_from'], 'restrictionDateFromVal', false, 'restrictionKey'); $_smarty_tpl->tpl_vars['restrictionDateFromVal']->do_else = true; if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['restrictionKey']->value => $_smarty_tpl->tpl_vars['restrictionDateFromVal']->value) { $_smarty_tpl->tpl_vars['restrictionDateFromVal']->do_else = false; ?> _assignInScope('restrictionDataRangeTemp', array('date_from'=>$_smarty_tpl->tpl_vars['restrictionDateFromVal']->value,'date_to'=>$_POST['restriction_date_to'][$_smarty_tpl->tpl_vars['restrictionKey']->value],'min_los'=>$_POST['restriction_min_los'][$_smarty_tpl->tpl_vars['restrictionKey']->value],'max_los'=>$_POST['restriction_max_los'][$_smarty_tpl->tpl_vars['restrictionKey']->value]));?> tpl_vars['restrictionKey']->value]))) {?> tpl_vars['restrictionDataRangeTemp']) ? $_smarty_tpl->tpl_vars['restrictionDataRangeTemp']->value : array(); if (!(is_array($_tmp_array) || $_tmp_array instanceof ArrayAccess)) { settype($_tmp_array, 'array'); } $_tmp_array['id_rt_restriction'] = $_POST['id_rt_restriction'][$_smarty_tpl->tpl_vars['restrictionKey']->value]; $_smarty_tpl->_assignInScope('restrictionDataRangeTemp', $_tmp_array);?> tpl_vars['restrictionDataRange']) ? $_smarty_tpl->tpl_vars['restrictionDataRange']->value : array(); if (!(is_array($_tmp_array) || $_tmp_array instanceof ArrayAccess)) { settype($_tmp_array, 'array'); } $_tmp_array[] = $_smarty_tpl->tpl_vars['restrictionDataRangeTemp']->value; $_smarty_tpl->_assignInScope('restrictionDataRange', $_tmp_array);?> smarty->ext->_foreach->restore($_smarty_tpl, 1);?> tpl_vars['roomTypeInfo']->value['restrictionDataRange'])) && $_smarty_tpl->tpl_vars['roomTypeInfo']->value['restrictionDataRange']) {?> _assignInScope('restrictionDataRange', $_smarty_tpl->tpl_vars['roomTypeInfo']->value['restrictionDataRange']);?> _assignInScope('restrictionDataRange', array(array('date_from'=>'','date_to'=>'','min_los'=>'','max_los'=>'')));?> smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['restrictionDataRange']->value, 'restrictionInfo'); $_smarty_tpl->tpl_vars['restrictionInfo']->do_else = true; if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['restrictionInfo']->value) { $_smarty_tpl->tpl_vars['restrictionInfo']->do_else = false; ?> smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Date From'),$_smarty_tpl ) );?> smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Date To'),$_smarty_tpl ) );?> smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Minimum length of stay'),$_smarty_tpl ) );?> smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Maximum length of stay'),$_smarty_tpl ) );?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'day(s)'),$_smarty_tpl ) );?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'day(s)'),$_smarty_tpl ) );?>
tpl_vars['restrictionInfo']->value['id_rt_restriction']))) {?> tpl_vars['restrictionInfo']->value['id_rt_restriction']))) {?>data-id-rt-restriction="tpl_vars['restrictionInfo']->value['id_rt_restriction'];?> ">
> var days_txt = "smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'day(s)','js'=>1),$_smarty_tpl ) );?> "; var adminProductLink = "tpl_vars['link']->value->getAdminlink('AdminProducts');?> "; var someErrorText = "smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Something went wrong. Please try again.','js'=>1),$_smarty_tpl ) );?> "; // console.log($.datepicker.parseDate( "dd-mm-yy", "15-06-2022" )); $(document).ready(function() { $("input[name='active_restriction_dates']").on('change', function () { if (parseInt($(this).val())) { $("#restriction_dates_container").show(200); } else { $("#restriction_dates_container").hide(200); } }); $(document).on("click", ".delete_date_restriction",function(e) { e.preventDefault(); if (typeof $(this).attr('data-id-rt-restriction') !== 'undefined' && $(this).attr('data-id-rt-restriction') !== false) { var currentElement = $(this); $.ajax({ url: adminProductLink, type: 'POST', dataType: 'json', data: { ajax: true, action:'deleteRoomTypeLengthOfStayRestriction', id_rt_restriction: currentElement.attr('data-id-rt-restriction'), }, success: function (result) { if (typeof result.success !== 'undefined' && result.success !== false) { showSuccessMessage(result.success); currentElement.closest('tr').remove(); } else if (typeof result.error !== 'undefined' && result.error !== false) { showErrorMessage(result.error); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { showErrorMessage(someErrorText); } }); } else { $(this).closest('tr').remove(); } }); $('#add_los_restriction').on('click',function(e) { e.preventDefault(); var html = ''; html += ''; html += ''; html += '
'; html += ''; html += ''; html += '
'; html += ''; html += ''; html += '
'; html += ''; html += ''; html += '
'; html += ''; html += ''; html += '
'; html += ''; html += ''+ days_txt +''; html += '
'; html += ''; html += ''; html += '
'; html += ''; html += ''+ days_txt +''; html += '
'; html += ''; html += ''; html += ''; html += ''; html += ''; $('#restriction_dates_table tbody').append(html); $(this).blur(); }); $(document).on('focus', '.restriction_date', function() { var dateFormat = "dd-mm-yy"; $(this).datepicker({ defaultDate: new Date(), dateFormat: dateFormat, minDate: 0, beforeShow: function (input, instance) { if ($(input).hasClass('date_to_restriction') ) { var dateFrom = $(this).closest('tr').find('td div input.date_from_restriction').val(); if (typeof dateFrom !== 'undefined' && dateFrom !== false && dateFrom != '') { // This can also work but more testing needed: var date = new Date($.datepicker.parseDate(dateFormat, dateFrom)); var minDateTo = new Date($.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(dateFormat, dateFrom))); minDateTo.setDate(minDateTo.getDate() + 1); $(this).datepicker("option", "minDate", minDateTo); } } }, beforeShowDay: function (currentDate) { let dateRange = []; $(this).closest('tr').siblings().each(function( index ) { var dateFrom = $(this).find('td div input.date_from_restriction').val(); var dateTo = $(this).find('td div input.date_to_restriction').val(); if ((typeof dateFrom !== 'undefined' && dateFrom !== false && dateFrom != '') && (typeof dateTo !== 'undefined' && dateTo !== false && dateTo != '')) { for (let index = $.datepicker.parseDate(dateFormat, dateFrom); index < $.datepicker.parseDate(dateFormat, dateTo); index.setDate(index.getDate() + 1)) { dateRange.push($.datepicker.formatDate(dateFormat, index)); } } }); let dateString = $.datepicker.formatDate(dateFormat, currentDate); return [dateRange.indexOf(dateString) == -1]; }, onClose: function (dateText, instance) { if ($(this).hasClass('date_from_restriction')) { if (dateText != "") { var dateFrom = $.datepicker.parseDate(dateFormat, dateText); var dateTo = $(this).closest('tr').find('td div input.date_to_restriction').val(); dateTo = $.datepicker.parseDate(dateFormat, dateTo); if (dateFrom >= dateTo) { // In this case empty date_to, so that user have to again select the date for date_to field $(this).closest('tr').find('td div input.date_to_restriction').val(""); } } } } }); }); }); >