nhance/app/Views/logs/index.php
2025-12-11 16:33:38 +05:30

303 lines
8.9 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= esc($title) ?></title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
} */
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 10px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
overflow: hidden;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.header h1 {
font-size: 2rem;
margin-bottom: 10px;
}
.header p {
opacity: 0.9;
}
.content {
padding: 30px;
}
.alert {
padding: 15px 20px;
margin-bottom: 20px;
border-radius: 5px;
font-weight: 500;
}
.alert-success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.alert-error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.actions {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 20px;
border-bottom: 2px solid #e9ecef;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
text-decoration: none;
display: inline-block;
transition: all 0.3s ease;
}
.btn-danger {
background: #dc3545;
color: white;
}
.btn-danger:hover {
background: #c82333;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5568d3;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.btn-success {
background: #28a745;
color: white;
}
.btn-success:hover {
background: #218838;
}
.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
.table-wrapper {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
background: white;
}
thead {
background: #f8f9fa;
}
th {
padding: 15px;
text-align: left;
font-weight: 600;
color: #495057;
border-bottom: 2px solid #dee2e6;
}
td {
padding: 15px;
border-bottom: 1px solid #dee2e6;
}
tbody tr {
transition: background 0.2s ease;
}
tbody tr:hover {
background: #f8f9fa;
}
.no-logs {
text-align: center;
padding: 60px 20px;
color: #6c757d;
}
.no-logs svg {
width: 100px;
height: 100px;
margin-bottom: 20px;
opacity: 0.5;
}
.action-buttons {
display: flex;
gap: 8px;
}
.file-name {
font-weight: 600;
color: #667eea;
}
.stats {
display: flex;
gap: 20px;
margin-bottom: 20px;
}
.stat-card {
flex: 1;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 8px;
text-align: center;
}
.stat-card h3 {
font-size: 2rem;
margin-bottom: 5px;
}
.stat-card p {
opacity: 0.9;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<!-- <div class="header">
<h1>📋 Log File Manager</h1>
<p>View and manage your CodeIgniter 4 log files</p>
</div> -->
<div class="content">
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success">
✓ <?= session()->getFlashdata('success') ?>
</div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-error">
✗ <?= session()->getFlashdata('error') ?>
</div>
<?php endif; ?>
<!-- <div class="stats">
<div class="stat-card">
<h3><?= count($logFiles) ?></h3>
<p>Total Log Files</p>
</div>
</div> -->
<div class="actions">
<h2 style="color: #495057;">Log Files</h2>
<?php if (!empty($logFiles)): ?>
<!-- <a href="<?= base_url('logs/clearAll') ?>"
class="btn btn-danger"
onclick="return confirm('Are you sure you want to delete all log files?')">
🗑️ Clear All Logs
</a> -->
<?php endif; ?>
</div>
<?php if (empty($logFiles)): ?>
<div class="no-logs">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<h3>No Log Files Found</h3>
<p>There are no log files to display at the moment.</p>
</div>
<?php else: ?>
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>File Name</th>
<th>Size</th>
<th>Last Modified</th>
<th style="text-align: center;">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($logFiles as $file): ?>
<tr>
<td>
<span class="file-name">
📄 <?= esc($file['name']) ?>
</span>
</td>
<td><?= esc($file['size']) ?></td>
<td><?= esc($file['modified_date']) ?></td>
<td>
<div class="action-buttons" style="justify-content: center;">
<a href="<?= base_url('logs/view/' . urlencode($file['name'])) ?>"
class="btn btn-primary btn-sm">
View
</a>
<a href="<?= base_url('logs/download/' . urlencode($file['name'])) ?>"
class="btn btn-success btn-sm">
Download
</a>
<!-- <a href="<?= base_url('logs/delete/' . urlencode($file['name'])) ?>"
class="btn btn-danger btn-sm"
onclick="return confirm('Are you sure you want to delete this log file?')">
Delete
</a> -->
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</body>
</html>