Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {ReservationComponent} from "./landlord/reservation/reservation.component
import { EmailVerifiedComponent } from './email-verified/email-verified.component';
import { PaymentSuccessComponent } from './tenant/payment-success/payment-success.component';
import { PaymentCancelComponent } from './tenant/payment-cancel/payment-cancel.component';
import { LandlordDashboardComponent } from './landlord/landlord-dashboard/landlord-dashboard.component';

export const routes: Routes = [
{
Expand Down Expand Up @@ -49,5 +50,11 @@ export const routes: Routes = [
{
path: 'payment-cancel',
component: PaymentCancelComponent
}
},
{
path: 'landlord/dashboard',
component: LandlordDashboardComponent,
canActivate: [authorityRouteAccess],
data: { authorities: ['ROLE_LANDLORD'] }
},
];
129 changes: 129 additions & 0 deletions src/app/landlord/landlord-dashboard/landlord-dashboard.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<div class="dashboard-container">

<!-- Header -->
<div class="dashboard-header">
<h1>🏠 Dashboard Propriétaire</h1>
<button class="btn-refresh" (click)="loadDashboard()">
🔄 Actualiser
</button>
</div>

<!-- Loading -->
<div *ngIf="loading" class="loading">
<div class="spinner"></div>
<p>Chargement du dashboard...</p>
</div>

<!-- Error -->
<div *ngIf="error && !loading" class="error">
<p>❌ {{ error }}</p>
<button (click)="loadDashboard()">Réessayer</button>
</div>

<!-- Dashboard Content -->
<div *ngIf="dashboard && !loading">

<!-- Stats Globales -->
<div class="global-stats">



<div class="stat-card properties">
<div class="icon">🏠</div>
<div class="info">
<h2>{{ dashboard.totalProperties }}</h2>
<p>Propriétés</p>
</div>
</div>

<div class="stat-card bookings">
<div class="icon">📅</div>
<div class="info">
<h2>{{ dashboard.totalActiveBookings }}</h2>
<p>Réservations Actives</p>
</div>
</div>

</div>

<!-- Statut des Paiements -->
<div class="section">
<h2>💳 Statut des Paiements</h2>
<div class="payment-grid">

<div class="payment-card pending">
<div class="payment-icon">⏳</div>
<div class="payment-info">
<h3>{{ dashboard.paymentStatus.totalPendingPayments }}</h3>
<p>En attente</p>
<span class="amount">{{ dashboard.paymentStatus.pendingAmount }} MAD</span>
</div>
</div>

<div class="payment-card completed">
<div class="payment-icon">✅</div>
<div class="payment-info">
<h3>{{ dashboard.paymentStatus.totalCompletedPayments }}</h3>
<p>Complétés</p>
<span class="amount">{{ dashboard.paymentStatus.completedAmount }} MAD</span>
</div>
</div>

<div class="payment-card failed">
<div class="payment-icon">❌</div>
<div class="payment-info">
<h3>{{ dashboard.paymentStatus.totalFailedPayments }}</h3>
<p>Échoués</p>
</div>
</div>

</div>
</div>

<!-- Disponibilité des Propriétés -->
<div class="section">
<h2>🏡 Mes Propriétés</h2>

<div *ngIf="dashboard.properties.length === 0" class="empty">
<p>😔 Aucune propriété trouvée</p>
<a routerLink="/landlord">Ajouter une propriété</a>
</div>

<div class="properties-grid" *ngIf="dashboard.properties.length > 0">
<div *ngFor="let property of dashboard.properties" class="property-card">

<!-- Image -->
<div class="property-image">
<img [src]="property.coverUrl || 'assets/images/placeholder.jpg'"
[alt]="property.title">

<!-- Détails -->
<div class="property-details">
<h3>{{ property.title }}</h3>

<div class="property-stats">
<div class="stat">
<span class="icon">📅</span>
<span>{{ property.totalBookings }} réservations</span>
</div>
<div class="stat">
<span class="icon">✅</span>
<span>{{ property.availableDays }} jours disponibles</span>
</div>
</div>

<div *ngIf="property.nextCheckIn" class="next-checkin">
🗓️ Prochain check-in : {{ property.nextCheckIn | date:'dd/MM/yyyy' }}
</div>

<div class="status-badge" [ngClass]="getStatusClass(property.status)">
{{ getStatusLabel(property.status) }}
</div>
</div>

</div>
</div>
</div>

</div>
</div>
Loading