parent
70607721fa
commit
6572202743
@ -1 +1,92 @@ |
||||
<p>periode-essai works!</p> |
||||
<div xmlns=""> |
||||
|
||||
<h3>Ajouter une Période d'Essai : </h3> |
||||
|
||||
<form [formGroup]="registerForm" (ngSubmit)="onSubmit()" > |
||||
|
||||
<div class="form-group col-12 col-md-6"> |
||||
<label class="form-label">Collaborateur</label> |
||||
<select class="form-select" formControlName="collaborateurId" id="collaborateur-select" [ngClass]="{ 'is-invalid': submitted && f.collaborateurId.errors }"> |
||||
<option value="" disabled selected>Choisissez le collaborateur concerné par cette période d'essai</option> |
||||
<option *ngFor="let collaborateur of collaborateurs" [ngValue]="collaborateur.id">{{collaborateur.name}}</option> |
||||
</select> |
||||
<div *ngIf="submitted && f.collaborateurId.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.collaborateurId.errors.required">Vous devez choisir le collaborateur concerné par cette période d'essai </div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de début</label> |
||||
<input type="date" class="form-control" formControlName="startingDate" (change)="onStartingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.startingDate.errors }"> |
||||
<div *ngIf="submitted && f.startingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.startingDate.errors.required">La date de début d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin prévue</label> |
||||
<input type="date" class="form-control" formControlName="plannedEndingDate" (change)="onPlannedEndingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.plannedEndingDate.errors }"> |
||||
<div *ngIf="submitted && f.plannedEndingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.plannedEndingDate.errors.required">La date de fin prévue d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3"> |
||||
<label class="form-label">Date de fin réelle</label> |
||||
<input type="date" class="form-control" formControlName="realEndingDate" (change)="onRealEndingDateChange($event)" [ngClass]="{ 'is-invalid': submitted && f.realEndingDate.errors }"> |
||||
<div *ngIf="submitted && f.realEndingDate.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.realEndingDate.errors.required">La date de fin réelle d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Commentaire</label> |
||||
<input class="form-control" formControlName="comment" [ngClass]="{ 'is-invalid': submitted && f.comment.errors }"> |
||||
<div *ngIf="submitted && f.comment.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.comment.errors.required">Le commentaire d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="form-group col-12 col-sm-6 col-md-4 col-lg-3 mb-2"> |
||||
<label class="form-label">Issue</label> |
||||
<input class="form-control" formControlName="issue" [ngClass]="{ 'is-invalid': submitted && f.issue.errors }"> |
||||
<div *ngIf="submitted && f.issue.errors" class="invalid-feedback"> |
||||
<div *ngIf="f.issue.errors.required">L'issue d'une période d'essai est obligatoire</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
<div> |
||||
<button type="submit">Créer la période d'essai</button> |
||||
<button type="reset" (click)="onReset()">Effacer</button> |
||||
</div> |
||||
</form> |
||||
|
||||
<h2 class = mb-4>Périodes d'essai</h2> |
||||
|
||||
<div style="overflow-x:auto;" class="mb-5 col-12"> |
||||
<table class="table"> |
||||
<thead> |
||||
<tr> |
||||
<th scope="col">ID</th> |
||||
<th scope="col">Collaborateur ID</th> |
||||
<th scope="col">Issue</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let periodeEssai of periodeEssais"> |
||||
<th scope="row">{{periodeEssai.id}}</th> |
||||
<td> {{periodeEssai.collaborateurId}} </td> |
||||
<td> <a routerLink="{{periodeEssai.issue}}"></a></td> |
||||
<td> <a routerLink="{{periodeEssai.id}}"> Modifier </a></td> |
||||
</tr> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
|
||||
|
||||
|
||||
</div> |
||||
|
@ -0,0 +1,9 @@ |
||||
export interface PeriodeEssai { |
||||
id: number; |
||||
collaborateurId : number; |
||||
startingDate : Date; |
||||
plannedEndingDate : Date; |
||||
realEndingDate : Date; |
||||
comment : string; |
||||
issue : string; |
||||
} |
@ -0,0 +1,37 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient, HttpHeaders} from "@angular/common/http"; |
||||
import {Observable} from "rxjs"; |
||||
import {periodeessaisUrl} from "../../ressources/routes/routesPreprod"; |
||||
import {PeriodeEssai} from "../interfaces/periode-essai"; |
||||
|
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class PeriodeEssaiService{ |
||||
private periodeessaisUrl = periodeessaisUrl; |
||||
|
||||
httpOptions = { |
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }) |
||||
}; |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
getPeriodeEssais():Observable<PeriodeEssai[]> { |
||||
return this.http.get<PeriodeEssai[]>(this.periodeessaisUrl); |
||||
} |
||||
|
||||
getPeriodeEssai(id : number):Observable<PeriodeEssai>{ |
||||
return this.http.get<PeriodeEssai>(this.periodeessaisUrl+"/"+id); |
||||
} |
||||
|
||||
updatePeriodeEssai(periodeEssai : PeriodeEssai):Observable<PeriodeEssai>{ |
||||
let body = JSON.stringify(periodeEssai); |
||||
return this.http.put<PeriodeEssai>(this.periodeessaisUrl + "/" + periodeEssai.id, body, this.httpOptions); |
||||
} |
||||
|
||||
addPeriodeEssai(periodeEssai: PeriodeEssai): Observable<PeriodeEssai> { |
||||
let body = JSON.stringify(periodeEssai); |
||||
return this.http.post<PeriodeEssai>(this.periodeessaisUrl, body, this.httpOptions); |
||||
} |
||||
} |
@ -1,3 +1,4 @@ |
||||
export const collaborateursUrl = 'https://collaborateur-epa.apsdigit.lan/api/collaborateurs'; |
||||
export const agencesUrl = 'https://collaborateur-epa.apsdigit.lan/api/agences'; |
||||
export const businessunitsUrl = 'https://collaborateur-epa.apsdigit.lan/api/businessunits'; |
||||
export const periodeessaisUrl = 'https://collaboratuer-epa.apsdigit.lan/api/periodeessais'; |
||||
|
Loading…
Reference in new issue