put in new file

This commit is contained in:
2025-12-13 22:11:50 +11:00
parent ef7f2bcf1c
commit c5e641180b
3 changed files with 104 additions and 14 deletions
+10 -10
View File
@@ -24,7 +24,7 @@ export class StaffEditComponent implements OnInit, OnDestroy {
_error ='';
_id= -1;
Roles: Code[] = [];
id = input(0, { transform: numberAttribute });
id = input(0);
isNew = false;
validationPoints?: Code[];
private staffService = inject(StaffService);
@@ -48,14 +48,12 @@ export class StaffEditComponent implements OnInit, OnDestroy {
password: [''],
active: [false], //Validators.required
roleType: [0,[Validators.required, Validators.min(1)]],
roleType: [0,[Validators.required, Validators.min(1)]],
});
constructor(
) {
constructor() {
this.fillRole();
}
fillRole() :void
fillRole() : void
{
this.Roles = [];
let item:Code = {id:userRole.Admin, name: 'Admin', status:'Admin'};
@@ -69,7 +67,8 @@ fillRole() :void
//item = {id:userRole.Normal, name: 'Switch', status:'Switch'};
//this.Roles.push(item);
}
getClassForRequire(prev:string,name:string){
getClassForRequire(prev:string,name:string): string {
const notok = !this.adminuserForm.controls[name].valid &&
this.adminuserForm.controls[name].touched;
let str =prev;
@@ -77,7 +76,8 @@ getClassForRequire(prev:string,name:string){
str += " ng-invalid ng-dirty";
return str;
}
ngOnInit():void {
ngOnInit(): void {
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
const id = this.id(); // Number(this.route.snapshot.paramMap.get('id'));
// now load thing up
@@ -104,9 +104,9 @@ ngOnInit():void {
else
{
this.isNew = true;
}
}
}
getEditText(): string {
if (this._id > 0)
return "Edit Staff";