You've already forked Atomcms-edit
refactor: extract inline HTML rendering to Blade components
- Create 12 Blade components for Commandocentrum views - Reduce Commandocentrum from 1679 to 1192 lines (-29%) - Move server-info, hotel-status, alert-form, emulator-info/settings/status - Move nitro-settings/status, backups-list, clothing-status, staff-activity, update-history - Improve separation of concerns between controller logic and view rendering
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
@props(['activities'])
|
||||
|
||||
@php
|
||||
use App\Models\StaffActivity;
|
||||
@endphp
|
||||
|
||||
@if ($activities->isEmpty())
|
||||
<div style="text-align:center;padding:40px;color:#9ca3af;">
|
||||
<svg width="48" height="48" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="margin:0 auto 16px;opacity:0.5;">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<p>No staff activities recorded yet.</p>
|
||||
<p style="font-size:12px;margin-top:8px;">Staff actions will appear here automatically.</p>
|
||||
</div>
|
||||
@else
|
||||
<div style="background:#fff;border:1px solid #e2e8f0;border-radius:12px;overflow:hidden;">
|
||||
<div style="padding:16px;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center;">
|
||||
<span style="font-weight:600;color:#1e293b;">Recent Staff Activities</span>
|
||||
<span style="font-size:12px;color:#9ca3af;">Last 20 actions</span>
|
||||
</div>
|
||||
<div style="max-height:400px;overflow-y:auto;">
|
||||
@foreach ($activities as $activity)
|
||||
@php
|
||||
$icon = StaffActivity::getActionIcon($activity->action);
|
||||
$timeAgo = '';
|
||||
try {
|
||||
$carbon = \Carbon\Carbon::parse($activity->created_at);
|
||||
$now = \Carbon\Carbon::now();
|
||||
$diff = $now->diffInMinutes($carbon);
|
||||
if ($diff < 1) {
|
||||
$timeAgo = 'Just now';
|
||||
} elseif ($diff < 60) {
|
||||
$timeAgo = $diff . 'm ago';
|
||||
} elseif ($diff < 1440) {
|
||||
$timeAgo = floor($diff / 60) . 'h ago';
|
||||
} else {
|
||||
$timeAgo = floor($diff / 1440) . 'd ago';
|
||||
}
|
||||
} catch (\Exception) {
|
||||
$timeAgo = 'Unknown';
|
||||
}
|
||||
$username = $activity->user->username ?? 'Unknown';
|
||||
@endphp
|
||||
<div style="display:flex;align-items:center;gap:12px;padding:12px;border-bottom:1px solid #e2e8f0;">
|
||||
<div style="width:36px;height:36px;border-radius:50%;background:#f1f5f9;display:flex;align-items:center;justify-content:center;font-size:18px;">
|
||||
{{ $icon }}
|
||||
</div>
|
||||
<div style="flex:1;">
|
||||
<div style="font-weight:600;color:#1e293b;font-size:14px;">{{ e($username) }}</div>
|
||||
<div style="color:#64748b;font-size:12px;">{{ e($activity->description) }}</div>
|
||||
</div>
|
||||
<div style="text-align:right;">
|
||||
<span style="font-size:11px;color:#9ca3af;">{{ $timeAgo }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
Reference in New Issue
Block a user