Merge pull request 'Merge des modifications vues avec Mélissa Blanger lors de la code review' (#4) from refonte_review into develop

Reviewed-on: Clement.Ferrere/Collaborateur_Epa_Front#4
pull/5/head
Clement.Ferrere 3 years ago
commit 75c2979842
  1. 18
      angular.json
  2. 27
      src/app/agence-edit/agence-edit.component.css
  3. 61
      src/app/agence/agence.component.css
  4. 21
      src/app/agence/agence.component.html
  5. 10
      src/app/app-routing.module.ts
  6. 4
      src/app/app.component.html
  7. 0
      src/app/app.component.scss
  8. 3
      src/app/app.component.ts
  9. 14
      src/app/app.module.ts
  10. 27
      src/app/collaborateur-edit/collaborateur-edit.component.css
  11. 50
      src/app/collaborateur-edit/collaborateur-edit.component.html
  12. 81
      src/app/collaborateur/collaborateur.component.css
  13. 61
      src/app/collaborateur/collaborateur.component.html
  14. 13
      src/app/components/agence/agence-edit/agence-edit.component.html
  15. 0
      src/app/components/agence/agence-edit/agence-edit.component.scss
  16. 6
      src/app/components/agence/agence-edit/agence-edit.component.ts
  17. 32
      src/app/components/agence/agence.component.html
  18. 2
      src/app/components/agence/agence.component.scss
  19. 6
      src/app/components/agence/agence.component.ts
  20. 45
      src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.html
  21. 1
      src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.scss
  22. 19
      src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.ts
  23. 12
      src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.html
  24. 0
      src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.scss
  25. 6
      src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.ts
  26. 28
      src/app/components/collaborateur/collaborateur.component.html
  27. 3
      src/app/components/collaborateur/collaborateur.component.scss
  28. 6
      src/app/components/collaborateur/collaborateur.component.ts
  29. 2
      src/app/components/home/home.component.html
  30. 0
      src/app/components/home/home.component.scss
  31. 2
      src/app/components/home/home.component.ts
  32. 2
      src/app/home/home.component.html
  33. 17
      src/app/messages/messages.component.css
  34. 11
      src/app/messages/messages.component.html
  35. 16
      src/app/messages/messages.component.ts
  36. 20
      src/app/services/agence.service.ts
  37. 20
      src/app/services/collaborateur.service.ts
  38. 20
      src/app/services/message.service.ts
  39. 25
      src/app/tests/agence-edit.component.spec.ts
  40. 25
      src/app/tests/agence.component.spec.ts
  41. 16
      src/app/tests/agence.service.spec.ts
  42. 31
      src/app/tests/app.component.spec.ts
  43. 25
      src/app/tests/collaborateur-edit.component.spec.ts
  44. 25
      src/app/tests/collaborateur.component.spec.ts
  45. 16
      src/app/tests/collaborateur.service.spec.ts
  46. 25
      src/app/tests/home.component.spec.ts
  47. 16
      src/app/tests/message.service.spec.ts
  48. 25
      src/app/tests/messages.component.spec.ts
  49. 25
      src/app/tests/test.ts
  50. 0
      src/ressources/assets/icon_house.png
  51. 2
      src/ressources/routes/routes.ts
  52. 0
      src/ressources/strings/strings_fr.ts
  53. 1
      src/styles.css
  54. 86
      src/styles.scss

@ -8,6 +8,22 @@
"schematics": {
"@schematics/angular:application": {
"strict": true
},
"@schematics/angular:component": {
"style": "scss",
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
@ -28,7 +44,7 @@
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
"src/styles.scss"
],
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",

@ -1,27 +0,0 @@
label {
color: #435960;
font-weight: bold;
}
input {
font-size: 1em;
padding: .3rem;
margin: .5rem;
}
button {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
button:hover {
background-color: #42545C;
}
button:disabled {
background-color: #eee;
color: #ccc;
cursor: auto;
}

@ -1,61 +0,0 @@
label {
color: #435960;
font-weight: bold;
}
input {
font-size: 1em;
padding: .3rem;
margin: .5rem;
}
.agences {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.agences li {
position: relative;
cursor: pointer;
}
.agences li:hover {
left: .1em;
}
.agences a, td a {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
.agences a:hover {
background-color: #42545C;
}
.agences a:active {
background-color: #525252;
color: #fafafa;
}
.agences .badge{
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color:#405061;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
min-width: 16px;
text-align: right;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}

@ -1,21 +0,0 @@
<div xmlns="">
<h2>Agences</h2>
<table *ngFor="let agence of agences">
<td> {{agence.name}} </td>
<td></td>
<td> <a routerLink="{{agence.id}}"> Modifier </a></td>
</table>
<h3>Ajouter une agence : </h3>
<div>
<label class="col-2" for="agence-name">Agence name</label>
<input id="agence-name" [(ngModel)]="agence.name" placeholder="name">
</div>
<button class="add-button" (click)="add(agence)">
Ajouter une Agence
</button>
</div>

@ -1,10 +1,10 @@
import {NgModule} from '@angular/core';
import {RouterModule,Routes} from "@angular/router";
import {CollaborateurComponent} from "./collaborateur/collaborateur.component";
import {CollaborateurEditComponent} from "./collaborateur-edit/collaborateur-edit.component";
import {HomeComponent} from "./home/home.component";
import {AgenceComponent} from "./agence/agence.component";
import {AgenceEditComponent} from "./agence-edit/agence-edit.component";
import {CollaborateurComponent} from "./components/collaborateur/collaborateur.component";
import {CollaborateurEditComponent} from "./components/collaborateur/collaborateur-edit/collaborateur-edit.component";
import {HomeComponent} from "./components/home/home.component";
import {AgenceComponent} from "./components/agence/agence.component";
import {AgenceEditComponent} from "./components/agence/agence-edit/agence-edit.component";
const routes : Routes = [
{path:'', redirectTo:'/home', pathMatch:'full'},

@ -79,9 +79,5 @@
<router-outlet></router-outlet>
<app-messages></app-messages>
</div>

@ -4,8 +4,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'Collaborateur-Epa';
}

@ -4,24 +4,24 @@ import {HttpClientModule} from "@angular/common/http";
import { AppComponent } from './app.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {RouterModule} from "@angular/router";
import { CollaborateurComponent } from './collaborateur/collaborateur.component';
import { CollaborateurEditComponent } from './collaborateur-edit/collaborateur-edit.component';
import { CollaborateurComponent } from './components/collaborateur/collaborateur.component';
import { CollaborateurEditComponent } from './components/collaborateur/collaborateur-edit/collaborateur-edit.component';
import {FormsModule} from "@angular/forms";
import { MessagesComponent } from './messages/messages.component';
import { AppRoutingModule } from './app-routing.module';
import { HomeComponent } from './home/home.component';
import { AgenceComponent } from './agence/agence.component';
import { AgenceEditComponent } from './agence-edit/agence-edit.component';
import { HomeComponent } from './components/home/home.component';
import { AgenceComponent } from './components/agence/agence.component';
import { AgenceEditComponent } from './components/agence/agence-edit/agence-edit.component';
import { CollaborateurDetailComponent } from './components/collaborateur/collaborateur-detail/collaborateur-detail.component';
@NgModule({
declarations: [
AppComponent,
CollaborateurComponent,
CollaborateurEditComponent,
MessagesComponent,
HomeComponent,
AgenceComponent,
AgenceEditComponent,
CollaborateurDetailComponent
],
imports: [
BrowserModule,

@ -1,27 +0,0 @@
label {
color: #435960;
font-weight: bold;
}
input {
font-size: 1em;
padding: .3rem;
margin: .5rem;
}
button {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
button:hover {
background-color: #42545C;
}
button:disabled {
background-color: #eee;
color: #ccc;
cursor: auto;
}

@ -1,50 +0,0 @@
<div *ngIf="collaborateur">
<h2>{{collaborateur.name | uppercase}} {{collaborateur.firstName | uppercase}} </h2>
<div><span>id : </span>{{collaborateur.id}}</div>
<div>
<label class="col-2" for="collaborateur-name">Collaborateur name </label>
<input id="collaborateur-name" [(ngModel)]="collaborateur.name" placeholder="name">
<label class="col-2" for="collaborateur-firstName">Collaborateur firstname </label>
<input id="collaborateur-firstName" [(ngModel)]="collaborateur.firstName" placeholder="firstname">
<label class="col-2" for="collaborateur-birthDate">Collaborateur birthDate </label>
<input id="collaborateur-birthDate" [(ngModel)]="collaborateur.birthDate" placeholder="birthDate">
<label class="col-2" for="collaborateur-gender">Collaborateur gender </label>
<input id="collaborateur-gender" [(ngModel)]="collaborateur.gender" placeholder="gender">
<label class="col-2" for="collaborateur-status">Collaborateur status </label>
<input id="collaborateur-status" [(ngModel)]="collaborateur.status" placeholder="status">
<label class="col-2" for="collaborateur-childrenNumber">Collaborateur childrenNumber </label>
<input id="collaborateur-childrenNumber" [(ngModel)]="collaborateur.childrenNumber" placeholder="childrenNumber">
<label class="col-2" for="collaborateur-address">Collaborateur address </label>
<input id="collaborateur-address" [(ngModel)]="collaborateur.address" placeholder="address">
<label class="col-2" for="collaborateur-telephone">Collaborateur telephone </label>
<input id="collaborateur-telephone" [(ngModel)]="collaborateur.telephone" placeholder="telephone">
<label class="col-2" for="collaborateur-personalMail">Collaborateur personalMail </label>
<input id="collaborateur-personalMail" [(ngModel)]="collaborateur.personalMail" placeholder="personalMail">
<label class="col-2" for="collaborateur-apsideMail">Collaborateur apsideMail </label>
<input id="collaborateur-apsideMail" [(ngModel)]="collaborateur.apsideMail" placeholder="apsideMail">
<label class="col-2" for="collaborateur-resignationDate">Collaborateur resignationDate </label>
<input id="collaborateur-resignationDate" [(ngModel)]="collaborateur.resignationDate" placeholder="resignationDate">
<label class="col-2" for="collaborateur-referrerId">Collaborateur referrerId </label>
<input id="collaborateur-referrerId" [(ngModel)]="collaborateur.referrerId" placeholder="referrerId">
<label class="col-2" for="collaborateur-businessUnitId">Collaborateur businessUnitId </label>
<input id="collaborateur-businessUnitId" [(ngModel)]="collaborateur.businessUnitId" placeholder="businessUnitId">
</div>
<button (click)="goBack()">Retour</button>
<button (click)="save()">Sauvegarder les changements</button>
<button (click)="delete()">Supprimer le collaborateur</button>
</div>

@ -1,81 +0,0 @@
/* HeroesComponent's private CSS styles */
label {
color: #435960;
font-weight: bold;
}
input {
font-size: 1em;
padding: .3rem;
margin: .5rem;
}
.collaborateurs {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.collaborateurs li {
position: relative;
cursor: pointer;
}
.collaborateurs li:hover {
left: .1em;
}
.collaborateurs a, td a {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
.collaborateurs a:hover {
background-color: #42545C;
}
.collaborateurs a:active {
background-color: #525252;
color: #fafafa;
}
.collaborateurs .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color:#405061;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
min-width: 16px;
text-align: right;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
button {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
button:hover {
background-color: #42545C;
}
button:disabled {
background-color: #eee;
color: #ccc;
cursor: auto;
}

@ -1,61 +0,0 @@
<div xmlns="">
<h2>Collaborateurs</h2>
<table *ngFor="let collaborateur of collaborateurs">
<td> {{collaborateur.name}} </td>
<td></td>
<td> {{collaborateur.firstName}} </td>
<td></td>
<td> {{collaborateur.apsideMail}} </td>
<td></td>
<td> <a routerLink="{{collaborateur.id}}"> Modifier </a></td>
</table>
<h3>Ajouter un collaborateur : </h3>
<div>
<label class="col-2" for="collaborateur-name">Collaborateur name </label>
<input id="collaborateur-name" [(ngModel)]="collaborateur.name" placeholder="name">
<label class="col-2" for="collaborateur-firstName">Collaborateur firstname </label>
<input id="collaborateur-firstName" [(ngModel)]="collaborateur.firstName" placeholder="firstname">
<label class="col-2" for="collaborateur-birthDate">Collaborateur birthDate </label>
<input id="collaborateur-birthDate" [(ngModel)]="collaborateur.birthDate" placeholder="birthDate">
<label class="col-2" for="collaborateur-gender">Collaborateur name </label>
<input id="collaborateur-gender" [(ngModel)]="collaborateur.gender" placeholder="gender">
<label class="col-2" for="collaborateur-status">Collaborateur status </label>
<input id="collaborateur-status" [(ngModel)]="collaborateur.status" placeholder="status">
<label class="col-2" for="collaborateur-childrenNumber">Collaborateur childrenNumber </label>
<input id="collaborateur-childrenNumber" [(ngModel)]="collaborateur.childrenNumber" placeholder="childrenNumber">
<label class="col-2" for="collaborateur-address">Collaborateur address </label>
<input id="collaborateur-address" [(ngModel)]="collaborateur.address" placeholder="address">
<label class="col-2" for="collaborateur-telephone">Collaborateur telephone </label>
<input id="collaborateur-telephone" [(ngModel)]="collaborateur.telephone" placeholder="telephone">
<label class="col-2" for="collaborateur-personalMail">Collaborateur personalMail </label>
<input id="collaborateur-personalMail" [(ngModel)]="collaborateur.personalMail" placeholder="personalMail">
<label class="col-2" for="collaborateur-apsideMail">Collaborateur apsideMail </label>
<input id="collaborateur-apsideMail" [(ngModel)]="collaborateur.apsideMail" placeholder="apsideMail">
<label class="col-2" for="collaborateur-resignationDate">Collaborateur resignationDate </label>
<input id="collaborateur-resignationDate" [(ngModel)]="collaborateur.resignationDate" placeholder="resignationDate">
<label class="col-2" for="collaborateur-referrerId">Collaborateur referrerId </label>
<input id="collaborateur-referrerId" [(ngModel)]="collaborateur.referrerId" placeholder="referrerId">
<label class="col-2" for="collaborateur-businessUnitId">Collaborateur businessUnitId </label>
<input id="collaborateur-businessUnitId" [(ngModel)]="collaborateur.businessUnitId" placeholder="businessUnitId">
</div>
<button class="add-button" (click)="add(collaborateur)">
Ajouter un Collaborateur
</button>
</div>

@ -4,9 +4,20 @@
<h2>{{agence.name | uppercase}} </h2>
<div><span>id : </span>{{agence.id}}</div>
<div>
<label class="col-2" for="agence-name">Agence name </label>
<div class = mb-3>
<table>
<tr>
<th>Name</th>
</tr>
<tr>
<td>
<input id="agence-name" [(ngModel)]="agence.name" placeholder="name">
</td>
</tr>
</table>
</div>
</div>
<button (click)="goBack()">Retour</button>
<button (click)="save()">Sauvegarder les changements</button>

@ -1,13 +1,13 @@
import { Component, OnInit } from '@angular/core';
import {Agence} from "../interfaces/agence";
import {Agence} from "../../../interfaces/agence";
import {ActivatedRoute} from "@angular/router";
import {AgenceService} from "../services/agence.service";
import {AgenceService} from "../../../services/agence.service";
import {Location} from "@angular/common";
@Component({
selector: 'app-agence-edit',
templateUrl: './agence-edit.component.html',
styleUrls: ['./agence-edit.component.css']
styleUrls: ['./agence-edit.component.scss']
})
export class AgenceEditComponent implements OnInit {
agence : Agence | undefined;

@ -0,0 +1,32 @@
<div xmlns="">
<h2 class = mb-4>Agences</h2>
<table class = mb-5>
<tr>
<th class="spaced">Name</th>
</tr>
<tr *ngFor="let agence of agences">
<td class="spaced"> {{agence.name}} </td>
<td class="spaced"> <a routerLink="{{agence.id}}"> Modifier </a></td>
</tr>
</table>
<h3>Ajouter une agence : </h3>
<div class = mb-3>
<table>
<tr>
<th>Name</th>
</tr>
<tr>
<td>
<input id="agence-name" [(ngModel)]="agence.name" placeholder="name">
</td>
</tr>
</table>
</div>
<button class="add-button" (click)="add(agence)">
Ajouter une Agence
</button>
</div>

@ -1,12 +1,12 @@
import { Component, OnInit } from '@angular/core';
import {Agence} from "../interfaces/agence";
import {Agence} from "../../interfaces/agence";
import {HttpClient} from "@angular/common/http";
import {AgenceService} from "../services/agence.service";
import {AgenceService} from "../../services/agence.service";
@Component({
selector: 'app-agence',
templateUrl: './agence.component.html',
styleUrls: ['./agence.component.css']
styleUrls: ['./agence.component.scss']
})
export class AgenceComponent implements OnInit {
agences : Agence[] = [];

@ -0,0 +1,45 @@
<div *ngIf="collaborateur" style="overflow-x:auto;" class="mb-3">
<table>
<tr>
<th>Name</th>
<th>First Name</th>
<th>Birth Date</th>
<th>Gender</th>
<th>Status</th>
<th>Children Number</th>
<th>Address</th>
<th>Telephone</th>
<th>Personal Mail</th>
<th>Apside Mail</th>
<th>Resignation Date</th>
<th>Referrer ID</th>
<th>Business Unit ID</th>
</tr>
<tr>
<td><input id="collaborateur-name" [(ngModel)]="collaborateur.name" placeholder="name"></td>
<td><input id="collaborateur-firstName" [(ngModel)]="collaborateur.firstName" placeholder="firstname"></td>
<td><input id="collaborateur-birthDate" [(ngModel)]="collaborateur.birthDate" placeholder="birthDate"></td>
<td><input id="collaborateur-gender" [(ngModel)]="collaborateur.gender" placeholder="gender"></td>
<td><input id="collaborateur-status" [(ngModel)]="collaborateur.status" placeholder="status"></td>
<td><input id="collaborateur-childrenNumber" [(ngModel)]="collaborateur.childrenNumber" placeholder="childrenNumber"></td>
<td><input id="collaborateur-address" [(ngModel)]="collaborateur.address" placeholder="address"></td>
<td><input id="collaborateur-telephone" [(ngModel)]="collaborateur.telephone" placeholder="telephone"></td>
<td><input id="collaborateur-personalMail" [(ngModel)]="collaborateur.personalMail" placeholder="personalMail"></td>
<td><input id="collaborateur-apsideMail" [(ngModel)]="collaborateur.apsideMail" placeholder="apsideMail"></td>
<td><input id="collaborateur-resignationDate" [(ngModel)]="collaborateur.resignationDate" placeholder="resignationDate"></td>
<td><input id="collaborateur-referrerId" [(ngModel)]="collaborateur.referrerId" placeholder="referrerId"></td>
<td><input id="collaborateur-businessUnitId" [(ngModel)]="collaborateur.businessUnitId" placeholder="businessUnitId"></td>
</tr>
</table>
</div>

@ -0,0 +1,19 @@
import {Component, Input, OnInit} from '@angular/core';
import {Collaborateur} from "../../../interfaces/collaborateur";
@Component({
selector: 'app-collaborateur-detail',
templateUrl: './collaborateur-detail.component.html',
styleUrls: ['./collaborateur-detail.component.scss']
})
export class CollaborateurDetailComponent implements OnInit {
@Input()
collaborateur: Collaborateur | undefined;
constructor() { }
ngOnInit(): void {
}
}

@ -0,0 +1,12 @@
<div *ngIf="collaborateur">
<h2>{{collaborateur.name | uppercase}} {{collaborateur.firstName | uppercase}} </h2>
<div><span>id : </span>{{collaborateur.id}}</div>
<app-collaborateur-detail [collaborateur]="collaborateur"></app-collaborateur-detail>
<button (click)="goBack()">Retour</button>
<button (click)="save()">Sauvegarder les changements</button>
<button (click)="delete()">Supprimer le collaborateur</button>
</div>

@ -1,13 +1,13 @@
import {Component, OnInit} from '@angular/core';
import {Collaborateur} from "../interfaces/collaborateur";
import {Collaborateur} from "../../../interfaces/collaborateur";
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { CollaborateurService} from "../services/collaborateur.service";
import { CollaborateurService} from "../../../services/collaborateur.service";
@Component({
selector: 'app-collaborateur-edit',
templateUrl: './collaborateur-edit.component.html',
styleUrls: ['./collaborateur-edit.component.css']
styleUrls: ['./collaborateur-edit.component.scss']
})
export class CollaborateurEditComponent implements OnInit {
collaborateur : Collaborateur | undefined;

@ -0,0 +1,28 @@
<div xmlns="">
<h2 class = mb-4>Collaborateurs</h2>
<div style="overflow-x:auto;" class="mb-5">
<table >
<tr>
<th class="spaced">Name</th>
<th class="spaced">First Name</th>
<th class="spaced">Apside Mail</th>
</tr>
<tr *ngFor="let collaborateur of collaborateurs">
<td class="spaced"> {{collaborateur.name}} </td>
<td class="spaced"> {{collaborateur.firstName}} </td>
<td class="spaced"> {{collaborateur.apsideMail}} </td>
<td class="spaced"> <a routerLink="{{collaborateur.id}}"> Modifier </a></td>
</tr>
</table>
</div>
<h3>Ajouter un collaborateur : </h3>
<app-collaborateur-detail [collaborateur]="collaborateur"></app-collaborateur-detail>
<button class="add-button" (click)="add(collaborateur)">
Ajouter un Collaborateur
</button>
</div>

@ -1,12 +1,12 @@
import { Component, OnInit } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {CollaborateurService} from "../services/collaborateur.service";
import {Collaborateur} from "../interfaces/collaborateur";
import {CollaborateurService} from "../../services/collaborateur.service";
import {Collaborateur} from "../../interfaces/collaborateur";
@Component({
selector: 'app-collaborateur',
templateUrl: './collaborateur.component.html',
styleUrls: ['./collaborateur.component.css']
styleUrls: ['./collaborateur.component.scss']
})
export class CollaborateurComponent implements OnInit {
collaborateurs : Collaborateur[] = [];

@ -0,0 +1,2 @@
<h2>Services Collaborateurs EPA</h2>

@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {

@ -1,2 +0,0 @@
<h1>Services Collaborateurs EPA</h1>

@ -1,17 +0,0 @@
button {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: #E77620;
color: white;
border-radius: 4px;
}
button:hover {
background-color: #42545C;
}
button:disabled {
background-color: #eee;
color: #ccc;
cursor: auto;
}

@ -1,11 +0,0 @@
<div *ngIf="messageService.messages.length">
<h2>Messages</h2>
<button (click)="messageService.clear()">Clear messages</button>
<div *ngFor='let message of messageService.messages'>
{{message}}
</div>
</div>

@ -1,16 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { MessageService} from "../services/message.service";
@Component({
selector: 'app-messages',
templateUrl: './messages.component.html',
styleUrls: ['./messages.component.css']
})
export class MessagesComponent implements OnInit {
constructor(public messageService : MessageService) { }
ngOnInit(): void {
}
}

@ -1,50 +1,40 @@
import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {MessageService} from "./message.service";
import {Observable} from "rxjs";
import {Agence} from "../interfaces/agence";
import {agencesUrl} from "../../ressources/routes/routes";
@Injectable({
providedIn: 'root'
})
export class AgenceService {
private agencesUrl = 'https://localhost:7125/api/agences';
private agencesUrl = agencesUrl;
httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
constructor(private http: HttpClient,
private messageService : MessageService) { }
private log(message : string){
this.messageService.add(`AgenceService : ${message}`)
}
constructor(private http: HttpClient) { }
getAgences():Observable<Agence[]> {
this.log('get all agences');
return this.http.get<Agence[]>(this.agencesUrl);
}
getAgence(id : number):Observable<Agence>{
this.log(`get agence by id : ${id}`);
return this.http.get<Agence>(this.agencesUrl+"/"+id);
}
updateAgence(agence : Agence):Observable<any>{
updateAgence(agence : Agence):Observable<Agence>{
let body = JSON.stringify(agence);
this.log(`update agence ${agence.id}`)
return this.http.put(this.agencesUrl + "/" + agence.id, body, this.httpOptions);
return this.http.put<Agence>(this.agencesUrl + "/" + agence.id, body, this.httpOptions);
}
deleteAgence(agence: Agence) {
this.log(`delete agence ${agence.id}`)
return this.http.delete(this.agencesUrl + "/" + agence.id);
}
addAgence(agence: Agence): Observable<Agence> {
let body = JSON.stringify(agence);
this.log(`add agence ${body}`);
return this.http.post<Agence>(this.agencesUrl, body, this.httpOptions);
}
}

@ -1,51 +1,41 @@
import {Collaborateur} from "../interfaces/collaborateur";
import {Injectable} from '@angular/core';
import {Observable} from "rxjs";
import {MessageService} from "./message.service";
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {collaborateursUrl} from "../../ressources/routes/routes";
@Injectable({providedIn: 'root'})
export class CollaborateurService {
private collaborateursUrl = 'https://localhost:7125/api/collaborateurs';
private collaborateursUrl = collaborateursUrl;
httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
constructor(private http: HttpClient,
private messageService : MessageService) { }
private log(message : string){
this.messageService.add(`CollaborateurService : ${message}`)
}
constructor(private http: HttpClient) { }
getCollaborateurs():Observable<Collaborateur[]> {
this.log('get all collaborateurs');
return this.http.get<Collaborateur[]>(this.collaborateursUrl);
}
getCollaborateur(id : number):Observable<Collaborateur>{
this.log(`get collaborateur by id : ${id}`);
return this.http.get<Collaborateur>(this.collaborateursUrl+"/"+id);
}
updateCollaborateur(collaborateur : Collaborateur):Observable<any>{
updateCollaborateur(collaborateur : Collaborateur):Observable<Collaborateur>{
let body = JSON.stringify(collaborateur);
this.log(`update collaborateur ${collaborateur.id}`)
return this.http.put(this.collaborateursUrl + "/" + collaborateur.id, body, this.httpOptions);
return this.http.put<Collaborateur>(this.collaborateursUrl + "/" + collaborateur.id, body, this.httpOptions);
}
deleteCollaborateur(collaborateur: Collaborateur) {
this.log(`delete collaborateur ${collaborateur.id}`)
return this.http.delete(this.collaborateursUrl + "/" + collaborateur.id);
}
addCollaborateur(collaborateur: Collaborateur): Observable<Collaborateur> {
let body = JSON.stringify(collaborateur);
this.log(`add collaborateur ${body}`);
return this.http.post<Collaborateur>(this.collaborateursUrl, body, this.httpOptions);
}
}

@ -1,20 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class MessageService {
messages : string[] = [];
add(message: string){
this.messages.push(message)
}
clear(){
this.messages = [];
}
constructor() { }
}

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AgenceEditComponent } from '../agence-edit/agence-edit.component';
describe('AgenceEditComponent', () => {
let component: AgenceEditComponent;
let fixture: ComponentFixture<AgenceEditComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AgenceEditComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AgenceEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AgenceComponent } from '../agence/agence.component';
describe('AgenceComponent', () => {
let component: AgenceComponent;
let fixture: ComponentFixture<AgenceComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AgenceComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AgenceComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AgenceService } from '../services/agence.service';
describe('AgenceService', () => {
let service: AgenceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AgenceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

@ -1,31 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from '../app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'Collaborateur-Epa-Front'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('Collaborateur-Epa-Front');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('Collaborateur-Epa-Front app is running!');
});
});

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CollaborateurEditComponent } from '../collaborateur-edit/collaborateur-edit.component';
describe('CollaborateurEditComponent', () => {
let component: CollaborateurEditComponent;
let fixture: ComponentFixture<CollaborateurEditComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CollaborateurEditComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CollaborateurEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CollaborateurComponent } from '../collaborateur/collaborateur.component';
describe('CollaborateurComponent', () => {
let component: CollaborateurComponent;
let fixture: ComponentFixture<CollaborateurComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CollaborateurComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CollaborateurComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { CollaborateurService } from '../services/collaborateur.service';
describe('CollaborateurService', () => {
let service: CollaborateurService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CollaborateurService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeComponent } from '../home/home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { MessageService } from '../services/message.service';
describe('MessageService', () => {
let service: MessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MessageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MessagesComponent } from '../messages/messages.component';
describe('MessagesComponent', () => {
let component: MessagesComponent;
let fixture: ComponentFixture<MessagesComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ MessagesComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(MessagesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -1,25 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

@ -0,0 +1,2 @@
export const collaborateursUrl = 'https://localhost:7125/api/collaborateurs';
export const agencesUrl = 'https://localhost:7125/api/agences';

@ -1 +0,0 @@
/* You can add global styles to this file, and also import other style files */

@ -0,0 +1,86 @@
/* You can add global styles to this file, and also import other style files */
$primary: #183650;
$secondary: #e77620;
$accent: #e1e4e6;
$error: #b53333;
$success: #0b7023;
$info: #fff;
$warning: #e07612;
label {
color: $primary;
font-weight: bold;
}
input {
font-size: 1em;
padding: .3rem;
margin: .5rem;
}
button {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: $secondary;
color: white;
border-radius: 4px;
}
button:hover {
background-color: $primary;
}
button:disabled {
background-color: #eee;
color: #ccc;
cursor: auto;
}
.entities {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.entities li {
position: relative;
cursor: pointer;
}
.entities li:hover {
left: .1em;
}
.entities a, td a {
padding: 5px;
text-decoration: none;
margin: 2px;
display: inline-block;
background-color: $secondary;
color: white;
border-radius: 4px;
}
.entities a:hover {
background-color: $primary;
}
.entities a:active {
background-color: #525252;
color: #fafafa;
}
.spaced{
padding : 0 25px;
}
.list {
}
input{
margin: 0 15px 0 0;
}
Loading…
Cancel
Save