detail on course
This commit is contained in:
16
src/app/dashboard/pages/gain-details/gain-details.css
Normal file
16
src/app/dashboard/pages/gain-details/gain-details.css
Normal file
@@ -0,0 +1,16 @@
|
||||
/* Cohesive styles for gain-details */
|
||||
.space-y-4 > * + * { margin-top: 1rem; }
|
||||
.text-muted { color: var(--muted-foreground, #6b7280); }
|
||||
.bg-accent { background-color: var(--accent, #f3f4f6); }
|
||||
.p-2 { padding: 0.5rem; }
|
||||
.p-3 { padding: 0.75rem; }
|
||||
.p-4 { padding: 1rem; }
|
||||
.rounded-md { border-radius: 0.375rem; }
|
||||
.border { border: 1px solid var(--border, #e5e7eb); }
|
||||
.font-medium { font-weight: 600; }
|
||||
|
||||
/* Responsive tweaks */
|
||||
@media (min-width: 768px) {
|
||||
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
||||
}
|
||||
|
||||
65
src/app/dashboard/pages/gain-details/gain-details.html
Normal file
65
src/app/dashboard/pages/gain-details/gain-details.html
Normal file
@@ -0,0 +1,65 @@
|
||||
@if(detail()){
|
||||
<div class="space-y-4">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-2xl font-semibold">Détails du gain — Course n° {{ detail()!.course.numero }}</h2>
|
||||
<div class="flex items-center gap-2">
|
||||
<a z-button routerLink="/gains" zType="ghost"><i class="icon-arrow-left mr-2"></i>Retour</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<z-card class="p-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-3 text-sm">
|
||||
<div>
|
||||
<span class="font-medium">Date:</span>
|
||||
{{ detail()!.course.reunionDate | date : 'dd/MM/yyyy' }}
|
||||
</div>
|
||||
<div><span class="font-medium">Nom:</span> {{ detail()!.course.nom }}</div>
|
||||
<div><span class="font-medium">Montant cagnotte:</span> {{ detail()!.montantCagnotte | number : '1.0-0' : 'fr-FR' }} CFA</div>
|
||||
<div><span class="font-medium">Montant à rembourser:</span> {{ detail()!.montantARembourser | number : '1.0-0' : 'fr-FR' }} CFA</div>
|
||||
</div>
|
||||
</z-card>
|
||||
|
||||
@if(detail()!.formules && detail()!.formules.length > 0) {
|
||||
<div class="space-y-4">
|
||||
@for (f of detail()!.formules; track f.id || $index) {
|
||||
<z-card class="p-3">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<div class="text-sm font-medium">Formule: {{ f.gains }} — {{ f.typeFormule }}</div>
|
||||
<div class="text-sm text-muted">Type pari: {{ f.typePari }}</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-2 text-sm mb-3">
|
||||
<div><span class="font-medium">Masse initiale:</span> {{ f.masseInitiale | number }}</div>
|
||||
<div><span class="font-medium">Masse après prélèvements:</span> {{ f.masseApresPrelevements | number }}</div>
|
||||
<div><span class="font-medium">Masse finale:</span> {{ f.masseFinale | number }}</div>
|
||||
<div><span class="font-medium">Total gagnants:</span> {{ f.totalGagnants }}</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-md border overflow-hidden">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-accent">
|
||||
<tr>
|
||||
<th class="text-left p-2">Libellé</th>
|
||||
<th class="text-left p-2">Rapport</th>
|
||||
<th class="text-left p-2">Nombre gagnants</th>
|
||||
<th class="text-left p-2">Masse partagée</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (r of f.rapportsDetails; track r.id || $index) {
|
||||
<tr class="border-t">
|
||||
<td class="p-2">{{ r.libelle }}</td>
|
||||
<td class="p-2">{{ r.rapport }}</td>
|
||||
<td class="p-2">{{ r.nombreGagnants }}</td>
|
||||
<td class="p-2">{{ r.massePartageeRang | number }}</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</z-card>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
23
src/app/dashboard/pages/gain-details/gain-details.spec.ts
Normal file
23
src/app/dashboard/pages/gain-details/gain-details.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GainDetails } from './gain-details';
|
||||
|
||||
describe('GainDetails', () => {
|
||||
let component: GainDetails;
|
||||
let fixture: ComponentFixture<GainDetails>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [GainDetails]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(GainDetails);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
37
src/app/dashboard/pages/gain-details/gain-details.ts
Normal file
37
src/app/dashboard/pages/gain-details/gain-details.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
||||
import { ActivatedRoute, RouterModule, Router } from '@angular/router';
|
||||
import { ZardCardComponent } from '@shared/components/card/card.component';
|
||||
import { ZardButtonComponent } from '@shared/components/button/button.component';
|
||||
import { Gain } from 'src/app/core/services/gain';
|
||||
import { ResultatCagnotte } from 'src/app/core/interfaces/gain';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-gain-details',
|
||||
templateUrl: './gain-details.html',
|
||||
styleUrl: './gain-details.css',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [CommonModule, RouterModule, ZardCardComponent, ZardButtonComponent],
|
||||
})
|
||||
export class GainDetails {
|
||||
detail = signal<ResultatCagnotte | undefined>(undefined);
|
||||
|
||||
constructor(private route: ActivatedRoute, private api: Gain, private router: Router) {
|
||||
const id = this.route.snapshot.params['id'];
|
||||
if (!id) {
|
||||
// nothing to show, go back
|
||||
this.router.navigate(['/gains']);
|
||||
return;
|
||||
}
|
||||
|
||||
this.api.getById(String(id)).subscribe((d) => {
|
||||
console.log(d);
|
||||
this.detail.set(d);
|
||||
});
|
||||
}
|
||||
|
||||
goBack() {
|
||||
this.router.navigate(['/gains']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user