diff --git a/package.json b/package.json index d9282d1599a487d298e479d53907c8331ec25927..da8e72a2c286ff85b66614f1cadfa0d2cc6b1027 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/app/profile/profile.component.html b/src/app/profile/profile.component.html index 5dbf5d216ecea729fd24bd4272118193729f56d8..43c5a29af27dce8034692e6c1aaf3b4e62b7c649 100644 --- a/src/app/profile/profile.component.html +++ b/src/app/profile/profile.component.html @@ -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> diff --git a/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts b/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts index dccf978c4e929bdb5d20882d324656e9f4a42366..7f3ea1a62aa72cc0b60bce324ea9e5beedfac267 100644 --- a/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts +++ b/src/app/shared/components/structure-options-modal/structure-options-modal.component.ts @@ -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(); } }); }