Ajout d'un popup de validation suite à la réponse d'une demande de délégation

develop
Yanaël GRETTE 4 years ago
parent 69eaf38f25
commit f09c3cb8cf
  1. 13
      src/app/demandes-delegation/demandes-delegation.component.html
  2. 29
      src/app/demandes-delegation/demandes-delegation.component.ts
  3. 4
      src/app/demandes-delegation/demandes-delegation.module.ts
  4. 1
      src/app/demandes-delegation/details-demande-delegation/demande-delegation.component.ts
  5. 9
      src/app/demandes-delegation/details-demande-delegation/dialog-reponse-demande-delegation.html
  6. 4
      src/app/demandes-delegation/dialog-validation-reponse.html

@ -1,4 +1,11 @@
<app-nav-menu></app-nav-menu> <app-nav-menu></app-nav-menu>
<h1>Liste des demandes de délégations</h1> <h2>Liste de vos demandes de délégations en attente</h2>
<ng-container *ngIf="chargement">
<app-demande-delegation *ngFor="let demandeDelegation of demandesDelegation" [demandeDelegation]="demandeDelegation" (eventEmitter)="donnerReponse($event)"></app-demande-delegation> <mat-spinner></mat-spinner>
</ng-container>
<ng-container *ngIf="!chargement">
<p *ngIf="demandesDelegation.length==0">
Aucune demande de délégation en cours.
</p>
<app-demande-delegation *ngFor="let demandeDelegation of demandesDelegation" [demandeDelegation]="demandeDelegation" (eventEmitter)="donnerReponse($event)"></app-demande-delegation>
</ng-container>

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, Inject, OnInit } from '@angular/core';
import { CollaborateurDTO, DemandeDelegationDTO, DemandesDelegationService } from '@shared/api-swagger'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { CollaborateurDTO, DemandeDelegationDTO, DemandesDelegationService, EtatDemande } from '@shared/api-swagger';
import { cles } from '@shared/utils/cles'; import { cles } from '@shared/utils/cles';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
@ -20,7 +21,7 @@ export class DemandesDelegationComponent implements OnInit {
demandeDelegationSubscription: Subscription; demandeDelegationSubscription: Subscription;
demandeDelegationReponseSubscription: Subscription; demandeDelegationReponseSubscription: Subscription;
constructor(private demandeDelegationService: DemandesDelegationService) {} constructor(private demandeDelegationService: DemandesDelegationService, private matDialog: MatDialog) {}
ngOnInit() { ngOnInit() {
@ -50,7 +51,17 @@ export class DemandesDelegationComponent implements OnInit {
console.log(event); console.log(event);
const id: number = event.id; const id: number = event.id;
this.demandeDelegationReponseSubscription = this.demandeDelegationService.updateDemandeDelegation(event, event.id).subscribe( this.demandeDelegationReponseSubscription = this.demandeDelegationService.updateDemandeDelegation(event, event.id).subscribe(
() => this.demandesDelegation.filter(d => d.id != id), () => {
let data: any = {
acceptee: false
};
if(event.etatDemande == EtatDemande.Validee) {
data.acceptee = true,
data.ep = event.ep
}
this.demandesDelegation = this.demandesDelegation.filter(d => d.id != id);
this.matDialog.open(DialogValidationReponse, {data:data});
},
err => console.log(err) err => console.log(err)
); );
} }
@ -64,3 +75,13 @@ export class DemandesDelegationComponent implements OnInit {
} }
} }
} }
@Component({
selector: "dialog-validation-reponse",
templateUrl: "./dialog-validation-reponse.html"
})
export class DialogValidationReponse {
constructor(@Inject(MAT_DIALOG_DATA)public data: any, private matDialog: MatDialogRef<DialogValidationReponse>) {}
fermer() {this.matDialog.close();}
}

@ -8,7 +8,7 @@ import { MaterialModule } from "@shared/angular-material/angular-material.module
import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module';
import { DemandesDelegationComponent } from './demandes-delegation.component'; import { DemandesDelegationComponent, DialogValidationReponse } from './demandes-delegation.component';
import { DemandeDelegationComponent, DialogReponseDemandeDelegation } from './details-demande-delegation/demande-delegation.component'; import { DemandeDelegationComponent, DialogReponseDemandeDelegation } from './details-demande-delegation/demande-delegation.component';
import { DemandesDelegationRoutingModule } from './demandes-delegation.routing.module'; import { DemandesDelegationRoutingModule } from './demandes-delegation.routing.module';
@ -16,7 +16,7 @@ import { DemandesDelegationRoutingModule } from './demandes-delegation.routing.m
@NgModule({ @NgModule({
declarations: [ declarations: [
DemandesDelegationComponent, DemandeDelegationComponent, DemandesDelegationComponent, DemandeDelegationComponent,
DialogReponseDemandeDelegation DialogReponseDemandeDelegation, DialogValidationReponse
], ],
exports: [ DemandesDelegationComponent exports: [ DemandesDelegationComponent
], ],

@ -86,6 +86,7 @@ enregistrer() {
return; return;
let demandeDelegation: DemandeDelegationDTO = this.data.demandeDelegation; let demandeDelegation: DemandeDelegationDTO = this.data.demandeDelegation;
demandeDelegation.etatDemande = this.data.etatDemande; demandeDelegation.etatDemande = this.data.etatDemande;
demandeDelegation.raisonRefus = this.raisonRefus;
this.reponse = { this.reponse = {
engistree: true, engistree: true,
demandeDelegation: demandeDelegation demandeDelegation: demandeDelegation

@ -0,0 +1,9 @@
<p>{{texte}}</p>
<div>
<mat-form-field *ngIf="estRefus" appearance="fill">
<mat-label>Raison du refus</mat-label>
<textarea matInput [(ngModel)]="raisonRefus"></textarea>
</mat-form-field>
</div>
<button mat-raised-button (click)="enregistrer()" color="primary">Enregister la réponse</button>
<button mat-raised-button (click)="fermer()" color="warn">Annuler</button>

@ -0,0 +1,4 @@
<p>Votre réponse à la demande de délégation a bien été enregistrée</p>
<button *ngIf="data.acceptee" (click)="fermer()" [routerLink]="['/ep', data.ep.id]" mat-raised-button>Accéder à l'EP</button>
<button mat-raised-button (click)="fermer()">Fermer</button>
Loading…
Cancel
Save