{{ \App\Models\User::count() }}
Nombre total d'utilisateurs
@php // Get the current year model $currentYearModel = \App\Models\Annee::orderBy('annee', 'desc')->first(); $currentYearId = $currentYearModel ? $currentYearModel->id : null; // Get the actual values $totalCotisations = \App\Models\Cotisation::where(function($query) use ($currentYearId) { $query->where('annee', $currentYearId) ->orWhere('count_current_year', true); })->count(); // Count paid cotisations (status 1) $paidCotisations = \App\Models\Cotisation::where(function($query) use ($currentYearId) { $query->where('annee', $currentYearId) ->orWhere('count_current_year', true); })->where('statut_paiement', 1) ->count(); // Get amounts $paidAmount = \App\Models\Cotisation::where(function($query) use ($currentYearId) { $query->where('annee', $currentYearId) ->orWhere('count_current_year', true); })->where('statut_paiement', 1) ->sum('montant'); // Display the total amount echo number_format($paidAmount, 0, ',', ' ') . ' DH'; @endphp
Cotisations payées (année en cours)
@php $partialCotisations = \App\Models\Cotisation::where('annee', $currentYearId) ->where('statut_paiement', '3') ->count(); $partialPercentage = $totalCotisations > 0 ? round(($partialCotisations / $totalCotisations) * 100, 2) : 0; // Get the partial amount by summing montant_partiel $partialAmount = \App\Models\Cotisation::where('annee', $currentYearId) ->where('statut_paiement', '3') ->sum('montant_partiel'); // If no partial payments, get the regular montant instead if ($partialAmount === 0) { $partialAmount = \App\Models\Cotisation::where('annee', $currentYearId) ->where('statut_paiement', '3') ->sum('montant'); } @endphp {{ $partialPercentage }}% - {{ number_format($partialAmount, 0, '.', ' ') }} DH
Cotisations partiellement payées (année en cours)
@php $unpaidCotisations = \App\Models\Cotisation::where('annee', $currentYearId) ->where('statut_paiement', '2') ->count(); $unpaidPercentage = $totalCotisations > 0 ? round(($unpaidCotisations / $totalCotisations) * 100, 2) : 0; // Calculate unpaid amount using the actual amounts from the database $unpaidAmount = \App\Models\Cotisation::where('annee', $currentYearId) ->where('statut_paiement', '2') ->sum('montant'); // Add debug information Log::info('Unpaid Calculations:', [ 'unpaidCotisations' => $unpaidCotisations, 'unpaidAmount' => $unpaidAmount ]); @endphp {{ $unpaidPercentage }}% - {{ number_format($unpaidAmount, 0, '.', ' ') }} DH
Cotisations non payées (année en cours)
{{ \Spatie\Permission\Models\Role::where('name', 'adherent')->first()->users()->count() }}
Nombre des adherents
{{ \App\Models\User::whereNotNull('numero_chalet')->count() }}
Nombre chalet occupé
Chiffre d'affaires des charges par catégorie
@php
// Get all charge categories from Type model
$categories = \App\Models\Type::all();
$totalCharges = 0;
// Get the current year ID (based on the filter or default to most recent)
$yearId = $yearId ?? \App\Models\Annee::orderBy('annee', 'desc')->first()->id;
@endphp
@foreach($categories as $category)
@php
// Calculate sum for this category
$categorySum = \App\Models\Charge::where('rubrique', $category->nom)
->where('annee', $yearId)
->sum('montant');
// Add to total
$totalCharges += $categorySum;
// Determine icon, text color and background color based on category name
$textColor = 'text-white'; // White text for better contrast
$bgColor = match(strtolower($category->nom)) {
'charges annexes' => 'bg-blue-500 dark:bg-blue-600', // Blue
'divers' => 'bg-gray-500 dark:bg-gray-600', // Gray
'salaire' => 'bg-green-500 dark:bg-green-600', // Green
'plomberie' => 'bg-teal-500 dark:bg-teal-600', // Teal
'test' => 'bg-cyan-500 dark:bg-cyan-600', // Changed to Cyan
'frais de justice' => 'bg-violet-500 dark:bg-violet-600', // Changed to Violet
'amendis' => 'bg-amber-600 dark:bg-amber-700', // Changed to Amber
'carburant' => 'bg-rose-500 dark:bg-rose-600', // Changed to Deep Pink/Rose
'sécurité' => 'bg-indigo-500 dark:bg-indigo-600', // Indigo
'jardinage' => 'bg-lime-500 dark:bg-lime-600', // Lime Green
default => 'bg-gray-500 dark:bg-gray-600' // Default Gray
};
$icon = match(strtolower($category->nom)) {
'sécurité' => '',
'jardinage' => '',
'charges annexes' => '',
'divers' => '',
'salaire' => '',
'plomberie' => '',
'test' => '',
'frais de justice' => '',
'amendis' => '',
'carburant' => '',
default => '',
};
@endphp
@endforeach
{{ number_format($categorySum, 0, '.', ' ') }} DH
{{ $category->nom }}
{!! $icon !!}
{{ number_format($totalCharges, 0, '.', ' ') }} DH
Total des charges
Statistiques des cotisations
Cotisations récentes
Voir tout| Chalet | Adhérent | Montant | Date | Statut |
|---|---|---|---|---|
| {{ $cotisation->user->numero_chalet ?? 'N/A' }} | {{ $cotisation->user->name }} {{ $cotisation->user->lastname }} | {{ number_format($cotisation->montant, 0, '.', ' ') }} DH | {{ \Carbon\Carbon::parse($cotisation->date_paiement)->format('d/m/Y') }} | @if($cotisation->statut_paiement == 1) Payé @elseif($cotisation->statut_paiement == 3) Partiel @else Non payé @endif |