|
|
|
@ -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 { ButtonManagementService } from '../../services/button-management.service';
|
|
|
|
import { StorageService } from '../../shared/services/storage.service';
|
|
|
|
import { StorageService } from '../../shared/services/storage.service';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -33,13 +34,24 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
renewalDataExpanded: boolean = true;
|
|
|
|
renewalDataExpanded: boolean = true;
|
|
|
|
totalCount: number = 0;
|
|
|
|
totalCount: number = 0;
|
|
|
|
mode: 'edit' | 'view' = 'view';
|
|
|
|
mode: 'edit' | 'view' = 'view';
|
|
|
|
|
|
|
|
buttonPermissions: any;
|
|
|
|
|
|
|
|
roleOptions = [
|
|
|
|
|
|
|
|
{ label: 'Admin', value: 'ADMIN' },
|
|
|
|
|
|
|
|
{ label: 'User', value: 'USER' }
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private userService: UserSetupService, private fb: FormBuilder, private storageService: StorageService){}
|
|
|
|
constructor(
|
|
|
|
|
|
|
|
private userService: UserSetupService,
|
|
|
|
|
|
|
|
private fb: FormBuilder,
|
|
|
|
|
|
|
|
private buttonManagementService: ButtonManagementService,
|
|
|
|
|
|
|
|
private storageService: StorageService
|
|
|
|
|
|
|
|
){}
|
|
|
|
|
|
|
|
|
|
|
|
get users$(){
|
|
|
|
get users$(){
|
|
|
|
return this.userService.users$;
|
|
|
|
return this.userService.users$;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onSearch(value: string): void {
|
|
|
|
onSearch(value: string): void {
|
|
|
|
this.searchText = value;
|
|
|
|
this.searchText = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -70,7 +82,7 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
userId: this.userForm.value.userId,
|
|
|
|
userId: this.userForm.value.userId,
|
|
|
|
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: this.userForm.value.userRole,
|
|
|
|
porOrgacode: this.storageService.getItem('POR_ORGACODE'),
|
|
|
|
porOrgacode: this.storageService.getItem('POR_ORGACODE'),
|
|
|
|
password: this.userForm.value.defaultPassword
|
|
|
|
password: this.userForm.value.defaultPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -82,6 +94,7 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
this.userForm.reset();
|
|
|
|
this.userForm.reset();
|
|
|
|
this.mode = 'edit';
|
|
|
|
this.mode = 'edit';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
error: (err: any) => console.error(err)
|
|
|
|
error: (err: any) => console.error(err)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@ -117,10 +130,15 @@ export class SetupUserComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getButtonPermissions();
|
|
|
|
|
|
|
|
|
|
|
|
this.userForm = this.fb.group({
|
|
|
|
this.userForm = this.fb.group({
|
|
|
|
userId: ['', [Validators.required]],
|
|
|
|
userId: ['', [Validators.required]],
|
|
|
|
userFullname: ['', [Validators.required, Validators.maxLength(500)]],
|
|
|
|
userFullname: ['', [Validators.required, Validators.maxLength(500)]],
|
|
|
|
defaultPassword: ['', Validators.required]
|
|
|
|
defaultPassword: ['', Validators.required],
|
|
|
|
|
|
|
|
email: ['', [Validators.required, Validators.email]],
|
|
|
|
|
|
|
|
userRole: ['', Validators.required]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.userService.loadUsers();
|
|
|
|
this.userService.loadUsers();
|
|
|
|
@ -139,4 +157,8 @@ ngOnInit(): void {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getButtonPermissions(){
|
|
|
|
|
|
|
|
this.buttonPermissions = this.buttonManagementService.buttonPermissions["setupUser"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|