diff --git a/angular.json b/angular.json index 3dd9353..b502b3c 100644 --- a/angular.json +++ b/angular.json @@ -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", diff --git a/src/app/agence-edit/agence-edit.component.css b/src/app/agence-edit/agence-edit.component.css deleted file mode 100644 index 127bdce..0000000 --- a/src/app/agence-edit/agence-edit.component.css +++ /dev/null @@ -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; -} diff --git a/src/app/agence/agence.component.css b/src/app/agence/agence.component.css deleted file mode 100644 index f331f45..0000000 --- a/src/app/agence/agence.component.css +++ /dev/null @@ -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; -} diff --git a/src/app/agence/agence.component.html b/src/app/agence/agence.component.html deleted file mode 100644 index 8a6819d..0000000 --- a/src/app/agence/agence.component.html +++ /dev/null @@ -1,21 +0,0 @@ -
-

Agences

- - - - - - -
{{agence.name}} Modifier
- -

Ajouter une agence :

- -
- - -
- - -
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 669ff1e..7c37b20 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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'}, diff --git a/src/app/app.component.html b/src/app/app.component.html index 787e796..bb7bb23 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -79,9 +79,5 @@ - - - - diff --git a/src/app/app.component.css b/src/app/app.component.scss similarity index 100% rename from src/app/app.component.css rename to src/app/app.component.scss diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 22195c0..83d44c7 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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'; } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4fca660..6c1d9a3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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, diff --git a/src/app/collaborateur-edit/collaborateur-edit.component.css b/src/app/collaborateur-edit/collaborateur-edit.component.css deleted file mode 100644 index 127bdce..0000000 --- a/src/app/collaborateur-edit/collaborateur-edit.component.css +++ /dev/null @@ -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; -} diff --git a/src/app/collaborateur-edit/collaborateur-edit.component.html b/src/app/collaborateur-edit/collaborateur-edit.component.html deleted file mode 100644 index 5c2b183..0000000 --- a/src/app/collaborateur-edit/collaborateur-edit.component.html +++ /dev/null @@ -1,50 +0,0 @@ - -
- -

{{collaborateur.name | uppercase}} {{collaborateur.firstName | uppercase}}

-
id : {{collaborateur.id}}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
diff --git a/src/app/collaborateur/collaborateur.component.css b/src/app/collaborateur/collaborateur.component.css deleted file mode 100644 index cc8fa06..0000000 --- a/src/app/collaborateur/collaborateur.component.css +++ /dev/null @@ -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; -} diff --git a/src/app/collaborateur/collaborateur.component.html b/src/app/collaborateur/collaborateur.component.html deleted file mode 100644 index 0191bff..0000000 --- a/src/app/collaborateur/collaborateur.component.html +++ /dev/null @@ -1,61 +0,0 @@ -
-

Collaborateurs

- - - - - - - - - - -
{{collaborateur.name}} {{collaborateur.firstName}} {{collaborateur.apsideMail}} Modifier
- -

Ajouter un collaborateur :

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
diff --git a/src/app/agence-edit/agence-edit.component.html b/src/app/components/agence/agence-edit/agence-edit.component.html similarity index 53% rename from src/app/agence-edit/agence-edit.component.html rename to src/app/components/agence/agence-edit/agence-edit.component.html index c6d0651..0ecfe31 100644 --- a/src/app/agence-edit/agence-edit.component.html +++ b/src/app/components/agence/agence-edit/agence-edit.component.html @@ -4,10 +4,21 @@

{{agence.name | uppercase}}

id : {{agence.id}}
- - +
+ + + + + + + +
Name
+ +
+
+ diff --git a/src/app/home/home.component.css b/src/app/components/agence/agence-edit/agence-edit.component.scss similarity index 100% rename from src/app/home/home.component.css rename to src/app/components/agence/agence-edit/agence-edit.component.scss diff --git a/src/app/agence-edit/agence-edit.component.ts b/src/app/components/agence/agence-edit/agence-edit.component.ts similarity index 86% rename from src/app/agence-edit/agence-edit.component.ts rename to src/app/components/agence/agence-edit/agence-edit.component.ts index 7627bd4..41c65b2 100644 --- a/src/app/agence-edit/agence-edit.component.ts +++ b/src/app/components/agence/agence-edit/agence-edit.component.ts @@ -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; diff --git a/src/app/components/agence/agence.component.html b/src/app/components/agence/agence.component.html new file mode 100644 index 0000000..97ca12b --- /dev/null +++ b/src/app/components/agence/agence.component.html @@ -0,0 +1,32 @@ +
+

Agences

+ + + + + + + + + +
Name
{{agence.name}} Modifier
+ +

Ajouter une agence :

+ +
+ + + + + + + +
Name
+ +
+
+ + +
diff --git a/src/app/components/agence/agence.component.scss b/src/app/components/agence/agence.component.scss new file mode 100644 index 0000000..139597f --- /dev/null +++ b/src/app/components/agence/agence.component.scss @@ -0,0 +1,2 @@ + + diff --git a/src/app/agence/agence.component.ts b/src/app/components/agence/agence.component.ts similarity index 82% rename from src/app/agence/agence.component.ts rename to src/app/components/agence/agence.component.ts index 8b0ae6a..e1c007f 100644 --- a/src/app/agence/agence.component.ts +++ b/src/app/components/agence/agence.component.ts @@ -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[] = []; diff --git a/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.html b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.html new file mode 100644 index 0000000..ff5369e --- /dev/null +++ b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.html @@ -0,0 +1,45 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameFirst NameBirth DateGenderStatusChildren NumberAddressTelephonePersonal MailApside MailResignation DateReferrer IDBusiness Unit ID
+ + + + + + + + +
diff --git a/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.scss b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.scss new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.scss @@ -0,0 +1 @@ + diff --git a/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.ts b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.ts new file mode 100644 index 0000000..ffc4c2d --- /dev/null +++ b/src/app/components/collaborateur/collaborateur-detail/collaborateur-detail.component.ts @@ -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 { + } + +} diff --git a/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.html b/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.html new file mode 100644 index 0000000..626e1f6 --- /dev/null +++ b/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.html @@ -0,0 +1,12 @@ + +
+ +

{{collaborateur.name | uppercase}} {{collaborateur.firstName | uppercase}}

+
id : {{collaborateur.id}}
+ + + + + + +
diff --git a/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.scss b/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/collaborateur-edit/collaborateur-edit.component.ts b/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.ts similarity index 85% rename from src/app/collaborateur-edit/collaborateur-edit.component.ts rename to src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.ts index 5bc5f47..7da33e1 100644 --- a/src/app/collaborateur-edit/collaborateur-edit.component.ts +++ b/src/app/components/collaborateur/collaborateur-edit/collaborateur-edit.component.ts @@ -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; diff --git a/src/app/components/collaborateur/collaborateur.component.html b/src/app/components/collaborateur/collaborateur.component.html new file mode 100644 index 0000000..21ef82a --- /dev/null +++ b/src/app/components/collaborateur/collaborateur.component.html @@ -0,0 +1,28 @@ +
+

Collaborateurs

+ +
+ + + + + + + + + + + + + +
NameFirst NameApside Mail
{{collaborateur.name}} {{collaborateur.firstName}} {{collaborateur.apsideMail}} Modifier
+
+ +

Ajouter un collaborateur :

+ + + + +
diff --git a/src/app/components/collaborateur/collaborateur.component.scss b/src/app/components/collaborateur/collaborateur.component.scss new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/src/app/components/collaborateur/collaborateur.component.scss @@ -0,0 +1,3 @@ + + + diff --git a/src/app/collaborateur/collaborateur.component.ts b/src/app/components/collaborateur/collaborateur.component.ts similarity index 82% rename from src/app/collaborateur/collaborateur.component.ts rename to src/app/components/collaborateur/collaborateur.component.ts index cf3378a..1210271 100644 --- a/src/app/collaborateur/collaborateur.component.ts +++ b/src/app/components/collaborateur/collaborateur.component.ts @@ -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[] = []; diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html new file mode 100644 index 0000000..18fdfe1 --- /dev/null +++ b/src/app/components/home/home.component.html @@ -0,0 +1,2 @@ +

Services Collaborateurs EPA

+ diff --git a/src/app/components/home/home.component.scss b/src/app/components/home/home.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/home/home.component.ts b/src/app/components/home/home.component.ts similarity index 85% rename from src/app/home/home.component.ts rename to src/app/components/home/home.component.ts index 007fef0..73acf06 100644 --- a/src/app/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -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 { diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html deleted file mode 100644 index c36cdcf..0000000 --- a/src/app/home/home.component.html +++ /dev/null @@ -1,2 +0,0 @@ -

Services Collaborateurs EPA

- diff --git a/src/app/messages/messages.component.css b/src/app/messages/messages.component.css deleted file mode 100644 index 7c8fa51..0000000 --- a/src/app/messages/messages.component.css +++ /dev/null @@ -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; -} diff --git a/src/app/messages/messages.component.html b/src/app/messages/messages.component.html deleted file mode 100644 index d7ac4b0..0000000 --- a/src/app/messages/messages.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
- -

Messages

- - - -
- {{message}} -
- -
diff --git a/src/app/messages/messages.component.ts b/src/app/messages/messages.component.ts deleted file mode 100644 index d1f296a..0000000 --- a/src/app/messages/messages.component.ts +++ /dev/null @@ -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 { - } - -} diff --git a/src/app/services/agence.service.ts b/src/app/services/agence.service.ts index a96c8ea..e1c80ac 100644 --- a/src/app/services/agence.service.ts +++ b/src/app/services/agence.service.ts @@ -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 { - this.log('get all agences'); return this.http.get(this.agencesUrl); } getAgence(id : number):Observable{ - this.log(`get agence by id : ${id}`); return this.http.get(this.agencesUrl+"/"+id); } - updateAgence(agence : Agence):Observable{ + updateAgence(agence : Agence):Observable{ 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(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 { let body = JSON.stringify(agence); - this.log(`add agence ${body}`); return this.http.post(this.agencesUrl, body, this.httpOptions); } } diff --git a/src/app/services/collaborateur.service.ts b/src/app/services/collaborateur.service.ts index 59fb016..f410852 100644 --- a/src/app/services/collaborateur.service.ts +++ b/src/app/services/collaborateur.service.ts @@ -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 { - this.log('get all collaborateurs'); return this.http.get(this.collaborateursUrl); } getCollaborateur(id : number):Observable{ - this.log(`get collaborateur by id : ${id}`); return this.http.get(this.collaborateursUrl+"/"+id); } - updateCollaborateur(collaborateur : Collaborateur):Observable{ + updateCollaborateur(collaborateur : Collaborateur):Observable{ 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(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 { let body = JSON.stringify(collaborateur); - this.log(`add collaborateur ${body}`); return this.http.post(this.collaborateursUrl, body, this.httpOptions); } } diff --git a/src/app/services/message.service.ts b/src/app/services/message.service.ts deleted file mode 100644 index eef12a6..0000000 --- a/src/app/services/message.service.ts +++ /dev/null @@ -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() { } - -} diff --git a/src/app/tests/agence-edit.component.spec.ts b/src/app/tests/agence-edit.component.spec.ts deleted file mode 100644 index 6823ad8..0000000 --- a/src/app/tests/agence-edit.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ AgenceEditComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(AgenceEditComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/agence.component.spec.ts b/src/app/tests/agence.component.spec.ts deleted file mode 100644 index afb5262..0000000 --- a/src/app/tests/agence.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ AgenceComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(AgenceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/agence.service.spec.ts b/src/app/tests/agence.service.spec.ts deleted file mode 100644 index ad5a664..0000000 --- a/src/app/tests/agence.service.spec.ts +++ /dev/null @@ -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(); - }); -}); diff --git a/src/app/tests/app.component.spec.ts b/src/app/tests/app.component.spec.ts deleted file mode 100644 index 2fe07e5..0000000 --- a/src/app/tests/app.component.spec.ts +++ /dev/null @@ -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!'); - }); -}); diff --git a/src/app/tests/collaborateur-edit.component.spec.ts b/src/app/tests/collaborateur-edit.component.spec.ts deleted file mode 100644 index 28fb9b4..0000000 --- a/src/app/tests/collaborateur-edit.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ CollaborateurEditComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(CollaborateurEditComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/collaborateur.component.spec.ts b/src/app/tests/collaborateur.component.spec.ts deleted file mode 100644 index af5ae30..0000000 --- a/src/app/tests/collaborateur.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ CollaborateurComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(CollaborateurComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/collaborateur.service.spec.ts b/src/app/tests/collaborateur.service.spec.ts deleted file mode 100644 index f182ad3..0000000 --- a/src/app/tests/collaborateur.service.spec.ts +++ /dev/null @@ -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(); - }); -}); diff --git a/src/app/tests/home.component.spec.ts b/src/app/tests/home.component.spec.ts deleted file mode 100644 index c61ccfa..0000000 --- a/src/app/tests/home.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ HomeComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(HomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/message.service.spec.ts b/src/app/tests/message.service.spec.ts deleted file mode 100644 index 899c75f..0000000 --- a/src/app/tests/message.service.spec.ts +++ /dev/null @@ -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(); - }); -}); diff --git a/src/app/tests/messages.component.spec.ts b/src/app/tests/messages.component.spec.ts deleted file mode 100644 index 3d7a2bb..0000000 --- a/src/app/tests/messages.component.spec.ts +++ /dev/null @@ -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; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ MessagesComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(MessagesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/tests/test.ts b/src/app/tests/test.ts deleted file mode 100644 index 2042356..0000000 --- a/src/app/tests/test.ts +++ /dev/null @@ -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[]; - (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); diff --git a/src/assets/icon_house.png b/src/ressources/assets/icon_house.png similarity index 100% rename from src/assets/icon_house.png rename to src/ressources/assets/icon_house.png diff --git a/src/ressources/routes/routes.ts b/src/ressources/routes/routes.ts new file mode 100644 index 0000000..1eb9e54 --- /dev/null +++ b/src/ressources/routes/routes.ts @@ -0,0 +1,2 @@ +export const collaborateursUrl = 'https://localhost:7125/api/collaborateurs'; +export const agencesUrl = 'https://localhost:7125/api/agences'; diff --git a/src/ressources/strings/strings_fr.ts b/src/ressources/strings/strings_fr.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/styles.css b/src/styles.css deleted file mode 100644 index 90d4ee0..0000000 --- a/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/src/styles.scss b/src/styles.scss new file mode 100644 index 0000000..ab2785a --- /dev/null +++ b/src/styles.scss @@ -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; +} +