Skip to content
Snippets Groups Projects
Commit 63912a66 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'feat/US1-admin-remove-from-structure' into 'dev'

feat/US1-admin-remove-from-structure

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client!160
parents 2bb59485 23f1ad8b
No related branches found
No related tags found
3 merge requests!180release V1.10.0,!178release V1.10.0,!160feat/US1-admin-remove-from-structure
......@@ -35,6 +35,7 @@
"leaflet.locatecontrol": "^0.72.0",
"lodash": "^4.17.20",
"luxon": "^1.25.0",
"npx": "^10.2.2",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
......
......@@ -31,7 +31,11 @@
<a class="structureName" routerLink="/acteurs" [state]="{ data: s.structure }">{{
s.structure.structureName
}}</a>
<app-structure-options-modal [structure]="s" (closed)="ngOnInit()"></app-structure-options-modal>
<app-structure-options-modal
[structure]="s"
(closed)="ngOnInit()"
(closedWithRefresh)="ngOnInit()"
></app-structure-options-modal>
</div>
<div fxLayout="column" fxLayoutGap="14px" class="ownersBlock">
<p class="ownerName" *ngFor="let owner of s.owners">{{ owner.email }}</p>
......
......@@ -23,6 +23,7 @@ export class StructureOptionsModalComponent implements OnInit {
@Input() public userProfile?: User;
@Input() public isEditFormView? = false;
@Output() closed = new EventEmitter();
@Output() closedWithRefresh = new EventEmitter();
public active: boolean;
// Password profile
......@@ -135,10 +136,17 @@ export class StructureOptionsModalComponent implements OnInit {
// Profile Section
public closeModalOptsProfile(): void {
this.editModal = null;
this.formEmail.reset();
this.formPassword.reset();
}
public closeModalOptsProfileAndRefresh(): void {
this.editModal = null;
//this.formAddAccount.reset();
this.formEmail.reset();
this.formPassword.reset();
this.closedWithRefresh.emit();
}
private toggleDeleteAccountModal(): void {
......@@ -196,6 +204,7 @@ export class StructureOptionsModalComponent implements OnInit {
user.email = this.fAddAccount.email.value;
this.structureService.addOwnerToStructure(user, this.structure.structure._id).subscribe(
() => {
this.closedWithRefresh.emit('');
this.closeModalOptsProfile();
this.formAddAccount.reset();
},
......@@ -209,7 +218,7 @@ export class StructureOptionsModalComponent implements OnInit {
this.structureService.removeOwnerFromStructure(owner, this.structure.structure._id).subscribe(() => {
this.structure.owners = this.structure.owners.filter((o) => o.id !== owner);
if (this.structure.owners.length == 0) {
this.closeModalOptsProfile();
this.closeModalOptsProfileAndRefresh();
}
});
}
......
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