diff --git a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html index 67a262d..ffb73f3 100644 --- a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html +++ b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.html @@ -26,11 +26,12 @@ @@ -48,6 +49,7 @@ [valueField]="'id'" [valuePrimitive]="true" (valueChange)="onPayrollChange($event)" + [disabled]="!_selectedRoleType" > @@ -59,10 +61,11 @@ diff --git a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts index d8dceed..a7f9551 100644 --- a/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts +++ b/HRM.UI/ClientApp/src/app/authentication/data-permssion/data-permssion.component.ts @@ -10,13 +10,13 @@ import { DataTransferService } from '../../data.transfer.service'; import { ApiService } from '../../app.api.service'; import { User } from '../../_models/Authentication/user'; import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums'; -import {PayrollType} from '../../_models/Authentication/payrollType'; -import {Employee} from '../../_models/Employee/employee'; -import {Grade} from '../../_models/Basic/grade'; -import {Department} from '../../_models/Basic/department'; -import {Designation} from '../../_models/HRBasic/designation'; -import {Location} from '../../_models/Basic/location'; -import {DynamicPicker, EnumDynamicpickerType} from '../../picker/dynamic-picker/Dynamic-Picker'; +import { PayrollType } from '../../_models/Authentication/payrollType'; +import { Employee } from '../../_models/Employee/employee'; +import { Grade } from '../../_models/Basic/grade'; +import { Department } from '../../_models/Basic/department'; +import { Designation } from '../../_models/HRBasic/designation'; +import { Location } from '../../_models/Basic/location'; +import { DynamicPicker, EnumDynamicpickerType } from '../../picker/dynamic-picker/Dynamic-Picker'; import { DataPermission } from 'src/app/_models/Basic/DataPermission'; @@ -52,19 +52,25 @@ export class DataPermssionComponent implements OnInit { public isLocation: boolean = false; onUserTypeChange(_selectedRoleType: any): void { - this.utilityHandlerService.ShowLoadingPanel = true; - this.userService.GetUsers(this._selectedRoleType.value).subscribe( - (x) => { - this.users = x; - this.utilityHandlerService.ShowLoadingPanel = false; - }, - (x) => { - this.notificationService.showError(x); - this.utilityHandlerService.ShowLoadingPanel = false; - }, - () => { - this.utilityHandlerService.ShowLoadingPanel = false; - }); + if (this._selectedRoleType.value != null) { + this.utilityHandlerService.ShowLoadingPanel = true; + this.userService.GetUsers(this._selectedRoleType.value).subscribe( + (x) => { + this.users = x; + this.utilityHandlerService.ShowLoadingPanel = false; + }, + (x) => { + this.notificationService.showError(x); + this.utilityHandlerService.ShowLoadingPanel = false; + }, + () => { + this.utilityHandlerService.ShowLoadingPanel = false; + }); + } + else { + this.users = []; + this.selectedUser = undefined; + } } EventPermissionType(selectedPermissionType: any): void { @@ -80,11 +86,13 @@ export class DataPermssionComponent implements OnInit { } onUserChange(selectedUserID: any): void { - this._selectedUser = selectedUserID; - this._userID = this._selectedUser.id; - - if (this._userID != undefined && this._selectedPayroll != undefined) - this.loadGridView() + if(selectedUserID.id != null){ + this._selectedUser = selectedUserID; + this._userID = this._selectedUser.id; + + if (this._userID != undefined && this._selectedPayroll != undefined) + this.loadGridView() + } } onPayrollChange(selectedPayrollID: any): void { diff --git a/HRM.UI/Controllers/DynamicPickerController.cs b/HRM.UI/Controllers/DynamicPickerController.cs index a77a23d..ee8a407 100644 --- a/HRM.UI/Controllers/DynamicPickerController.cs +++ b/HRM.UI/Controllers/DynamicPickerController.cs @@ -89,7 +89,11 @@ namespace HRM.UI.Controllers param = new object[2]; param[i] = EnumStatus.Active; - param[i + 1] = (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID; + + if(cty.PayrollTypeID == null) + param[i + 1] = (int)CurrentUser.GetCurrentUser(HttpContext.User).PayrollTypeID; + else + param[i + 1] = (int)cty.PayrollTypeID; paramtypes = new Type[2]; paramtypes[i] = typeof(EnumStatus);