@extends('layouts.app') @section('title', 'অ্যাক্টিভিটি লগ') @php $logLabels = [ 'meal_date' => 'তারিখ', 'status' => 'স্ট্যাটাস', 'meal_count' => 'মিল সংখ্যা', 'dining_location' => 'খাওয়ার স্থান', 'expense_date' => 'তারিখ', 'grocery_cost' => 'বাজার খরচ', 'fresh_market_cost' => 'তরকারি', 'gas_bill' => 'গ্যাস বিল', 'fish_meat_cost' => 'মাছ-মাংস', 'other_cost' => 'অন্যান্য', 'menu_date' => 'তারিখ', 'menu_details' => 'মেনু বিবরণ', 'user_id' => 'ইউজার আইডি', 'amount' => 'পরিমাণ', 'deposit_date' => 'তারিখ', 'notes' => 'নোট', 'company_id' => 'কার্ড নং', 'name' => 'নাম', 'department' => 'ডিপার্টমেন্ট', 'designation' => 'ডিজাইনেশন', 'mobile' => 'মোবাইল', 'room' => 'খাওয়ার স্থান', 'role' => 'রোল', 'password' => 'পাসওয়ার্ড', 'key' => 'সেটিং কী', 'value' => 'মান', 'emp_id' => 'এমপ্লয়ি আইডি', 'erp_code' => 'ERP কোড', 'unit' => 'ইউনিট', 'sub_unit' => 'সাব-ইউনিট', 'date_of_join' => 'জয়েনিং ডেট', 'emp_category' => 'ক্যাটাগরি', 'shift_in_time' => 'শিফট', ]; $valueFormatter = function ($value) { if (is_array($value)) { $value = json_encode($value, JSON_UNESCAPED_UNICODE); } $value = (string) $value; $map = [ 'on' => 'খেয়েছে', 'off' => 'খায়নি', 'Dining' => 'ডাইনিং', 'Canteen' => 'ক্যান্টিন', 'Desk' => 'ডেস্ক', 'active' => 'অ্যাক্টিভ', 'inactive' => 'নিষ্ক্রিয়', 'member' => 'সদস্য', 'manager' => 'ম্যানেজার', 'superadmin' => 'সুপার এডমিন', '1' => 'সক্রিয়', '0' => 'নিষ্ক্রিয়', ]; return $map[$value] ?? $value; }; $formatLogData = function ($data) use ($logLabels, $valueFormatter) { if (empty($data)) { return []; } $out = []; foreach ($data as $k => $v) { if ($k === 'password') { $v = '••••••••'; } else { $v = $valueFormatter($v); } $label = $logLabels[$k] ?? $k; $out[] = e($label . ': ' . $v); } return $out; }; $roleLabel = function ($role) { switch ($role) { case 'superadmin': return 'সুপার এডমিন'; case 'manager': return 'ম্যানেজার'; case 'member': return 'সদস্য'; default: return $role; } }; $filterQuery = http_build_query(array_filter($filters, fn ($v) => $v !== '')); $restoreBack = '/admin/activity-log' . ($filterQuery !== '' ? '?' . $filterQuery : ''); $actionMeta = function (string $action): array { switch ($action) { case 'insert': return ['badge-hue' => 'badge-success', 'icon' => 'fa-plus-circle']; case 'update': return ['badge-hue' => 'badge-warning', 'icon' => 'fa-pen']; case 'delete': return ['badge-hue' => 'badge-danger', 'icon' => 'fa-trash-alt']; case 'restore': return ['badge-hue' => 'badge-info', 'icon' => 'fa-undo']; default: return ['badge-hue' => 'badge-primary', 'icon' => 'fa-history']; } }; @endphp @section('content')
ড্যাশবোর্ড
শুধুমাত্র সুপার এডমিনের জন্য — প্রতিটি এন্ট্রি (সংযোজন/আপডেট/ডিলিট) এর ইতিহাস এখানে সংরক্ষিত হয়
ফিল্টার
রিসেট
অ্যাক্টিভিটি লগ — মোট {{ count($logs) }}টি এন্ট্রি
@if (\App\Services\Feature::isActive('excel_export') && (!\App\Services\Feature::isSuperAdminOnly('excel_export') || ($currentUser->role ?? '') === 'superadmin')) এক্সেল ডাউনলোড @endif
@if (empty($logs)) @else @foreach ($logs as $log) @php $oldLines = $formatLogData(is_array($log['old_data'] ?? null) ? $log['old_data'] : json_decode((string) ($log['old_data'] ?? ''), true)); $newLines = $formatLogData(is_array($log['new_data'] ?? null) ? $log['new_data'] : json_decode((string) ($log['new_data'] ?? ''), true)); $action = (string) $log['action']; $actionUi = $actionMeta($action); $actorName = (string) $log['actor_name']; $actorRole = (string) $log['actor_role']; $actorInitial = strtoupper(mb_substr(trim($actorName), 0, 1)) ?: '?'; $actorAvatar = $actorRole === 'superadmin' ? 'avatar-red' : ($actorRole === 'manager' ? 'avatar-orange' : 'avatar-blue'); @endphp @endforeach @endif
সময় সম্পাদক কর্ম পেজ রেকর্ড আইডি কার্ড নং পরিবর্তনের বিবরণ আনবার ফেরত
কোনো অ্যাক্টিভিটি লগ পাওয়া যায়নি।
{{ date('d M Y, H:i:s', strtotime($log['created_at'])) }}
{{ $actorName ?: 'সিস্টেম' }} {{ $roleLabel($actorRole) }}
{{ \App\Models\ActivityLog::actionLabel($action) }} {{ \App\Models\ActivityLog::tableLabel((string) $log['table_name']) }} {{ (int) $log['record_id'] > 0 ? (int) $log['record_id'] : '—' }} {{ (string) $log['card_id'] ?: '—' }} @if ($action === 'insert' && $newLines)
নতুন{!! implode('', array_map(fn ($l) => '' . $l . '', $newLines)) !!}
@elseif ($action === 'update') @if ($oldLines)
আগে{!! implode('', array_map(fn ($l) => '' . $l . '', $oldLines)) !!}
@endif @if ($newLines)
এখন{!! implode('', array_map(fn ($l) => '' . $l . '', $newLines)) !!}
@endif @elseif ($action === 'delete' && $oldLines)
ডিলিট হওয়া ডেটা{!! implode('', array_map(fn ($l) => '' . $l . '', $oldLines)) !!}
@endif
{{ (string) $log['ip_address'] ?: '—' }}
@if (\App\Models\ActivityLog::restoreSupported((string) $log['table_name']) && \App\Models\ActivityLog::supportedAction($action)) @php $restoreLabel = $action === 'insert' ? 'মুছুন (undo)' : 'ফেরত আনুন'; @endphp
@csrf
@else — @endif
@endsection