<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Liste des Projets - Association Sénégalaise de la Valls Icamp</title>
    <style>
        @page {
            margin: 30px;
        }

        body {
            font-family: 'Helvetica', sans-serif;
            color: #000;
            margin: 0;
            padding: 0;
        }

        .title-container {
            text-align: center;
            margin-bottom: 30px;
        }

        .main-title {
            font-size: 18px;
            font-weight: bold;
            text-transform: uppercase;
            text-decoration: underline;
        }

        .sub-title {
            font-size: 14px;
            margin-top: 5px;
            font-weight: bold;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            border: 1px solid #000;
            padding: 8px 10px;
            text-align: left;
        }

        th {
            background-color: #fff;
            font-weight: bold;
            text-transform: uppercase;
            font-size: 14px;
        }

        td {
            font-size: 12px;
        }

        .project-name {
            font-weight: bold;
        }
    </style>
</head>

<body>
    <div class="title-container">
        <div class="main-title">Association Sénégalaise de la Valls Icamp</div>
        <div class="sub-title">Liste des Projets - {{ date('d/m/Y') }}</div>
    </div>

    <table>
        <thead>
            <tr>
                <th style="width: 25%;">Projet</th>
                <th style="width: 15%;">Montant</th>
                <th style="width: 15%;">Fréquence</th>
                <th style="width: 15%;">Début</th>
                <th style="width: 15%;">Fin</th>
                <th style="width: 10%;">Membres</th>
                <th style="width: 10%;">Statut</th>
            </tr>
        </thead>
        <tbody>
            @foreach($projects as $project)
                <tr>
                    <td class="project-name">{{ $project->name }}</td>
                    <td>{{ number_format($project->amount, 0, ',', ' ') }}
                        {{ \App\Models\Setting::get('currency', 'FCFA') }}
                    </td>
                    <td style="text-transform: capitalize;">{{ $project->frequency }}</td>
                    <td>{{ $project->start_date->format('d/m/Y') }}</td>
                    <td>{{ $project->end_date ? $project->end_date->format('d/m/Y') : '-' }}</td>
                    <td style="text-align: center;">{{ $project->members->count() }}</td>
                    <td style="text-align: center; text-transform: capitalize;">{{ $project->status }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>
</body>

</html>