Skip to content
Snippets Groups Projects
Commit 7c55a54d authored by Jérémie BRISON's avatar Jérémie BRISON Committed by Hugo SUBTIL
Browse files

feat(admin) : add commentary

parent 0f9e822e
Branches
Tags
3 merge requests!68Recette,!67Dev,!51Feat/admin panel attachment
<div fxLayout="row" fxLayoutAlign="center center">
<table>
<table *ngIf="demandsAttachment">
<thead>
<th>Utilisateur</th>
<th>Structure</th>
......
......@@ -15,21 +15,26 @@ export class ValidationAttachmentComponent implements OnInit {
constructor(private adminService: AdminService) {}
ngOnInit(): void {
this.demandsAttachment = this.adminService.getPendingAttachmentsStructure();
this.adminService.getPendingAttachmentsStructure().subscribe((demands) => {
this.demandsAttachment = demands;
});
}
// Todo : Appeler removeDemand(demand) dans le subscribe de acceptAttachmentStructure() quand l'api sera faite.
public acceptDemand(demand: demandAttachment): void {
console.log('accept');
this.removeDemand(demand);
this.adminService.acceptAttachmentStructure(demand.userEmail, demand.structureId);
this.removeDemand(demand);
}
// Todo : Appeler removeDemand(demand) dans le subscribe de acceptAttachmentStructure() quand l'api sera faite.
public refuseDemand(demand: demandAttachment): void {
console.log('refuse');
this.adminService.refuseAttachmentStructure(demand.userEmail, demand.structureId);
this.removeDemand(demand);
}
// Remove the request that was accepted or refused
private removeDemand(demand: demandAttachment): void {
const index = this.demandsAttachment.findIndex((d: demandAttachment) => d === demand);
if (index > -1) {
......
import { Structure } from '../../models/structure.model';
import { User } from '../../models/user.model';
export class demandAttachment {
userEmail: string;
structureId: number;
......
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { demandAttachment } from '../models/demandAttachment.model';
@Injectable({
providedIn: 'root',
})
export class AdminService {
constructor() {}
constructor(private http: HttpClient) {}
// Return pendingAttachments of all profiles.
public getPendingAttachmentsStructure(): demandAttachment[] {
return [{ userEmail: 'jb@test.fr', structureId: 53 }];
public getPendingAttachmentsStructure(): Observable<demandAttachment[]> {
return this.http.get<any>('api/users/pendingAttachments');
}
// Post
public acceptAttachmentStructure(mailUser, idStructure): void {}
// Todo : Api post qui retourne vrai si aucune erreur sinon httpException
public acceptAttachmentStructure(mailUser, idStructure) {}
// Post
public refuseAttachmentStructure(mailUser, idStructure): void {}
// Todo : Api post qui retourne vrai si aucune erreur sinon httpException
public refuseAttachmentStructure(mailUser, idStructure) {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment