From 0a0966f398e87c913c8079f76c26c0fbfb7d5c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Tue, 9 Mar 2021 15:30:46 +0100 Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20de=20ne=20r=C3=A9cup=C3=A9re?= =?UTF-8?q?r=20que=20les=20EP=20obligatoires=20dans=20la=20page=20assistan?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/shared/api-swagger/api/ep.service.ts | 78 ++++++++----------- .../shared/mat-tables/ep-table/ep-table.html | 30 ++++--- .../shared/mat-tables/ep-table/ep-table.ts | 17 +++- 3 files changed, 68 insertions(+), 57 deletions(-) diff --git a/src/app/shared/api-swagger/api/ep.service.ts b/src/app/shared/api-swagger/api/ep.service.ts index 75e18bc..884eb84 100644 --- a/src/app/shared/api-swagger/api/ep.service.ts +++ b/src/app/shared/api-swagger/api/ep.service.ts @@ -208,27 +208,29 @@ export class EpService { * @param idBUs liste des ids des BU auxquelles les données sont rattachées * @param asc Indique si les données sont récupérées dans l'ordre croissant ou non * @param numPage Numéro de la page du tableau à afficher - * @param parPAge Nombre d’élément maximum à afficher dans le tableau + * @param parPage Nombre d’élément maximum à afficher dans le tableau * @param texte Texte permettant de filtrer les données + * @param epObligatoire Récupérer la liste des EP obligatoires * @param tri Colonne du tableau sur lequel le tri devra être effectué * @param dateDebut Date à partir de laquelle les données son récupérées * @param dateFin Date jusqu'à laquelle les données sont récupérées * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'body', reportProgress?: boolean): Observable>; - public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'response', reportProgress?: boolean): Observable>>; - public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'events', reportProgress?: boolean): Observable>>; - public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe: any = 'body', reportProgress: boolean = false ): Observable { - - - - - - - - - + public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPage?: number, texte?: string, epObligatoire?: boolean, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'body', reportProgress?: boolean): Observable>; + public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPage?: number, texte?: string, epObligatoire?: boolean, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'response', reportProgress?: boolean): Observable>>; + public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPage?: number, texte?: string, epObligatoire?: boolean, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'events', reportProgress?: boolean): Observable>>; + public getEPEnCours(idBUs?: Array, asc?: boolean, numPage?: number, parPage?: number, texte?: string, epObligatoire?: boolean, tri?: string, dateDebut?: Date, dateFin?: Date, observe: any = 'body', reportProgress: boolean = false ): Observable { + + + + + + + + + + let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); if (idBUs) { idBUs.forEach((element) => { @@ -241,12 +243,15 @@ export class EpService { if (numPage !== undefined && numPage !== null) { queryParameters = queryParameters.set('numPage', numPage); } - if (parPAge !== undefined && parPAge !== null) { - queryParameters = queryParameters.set('parPAge', parPAge); + if (parPage !== undefined && parPage !== null) { + queryParameters = queryParameters.set('parPage', parPage); } if (texte !== undefined && texte !== null) { queryParameters = queryParameters.set('texte', texte); } + if (epObligatoire !== undefined && epObligatoire !== null) { + queryParameters = queryParameters.set('epObligatoire', epObligatoire); + } if (tri !== undefined && tri !== null) { queryParameters = queryParameters.set('tri', tri); } @@ -390,49 +395,34 @@ export class EpService { * * Récupérer le nombre total d’EP en cours. * @param idBUs liste des ids des BU auxquelles les données sont rattachées - * @param asc Indique si les données sont récupérées dans l'ordre croissant ou non - * @param numPage Numéro de la page du tableau à afficher - * @param parPAge Nombre d’élément maximum à afficher dans le tableau * @param texte Texte permettant de filtrer les données - * @param tri Colonne du tableau sur lequel le tri devra être effectué + * @param epObligatoire Récupérer la liste des EP obligatoires * @param dateDebut Date à partir de laquelle les données son récupérées * @param dateFin Date jusqu'à laquelle les données sont récupérées * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getEPEnCoursCount(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'body', reportProgress?: boolean): Observable; - public getEPEnCoursCount(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'response', reportProgress?: boolean): Observable>; - public getEPEnCoursCount(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe?: 'events', reportProgress?: boolean): Observable>; - public getEPEnCoursCount(idBUs?: Array, asc?: boolean, numPage?: number, parPAge?: number, texte?: string, tri?: string, dateDebut?: Date, dateFin?: Date, observe: any = 'body', reportProgress: boolean = false ): Observable { - - - - - - - - - + public getEPEnCoursCount(idBUs?: Array, texte?: string, epObligatoire?: boolean, dateDebut?: Date, dateFin?: Date, observe?: 'body', reportProgress?: boolean): Observable; + public getEPEnCoursCount(idBUs?: Array, texte?: string, epObligatoire?: boolean, dateDebut?: Date, dateFin?: Date, observe?: 'response', reportProgress?: boolean): Observable>; + public getEPEnCoursCount(idBUs?: Array, texte?: string, epObligatoire?: boolean, dateDebut?: Date, dateFin?: Date, observe?: 'events', reportProgress?: boolean): Observable>; + public getEPEnCoursCount(idBUs?: Array, texte?: string, epObligatoire?: boolean, dateDebut?: Date, dateFin?: Date, observe: any = 'body', reportProgress: boolean = false ): Observable { + + + + + + let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); if (idBUs) { idBUs.forEach((element) => { queryParameters = queryParameters.append('idBUs', element); }) } - if (asc !== undefined && asc !== null) { - queryParameters = queryParameters.set('asc', asc); - } - if (numPage !== undefined && numPage !== null) { - queryParameters = queryParameters.set('numPage', numPage); - } - if (parPAge !== undefined && parPAge !== null) { - queryParameters = queryParameters.set('parPAge', parPAge); - } if (texte !== undefined && texte !== null) { queryParameters = queryParameters.set('texte', texte); } - if (tri !== undefined && tri !== null) { - queryParameters = queryParameters.set('tri', tri); + if (epObligatoire !== undefined && epObligatoire !== null) { + queryParameters = queryParameters.set('epObligatoire', epObligatoire); } if (dateDebut !== undefined && dateDebut !== null) { queryParameters = queryParameters.set('dateDebut', dateDebut.toISOString()); diff --git a/src/app/shared/mat-tables/ep-table/ep-table.html b/src/app/shared/mat-tables/ep-table/ep-table.html index 7b08a9a..c315838 100644 --- a/src/app/shared/mat-tables/ep-table/ep-table.html +++ b/src/app/shared/mat-tables/ep-table/ep-table.html @@ -35,22 +35,30 @@ - Date de début - - clear - - + Date de début + + clear + + - Date de fin - - clear - - + Date de fin + + clear + + - + + +
+ + EP obligatoires + +
+ + diff --git a/src/app/shared/mat-tables/ep-table/ep-table.ts b/src/app/shared/mat-tables/ep-table/ep-table.ts index 5138072..45cd444 100644 --- a/src/app/shared/mat-tables/ep-table/ep-table.ts +++ b/src/app/shared/mat-tables/ep-table/ep-table.ts @@ -1,4 +1,5 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; +import { MatSlideToggleChange } from "@angular/material/slide-toggle"; import { MatTableDataSource } from "@angular/material/table"; import { affichageStatut, BusinessUnitDTO, CollaborateurDTO, EpInformationDTO, EpService, estEnAttente, StatutEp, TypeEp } from "@shared/api-swagger"; import { cles, epTypeRecherche } from "@shared/utils/cles"; @@ -11,6 +12,7 @@ import { Subscription } from "rxjs"; export class EpTableComponent implements OnInit{ chargement: boolean = true; + epTypeRecherche :any = epTypeRecherche; /** * * Ordre de tri à envoyer au serveur (true : croissant, false : décroissantà). @@ -57,6 +59,11 @@ export class EpTableComponent implements OnInit{ */ private busIds: Array = []; + /** + * Permet d'indiquer si l'on ne récupère que les EP obligatoires ou non (lors de la récupération des EP en cours uniquement) + */ + epObligatoires: boolean = false; + dateDebut : Date; dateFin: Date; @@ -149,10 +156,11 @@ export class EpTableComponent implements OnInit{ } getEPEnCours() { - this.epSubscription = this.epService.getEPEnCours(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe( + console.log(this.epObligatoires); + this.epSubscription = this.epService.getEPEnCours(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.epObligatoires, this.tri, this.dateDebut, this.dateFin).subscribe( eps => { this.dataSource = new MatTableDataSource(eps); - this.epCountSubscription = this.epService.getEPEnCoursCount(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe( + this.epCountSubscription = this.epService.getEPEnCoursCount(this.busIds,this.search, this.epObligatoires, this.dateDebut, this.dateFin).subscribe( count => { console.log(count); this.taille = count @@ -186,6 +194,11 @@ export class EpTableComponent implements OnInit{ ); } + updateToggle(event :MatSlideToggleChange) { + this.epObligatoires = event.checked; + this.updateDataSource(); + } + /** * création de la liste des business unit du collaborateur connecté pour afficher les checkboxes */