_decodeProperties($_smarty_tpl, array ( 'version' => '4.3.1', 'unifunc' => 'content_68cac2d9726574_68884552', 'has_nocache_code' => false, 'file_dependency' => array ( '6be11145f2e44fb62e85b7f62586d0954f7edb37' => array ( 0 => '/var/www/html/yatmack/ui/ui/plan.tpl', 1 => 1758036051, 2 => 'file', ), ), 'includes' => array ( 'file:sections/header.tpl' => 1, 'file:pagination.tpl' => 1, 'file:sections/footer.tpl' => 1, ), ),false)) { function content_68cac2d9726574_68884552 (Smarty_Internal_Template $_smarty_tpl) { $_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); ?>

Plans

tpl_vars['_admin']->value['user_type'],array('SuperAdmin','Admin'))) {?>  
 
smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['d']->value, 'ds'); $_smarty_tpl->tpl_vars['ds']->do_else = true; if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['ds']->value) { $_smarty_tpl->tpl_vars['ds']->do_else = false; ?> tpl_vars['ds']->value['is_off']) {?>class="danger" tpl_vars['ds']->value['is_suspended']) {?>class="warning" > smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
tpl_vars['ds']->value['username'];?> tpl_vars['ds']->value['namebp'];?> tpl_vars['ds']->value['type'];?> tpl_vars['ds']->value['recharged_on'],$_smarty_tpl->tpl_vars['ds']->value['recharged_time']);?> tpl_vars['ds']->value['expiration'],$_smarty_tpl->tpl_vars['ds']->value['time']);?> tpl_vars['ds']->value['is_active']) {?> Active tpl_vars['ds']->value['is_suspended'] && $_smarty_tpl->tpl_vars['ds']->value['is_expired']) {?> Suspended tpl_vars['ds']->value['is_suspended'] && !$_smarty_tpl->tpl_vars['ds']->value['is_expired']) {?> Suspending Inactive tpl_vars['ds']->value['is_suspended'] && !$_smarty_tpl->tpl_vars['ds']->value['is_expired']) {?> Calculating... tpl_vars['ds']->value['is_expired']) {?> Expired - tpl_vars['ds']->value['method'];?> tpl_vars['ds']->value['routers'];?> tpl_vars['ds']->value['is_off'] && !($_smarty_tpl->tpl_vars['ds']->value['is_suspended'] && $_smarty_tpl->tpl_vars['ds']->value['is_expired'])) {?> tpl_vars['ds']->value['is_suspended'] && $_smarty_tpl->tpl_vars['ds']->value['is_expired']) {?> tpl_vars['_admin']->value['user_type'],array('SuperAdmin','Admin'))) {?>
_subTemplateRender("file:pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); ?>
> // Recharge Modal - Removed as recharge now navigates to dedicated page // Recharge modal functions removed as recharge now navigates to dedicated page function showSuspendModal(customerId, customerName) { document.getElementById('suspend_customer_id').value = customerId; document.getElementById('customer_name').value = customerName; // Set default date and time (6 minutes from now) var now = new Date(); now.setMinutes(now.getMinutes() + 6); var dateStr = now.toISOString().split('T')[0]; var timeStr = now.toTimeString().split(' ')[0].substring(0, 5); document.getElementById('suspension_date').value = dateStr; document.getElementById('suspension_time').value = timeStr; // Show modal using both jQuery and vanilla JS for compatibility if (typeof $ !== 'undefined' && $.fn.modal) { $('#suspendModal').modal('show'); } else { // Fallback for vanilla JS var modal = document.getElementById('suspendModal'); modal.style.display = 'block'; modal.classList.add('show'); document.body.classList.add('modal-open'); // Add backdrop var backdrop = document.createElement('div'); backdrop.className = 'modal-backdrop fade show'; backdrop.id = 'modal-backdrop'; document.body.appendChild(backdrop); } } function closeSuspendModal() { // Close modal using both jQuery and vanilla JS for compatibility if (typeof $ !== 'undefined' && $.fn.modal) { $('#suspendModal').modal('hide'); } else { // Fallback for vanilla JS var modal = document.getElementById('suspendModal'); modal.style.display = 'none'; modal.classList.remove('show'); document.body.classList.remove('modal-open'); // Remove backdrop var backdrop = document.getElementById('modal-backdrop'); if (backdrop) { backdrop.remove(); } } } // Close modal when clicking outside of it document.addEventListener('click', function(event) { var modal = document.getElementById('suspendModal'); if (event.target === modal) { closeSuspendModal(); } }); // Close modal with Escape key document.addEventListener('keydown', function(event) { if (event.key === 'Escape') { var modal = document.getElementById('suspendModal'); if (modal.classList.contains('show')) { closeSuspendModal(); } } }); // Countdown timer for suspended users function updateCountdowns() { var now = new Date().getTime(); var hasExpired = false; document.querySelectorAll('[id^="countdown-"]').forEach(function(element) { var customerId = element.id.replace('countdown-', ''); var minutesElement = document.getElementById('minutes-' + customerId); if (minutesElement) { // Get expiry time from the table row var row = element.closest('tr'); var expiryCell = row.querySelector('td:nth-child(5)'); // Expires On column var expiryText = expiryCell.textContent.trim(); // Parse the expiry date and time var expiryDate = new Date(expiryText); if (!isNaN(expiryDate.getTime())) { var timeLeft = expiryDate.getTime() - now; if (timeLeft > 0) { var minutes = Math.floor(timeLeft / (1000 * 60)); var hours = Math.floor(minutes / 60); var days = Math.floor(hours / 24); var displayText = ''; if (days > 0) { displayText = days + 'd ' + (hours % 24) + 'h ' + (minutes % 60) + 'm'; } else if (hours > 0) { displayText = hours + 'h ' + (minutes % 60) + 'm'; } else { displayText = minutes + 'm'; } minutesElement.textContent = displayText; } else { // Timer has expired - update UI immediately minutesElement.textContent = 'Expired'; element.className = 'text-danger'; // Update the status badge to Inactive var statusCell = row.querySelector('td:nth-child(6)'); // Status column if (statusCell) { var badge = statusCell.querySelector('.badge'); if (badge) { badge.className = 'badge badge-danger'; badge.textContent = 'Inactive'; } } // Update the suspend button to show Inactive var suspendButton = row.querySelector('button[onclick*="showSuspendModal"]'); if (suspendButton) { suspendButton.outerHTML = ' Inactive'; } hasExpired = true; } } } }); // If any countdown expired, refresh the page after a short delay to sync with backend if (hasExpired) { setTimeout(function() { location.reload(); }, 2000); // Wait 2 seconds before refreshing } } // Update countdowns every 10 seconds for better real-time experience setInterval(updateCountdowns, 10000); // Initial update document.addEventListener('DOMContentLoaded', function() { updateCountdowns(); // Initialize modal form interactions initializeModalForm(); }); // Initialize Modal Form Interactions function initializeModalForm() { // Load servers when type changes $('input[type=radio][name="type"]').change(function(){ $("#modal_server").html(''); $("#modal_plan").html(''); $("#modal-server-help").text('Loading routers...'); $("#modal-plan-help").text('Select a router first to load available plans'); if ($('#modalHot').is(':checked') || $('#modalPOE').is(':checked')) { $.ajax({ type: "POST", dataType: "html", url: "index.php?_route=autoload/server", success: function(msg){ $("#modal_server").html(msg); $("#modal_server").prop('disabled', false); // Update help text var serverCount = $("#modal_server option").length - 1; if (serverCount > 0) { $("#modal-server-help").text('Found ' + serverCount + ' router(s) available'); } else { $("#modal-server-help").text('No routers found. Please add routers first.'); } }, error: function(xhr, status, error) { $("#modal-server-help").text('Error loading routers. Please try again.'); } }); } }); // Load plans when server changes $("#modal_server").change(function(){ var server = $("#modal_server").val(); var jenis = $('input[name="type"]:checked').val(); if (server && jenis) { $("#modal-plan-help").text('Loading plans...'); $.ajax({ type: "POST", dataType: "html", url: "index.php?_route=autoload/plan", data: "jenis=" + jenis + "&server=" + server, success: function(msg){ $("#modal_plan").html(msg); $("#modal_plan").prop('disabled', false); // Update help text var planCount = $("#modal_plan option").length - 1; if (planCount > 0) { $("#modal-plan-help").text('Found ' + planCount + ' plan(s) available'); } else { $("#modal-plan-help").text('No plans found for this router and type. Please create plans first.'); } }, error: function(xhr, status, error) { $("#modal-plan-help").text('Error loading plans. Please try again.'); } }); } else { $("#modal_plan").html(''); $("#modal-plan-help").text('Select a router and type first to load available plans'); } }); } > _subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); } }