<?php
/* Smarty version 4.3.1, created on 2025-09-18 01:02:48
  from '/var/www/html/yatmack/ui/ui/logs-cron.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.3.1',
  'unifunc' => 'content_68cb3008aa5af8_93939828',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '627ce4cb5b6e955190e2871363306142c8d43846' => 
    array (
      0 => '/var/www/html/yatmack/ui/ui/logs-cron.tpl',
      1 => 1758108485,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:sections/header.tpl' => 1,
    'file:pagination.tpl' => 1,
    'file:sections/footer.tpl' => 1,
  ),
),false)) {
function content_68cb3008aa5af8_93939828 (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);
?>

<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title">
                        <i class="fa fa-clock-o"></i> <?php echo Lang::T('Cron Job Logs');?>

                    </h5>
                    <div class="btn-group pull-right">
                        <a href="<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
logs/cron" class="btn btn-primary btn-sm">
                            <i class="fa fa-refresh"></i> Refresh
                        </a>
                    </div>
                </div>
                <div class="card-body">
                    
                    <!-- Statistics Overview -->
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <div class="card bg-primary text-white">
                                <div class="card-body">
                                    <h4><?php echo $_smarty_tpl->tpl_vars['stats']->value['total_runs'];?>
</h4>
                                    <p>Total Runs (7 days)</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="card bg-success text-white">
                                <div class="card-body">
                                    <h4><?php echo $_smarty_tpl->tpl_vars['stats']->value['successful_runs'];?>
</h4>
                                    <p>Successful Runs</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="card bg-danger text-white">
                                <div class="card-body">
                                    <h4><?php echo $_smarty_tpl->tpl_vars['stats']->value['failed_runs'];?>
</h4>
                                    <p>Failed Runs</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="card bg-info text-white">
                                <div class="card-body">
                                    <h4><?php echo $_smarty_tpl->tpl_vars['stats']->value['avg_execution_time'];?>
s</h4>
                                    <p>Avg Execution Time</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Last Run Information -->
                    <div class="alert alert-info">
                        <h6><i class="fa fa-info-circle"></i> Last Run Information</h6>
                        <p><strong>Last Run:</strong> <?php if ($_smarty_tpl->tpl_vars['stats']->value['last_run']) {
echo $_smarty_tpl->tpl_vars['stats']->value['last_run'];
} else { ?>Never<?php }?></p>
                        <p><strong>Last Success:</strong> <?php if ($_smarty_tpl->tpl_vars['stats']->value['last_success']) {
echo $_smarty_tpl->tpl_vars['stats']->value['last_success'];
} else { ?>Never<?php }?></p>
                        <p><strong>Last Failure:</strong> <?php if ($_smarty_tpl->tpl_vars['stats']->value['last_failure']) {
echo $_smarty_tpl->tpl_vars['stats']->value['last_failure'];
} else { ?>Never<?php }?></p>
                    </div>

                    <!-- Filters -->
                    <div class="row mb-3">
                        <div class="col-md-12">
                            <form method="post" action="<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
logs/cron" class="form-inline">
                                <div class="form-group mr-2">
                                    <input type="text" name="q" class="form-control" placeholder="Search error messages..." value="<?php echo $_smarty_tpl->tpl_vars['q']->value;?>
">
                                </div>
                                <div class="form-group mr-2">
                                    <select name="cron_type" class="form-control">
                                        <option value="">All Types</option>
                                        <option value="main" <?php if ($_smarty_tpl->tpl_vars['cron_type']->value == 'main') {?>selected<?php }?>>Main Cron</option>
                                        <option value="reminder" <?php if ($_smarty_tpl->tpl_vars['cron_type']->value == 'reminder') {?>selected<?php }?>>Reminder Cron</option>
                                    </select>
                                </div>
                                <div class="form-group mr-2">
                                    <select name="status" class="form-control">
                                        <option value="">All Status</option>
                                        <option value="completed" <?php if ($_smarty_tpl->tpl_vars['status']->value == 'completed') {?>selected<?php }?>>Completed</option>
                                        <option value="failed" <?php if ($_smarty_tpl->tpl_vars['status']->value == 'failed') {?>selected<?php }?>>Failed</option>
                                        <option value="running" <?php if ($_smarty_tpl->tpl_vars['status']->value == 'running') {?>selected<?php }?>>Running</option>
                                    </select>
                                </div>
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-search"></i> Filter
                                </button>
                                <a href="<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
logs/cron" class="btn btn-default">
                                    <i class="fa fa-times"></i> Clear
                                </a>
                            </form>
                        </div>
                    </div>

                    <!-- Logs Table -->
                    <div class="table-responsive">
                        <table class="table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Type</th>
                                    <th>Started</th>
                                    <th>Finished</th>
                                    <th>Status</th>
                                    <th>Duration</th>
                                    <th>Expired Users</th>
                                    <th>Notifications</th>
                                    <th>Auto Renewals</th>
                                    <th>Memory</th>
                                    <th>Error</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['d']->value, 'log');
$_smarty_tpl->tpl_vars['log']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['log']->value) {
$_smarty_tpl->tpl_vars['log']->do_else = false;
?>
                                <tr class="<?php if ($_smarty_tpl->tpl_vars['log']->value['status'] == 'completed') {?>success<?php } elseif ($_smarty_tpl->tpl_vars['log']->value['status'] == 'failed') {?>danger<?php } else { ?>warning<?php }?>">
                                    <td><?php echo $_smarty_tpl->tpl_vars['log']->value['id'];?>
</td>
                                    <td>
                                        <span class="label label-<?php if ($_smarty_tpl->tpl_vars['log']->value['cron_type'] == 'main') {?>primary<?php } else { ?>info<?php }?>">
                                            <?php echo mb_strtoupper((string) $_smarty_tpl->tpl_vars['log']->value['cron_type'] ?? '', 'UTF-8');?>

                                        </span>
                                    </td>
                                    <td><?php echo $_smarty_tpl->tpl_vars['log']->value['started_at'];?>
</td>
                                    <td><?php if ($_smarty_tpl->tpl_vars['log']->value['finished_at']) {
echo $_smarty_tpl->tpl_vars['log']->value['finished_at'];
} else { ?>-<?php }?></td>
                                    <td>
                                        <span class="label label-<?php if ($_smarty_tpl->tpl_vars['log']->value['status'] == 'completed') {?>success<?php } elseif ($_smarty_tpl->tpl_vars['log']->value['status'] == 'failed') {?>danger<?php } else { ?>warning<?php }?>">
                                            <?php echo mb_strtoupper((string) $_smarty_tpl->tpl_vars['log']->value['status'] ?? '', 'UTF-8');?>

                                        </span>
                                    </td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['log']->value['execution_time']) {?>
                                            <?php echo $_smarty_tpl->tpl_vars['log']->value['execution_time'];?>
s
                                        <?php } else { ?>
                                            -
                                        <?php }?>
                                    </td>
                                    <td>
                                        <span class="badge badge-info"><?php echo $_smarty_tpl->tpl_vars['log']->value['expired_users_processed'];?>
</span>
                                        <?php if ($_smarty_tpl->tpl_vars['log']->value['expired_users_found'] != $_smarty_tpl->tpl_vars['log']->value['expired_users_processed']) {?>
                                            <small class="text-muted">(<?php echo $_smarty_tpl->tpl_vars['log']->value['expired_users_found'];?>
 found)</small>
                                        <?php }?>
                                    </td>
                                    <td>
                                        <span class="badge badge-success"><?php echo $_smarty_tpl->tpl_vars['log']->value['notifications_sent'];?>
</span>
                                    </td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['log']->value['auto_renewals_attempted'] > 0) {?>
                                            <span class="badge badge-warning"><?php echo $_smarty_tpl->tpl_vars['log']->value['auto_renewals_successful'];?>
/<?php echo $_smarty_tpl->tpl_vars['log']->value['auto_renewals_attempted'];?>
</span>
                                        <?php } else { ?>
                                            -
                                        <?php }?>
                                    </td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['log']->value['memory_usage']) {?>
                                            <?php echo $_smarty_tpl->tpl_vars['log']->value['memory_usage'];?>

                                        <?php } else { ?>
                                            -
                                        <?php }?>
                                    </td>
                                    <td>
                                        <?php if ($_smarty_tpl->tpl_vars['log']->value['error_message']) {?>
                                            <span class="text-danger" title="<?php echo $_smarty_tpl->tpl_vars['log']->value['error_message'];?>
">
                                                <i class="fa fa-exclamation-triangle"></i>
                                            </span>
                                        <?php } else { ?>
                                            -
                                        <?php }?>
                                    </td>
                                </tr>
                                <?php
}
if ($_smarty_tpl->tpl_vars['log']->do_else) {
?>
                                <tr>
                                    <td colspan="11" class="text-center text-muted">
                                        <i class="fa fa-info-circle"></i> No cron logs found
                                    </td>
                                </tr>
                                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </tbody>
                        </table>
                    </div>

                    <!-- Pagination -->
                    <?php $_smarty_tpl->_subTemplateRender("file:pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>

                    <!-- Legend -->
                    <div class="mt-3">
                        <h6>Legend:</h6>
                        <ul class="list-inline">
                            <li><span class="label label-success">COMPLETED</span> - Cron job finished successfully</li>
                            <li><span class="label label-danger">FAILED</span> - Cron job encountered an error</li>
                            <li><span class="label label-warning">RUNNING</span> - Cron job is currently running</li>
                        </ul>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<?php $_smarty_tpl->_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
}
}
