diff --git a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.html b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.html
index b074aa4..6139635 100644
--- a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.html
+++ b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.html
@@ -1,6 +1,6 @@
-
{{ 'dialogTitleAddUser' | translate }}
+{{ isEditMode ? ('dialogTitleEditUser' | translate) : ('dialogTitleAddUser' | translate) }}
-
-
+
+
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts
index c5987ba..f66fa0f 100644
--- a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts
+++ b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts
@@ -1,9 +1,9 @@
import { Component, EventEmitter, Inject, OnInit, Output } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import {ToastrService} from "ngx-toastr";
-import {HttpClient} from "@angular/common/http";
-import {DataService} from "../data.service";
+import { ToastrService } from "ngx-toastr";
+import { HttpClient } from "@angular/common/http";
+import { DataService } from "../data.service";
interface UserGroup {
'@id': string;
@@ -19,15 +19,17 @@ interface UserGroup {
export class AddUserModalComponent implements OnInit {
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
@Output() userAdded = new EventEmitter();
+ @Output() userEdited = new EventEmitter();
userForm: FormGroup;
userGroups: UserGroup[] = [];
organizationalUnits: any[] = [];
userId: string | null = null;
loading: boolean = false;
+ isEditMode: boolean = false;
protected views = [
- {value: 'card', name: 'Tarjetas'},
- {value: 'list', name: 'Listado'},
+ { value: 'card', name: 'Tarjetas' },
+ { value: 'list', name: 'Listado' },
];
constructor(
@@ -45,6 +47,10 @@ export class AddUserModalComponent implements OnInit {
groupsView: ['card', Validators.required],
organizationalUnits: [[]]
});
+
+ if (data) {
+ this.isEditMode = true;
+ }
}
ngOnInit(): void {
@@ -114,6 +120,7 @@ export class AddUserModalComponent implements OnInit {
this.http.put(`${this.baseUrl}${this.userId}`, payload).subscribe(
(response) => {
this.toastService.success('Usuario editado correctamente');
+ this.userEdited.emit();
this.dialogRef.close();
this.loading = false;
},
@@ -126,6 +133,7 @@ export class AddUserModalComponent implements OnInit {
this.http.post(`${this.baseUrl}/users`, payload).subscribe(
(response) => {
this.toastService.success('Usuario añadido correctamente');
+ this.userAdded.emit();
this.dialogRef.close();
this.loading = false;
},
@@ -137,4 +145,4 @@ export class AddUserModalComponent implements OnInit {
}
}
}
-}
+}
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.css b/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.css
index d37ba39..45607bd 100644
--- a/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.css
+++ b/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.css
@@ -1,6 +1,5 @@
.user-form .form-field {
display: block;
- margin-bottom: 10px;
}
.checkbox-group label {
@@ -23,4 +22,8 @@ mat-spinner {
justify-content: flex-end;
gap: 1em;
padding: 1.5em;
+}
+
+.form-container {
+ margin-top: 2em;
}
\ No newline at end of file
diff --git a/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.html b/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.html
index 0a3aac7..e590732 100644
--- a/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.html
+++ b/ogWebconsole/src/app/components/admin/users/users/change-password-modal/change-password-modal.component.html
@@ -1,4 +1,4 @@
-{{ 'dialogTitleEditUser' | translate }}
+{{ 'dialogTitleChangePassword' | translate }}