From 1058fb0a7e17abc84acae5541f818960b450c93b Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Wed, 30 Mar 2022 15:29:11 +0200 Subject: [PATCH] Factorisation detail BU et Agence + refacto Agence --- src/app/app.module.ts | 5 ++- .../agence-detail.component.html | 8 +++++ .../agence-detail.component.scss | 0 .../agence-detail/agence-detail.component.ts | 31 +++++++++++++++++ .../agence-edit/agence-edit.component.html | 15 +-------- .../components/agence/agence.component.html | 9 +---- .../businessunit-detail.component.html | 33 ++++++++++--------- .../businessunit/businessunit.component.html | 21 +----------- 8 files changed, 64 insertions(+), 58 deletions(-) create mode 100644 src/app/components/agence/agence-detail/agence-detail.component.html create mode 100644 src/app/components/agence/agence-detail/agence-detail.component.scss create mode 100644 src/app/components/agence/agence-detail/agence-detail.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index bd579cf..3204ce7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -15,6 +15,7 @@ import { CollaborateurDetailComponent } from './components/collaborateur/collabo import { BusinessunitComponent } from './components/businessunit/businessunit.component'; import { BusinessunitEditComponent } from './components/businessunit/businessunit-edit/businessunit-edit.component'; import { BusinessunitDetailComponent } from './components/businessunit/businessunit-detail/businessunit-detail.component'; +import { AgenceDetailComponent } from './components/agence/agence-detail/agence-detail.component'; @NgModule({ declarations: [ @@ -24,10 +25,12 @@ import { BusinessunitDetailComponent } from './components/businessunit/businessu HomeComponent, AgenceComponent, AgenceEditComponent, + AgenceDetailComponent, CollaborateurDetailComponent, BusinessunitComponent, BusinessunitEditComponent, - BusinessunitDetailComponent + BusinessunitDetailComponent, + ], imports: [ BrowserModule, diff --git a/src/app/components/agence/agence-detail/agence-detail.component.html b/src/app/components/agence/agence-detail/agence-detail.component.html new file mode 100644 index 0000000..01ffc21 --- /dev/null +++ b/src/app/components/agence/agence-detail/agence-detail.component.html @@ -0,0 +1,8 @@ +
+ +
+ + + +
+
diff --git a/src/app/components/agence/agence-detail/agence-detail.component.scss b/src/app/components/agence/agence-detail/agence-detail.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/agence/agence-detail/agence-detail.component.ts b/src/app/components/agence/agence-detail/agence-detail.component.ts new file mode 100644 index 0000000..a06a442 --- /dev/null +++ b/src/app/components/agence/agence-detail/agence-detail.component.ts @@ -0,0 +1,31 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {Agence} from "../../../interfaces/agence"; +import {HttpClient} from "@angular/common/http"; +import {AgenceService} from "../../../services/agence.service"; +@Component({ + selector: 'app-agence-detail', + templateUrl: './agence-detail.component.html', + styleUrls: ['./agence-detail.component.scss'] +}) +export class AgenceDetailComponent implements OnInit { + + agences : Agence[] = []; + @Input() + agence = {} as Agence ; + + constructor( + private http : HttpClient, + private agenceService: AgenceService, + ) { } + + ngOnInit(): void { + this.getAgences(); + this.getAgences(); + } + + getAgences():void { + this.agenceService.getAgences() + .subscribe(agences => this.agences = agences); + } + +} diff --git a/src/app/components/agence/agence-edit/agence-edit.component.html b/src/app/components/agence/agence-edit/agence-edit.component.html index 0ecfe31..77428c1 100644 --- a/src/app/components/agence/agence-edit/agence-edit.component.html +++ b/src/app/components/agence/agence-edit/agence-edit.component.html @@ -3,21 +3,8 @@

{{agence.name | uppercase}}

id : {{agence.id}}
-
-
- - - - - - - -
Name
- -
-
-
+ diff --git a/src/app/components/agence/agence.component.html b/src/app/components/agence/agence.component.html index bf84f77..e219d51 100644 --- a/src/app/components/agence/agence.component.html +++ b/src/app/components/agence/agence.component.html @@ -21,14 +21,7 @@

Ajouter une agence :

-
- -
- - - -
-
+