|
|
|
@ -8,6 +8,7 @@ import { SetupUser } from '../../models/user';
|
|
|
|
import { UserSetupService } from '../../services/user-setup.service';
|
|
|
|
import { UserSetupService } from '../../services/user-setup.service';
|
|
|
|
import { UserFilterPipe } from '../../shared/pipes/userFilterPipe';
|
|
|
|
import { UserFilterPipe } from '../../shared/pipes/userFilterPipe';
|
|
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
|
|
import { FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
|
|
|
|
|
|
import { StorageService } from '../../shared/services/storage.service';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
@ -34,7 +35,7 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
mode: 'edit' | 'view' = 'view';
|
|
|
|
mode: 'edit' | 'view' = 'view';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private userService: UserSetupService, private fb: FormBuilder){}
|
|
|
|
constructor(private userService: UserSetupService, private fb: FormBuilder, private storageService: StorageService){}
|
|
|
|
|
|
|
|
|
|
|
|
get users$(){
|
|
|
|
get users$(){
|
|
|
|
return this.userService.users$;
|
|
|
|
return this.userService.users$;
|
|
|
|
@ -70,8 +71,11 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
userFullname: this.userForm.value.userFullname,
|
|
|
|
userFullname: this.userForm.value.userFullname,
|
|
|
|
email: `${this.userForm.value.userId}@dummy.com`,
|
|
|
|
email: `${this.userForm.value.userId}@dummy.com`,
|
|
|
|
role: 'ADMIN',
|
|
|
|
role: 'ADMIN',
|
|
|
|
defaultPassword: this.userForm.value.defaultPassword
|
|
|
|
porOrgacode: this.storageService.getItem('POR_ORGACODE'),
|
|
|
|
|
|
|
|
password: this.userForm.value.defaultPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('Payload:', newUser); // 👈 Debug
|
|
|
|
|
|
|
|
|
|
|
|
this.userService.addUser(newUser).subscribe({
|
|
|
|
this.userService.addUser(newUser).subscribe({
|
|
|
|
next: () => {
|
|
|
|
next: () => {
|
|
|
|
this.userService.loadUsers();
|
|
|
|
this.userService.loadUsers();
|
|
|
|
|