_decodeProperties($_smarty_tpl, array ( 'version' => '3.1.39', 'unifunc' => 'content_6494328fd80046_75935811', 'has_nocache_code' => false, 'file_dependency' => array ( 'c553f64fddb30ee5190ef3c414465ad500492a6f' => array ( 0 => 'C:\\xampp\\htdocs\\hotelcommerce\\admin\\themes\\default\\template\\controllers\\products\\configuration.tpl', 1 => 1687433793, 2 => 'file', ), ), 'includes' => array ( ), ),false)) { function content_6494328fd80046_75935811 (Smarty_Internal_Template $_smarty_tpl) { if ((isset($_smarty_tpl->tpl_vars['product']->value->id))) {?>

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

_assignInScope('rooms_info', $_POST['rooms_info']);?> tpl_vars['htl_room_info']->value)) && is_array($_smarty_tpl->tpl_vars['htl_room_info']->value) && count($_smarty_tpl->tpl_vars['htl_room_info']->value)) {?> _assignInScope('rooms_info', $_smarty_tpl->tpl_vars['htl_room_info']->value);?> tpl_vars['rooms_info']->value)) && is_array($_smarty_tpl->tpl_vars['rooms_info']->value) && count($_smarty_tpl->tpl_vars['rooms_info']->value)) {?> smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['rooms_info']->value, 'room_info', false, 'key'); $_smarty_tpl->tpl_vars['room_info']->do_else = true; if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['room_info']->value) { $_smarty_tpl->tpl_vars['room_info']->do_else = false; ?> _assignInScope('var_name_room_info', "rooms_info[".((string)$_smarty_tpl->tpl_vars['key']->value)."]");?> smarty->ext->_foreach->restore($_smarty_tpl, 1);?> tpl_vars['k'] = new Smarty_Variable(null, $_smarty_tpl->isRenderingCache);$_smarty_tpl->tpl_vars['k']->step = 1;$_smarty_tpl->tpl_vars['k']->total = (int) ceil(($_smarty_tpl->tpl_vars['k']->step > 0 ? 1+1 - (0) : 0-(1)+1)/abs($_smarty_tpl->tpl_vars['k']->step)); if ($_smarty_tpl->tpl_vars['k']->total > 0) { for ($_smarty_tpl->tpl_vars['k']->value = 0, $_smarty_tpl->tpl_vars['k']->iteration = 1;$_smarty_tpl->tpl_vars['k']->iteration <= $_smarty_tpl->tpl_vars['k']->total;$_smarty_tpl->tpl_vars['k']->value += $_smarty_tpl->tpl_vars['k']->step, $_smarty_tpl->tpl_vars['k']->iteration++) { $_smarty_tpl->tpl_vars['k']->first = $_smarty_tpl->tpl_vars['k']->iteration === 1;$_smarty_tpl->tpl_vars['k']->last = $_smarty_tpl->tpl_vars['k']->iteration === $_smarty_tpl->tpl_vars['k']->total;?> _assignInScope('var_name_room_info', "rooms_info[".((string)$_smarty_tpl->tpl_vars['k']->value)."]");?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'--'),$_smarty_tpl ) );?>
tpl_vars['room_info']->value['id_status'] != $_smarty_tpl->tpl_vars['rm_status']->value['STATUS_TEMPORARY_INACTIVE']['id']) { echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Add Dates'),$_smarty_tpl ) ); } else { echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'View Dates'),$_smarty_tpl ) ); }?> tpl_vars['room_info']->value['id_status'] == $_smarty_tpl->tpl_vars['rm_status']->value['STATUS_TEMPORARY_INACTIVE']['id']) {?>value="tpl_vars['room_info']->value['disable_dates_json'], ENT_QUOTES, 'UTF-8', true);?> "> tpl_vars['room_info']->value['id']))) {?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Add Dates'),$_smarty_tpl ) );?> tpl_vars['k']->value == 1) {?>
> var prod_link = "tpl_vars['link']->value->getAdminLink('AdminProducts');?> "; var rm_status = tpl_vars['rm_status']->value);?> ; var currentRoomRow = 0; $(document).ready(function() { const DisableDatesModal = { init: function() { DisableDatesModal.addNewRow(); DisableDatesModal.hideErrors(); DisableDatesModal.removeAllInvalidRowDataMarkers(); }, addNewRow: function() { $('#deactiveDatesModal tbody').append(this.disableDatesRowHtml); }, populateWithDatesInfo: function(datesInfo) { const $this = this; $(datesInfo).each(function(i, dateRange) { $('#deactiveDatesModal tbody').append($this.disableDatesRowHtml); const dateRangeRow = $('#deactiveDatesModal tbody tr').last(); $(dateRangeRow).find('.disabled_date_from').val(dateRange.date_from); $(dateRangeRow).find('.disabled_date_to').val(dateRange.date_to); $(dateRangeRow).find('.room_disable_reason').val(dateRange.reason); }); }, validateDisableDates: function(cb) { DisableDatesModal.hideErrors(); DisableDatesModal.removeAllInvalidRowDataMarkers(); DisableDatesModal.disableRowDeleteActionButtons(); let idRoom = parseInt($('#deactiveDatesModal .room-disable-dates').attr('data-id-room')); idRoom = idRoom == isNaN(idRoom) ? 0 : idRoom; const disableDates = Array(); $('#deactiveDatesModal .room-disable-dates tbody tr').each(function(i, tr) { const date_from = $(tr).find('.disabled_date_from').val().trim(); const date_to = $(tr).find('.disabled_date_to').val().trim(); disableDates.push({ date_from, date_to }); }); $.ajax({ url: prod_link, type: 'POST', data: { ajax: true, action: 'validateDisableDates', id_room: idRoom, disable_dates: disableDates, }, dataType: 'JSON', success: function(response) { if (response.status) { if (typeof cb === 'function') { cb(); } } else { DisableDatesModal.showErrors(response.errors); DisableDatesModal.addInvalidRowDataMarkers(response.rows_to_highlight); } }, complete: function () { DisableDatesModal.enableRowDeleteActionButtons(); } }); }, showErrors: function(errors) { $('#deactiveDatesModal .errors-wrap').html(errors); $('#deactiveDatesModal .errors-wrap').show(); }, hideErrors: function() { $('#deactiveDatesModal .errors-wrap').hide(); $('#deactiveDatesModal .errors-wrap').html(''); }, addInvalidRowDataMarkers: function(rowsToHighlight) { rowsToHighlight.map(function (rowIndex) { const tr = $('#deactiveDatesModal .room-disable-dates tbody tr').eq(rowIndex); DisableDatesModal.markRowDataInvalid(tr); }); }, getDisableDatesInfo: function() { const disableDates = Array(); $('#deactiveDatesModal .room-disable-dates tbody tr').each(function(i, tr) { disableDates.push({ date_from: $(tr).find('.disabled_date_from').val().trim(), date_to: $(tr).find('.disabled_date_to').val().trim(), reason: $(tr).find('.room_disable_reason').val().trim(), }); }); return disableDates; }, disableRowDeleteActionButtons: function() { const disableDates = Array(); $('#deactiveDatesModal .room-disable-dates .remove-disable-dates-button').addClass('disabled'); }, enableRowDeleteActionButtons: function() { const disableDates = Array(); $('#deactiveDatesModal .room-disable-dates .remove-disable-dates-button').removeClass('disabled'); }, markRowDataInvalid: function(tr) { $(tr).css({ 'outline': '1px solid #D27C82', 'border-radius': '2px' }); }, removeAllInvalidRowDataMarkers: function(tr) { $('#deactiveDatesModal .room-disable-dates tr').css('outline', ''); $(tr).css('outline', ''); }, removeRowDataMark: function(tr) { $(tr).css('outline', ''); }, disableDatesRowHtml: ` `, } // Disable dates data filling when model open $('#deactiveDatesModal').on('show.bs.modal', function(e) { const triggerRoomRow = $(e.relatedTarget); const roomRowIndex = parseInt($(triggerRoomRow).closest('tr').attr('data-row-index')); const idRoom = parseInt($(triggerRoomRow).attr('data-id-room')); $('#deactiveDatesModal table.room-disable-dates tbody').html(''); $('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index', roomRowIndex); $('#deactiveDatesModal table.room-disable-dates').attr('data-id-room', idRoom); let disableDates = $(triggerRoomRow).closest('tr').find('.disable_dates_json').val(); if (!disableDates) { DisableDatesModal.init(); return; } disableDates = JSON.parse(disableDates); DisableDatesModal.hideErrors(); DisableDatesModal.populateWithDatesInfo(disableDates); }); // Disable dates data filling when model open $('#deactiveDatesModal').on('hide.bs.modal', function(e) { const disableDates = DisableDatesModal.getDisableDatesInfo(); const roomRowIndex = parseInt($('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index')); const roomRow = $('#product-configuration .hotel-room tr.room_data_values[data-row-index='+roomRowIndex+']'); $(roomRow).find('.disable_dates_json').val(JSON.stringify(disableDates)); }); // copy json formatted dates to room $(document).on('click', '.deactiveDatesModalSubmit', function() { DisableDatesModal.validateDisableDates(function () { const disableDates = DisableDatesModal.getDisableDatesInfo(); const roomRowIndex = parseInt($('#deactiveDatesModal table.room-disable-dates').attr('data-room-row-index')); const roomRow = $('#product-configuration .hotel-room tr.room_data_values[data-row-index='+roomRowIndex+']'); $(roomRow).find('.disable_dates_json').val(JSON.stringify(disableDates)); $('#deactiveDatesModal').modal('hide'); }); }); // Add new room detail $('#add-more-rooms-button').on('click',function() { var lengthRooms = parseInt($('.room_data_values').length); var prefix = 'rooms_info['+lengthRooms+']'; html = ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += "smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Add Dates'),$_smarty_tpl ) );?> "; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; html += ''; $('table.hotel-room tbody').append(html); }); // delete room $('.rm_htl_room').on('click',function(e) { e.preventDefault(); var $current = $(this); var id_htl_info = $(this).attr('data-id-htl-info'); $.ajax({ url: prod_link, type: 'POST', dataType: 'text', data: { ajax:true, action:'deleteHotelRoom', id: id_htl_info, }, success: function (result) { if (parseInt(result) == 1) { showSuccessMessage("smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Removed successfully'),$_smarty_tpl ) );?> "); $current.closest(".room_data_values").remove(); } else { showErrorMessage("smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Some error occurred'),$_smarty_tpl ) );?> "); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { showErrorMessage("smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Some error occurred'),$_smarty_tpl ) );?> "); } }); }); $(".checkConfigurationClick").on("click", function() { $("#checkConfSubmit").val(1); return true; }); // remove room row $(document).on('click','.remove-rooms-button',function(e) { e.preventDefault(); $(this).closest('.room_data_values').remove(); $('#product-configuration table.hotel-room tr.room_data_values').each(function(iOuter, tr) { $(tr).attr('data-row-index', iOuter); $(tr).find('input, select').each(function (iInner, inputField) { let fieldName = $(inputField).attr('name'); fieldName = fieldName.replace(/[0-9]+/, iOuter) $(inputField).attr('name', fieldName); }); }); }); // on changing the room status as disabled for some date range $(document).on('change', '.room_status', function(){ var status_val = $(this).val(); if (status_val == rm_status.STATUS_TEMPORARY_INACTIVE.id) { $(this).closest('.room_data_values').find('.deactiveDatesModal').removeClass('disabled'); } else { $(this).closest('.room_data_values').find('.deactiveDatesModal').addClass('disabled'); } }); $(document).on('focus', '.disabled_date_from, .disabled_date_to', function () { $('.disabled_date_from').datepicker({ showOtherMonths: true, dateFormat: 'yy-mm-dd', minDate: 0, onSelect: function(selectedDate) { var date_format = selectedDate.split('-'); selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format[0], date_format[1] - 1, date_format[2]))); selectedDate.setDate(selectedDate.getDate() + 1); $(this).closest('tr').find('.disabled_date_to').datepicker('option', 'minDate', selectedDate); }, onClose: function(selectedDate) { var dateTo = $(this).closest('tr').find('.disabled_date_to').val(); if (!dateTo || (dateTo && selectedDate >= dateTo)) { $(this).closest('tr').find('.disabled_date_to').datepicker('show'); } }, }); $('.disabled_date_to').datepicker({ showOtherMonths: true, dateFormat: 'yy-mm-dd', minDate: 0, beforeShow: function (input, instance) { var date_to = $(this).closest('tr').find('.disabled_date_from').val(); if (typeof date_to != 'undefined' && date_to != '') { var date_format = date_to.split('-'); var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format[0], date_format[1] - 1, date_format[2]))); } else { var date_format = new Date(); var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date())); } selectedDate.setDate(selectedDate.getDate()+1); $(this).datepicker('option', 'minDate', selectedDate); }, }); }); $('.add_more_room_disable_dates').on('click', function() { DisableDatesModal.addNewRow(); }); $(document).on('click','.remove-disable-dates-button',function(e) { e.preventDefault(); $(this).closest('tr').remove(); }); }); >