diff --git a/src/app/app.component.html b/src/app/app.component.html
index 507b697..b746eb1 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -61,13 +61,13 @@
Home
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 c13221a..b876226 100644
--- a/src/app/components/agence/agence-edit/agence-edit.component.html
+++ b/src/app/components/agence/agence-edit/agence-edit.component.html
@@ -14,6 +14,17 @@
+
+
diff --git a/src/app/components/agence/agence-edit/agence-edit.component.ts b/src/app/components/agence/agence-edit/agence-edit.component.ts
index a899027..c6ab958 100644
--- a/src/app/components/agence/agence-edit/agence-edit.component.ts
+++ b/src/app/components/agence/agence-edit/agence-edit.component.ts
@@ -4,6 +4,8 @@ import {ActivatedRoute} from "@angular/router";
import {AgenceService} from "../../../services/agence.service";
import {Location} from "@angular/common";
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+import {Businessunit} from "../../../interfaces/businessunit";
+import {BusinessunitService} from "../../../services/businessunit.service";
@Component({
selector: 'app-agence-edit',
@@ -11,7 +13,9 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
styleUrls: ['./agence-edit.component.scss']
})
export class AgenceEditComponent implements OnInit {
- agence = {} as Agence ;
+ agence = {} as Agence;
+ businessUnits : Businessunit[] = [];
+ businessUnit = {} as Businessunit ;
registerForm!: FormGroup;
submitted = false;
@@ -19,14 +23,17 @@ export class AgenceEditComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private agenceService: AgenceService,
+ private businessUnitService: BusinessunitService,
private location: Location,
private formBuilder: FormBuilder
) { }
ngOnInit(): void {
+ this.getBusinessUnits()
this.getAgence()
this.registerForm = this.formBuilder.group({
- name: ['', Validators.required]
+ name: ['', Validators.required],
+ businessUnitId:['',Validators.required]
});
}
@@ -64,5 +71,9 @@ export class AgenceEditComponent implements OnInit {
this.submitted = false;
this.registerForm.reset();
}
+ getBusinessUnits():void {
+ this.businessUnitService.getBusinessunits()
+ .subscribe(businessunits => this.businessUnits = businessunits);
+ }
}
diff --git a/src/app/components/agence/agence.component.html b/src/app/components/agence/agence.component.html
index d4af2fa..6e44397 100644
--- a/src/app/components/agence/agence.component.html
+++ b/src/app/components/agence/agence.component.html
@@ -12,6 +12,17 @@
+
+
diff --git a/src/app/components/agence/agence.component.ts b/src/app/components/agence/agence.component.ts
index 4a00db4..4dd6963 100644
--- a/src/app/components/agence/agence.component.ts
+++ b/src/app/components/agence/agence.component.ts
@@ -3,6 +3,8 @@ import {Agence} from "../../interfaces/agence";
import {HttpClient} from "@angular/common/http";
import {AgenceService} from "../../services/agence.service";
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+import {Businessunit} from "../../interfaces/businessunit";
+import {BusinessunitService} from "../../services/businessunit.service";
@Component({
selector: 'app-agence',
@@ -11,7 +13,9 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
})
export class AgenceComponent implements OnInit {
agences : Agence[] = [];
- agence = {} as Agence ;
+ agence = {} as Agence;
+ businessUnits : Businessunit[] = [];
+ businessUnit = {} as Businessunit ;
registerForm!: FormGroup;
submitted = false;
@@ -19,13 +23,16 @@ export class AgenceComponent implements OnInit {
constructor(
private http : HttpClient,
private agenceService: AgenceService,
+ private businessUnitService: BusinessunitService,
private formBuilder: FormBuilder
) { }
ngOnInit(): void {
this.getAgences();
+ this.getBusinessUnits();
this.registerForm = this.formBuilder.group({
- name: ['', Validators.required]
+ name: ['', Validators.required],
+ businessUnitId: ['',Validators.required]
});
}
@@ -34,6 +41,11 @@ export class AgenceComponent implements OnInit {
.subscribe(agences => this.agences = agences);
}
+ getBusinessUnits() {
+ this.businessUnitService.getBusinessunits()
+ .subscribe(businessunits => this.businessUnits = businessunits);
+ }
+
add(agence: Agence): void {
this.agenceService.addAgence(agence)
.subscribe(agence => {
@@ -47,7 +59,8 @@ export class AgenceComponent implements OnInit {
if (this.registerForm.invalid) {
return;
}
- this.agence = this.registerForm.value
+ this.agence.name = this.registerForm.value.name
+ this.agence.businessUnitId = this.registerForm.value.businessUnitId
this.add(this.agence)
}
@@ -58,4 +71,5 @@ export class AgenceComponent implements OnInit {
this.registerForm.reset();
}
+
}
diff --git a/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.html b/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.html
index 177ad32..d7bf37e 100644
--- a/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.html
+++ b/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.html
@@ -14,17 +14,6 @@
-
-
diff --git a/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.ts b/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.ts
index 22d4d31..ba03376 100644
--- a/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.ts
+++ b/src/app/components/businessunit/businessunit-edit/businessunit-edit.component.ts
@@ -34,8 +34,7 @@ export class BusinessunitEditComponent implements OnInit {
this.getBusinessunit();
this.getAgences();
this.registerForm = this.formBuilder.group({
- name: ['', Validators.required],
- agenceId: ['',Validators.required]
+ name: ['', Validators.required]
});
}
@@ -75,7 +74,6 @@ export class BusinessunitEditComponent implements OnInit {
return;
}
this.businessunit.name = this.registerForm.value.name
- this.businessunit.agenceId = this.registerForm.value.agenceId
this.save()
}
diff --git a/src/app/components/businessunit/businessunit.component.html b/src/app/components/businessunit/businessunit.component.html
index a7bf06c..bf65d8c 100644
--- a/src/app/components/businessunit/businessunit.component.html
+++ b/src/app/components/businessunit/businessunit.component.html
@@ -12,17 +12,6 @@
-
-
diff --git a/src/app/components/businessunit/businessunit.component.ts b/src/app/components/businessunit/businessunit.component.ts
index 9dc86f0..de93580 100644
--- a/src/app/components/businessunit/businessunit.component.ts
+++ b/src/app/components/businessunit/businessunit.component.ts
@@ -2,8 +2,6 @@ import { Component, OnInit } from '@angular/core';
import {Businessunit} from "../../interfaces/businessunit";
import {HttpClient} from "@angular/common/http";
import {BusinessunitService} from "../../services/businessunit.service";
-import {Agence} from "../../interfaces/agence";
-import {AgenceService} from "../../services/agence.service";
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
@Component({
@@ -15,8 +13,6 @@ export class BusinessunitComponent implements OnInit {
businessunits : Businessunit[] = [];
businessunit = {} as Businessunit ;
- agences : Agence[] = [];
- agence = {} as Agence ;
registerForm!: FormGroup;
submitted = false;
@@ -24,16 +20,13 @@ export class BusinessunitComponent implements OnInit {
constructor(
private http : HttpClient,
private businessunitService: BusinessunitService,
- private agenceService: AgenceService,
private formBuilder: FormBuilder
) { }
ngOnInit(): void {
this.getBusinessunits();
- this.getAgences();
this.registerForm = this.formBuilder.group({
name: ['', Validators.required],
- agenceId: ['',Validators.required]
});
}
@@ -42,11 +35,6 @@ export class BusinessunitComponent implements OnInit {
.subscribe(businessunits => this.businessunits = businessunits);
}
- getAgences():void {
- this.agenceService.getAgences()
- .subscribe(agences => this.agences = agences);
- }
-
add(businessunit: Businessunit): void {
this.businessunitService.addBusinessunit(businessunit)
.subscribe(businessunit => {
diff --git a/src/app/interfaces/agence.ts b/src/app/interfaces/agence.ts
index a88cc17..00bf754 100644
--- a/src/app/interfaces/agence.ts
+++ b/src/app/interfaces/agence.ts
@@ -1,4 +1,5 @@
export interface Agence {
name: string;
id: number;
+ businessUnitId : number;
}
diff --git a/src/app/interfaces/businessunit.ts b/src/app/interfaces/businessunit.ts
index 0b1b86a..9ccbebb 100644
--- a/src/app/interfaces/businessunit.ts
+++ b/src/app/interfaces/businessunit.ts
@@ -1,5 +1,4 @@
export interface Businessunit {
name: string;
id: number;
- agenceId : number;
}
diff --git a/src/app/services/agence.service.ts b/src/app/services/agence.service.ts
index a92030f..64c87e0 100644
--- a/src/app/services/agence.service.ts
+++ b/src/app/services/agence.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs";
import {Agence} from "../interfaces/agence";
-import {agencesUrl} from "../../ressources/routes/routesPreprod";
+import {agencesUrl} from "../../ressources/routes/routes";
@Injectable({
providedIn: 'root'
diff --git a/src/app/services/businessunit.service.ts b/src/app/services/businessunit.service.ts
index 2c96ef2..bd17c09 100644
--- a/src/app/services/businessunit.service.ts
+++ b/src/app/services/businessunit.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {Observable} from "rxjs";
import {Businessunit} from "../interfaces/businessunit";
-import {businessunitsUrl} from "../../ressources/routes/routesPreprod";
+import {businessunitsUrl} from "../../ressources/routes/routes";
@Injectable({
providedIn: 'root'
diff --git a/src/app/services/collaborateur.service.ts b/src/app/services/collaborateur.service.ts
index 2b58b98..f410852 100644
--- a/src/app/services/collaborateur.service.ts
+++ b/src/app/services/collaborateur.service.ts
@@ -2,7 +2,7 @@ import {Collaborateur} from "../interfaces/collaborateur";
import {Injectable} from '@angular/core';
import {Observable} from "rxjs";
import {HttpClient, HttpHeaders} from "@angular/common/http";
-import {collaborateursUrl} from "../../ressources/routes/routesPreprod";
+import {collaborateursUrl} from "../../ressources/routes/routes";
@Injectable({providedIn: 'root'})