Skip to content
Snippets Groups Projects
Commit c2854d0a authored by Antonin COQUET's avatar Antonin COQUET
Browse files

report error on structur form list

parent 099b8341
No related branches found
No related tags found
3 merge requests!178release V1.10.0,!120Dev,!113Feat/report structure error
...@@ -193,4 +193,10 @@ export class StructureService { ...@@ -193,4 +193,10 @@ export class StructureService {
public getStructureWithOwners(structureId: string, profile: User): Observable<StructureWithOwners> { public getStructureWithOwners(structureId: string, profile: User): Observable<StructureWithOwners> {
return this.http.post<any>(`${this.baseUrl}/${structureId}/withOwners`, { emailUser: profile.email }); return this.http.post<any>(`${this.baseUrl}/${structureId}/withOwners`, { emailUser: profile.email });
} }
public sendMailOnStructureError(structureId: string, content: string, profile: User): Observable<boolean> {
console.log('send:', content, ' to:', structureId);
return;
//return this.http.post<any>(`${this.baseUrl}/${structureId}/withOwners`, { emailUser: profile.email });
}
} }
...@@ -14,6 +14,7 @@ import { RadioFormComponent } from './radio-form/radio-form.component'; ...@@ -14,6 +14,7 @@ import { RadioFormComponent } from './radio-form/radio-form.component';
import { ModalConfirmationComponent } from './modal-confirmation/modal-confirmation.component'; import { ModalConfirmationComponent } from './modal-confirmation/modal-confirmation.component';
import { StructureOptionsModalComponent } from './structure-options-modal/structure-options-modal.component'; import { StructureOptionsModalComponent } from './structure-options-modal/structure-options-modal.component';
import { ModalOptionsComponent } from './modal-options/modal-options.component'; import { ModalOptionsComponent } from './modal-options/modal-options.component';
import { TextInputModalComponent } from './text-input-modal/text-input-modal.component';
// tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length
export { export {
...@@ -33,6 +34,7 @@ export { ...@@ -33,6 +34,7 @@ export {
ModalConfirmationComponent, ModalConfirmationComponent,
StructureOptionsModalComponent, StructureOptionsModalComponent,
ModalOptionsComponent, ModalOptionsComponent,
TextInputModalComponent,
}; };
// tslint:disable-next-line:variable-name // tslint:disable-next-line:variable-name
...@@ -53,4 +55,5 @@ export const SharedComponents = [ ...@@ -53,4 +55,5 @@ export const SharedComponents = [
ModalConfirmationComponent, ModalConfirmationComponent,
StructureOptionsModalComponent, StructureOptionsModalComponent,
ModalOptionsComponent, ModalOptionsComponent,
TextInputModalComponent,
]; ];
<div *ngIf="openned" class="modalBackground" ng-controller="myCtrl">
<div class="modal">
<div class="contentModal" fxLayout="column" fxLayoutAlign="space-around center">
<h3>ATTENTION</h3>
<p>{{ content }}</p>
<textarea ng-model="myContent" id="story" class="textarea" name="story" rows="6">{{ placeholder }}</textarea>
<div class="footerModal" fxLayout="row" fxLayoutAlign="space-around center">
<button class="btn-primary small leave" (click)="closeModal(true)">Confirmer</button>
<button class="btn-primary small" (click)="closeModal(false)">Annuler</button>
</div>
{{ myContent }}
</div>
</div>
</div>
@import '../../../../assets/scss/color';
@import '../../../../assets/scss/typography';
@import '../../../../assets/scss/shapes';
@import '../../../../assets/scss/z-index';
.modalExitContainer {
width: 100%;
height: 100%;
z-index: $modal-z-index;
position: absolute;
content: '';
top: 0;
background-color: $modal-background;
.modal {
.contentModal {
width: 100%;
background: $white;
padding: 35px 20px 18px 20px;
h3 {
@include cn-bold-18;
color: $orange-warning;
}
p {
@include cn-bold-16;
color: $grey-1;
text-align: center;
}
.footerModal {
width: 100%;
margin-top: 14px;
@include cn-bold-16;
.leave {
background: none;
color: $grey-1;
text-decoration: underline;
}
}
}
width: 350px;
margin: auto;
border-radius: 6px;
@include background-hash($grey-2);
border: 1px solid $grey-4;
margin-top: 50vh;
transform: translateY(-50%);
}
}
.textarea {
width: 100%;
background-color: #f8f8f8;
}
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TextInputModalComponent } from './text-input-modal.component';
describe('ModalConfirmationComponent', () => {
let component: TextInputModalComponent;
let fixture: ComponentFixture<TextInputModalComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TextInputModalComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TextInputModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'app-text-input-modal',
templateUrl: './text-input-modal.component.html',
styleUrls: ['./text-input-modal.component.scss'],
})
export class TextInputModalComponent {
@Input() public openned: boolean;
@Input() public content: string;
@Input() public placeholder: string;
@Output() closed = new EventEmitter<boolean>();
public myContent: string;
constructor() {}
public closeModal(value: boolean): void {
this.closed.emit(value);
}
}
...@@ -124,6 +124,14 @@ ...@@ -124,6 +124,14 @@
<div fxLayout="row" fxLayoutAlign="center center" class="hide-on-print"> <div fxLayout="row" fxLayoutAlign="center center" class="hide-on-print">
<a *ngIf="!isClaimed" (click)="handleClaim()" class="primary" tabindex="0">Revendiquer cette structure</a> <a *ngIf="!isClaimed" (click)="handleClaim()" class="primary" tabindex="0">Revendiquer cette structure</a>
<a *ngIf="displayJoin()" (click)="handleJoin()" class="primary" tabindex="0">Rejoindre cette structure</a> <a *ngIf="displayJoin()" (click)="handleJoin()" class="primary" tabindex="0">Rejoindre cette structure</a>
<a
*ngIf="!profileService.isLinkedToStructure(structure._id) && !profileService.isAdmin()"
(click)="displayModalError()"
class="primary"
tabindex="0"
>
Signaler une erreur
</a>
<!-- temporary remove edit --> <!-- temporary remove edit -->
<a <a
*ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()" *ngIf="profileService.isLinkedToStructure(structure._id) || profileService.isAdmin()"
...@@ -369,3 +377,12 @@ ...@@ -369,3 +377,12 @@
" "
(closed)="joinStructure($event)" (closed)="joinStructure($event)"
></app-modal-confirmation> ></app-modal-confirmation>
<app-text-input-modal
[openned]="structureErrorModalOpenned"
[placeholder]="'Décrivez l\'erreur ici'"
[content]="
'Voulez-vous notifier res\'in d\'une erreur sur la fiche de cet acteur&nbsp;? Votre commentaire sera envoyé aux administrateurs.'
"
(closed)="sendErrorEmail($event)"
></app-text-input-modal>
...@@ -42,6 +42,7 @@ export class StructureDetailsComponent implements OnInit { ...@@ -42,6 +42,7 @@ export class StructureDetailsComponent implements OnInit {
public currentProfile: User = null; public currentProfile: User = null;
public deleteModalOpenned = false; public deleteModalOpenned = false;
public claimModalOpenned = false; public claimModalOpenned = false;
public structureErrorModalOpenned = false;
public joinModalOpenned = false; public joinModalOpenned = false;
constructor( constructor(
...@@ -236,13 +237,13 @@ export class StructureDetailsComponent implements OnInit { ...@@ -236,13 +237,13 @@ export class StructureDetailsComponent implements OnInit {
_.find(this.accessRightsReferentiel.modules, { id: rights }) _.find(this.accessRightsReferentiel.modules, { id: rights })
); );
this.parentingHelp = this.structure.parentingHelp.map((help) => this.parentingHelp = this.structure.parentingHelp.map((help) =>
_.find(this.parentingHelpsReferentiel.modules, { id: help }) _.find(this.parentingHelpsReferentiel.modules, { id: help })
); );
this.socialAndProfessional = this.structure.socialAndProfessional.map((skill) => this.socialAndProfessional = this.structure.socialAndProfessional.map((skill) =>
_.find(this.socialAndProfessionalsReferentiel.modules, { id: skill }) _.find(this.socialAndProfessionalsReferentiel.modules, { id: skill })
); );
this.digitalCultureSecurity = this.structure.digitalCultureSecurity.map((skill) => this.digitalCultureSecurity = this.structure.digitalCultureSecurity.map((skill) =>
_.find(this.digitalCultureSecuritysReferentiel.modules, { id: skill }) _.find(this.digitalCultureSecuritysReferentiel.modules, { id: skill })
); );
} }
...@@ -288,4 +289,17 @@ export class StructureDetailsComponent implements OnInit { ...@@ -288,4 +289,17 @@ export class StructureDetailsComponent implements OnInit {
!this.profileService.isPendingLinkedToStructure(this.structure._id) !this.profileService.isPendingLinkedToStructure(this.structure._id)
); );
} }
public displayModalError(): void {
//do we need to check for user is logged ?
this.structureErrorModalOpenned = !this.structureErrorModalOpenned;
}
public sendErrorEmail(shouldSend: boolean, content: string): void {
this.displayModalError();
if (shouldSend) {
console.log('conrtent is:', content);
this.structureService.sendMailOnStructureError(this.structure._id, '', this.currentProfile);
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment