14-04-2026
This commit is contained in:
parent
f58c709945
commit
0f82fea88a
72 changed files with 7414 additions and 148 deletions
74
dev/payment-dashboard/app/Models/PaymentIncident.php
Normal file
74
dev/payment-dashboard/app/Models/PaymentIncident.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class PaymentIncident extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'title', 'description', 'provider', 'type', 'status',
|
||||
'severity', 'affected_orders', 'affected_revenue',
|
||||
'detected_at', 'resolved_at', 'ticket_number',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'detected_at' => 'datetime',
|
||||
'resolved_at' => 'datetime',
|
||||
'affected_revenue' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function activities(): HasMany
|
||||
{
|
||||
return $this->hasMany(IncidentActivity::class, 'incident_id');
|
||||
}
|
||||
|
||||
public function getDurationAttribute(): string
|
||||
{
|
||||
$end = $this->resolved_at ?? now();
|
||||
$diff = $this->detected_at->diff($end);
|
||||
if ($diff->days > 0) {
|
||||
return $diff->days.'d '.$diff->h.'h';
|
||||
}
|
||||
if ($diff->h > 0) {
|
||||
return $diff->h.'h '.$diff->i.'min';
|
||||
}
|
||||
|
||||
return $diff->i.' min';
|
||||
}
|
||||
|
||||
public function getSeverityColorAttribute(): string
|
||||
{
|
||||
return match ($this->severity) {
|
||||
'critical' => '#ef4444',
|
||||
'high' => '#f97316',
|
||||
'medium' => '#eab308',
|
||||
'low' => '#22c55e',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
public function getStatusLabelAttribute(): string
|
||||
{
|
||||
return match ($this->status) {
|
||||
'open' => 'Offen',
|
||||
'in_progress' => 'In Bearbeitung',
|
||||
'waiting_provider' => 'Wartet auf Anbieter',
|
||||
'resolved' => 'Gelöst',
|
||||
'closed' => 'Geschlossen',
|
||||
default => $this->status,
|
||||
};
|
||||
}
|
||||
|
||||
public function getProviderLabelAttribute(): string
|
||||
{
|
||||
return match ($this->provider) {
|
||||
'payone' => 'PAYONE',
|
||||
'stripe' => 'Stripe',
|
||||
'paypal' => 'PayPal',
|
||||
'mollie' => 'Mollie',
|
||||
default => 'Sonstige',
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue