mirror of
https://github.com/tips-of-mine/GLPI-Plugin-SOC-Case-Management.git
synced 2025-06-27 21:28:42 +02:00
88 lines
3.2 KiB
PHP
88 lines
3.2 KiB
PHP
<?php
|
|
include ("../../../inc/includes.php");
|
|
|
|
Session::checkRight("plugin_soc_case", READ);
|
|
|
|
// Check if plugin is activated
|
|
if (!Plugin::isPluginActive("soc")) {
|
|
Html::displayNotFoundError();
|
|
}
|
|
|
|
Html::header(__('SOC Dashboard', 'soc'), '', "management", "pluginsoccase");
|
|
|
|
// Get counts
|
|
$case = new PluginSocCase();
|
|
$total_cases = countElementsInTable($case->getTable());
|
|
$new_cases = countElementsInTable($case->getTable(), ['status' => PluginSocCase::STATUS_NEW]);
|
|
$critical_cases = countElementsInTable($case->getTable(), ['severity' => PluginSocCase::SEVERITY_CRITICAL]);
|
|
|
|
// Display dashboard
|
|
?>
|
|
<div class="soc-dashboard">
|
|
<h2><?php echo __('SOC Case Management Dashboard', 'soc'); ?></h2>
|
|
|
|
<!-- KPI Cards -->
|
|
<div class="soc-kpi-container">
|
|
<div class="soc-kpi-card">
|
|
<div class="soc-kpi-label"><?php echo __('Total Cases', 'soc'); ?></div>
|
|
<div class="soc-kpi-value" data-value="<?php echo $total_cases; ?>"><?php echo $total_cases; ?></div>
|
|
</div>
|
|
|
|
<div class="soc-kpi-card">
|
|
<div class="soc-kpi-label"><?php echo __('New Cases', 'soc'); ?></div>
|
|
<div class="soc-kpi-value" data-value="<?php echo $new_cases; ?>"><?php echo $new_cases; ?></div>
|
|
</div>
|
|
|
|
<div class="soc-kpi-card">
|
|
<div class="soc-kpi-label"><?php echo __('Critical Cases', 'soc'); ?></div>
|
|
<div class="soc-kpi-value" data-value="<?php echo $critical_cases; ?>"><?php echo $critical_cases; ?></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recent Cases -->
|
|
<div class="soc-card" style="flex: 1 1 100%;">
|
|
<div class="soc-card-header">
|
|
<h3 class="soc-card-title"><?php echo __('Recent Cases', 'soc'); ?></h3>
|
|
</div>
|
|
<div class="soc-card-content">
|
|
<?php
|
|
$cases = $DB->request([
|
|
'FROM' => $case->getTable(),
|
|
'ORDER' => ['date_creation DESC'],
|
|
'LIMIT' => 5
|
|
]);
|
|
|
|
if (count($cases) > 0) {
|
|
echo '<table class="tab_cadre_fixehov">';
|
|
echo '<tr>';
|
|
echo '<th>' . __('Name') . '</th>';
|
|
echo '<th>' . __('Status') . '</th>';
|
|
echo '<th>' . __('Severity', 'soc') . '</th>';
|
|
echo '<th>' . __('Creation date') . '</th>';
|
|
echo '</tr>';
|
|
|
|
foreach ($cases as $data) {
|
|
echo '<tr class="tab_bg_1">';
|
|
echo '<td><a href="case.form.php?id=' . $data['id'] . '">' . $data['name'] . '</a></td>';
|
|
echo '<td><span class="soc-status soc-status-' . $data['status'] . '">' . $case->getStatusOptions()[$data['status']] . '</span></td>';
|
|
echo '<td><span class="soc-severity soc-severity-' . $data['severity'] . '">' . $case->getSeverityOptions()[$data['severity']] . '</span></td>';
|
|
echo '<td>' . Html::convDateTime($data['date_creation']) . '</td>';
|
|
echo '</tr>';
|
|
}
|
|
|
|
echo '</table>';
|
|
} else {
|
|
echo '<p>' . __('No cases found.', 'soc') . '</p>';
|
|
}
|
|
?>
|
|
|
|
<div class="center" style="margin-top: 20px;">
|
|
<a href="case.php" class="submit"><?php echo __('View all cases', 'soc'); ?></a>
|
|
<a href="case.form.php" class="submit"><?php echo __('Create new case', 'soc'); ?></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
Html::footer();
|