@extends('admin.admin_master')
@section('admin')
<div class="page-content">
    <div class="container-fluid">
        <h2 class="mb-4">My Dashboard</h2>
        <div class="row">
            <div class="col-md-6">
                <div class="card shadow">
                    <div class="card-header bg-primary text-white">My Workflows</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($myWorkflows as $wf)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $wf->name }}</span>
                                    <span class="badge bg-secondary">{{ $wf->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                        <a href="{{ route('workflow.myworkflow') }}" class="btn btn-primary btn-sm mt-3">View My Workflows</a>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card shadow">
                    <div class="card-header bg-success text-white">My Folders</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($myFolders as $folder)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $folder->name }}</span>
                                    <span class="badge bg-info">{{ $folder->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                        <a href="{{ route('folders.my') }}" class="btn btn-success btn-sm mt-3">View My Folders</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="row mt-4">
            <div class="col-md-12">
                <div class="card shadow">
                    <div class="card-header bg-info text-white">My Pending Tasks</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($myTasks as $task)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $task->workflow->name ?? '-' }} - {{ $task->status }}</span>
                                    <span class="badge bg-warning">{{ $task->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                        <a href="{{ route('workflow.myworkflow') }}" class="btn btn-info btn-sm mt-3">Go to My Tasks</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
