From 9449162ccf2d0e97be52dfda3bd9068f617b0d95 Mon Sep 17 00:00:00 2001 From: apuente Date: Wed, 29 May 2024 15:16:02 +0200 Subject: [PATCH] =?UTF-8?q?Pagina=20usuarios=20modales=20a=C3=B1adir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ogWebconsole/src/app/app.module.ts | 3 +- .../add-user-modal.component.html | 43 +------------------ .../add-user-modal.component.ts | 31 +------------ 3 files changed, 5 insertions(+), 72 deletions(-) diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index 38a7391..8b9712b 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -7,7 +7,7 @@ import { MainLayoutComponent } from './components/layout/main-layout/main-layout import { HeaderComponent } from './components/layout/header/header.component'; import { SidebarComponent } from './components/layout/sidebar/sidebar.component'; import { LoginComponent } from './components/login/login.component'; -import { FormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { CustomInterceptor } from './services/custom.interceptor'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; @@ -48,6 +48,7 @@ import { AddUserModalComponent } from './components/pages/admin/users/users/add- imports: [BrowserModule, AppRoutingModule, FormsModule, + ReactiveFormsModule, MatToolbarModule, MatIconModule, MatButtonModule, diff --git a/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.html b/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.html index a65fc48..7f26618 100644 --- a/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.html +++ b/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.html @@ -5,50 +5,9 @@ Nombre de usuario - - - Roles - - - -
-
- - Unidad Organizacional {{i + 1}} - - -
- -
- - - Contraseña - - - - Habilitado - -
-
-
- - Grupo {{i + 1}} - - - - - Permisos - - - - Habilitado -
-
- -
- +
diff --git a/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.ts b/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.ts index 2daea9e..627cd62 100644 --- a/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.ts +++ b/ogWebconsole/src/app/components/pages/admin/users/users/add-user-modal/add-user-modal.component.ts @@ -1,5 +1,5 @@ import { Component, Inject } from '@angular/core'; -import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; @Component({ @@ -16,37 +16,10 @@ export class AddUserModalComponent { private fb: FormBuilder ) { this.userForm = this.fb.group({ - username: ['', Validators.required], - roles: ['', Validators.required], - allowedOrganizationalUnits: this.fb.array([this.createOrganizationalUnit()]), - password: ['', Validators.required], - enabled: [true], - userGroups: this.fb.array([this.createUserGroup()]) + username: ['', Validators.required] }); } - createOrganizationalUnit(): FormGroup { - return this.fb.group({ - name: ['', Validators.required] - }); - } - - addOrganizationalUnit(): void { - (this.userForm.get('allowedOrganizationalUnits') as FormArray).push(this.createOrganizationalUnit()); - } - - createUserGroup(): FormGroup { - return this.fb.group({ - name: ['', Validators.required], - permissions: ['', Validators.required], - enabled: [true] - }); - } - - addUserGroup(): void { - (this.userForm.get('userGroups') as FormArray).push(this.createUserGroup()); - } - onNoClick(): void { this.dialogRef.close(); }