Merge branch 'Workorder/improve-and-add-dashboard' into 'master'
changed dashboard See merge request fronk/thetool!2062
This commit is contained in:
@@ -121,14 +121,14 @@ class WorkorderDashboardController extends TTCrud
|
||||
private function getKPIs($db, $whereClause, $tenantCampaignIds, $dateFrom, $dateTo): array
|
||||
{
|
||||
$total = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause")->fetch_assoc()['c'] ?? 0;
|
||||
$completed = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause AND w.status IN ('completed', 'charged')")->fetch_assoc()['c'] ?? 0;
|
||||
$pending = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause AND w.status IN ('new', 'assigned', 'scheduled', 'in_progress', 'documented')")->fetch_assoc()['c'] ?? 0;
|
||||
$offen = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause AND w.status NOT IN ('completed', 'charged', 'archived')")->fetch_assoc()['c'] ?? 0;
|
||||
$terminisiert = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause AND w.status NOT IN ('completed', 'charged', 'archived') AND w.appointmentDate IS NOT NULL")->fetch_assoc()['c'] ?? 0;
|
||||
$issues = $db->query("SELECT COUNT(*) as c FROM thetool.Workorder w JOIN thetool.Preorder p ON w.preorderId = p.id WHERE $whereClause AND w.status IN ('intervention_required', 'correction_requested')")->fetch_assoc()['c'] ?? 0;
|
||||
|
||||
return [
|
||||
'total' => (int)$total,
|
||||
'completed' => (int)$completed,
|
||||
'pending' => (int)$pending,
|
||||
'offen' => (int)$offen,
|
||||
'terminisiert' => (int)$terminisiert,
|
||||
'issues' => (int)$issues,
|
||||
'interventionRate' => $total > 0 ? round(($issues / $total) * 100, 1) : 0,
|
||||
'avgCompletionDays' => $this->calculateAvgCompletionTime($db, $tenantCampaignIds),
|
||||
@@ -296,7 +296,7 @@ class WorkorderDashboardController extends TTCrud
|
||||
private function getEmptyDashboardData(): array
|
||||
{
|
||||
return [
|
||||
'kpis' => ['total' => 0, 'completed' => 0, 'pending' => 0, 'issues' => 0, 'interventionRate' => 0, 'avgCompletionDays' => null],
|
||||
'kpis' => ['total' => 0, 'offen' => 0, 'terminisiert' => 0, 'issues' => 0, 'interventionRate' => 0, 'avgCompletionDays' => null],
|
||||
'statusDistribution' => [], 'companyPerformance' => [], 'timeTrends' => [],
|
||||
'companyStatusCampaign' => [], 'interventionRates' => [], 'statusTransitions' => [],
|
||||
];
|
||||
|
||||
@@ -153,8 +153,8 @@ Vue.component('workorder-dashboard', {
|
||||
<div v-else class="dashboard-content">
|
||||
<div v-if="kpis" class="kpi-row">
|
||||
<wd-kpi-card title="Gesamt" :value="kpis.total || 0" icon="fas fa-clipboard-list" color="primary" />
|
||||
<wd-kpi-card title="Abgeschlossen" :value="kpis.completed || 0" icon="fas fa-check-circle" color="success" />
|
||||
<wd-kpi-card title="In Bearbeitung" :value="kpis.pending || 0" icon="fas fa-clock" color="warning" />
|
||||
<wd-kpi-card title="Offen" :value="kpis.offen || 0" icon="fas fa-folder-open" color="warning" />
|
||||
<wd-kpi-card title="Terminisiert" :value="kpis.terminisiert || 0" icon="fas fa-calendar-check" color="success" />
|
||||
<wd-kpi-card title="Problemrate" :value="kpis.interventionRate || 0" suffix="%" icon="fas fa-exclamation-triangle" color="danger" :subtitle="(kpis.issues || 0) + ' Probleme'" />
|
||||
<wd-kpi-card title="Ø Bearbeitungszeit" :value="kpis.avgCompletionDays || '-'" :suffix="kpis.avgCompletionDays ? ' Tage' : ''" icon="fas fa-hourglass-half" color="info" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user