Fix audit logs and issue reports pages, rename Issues to Tasks
修復稽核日誌與任務報表頁面,並將「問題」改名為「任務」 ## Changes 變更內容 ### Bug Fixes 錯誤修復 1. Fixed audit logs page 500 error - Added missing $auditableTypes variable to controller - Changed $events to $actions in view - Added description and ip_address columns to audit_logs table - Updated AuditLog model fillable array 2. Fixed issue reports page SQLite compatibility errors - Replaced MySQL NOW() function with Laravel now() helper - Replaced TIMESTAMPDIFF() with PHP-based date calculation - Fixed request->date() default value handling ### Feature Changes 功能變更 3. Renamed "Issues" terminology to "Tasks" throughout the system - Updated navigation menus (Admin: Issues → Admin: Tasks) - Updated all issue-related views to use task terminology - Changed Chinese labels from "問題" to "任務" - Updated dashboard, issue tracker, and reports pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,8 @@ class IssueReportsController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
// Date range filter (default: last 30 days)
|
||||
$startDate = $request->date('start_date', now()->subDays(30));
|
||||
$endDate = $request->date('end_date', now());
|
||||
$startDate = $request->date('start_date') ?? now()->subDays(30);
|
||||
$endDate = $request->date('end_date') ?? now();
|
||||
|
||||
// Overview Statistics
|
||||
$stats = [
|
||||
@@ -63,11 +63,12 @@ class IssueReportsController extends Controller
|
||||
->get();
|
||||
|
||||
// Assignee Performance
|
||||
$now = now();
|
||||
$assigneePerformance = User::select('users.id', 'users.name')
|
||||
->leftJoin('issues', 'users.id', '=', 'issues.assigned_to_user_id')
|
||||
->selectRaw('count(issues.id) as total_assigned')
|
||||
->selectRaw('sum(case when issues.status = ? then 1 else 0 end) as completed', [Issue::STATUS_CLOSED])
|
||||
->selectRaw('sum(case when issues.due_date < NOW() and issues.status != ? then 1 else 0 end) as overdue', [Issue::STATUS_CLOSED])
|
||||
->selectRaw('sum(case when issues.due_date < ? and issues.status != ? then 1 else 0 end) as overdue', [$now, Issue::STATUS_CLOSED])
|
||||
->groupBy('users.id', 'users.name')
|
||||
->having('total_assigned', '>', 0)
|
||||
->orderByDesc('total_assigned')
|
||||
@@ -101,9 +102,15 @@ class IssueReportsController extends Controller
|
||||
->get();
|
||||
|
||||
// Average Resolution Time (days)
|
||||
$avgResolutionTime = Issue::whereNotNull('closed_at')
|
||||
->selectRaw('avg(TIMESTAMPDIFF(DAY, created_at, closed_at)) as avg_days')
|
||||
->value('avg_days');
|
||||
$closedIssues = Issue::whereNotNull('closed_at')
|
||||
->select('created_at', 'closed_at')
|
||||
->get();
|
||||
|
||||
$avgResolutionTime = $closedIssues->isNotEmpty()
|
||||
? $closedIssues->avg(function ($issue) {
|
||||
return $issue->created_at->diffInDays($issue->closed_at);
|
||||
})
|
||||
: null;
|
||||
|
||||
// Recent Activity (last 10 issues)
|
||||
$recentIssues = Issue::with(['creator', 'assignee'])
|
||||
|
||||
Reference in New Issue
Block a user