put in signal for edit
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ApplicationConfig, provideAppInitializer, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { provideRouter, withComponentInputBinding } from '@angular/router';
|
||||
import { JwtInterceptor, ErrorInterceptor, initializeApp } from './shares';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
import { providePrimeNG } from 'primeng/config';
|
||||
@@ -27,7 +27,7 @@ export const appConfig: ApplicationConfig = {
|
||||
}
|
||||
}
|
||||
}),
|
||||
provideRouter(routes)
|
||||
provideRouter(routes, withComponentInputBinding())
|
||||
]
|
||||
};
|
||||
/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, inject, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, inject, input, numberAttribute, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ReactiveFormsModule, UntypedFormBuilder, Validators } from '@angular/forms';
|
||||
import { Subject, Subscription} from 'rxjs';
|
||||
@@ -23,9 +23,15 @@ export class StaffEditComponent implements OnInit, OnDestroy {
|
||||
loginUser ='';
|
||||
_error ='';
|
||||
_id= -1;
|
||||
Roles: Code[];
|
||||
Roles: Code[] = [];
|
||||
id = input(0, { transform: numberAttribute });
|
||||
isNew = false;
|
||||
validationPoints?: Code[];
|
||||
private staffService = inject(StaffService);
|
||||
private messageService = inject(MessageService);
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private lookupService = inject(LookupService);
|
||||
msg="[adminUser Component] ";
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
//for focus input
|
||||
@@ -46,12 +52,11 @@ export class StaffEditComponent implements OnInit, OnDestroy {
|
||||
|
||||
});
|
||||
constructor(
|
||||
private staffService: StaffService,
|
||||
private messageService: MessageService,
|
||||
private lookupService: LookupService,
|
||||
private router: Router, private route: ActivatedRoute,
|
||||
) {
|
||||
|
||||
this.fillRole();
|
||||
}
|
||||
fillRole() :void
|
||||
{
|
||||
this.Roles = [];
|
||||
let item:Code = {id:userRole.Admin, name: 'Admin', status:'Admin'};
|
||||
this.Roles.push(item);
|
||||
@@ -61,11 +66,9 @@ constructor(
|
||||
this.Roles.push(item);
|
||||
item = {id:userRole.ServiceManager, name: 'Service Manager', status:'ServiceManager'};
|
||||
this.Roles.push(item);
|
||||
|
||||
|
||||
//item = {id:userRole.Normal, name: 'Switch', status:'Switch'};
|
||||
//this.Roles.push(item);
|
||||
}
|
||||
}
|
||||
getClassForRequire(prev:string,name:string){
|
||||
const notok = !this.adminuserForm.controls[name].valid &&
|
||||
this.adminuserForm.controls[name].touched;
|
||||
@@ -76,7 +79,7 @@ getClassForRequire(prev:string,name:string){
|
||||
}
|
||||
ngOnInit():void {
|
||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||
const id = Number(this.route.snapshot.paramMap.get('id'));
|
||||
const id = this.id(); // Number(this.route.snapshot.paramMap.get('id'));
|
||||
// now load thing up
|
||||
const user = Utils.getCurrentUser();
|
||||
// console.log(this.msg + "current login user ", user);
|
||||
|
||||
Reference in New Issue
Block a user